Exemplo n.º 1
0
        private void CreateClassRoom(Core.Helpers.Elements.Forms.Form form, Core.Helpers.Elements.Forms.Group classGroup)
        {
            Core.Helpers.Elements.Forms.Row roomRow = classGroup.AddRow();
            TimetableText roomText = new TimetableText();

            roomRow.Description = "<strong>Room</strong>";

            if (this._state.Equals(TimetableStates.Teaching))
            {
                if (this._isUnique)
                {
                    roomText.Highlighted = "None";
                    form.AddHiddenField("ClassRoomId", "ClassRoomId", null);

                    form.AddHiddenField("ClassRoomName-Original", "ClassRoomName-Original", "None");
                    form.AddHiddenField("ClassRoomId-Original", "ClassRoomId-Original", null);
                }
                else
                {
                    if (string.IsNullOrEmpty(this._roomName))
                    {
                        roomText.Highlighted = "None";
                        form.AddHiddenField("ClassRoomName-Original", "ClassRoomName-Original", "None");
                    }
                    else
                    {
                        roomText.Highlighted = this._roomName;
                        form.AddHiddenField("ClassRoomName-Original", "ClassRoomName-Original", this._roomName);
                    }

                    form.AddHiddenField("ClassRoomId", "ClassRoomId", this._roomId.ToString());
                    form.AddHiddenField("ClassRoomId-Original", "ClassRoomId-Original", this._roomId.ToString());
                }
            }
            else
            {
                roomText.Highlighted = "None";
                form.AddHiddenField("ClassRoomId", "ClassRoomId", null);

                form.AddHiddenField("ClassRoomName-Original", "ClassRoomName-Original", "None");
                form.AddHiddenField("ClassRoomId-Original", "ClassRoomId-Original", null);
            }

            roomText.HighlightedId = "ClassRoomName";
            roomText.OnClick       = "selectClassRoom();";

            roomRow.Text = roomText.ToString();
        }
Exemplo n.º 2
0
        private void CreateUniqueName(Core.Helpers.Elements.Forms.Form form, Core.Helpers.Elements.Forms.Group uniqueGroup)
        {
            Core.Helpers.Elements.Forms.Row nameRow = uniqueGroup.AddRow();
            nameRow.Description = "<strong>Name</strong>";

            if (this._state.Equals(TimetableStates.Teaching))
            {
                if (this._isUnique)
                {
                    nameRow.SetToTextField("UniqueName", null, this._commitmentName, 1, 0, false, false);
                }
                else
                {
                    nameRow.SetToTextField("UniqueName", null, null, 1, 0, false, false);
                }
            }
            else
            {
                nameRow.SetToTextField("UniqueName", null, null, 1, 0, false, false);
            }
        }
Exemplo n.º 3
0
        private void CreateClassClass(Core.Helpers.Elements.Forms.Form form, Core.Helpers.Elements.Forms.Group classGroup)
        {
            Core.Helpers.Elements.Forms.Row classRow = classGroup.AddRow();
            TimetableText classText = new TimetableText();

            classRow.Description = "<strong>Class</strong>";

            if (this._state.Equals(TimetableStates.Teaching))
            {
                if (this._isUnique)
                {
                    classText.Highlighted = "None";
                    form.AddHiddenField("ClassClassId", "ClassClassId", null);

                    form.AddHiddenField("ClassClassName-Original", "ClassClassName-Original", "None");
                    form.AddHiddenField("ClassClassId-Original", "ClassClassId-Original", null);
                }
                else
                {
                    classText.Highlighted = this._className;
                    form.AddHiddenField("ClassClassId", "ClassClassId", this._classId.ToString());

                    form.AddHiddenField("ClassClassName-Original", "ClassClassName-Original", this._className);
                    form.AddHiddenField("ClassClassId-Original", "ClassClassId-Original", this._classId.ToString());
                }
            }
            else
            {
                classText.Highlighted = "None";
                form.AddHiddenField("ClassClassId", "ClassClassId", null);

                form.AddHiddenField("ClassClassName-Original", "ClassClassName-Original", "None");
                form.AddHiddenField("ClassClassId-Original", "ClassClassId-Original", null);
            }

            classText.HighlightedId = "ClassClassName";
            classText.OnClick       = "selectClassClass();";

            classRow.Text = classText.ToString();
        }
Exemplo n.º 4
0
        private void CreateClassQualification(Core.Helpers.Elements.Forms.Form form, Core.Helpers.Elements.Forms.Group classGroup)
        {
            Core.Helpers.Elements.Forms.Row qualificationRow = classGroup.AddRow();
            TimetableText qualificationText = new TimetableText();

            qualificationRow.Description = "<strong>Qualification</strong>";

            if (this._state.Equals(TimetableStates.Teaching))
            {
                if (this._isUnique)
                {
                    qualificationText.Highlighted = "None";
                    form.AddHiddenField("ClassSubjectQualificationId", "ClassSubjectQualificationId", null);

                    form.AddHiddenField("ClassQualificationName-Original", "ClassQualificationName-Original", "None");
                    form.AddHiddenField("ClassSubjectQualificationId-Original", "ClassSubjectQualificationId-Original", null);
                }
                else
                {
                    qualificationText.Highlighted = this._qualificationName;
                    form.AddHiddenField("ClassSubjectQualificationId", "ClassSubjectQualificationId", this._subjectQualificationId.ToString());

                    form.AddHiddenField("ClassQualificationName-Original", "ClassQualificationName-Original", this._qualificationName);
                    form.AddHiddenField("ClassSubjectQualificationId-Original", "ClassSubjectQualificationId-Original", this._subjectQualificationId.ToString());
                }
            }
            else
            {
                qualificationText.Highlighted = "None";
                form.AddHiddenField("ClassSubjectQualificationId", "ClassSubjectQualificationId", null);

                form.AddHiddenField("ClassQualificationName-Original", "ClassQualificationName-Original", "None");
                form.AddHiddenField("ClassSubjectQualificationId-Original", "ClassSubjectQualificationId-Original", null);
            }

            qualificationText.HighlightedId = "ClassQualificationName";
            qualificationText.OnClick       = "selectClassQualification();";

            qualificationRow.Text = qualificationText.ToString();
        }
Exemplo n.º 5
0
        private void CreateUniqueYeargroup(Core.Helpers.Elements.Forms.Form form, Core.Helpers.Elements.Forms.Group uniqueGroup)
        {
            Core.Helpers.Elements.Forms.Row yeargroupRow = uniqueGroup.AddRow();
            TimetableText yeargroupText = new TimetableText();

            yeargroupRow.Description = "<strong>Yeargroup</strong>";

            if (this._state.Equals(TimetableStates.Teaching))
            {
                if (this._isUnique)
                {
                    yeargroupText.Highlighted = this._yeargroupName;
                    form.AddHiddenField("UniqueYeargroupId", "UniqueYeargroupId", this._yeargroupId.ToString());

                    form.AddHiddenField("UniqueYeargroupName-Original", "UniqueYeargroupName-Original", this._yeargroupName);
                    form.AddHiddenField("UniqueYeargroupId-Original", "UniqueYeargroupId-Original", this._yeargroupId.ToString());
                }
                else
                {
                    yeargroupText.Highlighted = "None";
                    form.AddHiddenField("UniqueYeargroupId", "UniqueYeargroupId", null);

                    form.AddHiddenField("UniqueYeargroupName-Original", "UniqueYeargroupName-Original", "None");
                    form.AddHiddenField("UniqueYeargroupId-Original", "UniqueYeargroupId-Original", null);
                }
            }
            else
            {
                yeargroupText.Highlighted = "None";
                form.AddHiddenField("UniqueYeargroupId", "UniqueYeargroupId", null);

                form.AddHiddenField("UniqueYeargroupName-Original", "UniqueYeargroupName-Original", "None");
                form.AddHiddenField("UniqueYeargroupId-Original", "UniqueYeargroupId-Original", null);
            }

            yeargroupText.HighlightedId = "UniqueYeargroupName";
            yeargroupText.OnClick       = "selectUniqueYeargroup();";

            yeargroupRow.Text = yeargroupText.ToString();
        }
Exemplo n.º 6
0
        protected override void SetTabSpecific()
        {
            foreach (Core.Helpers.Elements.Tabs.Tab tab in this.Tabs)
            {
                Core.Helpers.Elements.MenuBar.Bar menuBar = new Core.Helpers.Elements.MenuBar.Bar();
                menuBar.Text = "Rotation week <strong>" + this._weekNo + "</strong>, <strong>" + ((DayOfWeek)(this._dayNo - 1)) + "</strong>, period <strong>" + this._period + "</strong>";
                menuBar.AddButton("back.png", "Click here to jump back to the staff member's timetable.", "?path=/staff/modify/teaching/" + this._staffId + "/week/" + this._weekNo + "/#Timetable", null);

                switch (tab.Id)
                {
                case "Unavailable":
                    if (this._state.Equals(TimetableStates.Unavailable))
                    {
                        tab.Content.SetVariable("UnavailableForm", new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/current.html").ToString());
                    }
                    else
                    {
                        Core.Helpers.Elements.Forms.BasicForm unavailableForm = new Core.Helpers.Elements.Forms.BasicForm();
                        unavailableForm.Id          = "Unavailable";
                        unavailableForm.HasTopSpace = true;
                        unavailableForm.PostUrl     = "/staff/modify/update/teaching/timetable/";
                        unavailableForm.AddButton(null, "Switch", null, 1, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

                        unavailableForm.AddHiddenField("State", null, "Unavailable");
                        unavailableForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                        unavailableForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                        unavailableForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                        unavailableForm.AddHiddenField("Period", null, this._period.ToString());

                        tab.Content.SetVariable("UnavailableForm", unavailableForm.ToString());
                    }

                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Free":
                    if (this._state.Equals(TimetableStates.Free))
                    {
                        tab.Content.SetVariable("FreeForm", new Core.Helpers.Constructor("/Templates/Specific/Staff/Modify/Teaching/Timetable/current.html").ToString());
                    }
                    else
                    {
                        Core.Helpers.Elements.Forms.BasicForm freeForm = new Core.Helpers.Elements.Forms.BasicForm();
                        freeForm.Id          = "Free";
                        freeForm.HasTopSpace = true;
                        freeForm.PostUrl     = "/staff/modify/update/teaching/timetable/";
                        freeForm.AddButton(null, "Switch", null, 1, Core.Helpers.Elements.Forms.ButtonTypes.Submit);

                        freeForm.AddHiddenField("State", null, "Free");
                        freeForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                        freeForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                        freeForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                        freeForm.AddHiddenField("Period", null, this._period.ToString());

                        tab.Content.SetVariable("FreeForm", freeForm.ToString());
                    }

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Teaching":
                    Core.Helpers.Elements.Forms.GroupedForm teachingForm = new Core.Helpers.Elements.Forms.GroupedForm();
                    teachingForm.Id             = "Teaching";
                    teachingForm.HasTopSpace    = true;
                    teachingForm.PostUrl        = "/staff/modify/update/teaching/timetable/";
                    teachingForm.RadioGroupName = "SelectedGroup";

                    teachingForm.AddHiddenField("State", null, "Teaching");
                    teachingForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                    teachingForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                    teachingForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                    teachingForm.AddHiddenField("Period", null, this._period.ToString());

                    Core.Helpers.Elements.Forms.Group uniqueGroup = teachingForm.AddGroup("Unique");
                    uniqueGroup.TitleDetails.Image.Src     = "teach.png";
                    uniqueGroup.TitleDetails.Image.Tooltip = "A timetable entry unique to this staff member.";
                    uniqueGroup.TitleDetails.Text          = "<strong>A unique teaching entry</strong>";
                    uniqueGroup.RadioValue = "Unique";

                    if (this.Path.HasNext() && this.Path.Peek().Equals("uniquefail"))
                    {
                        Core.Helpers.Elements.Alerts.Alert uniqueFail = new Core.Helpers.Elements.Alerts.Alert("UniqueFail");
                        uniqueFail.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                        uniqueFail.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/uniquefailed.html").ToString();

                        uniqueGroup.RightPane.Contents = uniqueFail.ToString();
                    }
                    else
                    {
                        uniqueGroup.RightPane.Contents = "&nbsp;";
                    }

                    Core.Helpers.Elements.Forms.Group classGroup = teachingForm.AddGroup("Class");
                    classGroup.TitleDetails.Image.Src     = "teach.png";
                    classGroup.TitleDetails.Image.Tooltip = "A class";
                    classGroup.TitleDetails.Text          = "<strong>A class</strong>";
                    classGroup.RadioValue = "Class";

                    if (this.Path.HasNext() && this.Path.Peek().Equals("classfail"))
                    {
                        Core.Helpers.Elements.Alerts.Alert classFail = new Core.Helpers.Elements.Alerts.Alert("ClassFail");
                        classFail.Colour  = Core.Helpers.Elements.Alerts.Colours.Red;
                        classFail.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Period/classfailed.html").ToString();

                        classGroup.RightPane.Contents = classFail.ToString();
                    }
                    else
                    {
                        classGroup.RightPane.Contents = "&nbsp;";
                    }

                    this.CreateUniqueYeargroup(teachingForm, uniqueGroup);
                    this.CreateUniqueRoom(teachingForm, uniqueGroup);
                    this.CreateUniqueName(teachingForm, uniqueGroup);

                    this.CreateClassSubject(teachingForm, classGroup);
                    this.CreateClassQualification(teachingForm, classGroup);
                    this.CreateClassClass(teachingForm, classGroup);
                    this.CreateClassRoom(teachingForm, classGroup);

                    if (this._state.Equals(TimetableStates.Teaching))
                    {
                        if (this._isUnique)
                        {
                            teachingForm.OnReset  = "setFormTo('Teaching', 'Unique');";
                            uniqueGroup.IsDefault = true;
                        }
                        else
                        {
                            teachingForm.OnReset = "setFormTo('Teaching', 'Class');";
                            classGroup.IsDefault = true;
                        }

                        teachingForm.AddButton(null, "Reset", "resetNonFields();", 3, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
                        teachingForm.AddButton(null, "Update", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                    }
                    else
                    {
                        teachingForm.AddButton(null, "Switch", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                    }

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("job.png", "Click here to switch to the 'Busy' tab.", "#Busy", "switchToTab('Busy');");

                    tab.Content.SetVariable("TeachingForm", teachingForm.ToString());
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;

                case "Selection":
                    Core.Helpers.Elements.Search.SearchArea selectionSearch = new Core.Helpers.Elements.Search.SearchArea("Selection");
                    selectionSearch.AddButton("search.png", null, "doSelectionSearch();", "Click here to search.");
                    selectionSearch.AddButton("refresh.png", null, "resetSelectionSearch();", "Click here to reset the search criteria.");
                    selectionSearch.AddButton("back.png", null, "switchToTab('Teaching');", "Click here to jump back to the 'Teaching' tab.");
                    selectionSearch.AjaxUrl       = "/staff/modify/ajax/teaching/timetable/selection/search/";
                    selectionSearch.AjaxStatusUrl = "/staff/modify/ajax/teaching/timetable/selection/status/";

                    tab.Content.SetVariable("SearchArea", selectionSearch.ToString());
                    break;

                case "Busy":
                    Core.Helpers.Elements.Forms.BasicForm busyForm = new Core.Helpers.Elements.Forms.BasicForm();
                    busyForm.Id          = "Busy";
                    busyForm.HasTopSpace = true;
                    busyForm.PostUrl     = "/staff/modify/update/teaching/timetable/";

                    busyForm.AddHiddenField("State", null, "Busy");
                    busyForm.AddHiddenField("StaffId", null, this._staffId.ToString());
                    busyForm.AddHiddenField("WeekNo", null, this._weekNo.ToString());
                    busyForm.AddHiddenField("DayNo", null, this._dayNo.ToString());
                    busyForm.AddHiddenField("Period", null, this._period.ToString());

                    Core.Helpers.Elements.Forms.Row busyRow = busyForm.AddRow();
                    busyRow.Description = "<strong>Commitment Name</strong>";

                    if (tab.Alerts.IsEmpty)
                    {
                        busyForm.RightPane.Contents = "&nbsp;";
                    }
                    else
                    {
                        busyForm.RightPane.Contents = tab.Alerts.ToString();
                    }

                    if (this._state.Equals(TimetableStates.Busy))
                    {
                        busyForm.AddButton(null, "Reset", null, 3, Core.Helpers.Elements.Forms.ButtonTypes.Reset);
                        busyForm.AddButton(null, "Update", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                        busyRow.SetToTextField("BusyCommitment", null, this._commitmentName, 1, 0, false, false);
                    }
                    else
                    {
                        busyForm.AddButton(null, "Switch", null, 2, Core.Helpers.Elements.Forms.ButtonTypes.Submit);
                        busyRow.SetToTextField("BusyCommitment", null, null, 1, 0, false, false);
                    }

                    tab.Content.SetVariable("BusyForm", busyForm.ToString());

                    menuBar.AddButton("noentry.png", "Click here to switch to the 'Unavailable' tab.", "#Unavailable", "switchToTab('Unavailable');");
                    menuBar.AddButton("thumbsup.png", "Click here to switch to the 'Free' tab.", "#Free", "switchToTab('Free');");
                    menuBar.AddButton("teach.png", "Click here to switch to the 'Teaching' tab.", "#Teaching", "switchToTab('Teaching');");
                    tab.Content.SetVariable("MenuBar", menuBar.ToString());
                    break;
                }
            }
        }