// // public void sendPublishSubmitNotice(string ContentName, int RecordID, string RecordName) { try { Models.Domain.ContentMetadataModel CDef = null; string Copy = null; string Link = null; string FromAddress = null; // FromAddress = core.siteProperties.getText("EmailPublishSubmitFrom", core.siteProperties.emailAdmin); CDef = Models.Domain.ContentMetadataModel.createByUniqueName(core, ContentName); Link = "/" + core.appConfig.adminRoute + "?af=" + AdminFormPublishing; Copy = Msg_AuthoringSubmittedNotification; Copy = GenericController.strReplace(Copy, "<DOMAINNAME>", "<a href=\"" + HtmlController.encodeHtml(Link) + "\">" + core.webServer.requestDomain + "</a>"); Copy = GenericController.strReplace(Copy, "<RECORDNAME>", RecordName); Copy = GenericController.strReplace(Copy, "<CONTENTNAME>", ContentName); Copy = GenericController.strReplace(Copy, "<RECORDID>", RecordID.ToString()); Copy = GenericController.strReplace(Copy, "<SUBMITTEDDATE>", core.doc.profileStartTime.ToString()); Copy = GenericController.strReplace(Copy, "<SUBMITTEDNAME>", core.session.user.name); // EmailController.queueGroupEmail(core, core.siteProperties.getText("WorkflowEditorGroup", "Site Managers"), FromAddress, "Authoring Submitted Notification", Copy, false, true); // return; // // ----- Error Trap // } catch (Exception ex) { LogController.logError(core, ex); } }
// //===================================================================================================== /// <summary> /// Get the query to test the authoring control table if a record is locked /// </summary> /// <param name="cdef"></param> /// <param name="recordId"></param> /// <returns></returns> private static string getAuthoringControlCriteria(CoreController core, Models.Domain.ContentMetadataModel cdef, int recordId) { if (cdef == null) { return("(1=0)"); } var table = DbBaseModel.createByUniqueName <TableModel>(core.cpParent, cdef.tableName); if (table == null) { return("(1=0)"); } return(getAuthoringControlCriteria(getTableRecordKey(table.id, recordId), core.dateTimeNowMockable)); }
// //============================================================================= /// <summary> /// editor for page content inline editing /// </summary> /// <param name="core"></param> /// <param name="rootPageId"></param> /// <param name="OrderByClause"></param> /// <param name="AllowPageList"></param> /// <param name="AllowReturnLink"></param> /// <param name="ArchivePages"></param> /// <param name="contactMemberID"></param> /// <param name="childListSortMethodId"></param> /// <param name="main_AllowChildListComposite"></param> /// <param name="ArchivePage"></param> /// <returns></returns> internal static string getQuickEditing(CoreController core) { string result = ""; try { int childListSortMethodId = core.doc.pageController.page.childListSortMethodId; int contactMemberId = core.doc.pageController.page.contactMemberId; int rootPageId = core.doc.pageController.pageToRootList.Last().id; core.html.addStyleLink("" + cdnPrefix + "quickEditor/styles.css", "Quick Editor"); // // -- First Active Record - Output Quick Editor form Models.Domain.ContentMetadataModel cdef = Models.Domain.ContentMetadataModel.createByUniqueName(core, PageContentModel.tableMetadata.contentName); var pageContentTable = DbBaseModel.create <TableModel>(core.cpParent, cdef.id); var editLock = WorkflowController.getEditLock(core, pageContentTable.id, core.doc.pageController.page.id); WorkflowController.recordWorkflowStatusClass authoringStatus = WorkflowController.getWorkflowStatus(core, PageContentModel.tableMetadata.contentName, core.doc.pageController.page.id); PermissionController.UserContentPermissions userContentPermissions = PermissionController.getUserContentPermissions(core, cdef); bool AllowMarkReviewed = DbBaseModel.containsField <PageContentModel>("DateReviewed"); string OptionsPanelAuthoringStatus = core.session.getAuthoringStatusMessage(false, editLock.isEditLocked, editLock.editLockByMemberName, encodeDate(editLock.editLockExpiresDate), authoringStatus.isWorkflowApproved, authoringStatus.workflowApprovedMemberName, authoringStatus.isWorkflowSubmitted, authoringStatus.workflowSubmittedMemberName, authoringStatus.isWorkflowDeleted, authoringStatus.isWorkflowInserted, authoringStatus.isWorkflowModified, authoringStatus.workflowModifiedByMemberName); // // Set Editing Authoring Control // WorkflowController.setEditLock(core, pageContentTable.id, core.doc.pageController.page.id); // // SubPanel: Authoring Status // string leftButtonCommaList = ""; leftButtonCommaList = leftButtonCommaList + "," + ButtonCancel; if (userContentPermissions.allowSave) { leftButtonCommaList = leftButtonCommaList + "," + ButtonSave + "," + ButtonOK; } if (userContentPermissions.allowDelete && (core.doc.pageController.pageToRootList.Count == 1)) { // // -- allow delete and not root page leftButtonCommaList = leftButtonCommaList + "," + ButtonDelete; } if (userContentPermissions.allowAdd) { leftButtonCommaList = leftButtonCommaList + "," + ButtonAddChildPage; } int page_ParentId = 0; if ((page_ParentId != 0) && userContentPermissions.allowAdd) { leftButtonCommaList = leftButtonCommaList + "," + ButtonAddSiblingPage; } if (AllowMarkReviewed) { leftButtonCommaList = leftButtonCommaList + "," + ButtonMarkReviewed; } if (!string.IsNullOrEmpty(leftButtonCommaList)) { leftButtonCommaList = leftButtonCommaList.Substring(1); leftButtonCommaList = core.html.getPanelButtons(leftButtonCommaList); } if (!core.doc.userErrorList.Count.Equals(0)) { result += "" + "\r<tr>" + cr2 + "<td colspan=2 class=\"qeRow\"><div class=\"qeHeadCon\">" + ErrorController.getUserError(core) + "</div></td>" + "\r</tr>"; } if (!userContentPermissions.allowSave) { result += "" + "\r<tr>" + cr2 + "<td colspan=\"2\" class=\"qeRow\">" + getQuickEditingBody(core, PageContentModel.tableMetadata.contentName, "", true, true, rootPageId, !userContentPermissions.allowSave, true, PageContentModel.tableMetadata.contentName, false, contactMemberId) + "</td>" + "\r</tr>"; } else { result += "" + "\r<tr>" + cr2 + "<td colspan=\"2\" class=\"qeRow\">" + getQuickEditingBody(core, PageContentModel.tableMetadata.contentName, "", true, true, rootPageId, !userContentPermissions.allowSave, true, PageContentModel.tableMetadata.contentName, false, contactMemberId) + "</td>" + "\r</tr>"; } result += "\r<tr>" + cr2 + "<td class=\"qeRow qeLeft\" style=\"padding-top:10px;\">Name</td>" + cr2 + "<td class=\"qeRow qeRight\">" + HtmlController.inputText_Legacy(core, "name", core.doc.pageController.page.name, 1, 0, "", false, !userContentPermissions.allowSave) + "</td>" + "\r</tr>" + ""; string pageList = " (there are no parent pages)"; // // ----- Parent pages // if (core.doc.pageController.pageToRootList.Count > 1) { pageList = "<ul class=\"qeListUL\"><li class=\"qeListLI\">Current Page</li></ul>"; foreach (PageContentModel testPage in Enumerable.Reverse(core.doc.pageController.pageToRootList)) { string pageCaption = testPage.name; if (string.IsNullOrEmpty(pageCaption)) { pageCaption = "no name #" + GenericController.encodeText(testPage.id); } pageCaption = "<a href=\"" + PageContentController.getPageLink(core, testPage.id, "") + "\">" + pageCaption + "</a>"; pageList = "<ul class=\"qeListUL\"><li class=\"qeListLI\">" + pageCaption + pageList + "</li></ul>"; } } result += "" + "\r<tr>" + cr2 + "<td class=\"qeRow qeLeft\" style=\"padding-top:26px;\">Parent Pages</td>" + cr2 + "<td class=\"qeRow qeRight\"><div class=\"qeListCon\">" + pageList + "</div></td>" + "\r</tr>"; // // ----- Child pages // AddonModel addon = DbBaseModel.create <AddonModel>(core.cpParent, addonGuidChildList); CPUtilsBaseClass.addonExecuteContext executeContext = new CPUtilsBaseClass.addonExecuteContext { addonType = CPUtilsBaseClass.addonContext.ContextPage, hostRecord = new CPUtilsBaseClass.addonExecuteHostRecordContext { contentName = PageContentModel.tableMetadata.contentName, fieldName = "", recordId = core.doc.pageController.page.id }, argumentKeyValuePairs = GenericController.convertQSNVAArgumentstoDocPropertiesList(core, core.doc.pageController.page.childListInstanceOptions), instanceGuid = PageChildListInstanceId, errorContextMessage = "calling child page addon in quick editing editor" }; pageList = core.addon.execute(addon, executeContext); if (GenericController.strInstr(1, pageList, "<ul", 1) == 0) { pageList = "(there are no child pages)"; } result += "\r<tr>" + cr2 + "<td class=\"qeRow qeLeft\" style=\"padding-top:36px;\">Child Pages</td>" + cr2 + "<td class=\"qeRow qeRight\"><div class=\"qeListCon\">" + pageList + "</div></td>" + "\r</tr>"; result = "" + "\r<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">" + GenericController.nop(result) + "\r</table>"; result = "" + leftButtonCommaList + result + leftButtonCommaList; result = core.html.getPanel(result); // // Form Wrapper // result += "" + HtmlController.inputHidden("Type", FormTypePageAuthoring) + HtmlController.inputHidden("ID", core.doc.pageController.page.id) + HtmlController.inputHidden("ContentName", PageContentModel.tableMetadata.contentName); result = HtmlController.formMultipart(core, result, core.webServer.requestQueryString, "", "ccForm"); result = "<div class=\"ccCon\">" + result + "</div>"; } catch (Exception ex) { LogController.logError(core, ex); } return(result); }
// //===================================================================================================== /// <summary> /// the Approved Authoring Control /// </summary> /// <param name="ContentName"></param> /// <param name="RecordID"></param> /// <returns></returns> public static recordWorkflowStatusClass getWorkflowStatus(CoreController core, string ContentName, int RecordID) { recordWorkflowStatusClass result = new recordWorkflowStatusClass { isEditLocked = false, editLockByMemberName = "", editLockExpiresDate = DateTime.MinValue, workflowSubmittedMemberName = "", isWorkflowModified = false, workflowModifiedByMemberName = "", workflowModifiedDate = DateTime.MinValue, isWorkflowSubmitted = false, workflowSubmittedDate = DateTime.MinValue, isWorkflowApproved = false, workflowApprovedMemberName = "", workflowApprovedDate = DateTime.MinValue, isWorkflowDeleted = false, isWorkflowInserted = false }; try { if (RecordID > 0) { // // Get Workflow Locks Models.Domain.ContentMetadataModel CDef = Models.Domain.ContentMetadataModel.createByUniqueName(core, ContentName); if (CDef.id > 0) { var nameDict = new Dictionary <int, string>(); foreach (var recordLock in DbBaseModel.createList <AuthoringControlModel>(core.cpParent, getAuthoringControlCriteria(core, ContentName, RecordID))) { int createdBy = GenericController.encodeInteger(recordLock.createdBy); switch ((AuthoringControls)recordLock.controlType) { case AuthoringControls.Editing: if (!result.isEditLocked) { result.isEditLocked = true; result.editLockExpiresDate = recordLock.dateAdded; if (nameDict.ContainsKey(createdBy)) { result.editLockByMemberName = nameDict[createdBy]; } else { result.editLockByMemberName = DbBaseModel.getRecordName <PersonModel>(core.cpParent, createdBy); nameDict.Add(createdBy, result.workflowModifiedByMemberName); } } break; case AuthoringControls.Modified: if (!result.isWorkflowModified) { result.isWorkflowModified = true; result.workflowSubmittedDate = recordLock.dateAdded; if (nameDict.ContainsKey(createdBy)) { result.workflowModifiedByMemberName = nameDict[createdBy]; } else { result.workflowModifiedByMemberName = DbBaseModel.getRecordName <PersonModel>(core.cpParent, createdBy); nameDict.Add(createdBy, result.workflowModifiedByMemberName); } } break; case AuthoringControls.Submitted: if (!result.isWorkflowSubmitted) { result.isWorkflowSubmitted = true; result.workflowModifiedDate = recordLock.dateAdded; if (nameDict.ContainsKey(createdBy)) { result.workflowSubmittedMemberName = nameDict[createdBy]; } else { result.workflowSubmittedMemberName = DbBaseModel.getRecordName <PersonModel>(core.cpParent, createdBy); nameDict.Add(createdBy, result.workflowSubmittedMemberName); } } break; case AuthoringControls.Approved: if (!result.isWorkflowApproved) { result.isWorkflowApproved = true; result.workflowApprovedDate = encodeDate(recordLock.dateAdded); if (nameDict.ContainsKey(createdBy)) { result.workflowApprovedMemberName = nameDict[createdBy]; } else { result.workflowApprovedMemberName = DbBaseModel.getRecordName <PersonModel>(core.cpParent, createdBy); nameDict.Add(createdBy, result.workflowSubmittedMemberName); } } break; default: break; } } } } } catch (Exception ex) { LogController.logError(core, ex); throw; } return(result); }