Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Course currentCourse = AngelSession.CurrentAngelSession.Section;

                ProvisionLink.NavigateUrl = String.Format("{0}ProvisionCourse.aspx?id={1}", cNuggetRoot, currentCourse.CourseId);

                using (var clientData = new ClientDataProxy())
                {
                    List <CourseInfo> courses = new List <CourseInfo>(clientData.GetCourses(Util.GetUserKey(), Util.GetAuthCode()));

                    string panoptoCourseID = ConfigurationVariable.GetValue("PanoptoCourseID", null, null, null, currentCourse.CourseId, null);

                    if (String.IsNullOrEmpty(panoptoCourseID))
                    {
                        courses.Insert(0, new CourseInfo()
                        {
                            DisplayName = "-- Select an Existing Course --"
                        });
                    }

                    bool isProvisioned = false;
                    bool canSync       = false;

                    // Populate course drop down.
                    CoursesDropDown.Items.Clear();
                    foreach (CourseInfo course in courses)
                    {
                        ListItem item = new ListItem(course.DisplayName, course.PublicID.ToString());

                        // Select course if it matches the current Panopto course setting
                        if (course.PublicID.ToString() == panoptoCourseID)
                        {
                            item.Selected = true;
                        }

                        CoursesDropDown.Items.Add(item);

                        // Check for matching external ID indicating the course has already been provisioned
                        if (course.ExternalCourseID == Util.GetExternalCourseID(currentCourse.CourseId))
                        {
                            isProvisioned = true;

                            // If provisioned course is already selected, show "Sync users" link
                            if (course.PublicID.ToString() == panoptoCourseID)
                            {
                                canSync = true;
                            }
                        }
                    }

                    ProvisionPanel.Visible = (!isProvisioned || canSync);
                    ProvisionLink.Text     =
                        canSync
                            ? "Sync Users"
                            : "Add this course to Panopto";
                }
            }
        }
Exemplo n.º 2
0
 public static CourseInfo[] GetCourses()
 {
     using (var clientData = new ClientDataProxy())
     {
         return(clientData.GetCourses(Util.GetUserKey(), Util.GetAuthCode()));
     }
 }