// //======================================================================== /// <summary> /// Create a filename for the Virtual Directory /// </summary> /// <param name="contentName"></param> /// <param name="fieldName"></param> /// <param name="recordId"></param> /// <param name="originalFilename"></param> /// <returns></returns> public static string getVirtualFilename(CoreController core, string contentName, string fieldName, int recordId, string originalFilename = "") { try { if (string.IsNullOrEmpty(contentName.Trim())) { throw new ArgumentException("contentname cannot be blank"); } if (string.IsNullOrEmpty(fieldName.Trim())) { throw new ArgumentException("fieldname cannot be blank"); } if (recordId <= 0) { throw new ArgumentException("recordid is not valid"); } var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta == null) { throw new ArgumentException("contentName is not valid"); } string workingFieldName = fieldName.Trim().ToLowerInvariant(); if (!meta.fields.ContainsKey(workingFieldName)) { throw new ArgumentException("content metadata does not include field [" + fieldName + "]"); } if (string.IsNullOrEmpty(originalFilename)) { return(FileController.getVirtualRecordUnixPathFilename(meta.tableName, fieldName, recordId, meta.fields[fieldName.ToLowerInvariant()].fieldTypeId)); } return(FileController.getVirtualRecordUnixPathFilename(meta.tableName, fieldName, recordId, originalFilename)); } catch (Exception ex) { LogController.logError(core, ex); throw; } }
// //==================================================================================================== // public override int AddContentField(string contentName, string fieldName, CPContentBaseClass.FieldTypeIdEnum fieldType) { var contentMetadata = ContentMetadataModel.createByUniqueName(cp.core, contentName); var fieldMeta = ContentFieldMetadataModel.createDefault(cp.core, fieldName, fieldType); contentMetadata.verifyContentField(cp.core, fieldMeta, false, "Api CPContent.AddContentField [" + contentName + "." + fieldName + "]"); return(fieldMeta.id); }
public override string GetProperty(string ContentName, string PropertyName) { var contentMetadata = ContentMetadataModel.createByUniqueName(cp.core, ContentName); if (contentMetadata == null) { return(string.Empty); } return(contentMetadata.getContentProperty(cp.core, PropertyName)); }
// //==================================================================================================== // public override string GetTable(string contentName) { var meta = ContentMetadataModel.createByUniqueName(cp.core, contentName); if (meta == null) { return(string.Empty); } return(meta.tableName); }
// //==================================================================================================== /// <summary> /// returns the matching record name if a match is found, otherwise blank. Does NOT validate the record. /// </summary> /// <param name="contentName"></param> /// <param name="recordID"></param> /// <returns></returns> public override string GetRecordName(string contentName, int recordID) { var meta = ContentMetadataModel.createByUniqueName(cp.core, contentName); if (meta == null) { return(string.Empty); } return(meta.getRecordName(cp.core, recordID)); }
// //==================================================================================================== // public override string GetEditLink(string contentName, string recordGuid) { var contentMetadata = ContentMetadataModel.createByUniqueName(cp.core, contentName); if (contentMetadata == null) { throw new GenericException("ContentName [" + contentName + "], but no content metadata found with this name."); } return(AdminUIController.getRecordEditAnchorTag(cp.core, contentMetadata, recordGuid)); }
// //==================================================================================================== // public override string GetContentControlCriteria(string contentName) { var meta = ContentMetadataModel.createByUniqueName(cp.core, contentName); if (meta != null) { return(meta.legacyContentControlCriteria); } return(string.Empty); }
// //======================================================================== /// <summary> /// 'deleteContentRecords /// </summary> /// <param name="contentName"></param> /// <param name="sqlCriteria"></param> /// <param name="userId"></param> // public static void deleteContentRecords(CoreController core, string contentName, string sqlCriteria, int userId = 0) { var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta == null) { return; } using (var db = new DbController(core, meta.dataSourceName)) { core.db.deleteRows(meta.tableName, sqlCriteria); } }
// //======================================================================== /// <summary> /// Delete Content Record /// </summary> /// <param name="contentName"></param> /// <param name="recordId"></param> /// <param name="userId"></param> // public static void deleteContentRecord(CoreController core, string contentName, int recordId, int userId = SystemMemberId) { var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta == null) { return; } using (var db = new DbController(core, meta.dataSourceName)) { core.db.delete(recordId, meta.tableName); } }
// //============================================================= /// <summary> /// Return a record name given the record id. If not record is found, blank is returned. /// </summary> public static string getRecordName(CoreController core, string ContentName, int recordID) { try { var meta = ContentMetadataModel.createByUniqueName(core, ContentName); if (meta == null) { return(string.Empty); } return(meta.getRecordName(core, recordID)); } catch (Exception ex) { LogController.logError(core, ex); throw; } }
// //======================================================================== /// <summary> /// Get a Contents Tablename from the ContentPointer /// </summary> /// <param name="core"></param> /// <param name="contentName"></param> /// <returns></returns> public static string getContentTablename(CoreController core, string contentName) { try { var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta != null) { return(meta.tableName); } return(string.Empty); } catch (Exception ex) { LogController.logError(core, ex); throw; } }
// //======================================================================== /// <summary> /// get the id of the table record for a content /// </summary> /// <param name="contentName"></param> /// <returns></returns> public static int getContentTableID(CoreController core, string contentName) { var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta == null) { return(0); } var table = DbBaseModel.createByUniqueName <TableModel>(core.cpParent, meta.tableName); if (table != null) { return(table.id); } return(0); }
// //============================================================= /// <summary> /// Return a record name given the guid. If not record is found, blank is returned. /// </summary> public static string getRecordName(CoreController core, string contentName, string recordGuid) { try { var meta = ContentMetadataModel.createByUniqueName(core, contentName); if (meta == null) { return(string.Empty); } using (DataTable dt = core.db.executeQuery("select top 1 name from " + meta.tableName + " where ccguid=" + DbController.encodeSQLText(recordGuid) + " order by id")) { foreach (DataRow dr in dt.Rows) { return(DbController.getDataRowFieldText(dr, "name")); } } return(string.Empty); } catch (Exception ex) { LogController.logError(core, ex); throw; } }
// //============================================================= /// <summary> /// get the lowest recordId based on its name. If no record is found, 0 is returned /// </summary> /// <param name="contentName"></param> /// <param name="recordName"></param> /// <returns></returns> public static int getRecordIdByUniqueName(CoreController core, string contentName, string recordName) { try { if (String.IsNullOrWhiteSpace(recordName)) { return(0); } var meta = ContentMetadataModel.createByUniqueName(core, contentName); if ((meta == null) || (String.IsNullOrWhiteSpace(meta.tableName))) { return(0); } using (DataTable dt = core.db.executeQuery("select top 1 id from " + meta.tableName + " where name=" + DbController.encodeSQLText(recordName) + " order by id")) { foreach (DataRow dr in dt.Rows) { return(DbController.getDataRowFieldInteger(dr, "id")); } } return(0); } catch (Exception ex) { LogController.logError(core, ex); throw; } }
// // ==================================================================================================== /// <summary> /// Create the tabs for editing a record /// </summary> /// <param name="adminData.content"></param> /// <param name="editRecord"></param> /// <returns></returns> public static string get(CoreController core, AdminDataModel adminData) { string returnHtml = ""; try { // if ((!core.doc.userErrorList.Count.Equals(0)) && adminData.editRecord.loaded) { // // block load if there was a user error and it is already loaded (assume error was from response ) } else if (adminData.adminContent.id <= 0) { // // Invalid Content Processor.Controllers.ErrorController.addUserError(core, "There was a problem identifying the content you requested. Please return to the previous form and verify your selection."); return(""); } else if (adminData.editRecord.loaded && !adminData.editRecord.saved) { // // File types need to be reloaded from the Db, because... // LoadDb - sets them to the path-page // LoadResponse - sets the blank if no change, filename if there is an upload // SaveEditRecord - if blank, no change. If a filename it saves the uploaded file // GetForm_Edit - expects the Db value to be in EditRecordValueVariants (path-page) // // xx This was added to bypass the load for the editrefresh case (reload the response so the editor preference can change) // xx I do not know why the following section says "reload even if it is loaded", but lets try this // foreach (var keyValuePair in adminData.adminContent.fields) { ContentFieldMetadataModel field = keyValuePair.Value; if ((keyValuePair.Value.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.File) || (keyValuePair.Value.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileImage)) { adminData.editRecord.fieldsLc[field.nameLc].value = adminData.editRecord.fieldsLc[field.nameLc].dbValue; } } } else { // // otherwise, load the record, even if it was loaded during a previous form process adminData.loadEditRecord(core, true); } if (!AdminDataModel.userHasContentAccess(core, ((adminData.editRecord.contentControlId.Equals(0)) ? adminData.adminContent.id : adminData.editRecord.contentControlId))) { Processor.Controllers.ErrorController.addUserError(core, "Your account on this system does not have access rights to edit this content."); return(""); } // // Setup Edit Referer string EditReferer = core.docProperties.getText(RequestNameEditReferer); if (string.IsNullOrEmpty(EditReferer)) { EditReferer = core.webServer.requestReferer; if (!string.IsNullOrEmpty(EditReferer)) { // // special case - if you are coming from the advanced search, go back to the list page EditReferer = GenericController.strReplace(EditReferer, "&af=39", ""); // // if referer includes AdminWarningMsg (admin hint message), remove it -- this edit may fix the problem int Pos = EditReferer.IndexOf("AdminWarningMsg=", StringComparison.CurrentCulture); if (Pos >= 0) { EditReferer = EditReferer.left(Pos - 2); } } } core.doc.addRefreshQueryString(RequestNameEditReferer, EditReferer); // // load user's editor preferences to fieldEditorPreferences() - this is the editor this user has picked when there are >1 // fieldId:addonId,fieldId:addonId,etc // with custom FancyBox form in edit window with button "set editor preference" // this button causes a 'refresh' action, reloads fields with stream without save // // // ----- determine contentType for editor // CPHtml5BaseClass.EditorContentType contentType; if (GenericController.toLCase(adminData.adminContent.name) == "email templates") { contentType = CPHtml5BaseClass.EditorContentType.contentTypeEmailTemplate; } else if (GenericController.toLCase(adminData.adminContent.tableName) == "cctemplates") { contentType = CPHtml5BaseClass.EditorContentType.contentTypeWebTemplate; } else if (GenericController.toLCase(adminData.adminContent.tableName) == "ccemail") { contentType = CPHtml5BaseClass.EditorContentType.contentTypeEmail; } else { contentType = CPHtml5BaseClass.EditorContentType.contentTypeWeb; } EditorEnvironmentModel editorEnv = new EditorEnvironmentModel { allowHelpMsgCustom = false, editorAddonListJSON = core.html.getWysiwygAddonList(contentType), isRootPage = adminData.adminContent.tableName.ToLowerInvariant().Equals(PageContentModel.tableMetadata.tableNameLower) && (adminData.editRecord.parentId == 0) && (adminData.editRecord.id != 0), needUniqueEmailMessage = false, record_readOnly = adminData.editRecord.userReadOnly, styleList = "", styleOptionList = "", formFieldList = "" }; // // ----- determine access details var userContentPermissions = PermissionController.getUserContentPermissions(core, adminData.adminContent); bool allowDelete = adminData.adminContent.allowDelete && userContentPermissions.allowDelete && (adminData.editRecord.id != 0); bool allowAdd = adminData.adminContent.allowAdd && userContentPermissions.allowAdd; var editButtonBarInfo = new EditButtonBarInfoClass(core, adminData, allowDelete, true, userContentPermissions.allowSave, allowAdd); // string adminContentTableNameLc = adminData.adminContent.tableName.ToLowerInvariant(); bool allowLinkAlias = adminContentTableNameLc.Equals(PageContentModel.tableMetadata.tableNameLower); bool allowPeopleGroups = adminContentTableNameLc.Equals(PersonModel.tableMetadata.tableNameLower);; // //-----Create edit page if (adminContentTableNameLc.Equals(EmailModel.tableMetadata.tableNameLower)) { // LogController.logTrace(core, "getFormEdit, treat as email, adminContentTableNameLower [" + adminContentTableNameLc + "]"); // // -- email bool emailSubmitted = false; bool emailSent = false; DateTime LastSendTestDate = DateTime.MinValue; bool AllowEmailSendWithoutTest = (core.siteProperties.getBoolean("AllowEmailSendWithoutTest", false)); if (adminData.editRecord.fieldsLc.ContainsKey("lastsendtestdate")) { LastSendTestDate = GenericController.encodeDate(adminData.editRecord.fieldsLc["lastsendtestdate"].value); } if (adminData.adminContent.id.Equals(ContentMetadataModel.getContentId(core, "System Email"))) { // LogController.logTrace(core, "getFormEdit, System email"); // // System Email emailSubmitted = false; if (adminData.editRecord.id != 0) { if (adminData.editRecord.fieldsLc.ContainsKey("testmemberid")) { if (encodeInteger(adminData.editRecord.fieldsLc["testmemberid"].value) == 0) { adminData.editRecord.fieldsLc["testmemberid"].value = core.session.user.id; } } } editButtonBarInfo.allowSave = (userContentPermissions.allowSave && adminData.editRecord.allowUserSave && (!emailSubmitted) && (!emailSent)); editButtonBarInfo.allowSendTest = ((!emailSubmitted) && (!emailSent)); } else if (adminData.adminContent.id.Equals(ContentMetadataModel.getContentId(core, "Conditional Email"))) { // // Conditional Email emailSubmitted = false; editorEnv.record_readOnly = adminData.editRecord.userReadOnly || emailSubmitted; if (adminData.editRecord.id != 0) { if (adminData.editRecord.fieldsLc.ContainsKey("submitted")) { emailSubmitted = GenericController.encodeBoolean(adminData.editRecord.fieldsLc["submitted"].value); } } editButtonBarInfo.allowActivate = !emailSubmitted && ((LastSendTestDate != DateTime.MinValue) || AllowEmailSendWithoutTest); editButtonBarInfo.allowDeactivate = emailSubmitted; editButtonBarInfo.allowSave = userContentPermissions.allowSave && adminData.editRecord.allowUserSave && !emailSubmitted; } else { // // Group Email if (adminData.editRecord.id != 0) { emailSubmitted = encodeBoolean(adminData.editRecord.fieldsLc["submitted"].value); emailSent = encodeBoolean(adminData.editRecord.fieldsLc["sent"].value); } editButtonBarInfo.allowSave = !emailSubmitted && (userContentPermissions.allowSave && adminData.editRecord.allowUserSave); editButtonBarInfo.allowSend = !emailSubmitted && ((LastSendTestDate != DateTime.MinValue) || AllowEmailSendWithoutTest); editButtonBarInfo.allowSendTest = !emailSubmitted; editorEnv.record_readOnly = adminData.editRecord.userReadOnly || emailSubmitted || emailSent; } } else if (adminContentTableNameLc.Equals(PageContentModel.tableMetadata.tableNameLower)) { // // Page Content // editButtonBarInfo.allowMarkReviewed = true; editButtonBarInfo.isPageContent = true; editButtonBarInfo.hasChildRecords = true; allowLinkAlias = true; } else { // // All other tables (User definined) var pageContentMetadata = ContentMetadataModel.createByUniqueName(core, "page content"); editButtonBarInfo.isPageContent = pageContentMetadata.isParentOf(core, adminData.adminContent.id); editButtonBarInfo.hasChildRecords = adminData.adminContent.containsField(core, "parentid"); editButtonBarInfo.allowMarkReviewed = core.db.isSQLTableField(adminData.adminContent.tableName, "DateReviewed"); } // // Print common form elements var Stream = new StringBuilderLegacyController(); Stream.add("\r<input type=\"hidden\" name=\"fieldEditorPreference\" id=\"fieldEditorPreference\" value=\"\">"); string editSectionButtonBar = AdminUIController.getSectionButtonBarForEdit(core, editButtonBarInfo); Stream.add(editSectionButtonBar); var headerInfo = new RecordEditHeaderInfoClass { recordId = adminData.editRecord.id, recordLockById = adminData.editRecord.editLock.editLockByMemberId, recordLockExpiresDate = encodeDate(adminData.editRecord.editLock.editLockExpiresDate), recordName = adminData.editRecord.nameLc }; string titleBarDetails = AdminUIController.getEditForm_TitleBarDetails(core, headerInfo, adminData.editRecord); Stream.add(AdminUIController.getSectionHeader(core, "", titleBarDetails)); { var editTabs = new EditTabModel(); EditViewTabList.addContentTabs(core, adminData, editTabs, editorEnv); if (allowPeopleGroups) { EditViewTabList.addCustomTab(core, editTabs, "Groups", GroupRuleEditor.get(core, adminData)); } if (allowLinkAlias) { EditViewTabList.addCustomTab(core, editTabs, "Link Aliases", LinkAliasEditor.getForm_Edit_LinkAliases(core, adminData, adminData.editRecord.userReadOnly)); } EditViewTabList.addCustomTab(core, editTabs, "Control Info", EditViewTabControlInfo.get(core, adminData, editorEnv)); Stream.add(editTabs.getTabs(core)); } Stream.add(editSectionButtonBar); Stream.add(HtmlController.inputHidden("FormFieldList", editorEnv.formFieldList)); returnHtml = wrapForm(core, Stream.text, adminData, AdminFormEdit); // // -- update page title if (adminData.editRecord.id == 0) { core.html.addTitle("Add " + adminData.adminContent.name); } else if (adminData.editRecord.nameLc == "") { core.html.addTitle("Edit #" + adminData.editRecord.id + " in " + adminData.editRecord.contentControlId_Name); } else { core.html.addTitle("Edit " + adminData.editRecord.nameLc + " in " + adminData.editRecord.contentControlId_Name); } } catch (Exception ex) { LogController.logError(core, ex); throw; } return(returnHtml); }
// //================================================================================= // //================================================================================= // public static string get(CPClass cp, CoreController core, AdminDataModel adminData) { string returnForm = ""; try { // string SearchValue = null; FindWordMatchEnum MatchOption = 0; int FormFieldPtr = 0; int FormFieldCnt = 0; ContentMetadataModel CDef = null; string FieldName = null; StringBuilderLegacyController Stream = new StringBuilderLegacyController(); int FieldPtr = 0; bool RowEven = false; string RQS = null; string[] FieldNames = { }; string[] FieldCaption = { }; int[] fieldId = null; CPContentBaseClass.FieldTypeIdEnum[] fieldTypeId = { }; string[] FieldValue = { }; int[] FieldMatchOptions = { }; int FieldMatchOption = 0; string[] FieldLookupContentName = { }; string[] FieldLookupList = { }; int ContentId = 0; int FieldCnt = 0; int FieldSize = 0; int RowPointer = 0; string LeftButtons = ""; string ButtonBar = null; string Title = null; string TitleBar = null; string Content = null; // // Process last form // string Button = core.docProperties.getText("button"); IndexConfigClass IndexConfig = null; if (!string.IsNullOrEmpty(Button)) { switch (Button) { case ButtonSearch: IndexConfig = IndexConfigClass.get(core, adminData); FormFieldCnt = core.docProperties.getInteger("fieldcnt"); if (FormFieldCnt > 0) { for (FormFieldPtr = 0; FormFieldPtr < FormFieldCnt; FormFieldPtr++) { FieldName = GenericController.toLCase(core.docProperties.getText("fieldname" + FormFieldPtr)); MatchOption = (FindWordMatchEnum)core.docProperties.getInteger("FieldMatch" + FormFieldPtr); switch (MatchOption) { case FindWordMatchEnum.MatchEquals: case FindWordMatchEnum.MatchGreaterThan: case FindWordMatchEnum.matchincludes: case FindWordMatchEnum.MatchLessThan: SearchValue = core.docProperties.getText("FieldValue" + FormFieldPtr); break; default: SearchValue = ""; break; } if (!IndexConfig.findWords.ContainsKey(FieldName)) { // // fieldname not found, save if not FindWordMatchEnum.MatchIgnore // if (MatchOption != FindWordMatchEnum.MatchIgnore) { IndexConfig.findWords.Add(FieldName, new IndexConfigFindWordClass { Name = FieldName, MatchOption = MatchOption, Value = SearchValue }); } } else { // // fieldname was found // IndexConfig.findWords[FieldName].MatchOption = MatchOption; IndexConfig.findWords[FieldName].Value = SearchValue; } } } GetHtmlBodyClass.setIndexSQL_SaveIndexConfig(cp, core, IndexConfig); return(string.Empty); case ButtonCancel: return(string.Empty); } } IndexConfig = IndexConfigClass.get(core, adminData); Button = "CriteriaSelect"; RQS = core.doc.refreshQueryString; // // ----- ButtonBar // if (adminData.ignore_legacyMenuDepth > 0) { LeftButtons += AdminUIController.getButtonPrimary(ButtonClose, "window.close();"); } else { LeftButtons += AdminUIController.getButtonPrimary(ButtonCancel); } LeftButtons += AdminUIController.getButtonPrimary(ButtonSearch); ButtonBar = AdminUIController.getSectionButtonBar(core, LeftButtons, ""); // // ----- TitleBar // Title = adminData.adminContent.name; Title = Title + " Advanced Search"; string TitleDescription = "<div>Enter criteria for each field to identify and select your results. The results of a search will have to have all of the criteria you enter.</div>"; TitleBar = AdminUIController.getSectionHeader(core, Title, TitleDescription); // // ----- List out all fields // CDef = ContentMetadataModel.createByUniqueName(core, adminData.adminContent.name); FieldSize = 100; Array.Resize(ref FieldNames, FieldSize + 1); Array.Resize(ref FieldCaption, FieldSize + 1); Array.Resize(ref fieldId, FieldSize + 1); Array.Resize(ref fieldTypeId, FieldSize + 1); Array.Resize(ref FieldValue, FieldSize + 1); Array.Resize(ref FieldMatchOptions, FieldSize + 1); Array.Resize(ref FieldLookupContentName, FieldSize + 1); Array.Resize(ref FieldLookupList, FieldSize + 1); foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminData.adminContent.fields) { ContentFieldMetadataModel field = keyValuePair.Value; if (FieldPtr >= FieldSize) { FieldSize = FieldSize + 100; Array.Resize(ref FieldNames, FieldSize + 1); Array.Resize(ref FieldCaption, FieldSize + 1); Array.Resize(ref fieldId, FieldSize + 1); Array.Resize(ref fieldTypeId, FieldSize + 1); Array.Resize(ref FieldValue, FieldSize + 1); Array.Resize(ref FieldMatchOptions, FieldSize + 1); Array.Resize(ref FieldLookupContentName, FieldSize + 1); Array.Resize(ref FieldLookupList, FieldSize + 1); } FieldName = GenericController.toLCase(field.nameLc); FieldNames[FieldPtr] = FieldName; FieldCaption[FieldPtr] = field.caption; fieldId[FieldPtr] = field.id; fieldTypeId[FieldPtr] = field.fieldTypeId; if (fieldTypeId[FieldPtr] == CPContentBaseClass.FieldTypeIdEnum.Lookup) { ContentId = field.lookupContentId; if (ContentId > 0) { FieldLookupContentName[FieldPtr] = MetadataController.getContentNameByID(core, ContentId); } FieldLookupList[FieldPtr] = field.lookupList; } // // set prepoplate value from indexconfig // if (IndexConfig.findWords.ContainsKey(FieldName)) { FieldValue[FieldPtr] = IndexConfig.findWords[FieldName].Value; FieldMatchOptions[FieldPtr] = (int)IndexConfig.findWords[FieldName].MatchOption; } FieldPtr += 1; } FieldCnt = FieldPtr; // // Add headers to stream // returnForm = returnForm + "<table border=0 width=100% cellspacing=0 cellpadding=4>"; // RowPointer = 0; for (FieldPtr = 0; FieldPtr < FieldCnt; FieldPtr++) { returnForm = returnForm + HtmlController.inputHidden("fieldname" + FieldPtr, FieldNames[FieldPtr]); RowEven = ((RowPointer % 2) == 0); FieldMatchOption = FieldMatchOptions[FieldPtr]; switch (fieldTypeId[FieldPtr]) { case CPContentBaseClass.FieldTypeIdEnum.Date: // // Date returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not empty</div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchEquals).ToString(), FieldMatchOption.ToString(), "") + "=</div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchGreaterThan).ToString(), FieldMatchOption.ToString(), "") + "></div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, encodeInteger(FindWordMatchEnum.MatchLessThan).ToString(), FieldMatchOption.ToString(), "") + "<</div>" + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputDate(core, "fieldvalue" + FieldPtr, encodeDate(FieldValue[FieldPtr])).Replace(">", " onFocus=\"ccAdvSearchText\">") + "</div>" + "</div>" + "</td>" + "</tr>"; break; case CPContentBaseClass.FieldTypeIdEnum.Currency: case CPContentBaseClass.FieldTypeIdEnum.Float: case CPContentBaseClass.FieldTypeIdEnum.Integer: case CPContentBaseClass.FieldTypeIdEnum.AutoIdIncrement: // // -- Numeric - changed FindWordMatchEnum.MatchEquals to MatchInclude to be compatible with Find Search returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not empty</div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "n" + FieldPtr) + "=</div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchGreaterThan).ToString(), FieldMatchOption.ToString(), "") + "></div>" + "<div style=\"display:block;float:left;width:50px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchLessThan).ToString(), FieldMatchOption.ToString(), "") + "<</div>" + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('n" + FieldPtr + "');e.checked=1;\">") + "</div>" + "</div>" + "</td>" + "</tr>"; RowPointer += 1; break; case CPContentBaseClass.FieldTypeIdEnum.File: case CPContentBaseClass.FieldTypeIdEnum.FileImage: // // File // returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not empty</div>" + "</div>" + "</td>" + "</tr>"; RowPointer = RowPointer + 1; break; case CPContentBaseClass.FieldTypeIdEnum.Boolean: // // Boolean // returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchTrue).ToString(), FieldMatchOption.ToString(), "") + "true</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchFalse).ToString(), FieldMatchOption.ToString(), "") + "false</div>" + "</div>" + "</td>" + "</tr>"; break; case CPContentBaseClass.FieldTypeIdEnum.Text: case CPContentBaseClass.FieldTypeIdEnum.LongText: case CPContentBaseClass.FieldTypeIdEnum.HTML: case CPContentBaseClass.FieldTypeIdEnum.HTMLCode: case CPContentBaseClass.FieldTypeIdEnum.FileHTML: case CPContentBaseClass.FieldTypeIdEnum.FileHTMLCode: case CPContentBaseClass.FieldTypeIdEnum.FileCSS: case CPContentBaseClass.FieldTypeIdEnum.FileJavascript: case CPContentBaseClass.FieldTypeIdEnum.FileXML: // // Text // returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not empty</div>" + "<div style=\"display:block;float:left;width:150px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "t" + FieldPtr) + "includes</div>" + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('t" + FieldPtr + "');e.checked=1;\">") + "</div>" + "</div>" + "</td>" + "</tr>"; RowPointer = RowPointer + 1; break; case CPContentBaseClass.FieldTypeIdEnum.Lookup: case CPContentBaseClass.FieldTypeIdEnum.MemberSelect: // // Lookup returnForm = returnForm + "<tr>" + "<td class=\"ccAdminEditCaption\">" + FieldCaption[FieldPtr] + "</td>" + "<td class=\"ccAdminEditField\">" + "<div style=\"display:block;float:left;width:800px;\">" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchIgnore).ToString(), FieldMatchOption.ToString(), "") + "ignore</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchEmpty).ToString(), FieldMatchOption.ToString(), "") + "empty</div>" + "<div style=\"display:block;float:left;width:100px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.MatchNotEmpty).ToString(), FieldMatchOption.ToString(), "") + "not empty</div>" + "<div style=\"display:block;float:left;width:150px;\">" + HtmlController.inputRadio("FieldMatch" + FieldPtr, ((int)FindWordMatchEnum.matchincludes).ToString(), FieldMatchOption.ToString(), "t" + FieldPtr) + "includes</div>" + "<div style=\"display:block;float:left;width:300px;\">" + HtmlController.inputText_Legacy(core, "fieldvalue" + FieldPtr, FieldValue[FieldPtr], 1, 5, "", false, false, "ccAdvSearchText").Replace(">", " onFocus=\"var e=getElementById('t" + FieldPtr + "'); e.checked= 1;\">") + "</div>" + "</div>" + "</td>" + "</tr>"; RowPointer = RowPointer + 1; break; } } returnForm = returnForm + HtmlController.tableRowStart(); returnForm = returnForm + HtmlController.tableCellStart("120", 1, RowEven, "right") + "<img src=" + cdnPrefix + "images/spacer.gif width=120 height=1></td>"; returnForm = returnForm + HtmlController.tableCellStart("99%", 1, RowEven, "left") + "<img src=" + cdnPrefix + "images/spacer.gif width=1 height=1></td>"; returnForm = returnForm + kmaEndTableRow; returnForm = returnForm + "</table>"; Content = returnForm; // // Assemble LiveWindowTable Stream.add(ButtonBar); Stream.add(TitleBar); Stream.add(Content); Stream.add(ButtonBar); Stream.add("<input type=hidden name=fieldcnt VALUE=" + FieldCnt + ">"); Stream.add("<input type=hidden name=" + RequestNameAdminSubForm + " VALUE=" + AdminFormIndex_SubFormAdvancedSearch + ">"); returnForm = HtmlController.form(core, Stream.text); core.html.addTitle(adminData.adminContent.name + " Advanced Search"); } catch (Exception ex) { LogController.logError(core, ex); throw; } return(returnForm); }
// //============================================================================= // Print the Configure Index Form //============================================================================= // public static string get(CPClass cp, CoreController core, AdminDataModel adminData) { string result = ""; try { // todo refactor out ContentMetadataModel adminContent = adminData.adminContent; string Button = core.docProperties.getText(RequestNameButton); if (Button == ButtonOK) { // // -- Process OK, remove subform from querystring and return empty cp.Doc.AddRefreshQueryString(RequestNameAdminSubForm, ""); return(result); } // // Load Request if (Button == ButtonReset) { // // -- Process reset core.userProperty.setProperty(AdminDataModel.IndexConfigPrefix + adminContent.id.ToString(), ""); } IndexConfigClass IndexConfig = IndexConfigClass.get(core, adminData); int ToolsAction = core.docProperties.getInteger("dta"); int TargetFieldId = core.docProperties.getInteger("fi"); string TargetFieldName = core.docProperties.getText("FieldName"); int ColumnPointer = core.docProperties.getInteger("dtcn"); const string RequestNameAddField = "addfield"; string FieldNameToAdd = GenericController.toUCase(core.docProperties.getText(RequestNameAddField)); const string RequestNameAddFieldId = "addfieldID"; int FieldIDToAdd = core.docProperties.getInteger(RequestNameAddFieldId); bool normalizeSaveLoad = core.docProperties.getBoolean("NeedToReloadConfig"); bool AllowContentAutoLoad = false; StringBuilderLegacyController Stream = new StringBuilderLegacyController(); string Title = "Set Columns: " + adminContent.name; string Description = "Use the icons to add, remove and modify your personal column prefernces for this content (" + adminContent.name + "). Hit OK when complete. Hit Reset to restore your column preferences for this content to the site's default column preferences."; Stream.add(AdminUIController.getHeaderTitleDescription(Title, Description)); // //-------------------------------------------------------------------------------- // Process actions //-------------------------------------------------------------------------------- // if (adminContent.id != 0) { var CDef = ContentMetadataModel.create(core, adminContent.id); int ColumnWidthTotal = 0; if (ToolsAction != 0) { // // Block contentautoload, then force a load at the end // AllowContentAutoLoad = (core.siteProperties.getBoolean("AllowContentAutoLoad", true)); core.siteProperties.setProperty("AllowContentAutoLoad", false); bool reloadMetadata = false; int SourceContentId = 0; string SourceName = null; // // Make sure the FieldNameToAdd is not-inherited, if not, create new field // if (FieldIDToAdd != 0) { foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminContent.fields) { ContentFieldMetadataModel field = keyValuePair.Value; if (field.id == FieldIDToAdd) { if (field.inherited) { SourceContentId = field.contentId; SourceName = field.nameLc; // // -- copy the field using (var CSSource = new CsModel(core)) { if (CSSource.open("Content Fields", "(ContentID=" + SourceContentId + ")and(Name=" + DbController.encodeSQLText(SourceName) + ")")) { using (var CSTarget = new CsModel(core)) { if (CSTarget.insert("Content Fields")) { CSSource.copyRecord(CSTarget); CSTarget.set("ContentID", adminContent.id); reloadMetadata = true; } } } } } break; } } } // // Make sure all fields are not-inherited, if not, create new fields // foreach (var column in IndexConfig.columns) { ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()]; if (field.inherited) { SourceContentId = field.contentId; SourceName = field.nameLc; using (var CSSource = new CsModel(core)) { if (CSSource.open("Content Fields", "(ContentID=" + SourceContentId + ")and(Name=" + DbController.encodeSQLText(SourceName) + ")")) { using (var CSTarget = new CsModel(core)) { if (CSTarget.insert("Content Fields")) { CSSource.copyRecord(CSTarget); CSTarget.set("ContentID", adminContent.id); reloadMetadata = true; } } } } } } // // get current values for Processing // foreach (var column in IndexConfig.columns) { ColumnWidthTotal += column.Width; } // // ----- Perform any actions first // switch (ToolsAction) { case ToolsActionAddField: { // // Add a field to the index form // if (FieldIDToAdd != 0) { IndexConfigColumnClass column = null; foreach (var columnx in IndexConfig.columns) { columnx.Width = encodeInteger((columnx.Width * 80) / (double)ColumnWidthTotal); } { column = new IndexConfigColumnClass(); using (var csData = new CsModel(core)) { if (csData.openRecord("Content Fields", FieldIDToAdd)) { column.Name = csData.getText("name"); column.Width = 20; } } IndexConfig.columns.Add(column); normalizeSaveLoad = true; } } // break; } case ToolsActionRemoveField: { // // Remove a field to the index form int columnWidthTotal = 0; var dstColumns = new List <IndexConfigColumnClass>(); foreach (var column in IndexConfig.columns) { if (column.Name != TargetFieldName.ToLowerInvariant()) { dstColumns.Add(column); columnWidthTotal += column.Width; } } IndexConfig.columns = dstColumns; normalizeSaveLoad = true; break; } case ToolsActionMoveFieldLeft: { if (IndexConfig.columns.First().Name != TargetFieldName.ToLowerInvariant()) { int listIndex = 0; foreach (var column in IndexConfig.columns) { if (column.Name == TargetFieldName.ToLowerInvariant()) { break; } listIndex += 1; } IndexConfig.columns.swap(listIndex, listIndex - 1); normalizeSaveLoad = true; } break; } case ToolsActionMoveFieldRight: { if (IndexConfig.columns.Last().Name != TargetFieldName.ToLowerInvariant()) { int listIndex = 0; foreach (var column in IndexConfig.columns) { if (column.Name == TargetFieldName.ToLowerInvariant()) { break; } listIndex += 1; } IndexConfig.columns.swap(listIndex, listIndex + 1); normalizeSaveLoad = true; } break; } case ToolsActionExpand: { foreach (var column in IndexConfig.columns) { if (column.Name == TargetFieldName.ToLowerInvariant()) { column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 1.1); } else { column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 0.9); } } normalizeSaveLoad = true; break; } case ToolsActionContract: { foreach (var column in IndexConfig.columns) { if (column.Name != TargetFieldName.ToLowerInvariant()) { column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 1.1); } else { column.Width = Convert.ToInt32(Convert.ToDouble(column.Width) * 0.9); } } normalizeSaveLoad = true; break; } } // // Reload CDef if it changed // if (reloadMetadata) { core.clearMetaData(); core.cache.invalidateAll(); CDef = ContentMetadataModel.createByUniqueName(core, adminContent.name); } // // save indexconfig // if (normalizeSaveLoad) { // // Normalize the widths of the remaining columns ColumnWidthTotal = 0; foreach (var column in IndexConfig.columns) { ColumnWidthTotal += column.Width; } foreach (var column in IndexConfig.columns) { column.Width = encodeInteger((1000 * column.Width) / (double)ColumnWidthTotal); } GetHtmlBodyClass.setIndexSQL_SaveIndexConfig(cp, core, IndexConfig); IndexConfig = IndexConfigClass.get(core, adminData); } } // //-------------------------------------------------------------------------------- // Display the form //-------------------------------------------------------------------------------- // Stream.add("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\"><tr>"); Stream.add("<td width=\"5%\"> </td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>10%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>20%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>30%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>40%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>50%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>60%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>70%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>80%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>90%</nobr></td>"); Stream.add("<td width=\"9%\" align=\"center\" class=\"ccAdminSmall\"><nobr>100%</nobr></td>"); Stream.add("<td width=\"4%\" align=\"center\"> </td>"); Stream.add("</tr></table>"); // Stream.add("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"99%\"><tr>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("<td width=\"9%\"><nobr><img src=\"" + cdnPrefix + "images/black.gif\" width=\"1\" height=\"10\" ><img alt=\"space\" src=\"" + cdnPrefix + "images/spacer.gif\" width=\"100%\" height=\"10\" ></nobr></td>"); Stream.add("</tr></table>"); // // print the column headers // ColumnWidthTotal = 0; int InheritedFieldCount = 0; if (IndexConfig.columns.Count > 0) { // // Calc total width // foreach (var column in IndexConfig.columns) { ColumnWidthTotal += column.Width; } if (ColumnWidthTotal > 0) { Stream.add("<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"90%\">"); // // -- header Stream.add("<tr>"); int ColumnWidth = 0; int fieldId = 0; string Caption = null; foreach (var column in IndexConfig.columns) { // // print column headers - anchored so they sort columns // ColumnWidth = encodeInteger(100 * (column.Width / (double)ColumnWidthTotal)); ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()]; fieldId = field.id; Caption = field.caption; if (field.inherited) { Caption = Caption + "*"; InheritedFieldCount = InheritedFieldCount + 1; } Stream.add("<td class=\"small\" width=\"" + ColumnWidth + "%\" valign=\"top\" align=\"left\" style=\"background-color:white;border: 1px solid #555;\">" + Caption + "</td>"); } Stream.add("</tr>"); // // -- body Stream.add("<tr>"); foreach (var column in IndexConfig.columns) { // // print column headers - anchored so they sort columns // ColumnWidth = encodeInteger(100 * (column.Width / (double)ColumnWidthTotal)); ContentFieldMetadataModel field = adminContent.fields[column.Name.ToLowerInvariant()]; fieldId = field.id; Caption = field.caption; if (field.inherited) { Caption = Caption + "*"; InheritedFieldCount = InheritedFieldCount + 1; } int ColumnPtr = 0; string link = "?" + core.doc.refreshQueryString + "&FieldName=" + HtmlController.encodeHtml(field.nameLc) + "&fi=" + fieldId + "&dtcn=" + ColumnPtr + "&" + RequestNameAdminSubForm + "=" + AdminFormIndex_SubFormSetColumns; Stream.add("<td width=\"" + ColumnWidth + "%\" valign=\"top\" align=\"left\">"); Stream.add(HtmlController.div(AdminUIController.getDeleteLink(link + "&dta=" + ToolsActionRemoveField), "text-center")); Stream.add(HtmlController.div(AdminUIController.getArrowRightLink(link + "&dta=" + ToolsActionMoveFieldRight), "text-center")); Stream.add(HtmlController.div(AdminUIController.getArrowLeftLink(link + "&dta=" + ToolsActionMoveFieldLeft), "text-center")); Stream.add(HtmlController.div(AdminUIController.getExpandLink(link + "&dta=" + ToolsActionExpand), "text-center")); Stream.add(HtmlController.div(AdminUIController.getContractLink(link + "&dta=" + ToolsActionContract), "text-center")); Stream.add("</td>"); } Stream.add("</tr>"); Stream.add("</table>"); } } // // ----- If anything was inherited, put up the message // if (InheritedFieldCount > 0) { Stream.add("<p class=\"ccNormal\">* This field was inherited from the Content Definition's Parent. Inherited fields will automatically change when the field in the parent is changed. If you alter these settings, this connection will be broken, and the field will no longer inherit it's properties.</P class=\"ccNormal\">"); } // // ----- now output a list of fields to add // if (CDef.fields.Count == 0) { Stream.add(SpanClassAdminNormal + "This Content Definition has no fields</span><br>"); } else { foreach (KeyValuePair <string, ContentFieldMetadataModel> keyValuePair in adminContent.fields) { ContentFieldMetadataModel field = keyValuePair.Value; // // display the column if it is not in use if ((IndexConfig.columns.Find(x => x.Name == field.nameLc) == null)) { if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.File) { // // file can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileText) { // // filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (text file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileHTML) { // // filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (html file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileHTMLCode) { // // filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (html code file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileCSS) { // // css filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (css file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileXML) { // // xml filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (xml file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileJavascript) { // // javascript filename can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (javascript file field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.LongText) { // // can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (long text field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.HTML) { // // can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (html field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.FileImage) { // // can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (image field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.Redirect) { // // can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (redirect field)")); } else if (field.fieldTypeId == CPContentBaseClass.FieldTypeIdEnum.ManyToMany) { // // many to many can not be search Stream.add(HtmlController.div(iconNotAvailable + " " + field.caption + " (many-to-many field)")); } else { // // can be used as column header string link = "?" + core.doc.refreshQueryString + "&fi=" + field.id + "&dta=" + ToolsActionAddField + "&" + RequestNameAddFieldId + "=" + field.id + "&" + RequestNameAdminSubForm + "=" + AdminFormIndex_SubFormSetColumns; Stream.add(HtmlController.div(AdminUIController.getPlusLink(link, " " + field.caption))); } } } } } // //-------------------------------------------------------------------------------- // print the content tables that have index forms to Configure //-------------------------------------------------------------------------------- // core.siteProperties.setProperty("AllowContentAutoLoad", GenericController.encodeText(AllowContentAutoLoad)); string Content = "" + Stream.text + HtmlController.inputHidden("cid", adminContent.id.ToString()) + HtmlController.inputHidden(rnAdminForm, "1") + HtmlController.inputHidden(RequestNameAdminSubForm, AdminFormIndex_SubFormSetColumns) + ""; // // -- assemble form result = AdminUIController.getToolForm(core, Content, ButtonOK + "," + ButtonReset); core.html.addTitle(Title); } catch (Exception ex) { LogController.logError(core, ex); } return(result); }