// //==================================================================================================== /// <summary> /// constructor /// </summary> /// <param name="core"></param> public DocController(CoreController core) { this.core = core; // errorList = new List <string>(); pageController = new PageContentController(); domain = new DomainModel(); wysiwygAddonList = new Dictionary <CPHtml5BaseClass.EditorContentType, string>(); }
// //==================================================================================================== /// <summary> /// getFieldEditorPreference remote method /// </summary> /// <param name="cp"></param> /// <returns></returns> public override object Execute(Contensive.BaseClasses.CPBaseClass cp) { string result = ""; try { CoreController core = ((CPClass)cp).core; PageContentController.processFormQuickEditing(core); } catch (Exception ex) { cp.Site.ErrorReport(ex); } return(result); }
// //==================================================================================================== /// <summary> /// pageManager addon interface /// </summary> /// <param name="cp"></param> /// <returns></returns> public override object Execute(Contensive.BaseClasses.CPBaseClass cp) { try { CoreController core = ((CPClass)cp).core; // removed "<div class=\"ccBodyWeb\">" + PageContentController.getHtmlBody(core) + "</div>"; string result = PageContentController.getHtmlBody(core); if (core.doc.pageController.page != null) { // // -- add page# wrapper. This helps create targetted styles, like active style for menu active result = "<div id=\"page" + core.doc.pageController.page.id + "\">" + result + "</div>"; } return(result); } catch (Exception ex) { cp.Site.ErrorReport(ex); return("<div style=\"width:600px;margin:20px auto;\"><h1>Server Error</h1><p>There was an issue on this site that blocked your content. Thank you for your patience.</p></div>"); } }
// //============================================================================= /// <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); }
// //==================================================================================================== // // Creates the child page list used by PageContent // // RequestedListName is the name of the ChildList (ActiveContent Child Page List) // ----- New // {CHILDPAGELIST} = the listname for the orphan list at the bottom of all page content, same as "", "ORPHAN", "NONE" // RequestedListName = "", same as "ORPHAN", same as "NONE" // prints orphan list (child pages that have not printed so far (orphan list)) // AllowChildListDisplay - if false, no Child Page List is displayed, but authoring tags are still there // Changed to friend, not public // ----- Old // "NONE" returns child pages with no RequestedListName // "" same as "NONE" // "ORPHAN" returns all child pages that have not been printed on this page // - uses ChildPageListTracking to track what has been seen //============================================================================= // public static string getChildPageList(CoreController core, string requestedListName, string contentName, int parentPageID, bool allowChildListDisplay, bool ArchivePages = false) { try { if (string.IsNullOrEmpty(contentName)) { contentName = PageContentModel.tableMetadata.contentName; } string UcaseRequestedListName = toUCase(requestedListName); if ((UcaseRequestedListName == "NONE") || (UcaseRequestedListName == "ORPHAN") || (UcaseRequestedListName == "{CHILDPAGELIST}")) { UcaseRequestedListName = ""; } string archiveLink = core.webServer.requestPathPage; archiveLink = convertLinkToShortLink(archiveLink, core.webServer.requestDomain, core.appConfig.cdnFileUrl); archiveLink = encodeVirtualPath(archiveLink, core.appConfig.cdnFileUrl, appRootPath, core.webServer.requestDomain); string sqlCriteria = "(parentId=" + parentPageID + ")" + ((string.IsNullOrWhiteSpace(UcaseRequestedListName)) ? "" : "and(parentListName=" + DbController.encodeSQLText(UcaseRequestedListName) + ")"); List <PageContentModel> childPageList = DbBaseModel.createList <PageContentModel>(core.cpParent, sqlCriteria, "sortOrder"); var inactiveList = new StringBuilder(); var activeList = new StringBuilder(); bool isAuthoring = core.session.isEditing(contentName); int ChildListCount = 0; if (childPageList.Count > 0) { string currentPageChildPageIdList = core.cpParent.Doc.GetText("Current Page Child PageId List", "0"); string testPageIdList = "," + currentPageChildPageIdList + ","; foreach (PageContentModel childPage in childPageList) { if (!testPageIdList.Contains("," + childPage.id + ",")) { currentPageChildPageIdList += "," + childPage.id; } string PageLink = PageContentController.getPageLink(core, childPage.id, "", true, false); string pageMenuHeadline = childPage.menuHeadline; if (string.IsNullOrEmpty(pageMenuHeadline)) { pageMenuHeadline = childPage.name.Trim(' '); if (string.IsNullOrEmpty(pageMenuHeadline)) { pageMenuHeadline = "Related Page"; } } string pageEditLink = ""; if (core.session.isEditing(contentName)) { pageEditLink = AdminUIController.getRecordEditAndCutAnchorTag(core, contentName, childPage.id, true, childPage.name); } // string link = PageLink; if (ArchivePages) { link = GenericController.modifyLinkQuery(archiveLink, rnPageId, encodeText(childPage.id), true); } bool blockContentComposite = false; if (childPage.blockContent || childPage.blockPage) { blockContentComposite = !PageContentController.allowThroughPageBlock(core, childPage.id); } string LinkedText = GenericController.getLinkedText("<a href=\"" + HtmlController.encodeHtml(link) + "\">", pageMenuHeadline); if ((string.IsNullOrEmpty(UcaseRequestedListName)) && (childPage.parentListName != "") && (!isAuthoring)) { // // ----- Requested orphan list, and this record is in a named list, and not editing, do not display // } else if ((string.IsNullOrEmpty(UcaseRequestedListName)) && (childPage.parentListName != "")) { // // -- child page has a parentListName but this request does not if (!core.doc.pageController.childPageIdsListed.Contains(childPage.id)) { // // -- child page has not yet displays, if editing show it as an orphan page if (isAuthoring) { inactiveList.Append("\r<li name=\"page" + childPage.id + "\" name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItemNoBullet\">"); inactiveList.Append(pageEditLink); inactiveList.Append("[from missing child page list '" + childPage.parentListName + "': " + LinkedText + "]"); inactiveList.Append("</li>"); } } } else if ((string.IsNullOrEmpty(UcaseRequestedListName)) && (!allowChildListDisplay) && (!isAuthoring)) { // // ----- Requested orphan List, Not AllowChildListDisplay, not Authoring, do not display // } else if ((!string.IsNullOrEmpty(UcaseRequestedListName)) && (UcaseRequestedListName != GenericController.toUCase(childPage.parentListName))) { // // ----- requested named list and wrong RequestedListName, do not display // } else if (!childPage.allowInChildLists) { // // ----- Allow in Child Page Lists is false, display hint to authors // if (isAuthoring) { inactiveList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItemNoBullet\">"); inactiveList.Append(pageEditLink); inactiveList.Append("[Hidden (Allow in Child Lists is not checked): " + LinkedText + "]"); inactiveList.Append("</li>"); } } else if (!childPage.active) { // // ----- Not active record, display hint if authoring // if (isAuthoring) { inactiveList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItemNoBullet\">"); inactiveList.Append(pageEditLink); inactiveList.Append("[Hidden (Inactive): " + LinkedText + "]"); inactiveList.Append("</li>"); } } else if ((childPage.pubDate != DateTime.MinValue) && (childPage.pubDate > core.doc.profileStartTime)) { // // ----- Child page has not been published // if (isAuthoring) { inactiveList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItemNoBullet\">"); inactiveList.Append(pageEditLink); inactiveList.Append("[Hidden (To be published " + childPage.pubDate + "): " + LinkedText + "]"); inactiveList.Append("</li>"); } } else if ((childPage.dateExpires != DateTime.MinValue) && (childPage.dateExpires < core.doc.profileStartTime)) { // // ----- Child page has expired // if (isAuthoring) { inactiveList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItemNoBullet\">"); inactiveList.Append(pageEditLink); inactiveList.Append("[Hidden (Expired " + childPage.dateExpires + "): " + LinkedText + "]"); inactiveList.Append("</li>"); } } else { // // ----- display list (and authoring links) // if (isAuthoring) { activeList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccEditWrapper ccListItem allowSort\">"); if (!string.IsNullOrEmpty(pageEditLink)) { activeList.Append(HtmlController.div(iconGrip, "ccListItemDragHandle") + pageEditLink + " "); } activeList.Append(LinkedText); // // include authoring mark for content block // if (childPage.blockContent) { activeList.Append(" [Content Blocked]"); } if (childPage.blockPage) { activeList.Append(" [Page Blocked]"); } } else { activeList.Append("\r<li name=\"page" + childPage.id + "\" id=\"page" + childPage.id + "\" class=\"ccListItem allowSort\">"); activeList.Append(LinkedText); } // // include overview // if AllowBrief is false, BriefFilename is not loaded // if ((childPage.briefFilename != "") && (childPage.allowBrief)) { string Brief = encodeText(core.cdnFiles.readFileText(childPage.briefFilename)).Trim(' '); if (!string.IsNullOrEmpty(Brief)) { activeList.Append("<div class=\"ccListCopy\">" + Brief + "</div>"); } } activeList.Append("</li>"); // // -- add child page to childPagesListed list if (!core.doc.pageController.childPageIdsListed.Contains(childPage.id)) { core.doc.pageController.childPageIdsListed.Add(childPage.id); } ChildListCount = ChildListCount + 1; } } if (!string.IsNullOrWhiteSpace(currentPageChildPageIdList)) { core.cpParent.Doc.SetProperty("Current Page Child PageId List", currentPageChildPageIdList); } } // // ----- Add Link // if (!ArchivePages && isAuthoring) { foreach (var AddLink in AdminUIController.getRecordAddAnchorTag(core, contentName, "parentid=" + parentPageID + ",ParentListName=" + UcaseRequestedListName, true)) { if (!string.IsNullOrEmpty(AddLink)) { inactiveList.Append("\r<li class=\"ccEditWrapper ccListItemNoBullet\">" + AddLink + "</LI>"); } } } // // ----- If there is a list, add the list start and list end // string result = activeList.ToString() + inactiveList.ToString(); if (!string.IsNullOrEmpty(result)) { result = "\r<ul id=\"childPageList_" + parentPageID + "_" + requestedListName + "\" class=\"ccChildList\">" + result + "\r</ul>"; } if ((!string.IsNullOrEmpty(UcaseRequestedListName)) && (ChildListCount == 0) && isAuthoring) { result = "[Child Page List with no pages]</p><p>" + result; } return(result); } catch (Exception ex) { LogController.logError(core, ex); return(string.Empty); } }
// public override string GetPageLink(int pageID) { return(PageContentController.getPageLink(cp.core, pageID, "", true, false)); }
// public override string GetPageLink(int pageID, string queryStringSuffix) { return(PageContentController.getPageLink(cp.core, pageID, queryStringSuffix, true, false)); }
// //==================================================================================================== // public override string GetPageLink(int pageID, string queryStringSuffix, bool allowLinkAlias) { return(PageContentController.getPageLink(cp.core, pageID, queryStringSuffix, allowLinkAlias, false)); }