protected void publishButton_OnClick(object sender, EventArgs e) { WBLogging.Debug("In publishButton_OnClick()"); Hashtable metadataProblems = CheckMetadataOK(); if (metadataProblems.Count > 0) { PublishingApprovedByError.Text = metadataProblems["PublishingApprovedBy"].WBxToString(); CheckListError.Text = metadataProblems["CheckList"].WBxToString(); WBLogging.Debug("In publishButton_OnClick(): Page render required - not publishing at this point"); ReRenderPage(); } else { List <SPUser> approvedBy = PublishingApprovedBy.WBxGetMultiResolvedUsers(SPContext.Current.Web); process.AddExtraMetadata(WBColumn.PublishingApprovedBy, approvedBy.WBxToString()); process.AddExtraMetadata(WBColumn.PublishingApprovalChecklist, CheckBoxesCodes.Value); WBLogging.Debug("In publishButton_OnClick(): No page render required - so moving to GoToPublishPage"); GoToPublishPage(); } }
private Hashtable CheckMetadataOK() { Hashtable metadataProblems = new Hashtable(); List <SPUser> newUsers = PublishingApprovedBy.WBxGetMultiResolvedUsers(SPContext.Current.Web); if (newUsers.Count == 0) { metadataProblems.Add("PublishingApprovedBy", "You must enter at least one person who approved publication."); } String[] checkBoxesCodes = CheckBoxesCodes.Value.Split(';'); bool allChecked = true; foreach (String code in checkBoxesCodes) { CheckBox checkBox = (CheckBox)CheckBoxes.WBxFindNestedControlByID(code); if (!checkBox.Checked) { allChecked = false; } } if (!allChecked) { metadataProblems.Add("CheckList", "You have to read and tick all check boxes"); } return(metadataProblems); }