// //==================================================================================================== // public static string getActiveEditor(CoreController core, string ContentName, int RecordID, string FieldName, string FormElements = "") { // int ContentID = 0; string Copy = null; string Stream = ""; string ButtonPanel = null; string EditorPanel = null; string PanelCopy = null; string intContentName = null; int intRecordId = 0; string strFieldName = null; // intContentName = GenericController.encodeText(ContentName); intRecordId = GenericController.encodeInteger(RecordID); strFieldName = GenericController.encodeText(FieldName); // EditorPanel = ""; ContentID = Models.Domain.ContentMetadataModel.getContentId(core, intContentName); if ((ContentID < 1) || (intRecordId < 1) || (string.IsNullOrEmpty(strFieldName))) { PanelCopy = SpanClassAdminNormal + "The information you have selected can not be accessed.</span>"; EditorPanel = EditorPanel + core.html.getPanel(PanelCopy); } else { intContentName = MetadataController.getContentNameByID(core, ContentID); if (!string.IsNullOrEmpty(intContentName)) { using (var csData = new CsModel(core)) { csData.open(intContentName, "ID=" + intRecordId); if (!csData.ok()) { PanelCopy = SpanClassAdminNormal + "The information you have selected can not be accessed.</span>"; EditorPanel = EditorPanel + core.html.getPanel(PanelCopy); } else { Copy = csData.getText(strFieldName); EditorPanel = EditorPanel + HtmlController.inputHidden("Type", FormTypeActiveEditor); EditorPanel = EditorPanel + HtmlController.inputHidden("cid", ContentID); EditorPanel = EditorPanel + HtmlController.inputHidden("ID", intRecordId); EditorPanel = EditorPanel + HtmlController.inputHidden("fn", strFieldName); EditorPanel = EditorPanel + GenericController.encodeText(FormElements); EditorPanel = EditorPanel + core.html.getFormInputHTML("ContentCopy", Copy, "3", "45", false, true); ButtonPanel = core.html.getPanelButtons(ButtonCancel + "," + ButtonSave); EditorPanel = EditorPanel + ButtonPanel; } csData.close(); } } } Stream = Stream + core.html.getPanelHeader("Contensive Active Content Editor"); Stream = Stream + core.html.getPanel(EditorPanel); Stream = HtmlController.form(core, Stream); return(Stream); }
// //==================================================================================================== /// <summary> /// Process the active editor form /// </summary> /// <param name="core"></param> public static void processActiveEditor(CoreController core) { // string Button = null; int ContentID = 0; string ContentName = null; int RecordID = 0; string FieldName = null; string ContentCopy = null; // Button = core.docProperties.getText("Button"); switch (Button) { case ButtonCancel: // // ----- Do nothing, the form will reload with the previous contents // break; case ButtonSave: // // ----- read the form fields // ContentID = core.docProperties.getInteger("cid"); RecordID = core.docProperties.getInteger("id"); FieldName = core.docProperties.getText("fn"); ContentCopy = core.docProperties.getText("ContentCopy"); // // ----- convert editor active edit icons // ContentCopy = ActiveContentController.processWysiwygResponseForSave(core, ContentCopy); // // ----- save the content // ContentName = MetadataController.getContentNameByID(core, ContentID); if (!string.IsNullOrEmpty(ContentName)) { using (var csData = new CsModel(core)) { csData.open(ContentName, "ID=" + DbController.encodeSQLNumber(RecordID), "", false); if (csData.ok()) { csData.set(FieldName, ContentCopy); } csData.close(); } } break; } }