Exemplo n.º 1
0
		private Group GetAccountDisabledGroup(GroupedForm parent) {
			Group disabledGroup = parent.AddGroup("Disabled");
			disabledGroup.RadioValue = "Disabled";
			disabledGroup.TitleDetails.Text = "<strong>A PleaseTakes account does not exist for this teaching staff member</strong>";
			disabledGroup.TitleDetails.Image.Src = "removekey.png";
			disabledGroup.TitleDetails.Image.Tooltip = "No account exists";
			disabledGroup.IsDefault = !this._hasAccount;

			return disabledGroup;
		}
Exemplo n.º 2
0
		private Group GetAccountEnabledGroup(GroupedForm parent) {
			Group enabledGroup = parent.AddGroup("Enabled");
			enabledGroup.RadioValue = "Enabled";
			enabledGroup.TitleDetails.Text = "<strong>A PleaseTakes account exists for this teaching staff member</strong>";
			enabledGroup.TitleDetails.Image.Src = "addkey.png";
			enabledGroup.TitleDetails.Image.Tooltip = "An account exists";
			enabledGroup.IsDefault = this._hasAccount;

			string alertMessage = (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountAlert", true);

			if (string.IsNullOrEmpty(alertMessage))
				enabledGroup.RightPane.Contents = "&nbsp;";
			else {
				switch (alertMessage) {
					case "missing":
						Core.Helpers.Elements.Alerts.Alert missingAlert = new Core.Helpers.Elements.Alerts.Alert("MissingDetails");
						missingAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
						missingAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/missing.html").ToString();

						enabledGroup.RightPane.Contents = missingAlert.ToString();
						break;
					case "exists":
						Core.Helpers.Elements.Alerts.Alert alreadyExistsAlert = new Core.Helpers.Elements.Alerts.Alert("AlreadyExists");
						alreadyExistsAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Red;
						alreadyExistsAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/exists.html").ToString();

						enabledGroup.RightPane.Contents = alreadyExistsAlert.ToString();
						break;
					case "updated":
						Core.Helpers.Elements.Alerts.Alert updatedAlert = new Core.Helpers.Elements.Alerts.Alert("Updated");
						updatedAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						updatedAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/updated.html").ToString();

						enabledGroup.RightPane.Contents = updatedAlert.ToString();
						break;
					case "created":
						Core.Helpers.Constructor createdConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/created.html");
						createdConstructor.SetVariable("Password", (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountPassword", true));

						Core.Helpers.Elements.Alerts.Alert createdAlert = new Core.Helpers.Elements.Alerts.Alert("Created");
						createdAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						createdAlert.Message = createdConstructor.ToString();

						enabledGroup.RightPane.Contents = createdAlert.ToString();
						break;
					case "deleted":
						Core.Helpers.Elements.Alerts.Alert deletedAlert = new Core.Helpers.Elements.Alerts.Alert("Deleted");
						deletedAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						deletedAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/deleted.html").ToString();

						enabledGroup.RightPane.Contents = deletedAlert.ToString();
						break;
					case "resetnoaccount":
						Core.Helpers.Elements.Alerts.Alert resetNoAccountAlert = new Core.Helpers.Elements.Alerts.Alert("ResetNoAccount");
						resetNoAccountAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Yellow;
						resetNoAccountAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/resetnoaccount.html").ToString();

						enabledGroup.RightPane.Contents = resetNoAccountAlert.ToString();
						break;
					case "resetsuccess":
						Core.Helpers.Constructor resetSuccessConstructor = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/resetsuccess.html");
						resetSuccessConstructor.SetVariable("Password", (string)Core.Utils.ReturnTemporaryStorageObject("StaffTeachingAccountPassword", true));

						Core.Helpers.Elements.Alerts.Alert resetSuccessAlert = new Core.Helpers.Elements.Alerts.Alert("ResetSuccess");
						resetSuccessAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Green;
						resetSuccessAlert.Message = resetSuccessConstructor.ToString();

						enabledGroup.RightPane.Contents = resetSuccessAlert.ToString();
						break;
					case "loggedin":
						Core.Helpers.Elements.Alerts.Alert loggedInAlert = new Core.Helpers.Elements.Alerts.Alert("LoggedIn");
						loggedInAlert.Colour = Core.Helpers.Elements.Alerts.Colours.Yellow;
						loggedInAlert.Message = new Core.Helpers.Constructor("/Alerts/Specific/Staff/Modify/Teaching/Account/loggedin.html").ToString();

						enabledGroup.RightPane.Contents = loggedInAlert.ToString();
						break;
					default:
						enabledGroup.RightPane.Contents = "&nbsp;";
						break;
				}
			}

			Row username = enabledGroup.AddRow();
			username.Description = "<strong>Username</strong>";
			username.SetToTextField("Username", null, this._username, 1, 0, false, false);

			Row password = enabledGroup.AddRow();
			password.Description = "<strong>Password</strong>";

			if (this._hasAccount)
				password.Text = "<a href=\"?path=/staff/modify/update/teaching/account/reset/" + this._staffId + "/\"><em>Click to reset...</em></a>";
			else
				password.Text = "<em>Automatically generated</em>";

			Row accountType = enabledGroup.AddRow();
			accountType.Description = "<strong>Account Type</strong>";
			accountType.SetToRadioGroup();

			RadioGroup typeGroup = (RadioGroup)accountType.FormElement;
			typeGroup.Name = "AccountType";

			RadioButton administrative = typeGroup.AddRadioButton();
			administrative.Value = "Administrative";
			administrative.Label = "Administrative";
			administrative.TabIndex = 2;
			administrative.IsChecked = (this._hasAccount && this._isAdmin);

			RadioButton standard = typeGroup.AddRadioButton();
			standard.Value = "Standard";
			standard.Label = "Standard";
			standard.TabIndex = 3;
			standard.IsChecked = (this._hasAccount && !this._isAdmin);

			Row active = enabledGroup.AddRow();
			active.Description = "<strong>Is Active?</strong>";
			active.SetToRadioGroup();

			RadioGroup activeGroup = (RadioGroup)active.FormElement;
			activeGroup.Name = "Active";

			RadioButton yes = activeGroup.AddRadioButton();
			yes.Value = "Yes";
			yes.Label = "Yes";
			yes.TabIndex = 4;
			yes.IsChecked = (this._hasAccount && this._isActive);

			RadioButton no = activeGroup.AddRadioButton();
			no.Value = "No";
			no.Label = "No";
			no.TabIndex = 5;
			no.IsChecked = (this._hasAccount && !this._isActive);

			return enabledGroup;
		}