// // ==================================================================================================== public static string get(CPBaseClass cp, PageTemplateModel template) { try { string addonList = ""; foreach (var rule in DbBaseModel.createList <AddonTemplateRuleModel>(cp, "(templateId=" + template.id + ")")) { AddonModel addon = DbBaseModel.create <AddonModel>(cp, rule.addonId); if (addon != null) { addonList += System.Environment.NewLine + "\t\t" + "<IncludeAddon name=\"" + addon.name + "\" guid=\"" + addon.ccguid + "\" />"; } } return("" + System.Environment.NewLine + "\t" + "<Template" + " name=\"" + System.Net.WebUtility.HtmlEncode(template.name) + "\"" + " guid=\"" + template.ccguid + "\"" + " issecure=\"" + GenericController.getYesNo(template.isSecure) + "\"" + " >" + addonList + System.Environment.NewLine + "\t\t" + "<BodyHtml>" + ExportController.tabIndent(cp, ExportController.EncodeCData(template.bodyHTML)) + "</BodyHtml>" + System.Environment.NewLine + "\t" + "</Template>"); } catch (Exception ex) { cp.Site.ErrorReport(ex, "GetAddonNode"); return(string.Empty); } }
// // ==================================================================================================== // public static string getResourceNodeList(CPBaseClass cp, string execFileList, string CollectionGuid, List <string> tempPathFileList, string tempExportPath) { try { string nodeList = ""; if (!execFileList.Length.Equals(0)) { DateTime LastChangeDate = default; // // There are executable files to include in the collection // If installed, source path is collectionpath, if not installed, collectionpath will be empty // and file will be sourced right from addon path // string CollectionPath = ""; ExportController.GetLocalCollectionArgs(cp, CollectionGuid, ref CollectionPath, ref LastChangeDate); if (!CollectionPath.Length.Equals(0)) { CollectionPath += @"\"; } string[] Files = Strings.Split(execFileList, System.Environment.NewLine); for (int Ptr = 0; Ptr <= Information.UBound(Files); Ptr++) { string PathFilename = Files[Ptr]; if (!PathFilename.Length.Equals(0)) { PathFilename = Strings.Replace(PathFilename, @"\", "/"); string Path = ""; string Filename = PathFilename; int Pos = Strings.InStrRev(PathFilename, "/"); if (Pos > 0) { Filename = Strings.Mid(PathFilename, Pos + 1); Path = Strings.Mid(PathFilename, 1, Pos - 1); } string ManualFilename = ""; if (Strings.LCase(Filename) != Strings.LCase(ManualFilename)) { string AddonPath = @"addons\"; // AddFilename = AddonPath & CollectionPath & Filename cp.PrivateFiles.Copy(AddonPath + CollectionPath + Filename, tempExportPath + Filename, cp.TempFiles); if (!tempPathFileList.Contains(tempExportPath + Filename)) { tempPathFileList.Add(tempExportPath + Filename); nodeList = nodeList + System.Environment.NewLine + "\t" + "<Resource name=\"" + System.Net.WebUtility.HtmlEncode(Filename) + "\" type=\"executable\" path=\"" + System.Net.WebUtility.HtmlEncode(Path) + "\" />"; } } } } } return(nodeList); } catch (Exception ex) { cp.Site.ErrorReport(ex); return(string.Empty); } }
// // ==================================================================================================== public static string get(CPBaseClass cp, LayoutModel layout) { try { return("" + System.Environment.NewLine + "\t" + "<Layout" + " name=\"" + System.Net.WebUtility.HtmlEncode(layout.name) + "\"" + " guid=\"" + layout.ccguid + "\"" + " >" + ExportController.tabIndent(cp, ExportController.EncodeCData(layout.layout.content)) + System.Environment.NewLine + "\t" + "</Layout>"); } catch (Exception ex) { cp.Site.ErrorReport(ex, "GetAddonNode"); return(string.Empty); } }
// // ==================================================================================================== // public static string getResourceNodeList(CPBaseClass cp, List <string> execFileList, string CollectionGuid, List <string> tempPathFileList, string tempExportPath) { try { string nodeList = ""; foreach (var PathFilename in execFileList) { if (!PathFilename.Length.Equals(0)) { string fixedPathFilename = Strings.Replace(PathFilename, @"\", "/"); string path = ""; string filename = fixedPathFilename; int pos = Strings.InStrRev(fixedPathFilename, "/"); if (pos > 0) { filename = Strings.Mid(fixedPathFilename, pos + 1); path = Strings.Mid(fixedPathFilename, 1, pos - 1); } string CollectionPath = ""; DateTime LastChangeDate = default; ExportController.GetLocalCollectionArgs(cp, CollectionGuid, ref CollectionPath, ref LastChangeDate); if (!CollectionPath.Length.Equals(0)) { CollectionPath += @"\"; } string AddonPath = @"addons\"; // AddFilename = AddonPath & CollectionPath & Filename cp.PrivateFiles.Copy(AddonPath + CollectionPath + filename, tempExportPath + filename, cp.TempFiles); if (!tempPathFileList.Contains(tempExportPath + filename)) { tempPathFileList.Add(tempExportPath + filename); nodeList = nodeList + System.Environment.NewLine + "\t" + "<Resource name=\"" + System.Net.WebUtility.HtmlEncode(filename) + "\" type=\"executable\" path=\"" + System.Net.WebUtility.HtmlEncode(path) + "\" />"; } } } return(nodeList); } catch (Exception ex) { cp.Site.ErrorReport(ex); return(string.Empty); } }
// // ==================================================================================================== public static string getAddonNode(CPBaseClass cp, int addonid, ref string Return_IncludeModuleGuidList, ref string Return_IncludeSharedStyleGuidList) { string result = ""; try { using (CPCSBaseClass CS = cp.CSNew()) { if (CS.OpenRecord("Add-ons", addonid)) { string addonName = CS.GetText("name"); bool processRunOnce = CS.GetBoolean("ProcessRunOnce"); if (((Strings.LCase(addonName) == "oninstall") | (Strings.LCase(addonName) == "_oninstall"))) { processRunOnce = true; } // // content result += ExportController.getNode("Copy", CS.GetText("Copy")); result += ExportController.getNode("CopyText", CS.GetText("CopyText")); // // DLL result += ExportController.getNode("ActiveXProgramID", CS.GetText("objectprogramid"), true); result += ExportController.getNode("DotNetClass", CS.GetText("DotNetClass")); // // Features result += ExportController.getNode("ArgumentList", CS.GetText("ArgumentList")); result += ExportController.getNodeLookupContentName(cp, "instanceSettingPrimaryContentId", CS.GetInteger("instanceSettingPrimaryContentId"), "content"); result += ExportController.getNode("AsAjax", CS.GetBoolean("AsAjax")); result += ExportController.getNode("Filter", CS.GetBoolean("Filter")); result += ExportController.getNode("Help", CS.GetText("Help")); result += ExportController.getNode("HelpLink", CS.GetText("HelpLink")); result += System.Environment.NewLine + "\t" + "<Icon Link=\"" + CS.GetText("iconfilename") + "\" width=\"" + CS.GetInteger("iconWidth") + "\" height=\"" + CS.GetInteger("iconHeight") + "\" sprites=\"" + CS.GetInteger("iconSprites") + "\" />"; result += ExportController.getNode("InIframe", CS.GetBoolean("InFrame")); result += ExportController.getNode("BlockEditTools", CS.GetBoolean("BlockEditTools")); result += ExportController.getNode("AliasList", CS.GetText("aliasList")); // // -- Form XML result += ExportController.getNode("FormXML", CS.GetText("FormXML")); // // -- addon dependencies using (CPCSBaseClass CS2 = cp.CSNew()) { CS2.Open("Add-on Include Rules", "addonid=" + addonid); while (CS2.OK()) { int IncludedAddonID = CS2.GetInteger("IncludedAddonID"); using (CPCSBaseClass CS3 = cp.CSNew()) { CS3.Open("Add-ons", "ID=" + IncludedAddonID); if (CS3.OK()) { string Guid = CS3.GetText("ccGuid"); if (Guid == "") { Guid = cp.Utils.CreateGuid(); CS3.SetField("ccGuid", Guid); } result += System.Environment.NewLine + "\t" + "<IncludeAddon name=\"" + System.Net.WebUtility.HtmlEncode(CS3.GetText("name")) + "\" guid=\"" + Guid + "\"/>"; } CS3.Close(); } CS2.GoNext(); } CS2.Close(); } // // -- is inline/block result += ExportController.getNode("IsInline", CS.GetBoolean("IsInline")); // // -- javascript (xmlnode may not match Db filename) result += ExportController.getNode("JavascriptInHead", CS.GetText("JSFilename")); result += ExportController.getNode("javascriptForceHead", CS.GetBoolean("javascriptForceHead")); result += ExportController.getNode("JSHeadScriptSrc", CS.GetText("JSHeadScriptSrc")); // // -- javascript deprecated result += ExportController.getNode("JSBodyScriptSrc", CS.GetText("JSBodyScriptSrc"), true); result += ExportController.getNode("JavascriptBodyEnd", CS.GetText("JavascriptBodyEnd"), true); result += ExportController.getNode("JavascriptOnLoad", CS.GetText("JavascriptOnLoad"), true); // // -- Placements result += ExportController.getNode("Content", CS.GetBoolean("Content")); result += ExportController.getNode("Template", CS.GetBoolean("Template")); result += ExportController.getNode("Email", CS.GetBoolean("Email")); result += ExportController.getNode("Admin", CS.GetBoolean("Admin")); result += ExportController.getNode("OnPageEndEvent", CS.GetBoolean("OnPageEndEvent")); result += ExportController.getNode("OnPageStartEvent", CS.GetBoolean("OnPageStartEvent")); result += ExportController.getNode("OnBodyStart", CS.GetBoolean("OnBodyStart")); result += ExportController.getNode("OnBodyEnd", CS.GetBoolean("OnBodyEnd")); result += ExportController.getNode("RemoteMethod", CS.GetBoolean("RemoteMethod")); result += CS.FieldOK("Diagnostic") ? ExportController.getNode("Diagnostic", CS.GetBoolean("Diagnostic")) : ""; // // -- Presentation result += ExportController.getNode("category", CS.GetText("addoncategoryid")); // // -- Process result += ExportController.getNode("ProcessRunOnce", processRunOnce); result += ExportController.getNode("ProcessInterval", CS.GetInteger("ProcessInterval")); // // Meta // result += ExportController.getNode("MetaDescription", CS.GetText("MetaDescription")); result += ExportController.getNode("OtherHeadTags", CS.GetText("OtherHeadTags")); result += ExportController.getNode("PageTitle", CS.GetText("PageTitle")); result += ExportController.getNode("RemoteAssetLink", CS.GetText("RemoteAssetLink")); // // Styles string Styles = ""; if (!CS.GetBoolean("BlockDefaultStyles")) { Styles = CS.GetText("StylesFilename").Trim(); } string StylesTest = CS.GetText("CustomStylesFilename").Trim(); if (StylesTest != "") { if (Styles != "") { Styles = Styles + System.Environment.NewLine + StylesTest; } else { Styles = StylesTest; } } result += ExportController.getNode("Styles", Styles); result += ExportController.getNode("styleslinkhref", CS.GetText("styleslinkhref")); // // // Scripting // string NodeInnerText = CS.GetText("ScriptingCode").Trim(); if (NodeInnerText != "") { NodeInnerText = System.Environment.NewLine + "\t" + "\t" + "<Code>" + ExportController.EncodeCData(NodeInnerText) + "</Code>"; } using (CPCSBaseClass CS2 = cp.CSNew()) { CS2.Open("Add-on Scripting Module Rules", "addonid=" + addonid); while (CS2.OK()) { int ScriptingModuleID = CS2.GetInteger("ScriptingModuleID"); using (CPCSBaseClass CS3 = cp.CSNew()) { CS3.Open("Scripting Modules", "ID=" + ScriptingModuleID); if (CS3.OK()) { string Guid = CS3.GetText("ccGuid"); if (Guid == "") { Guid = cp.Utils.CreateGuid(); CS3.SetField("ccGuid", Guid); } Return_IncludeModuleGuidList = Return_IncludeModuleGuidList + System.Environment.NewLine + Guid; NodeInnerText = NodeInnerText + System.Environment.NewLine + "\t" + "\t" + "<IncludeModule name=\"" + System.Net.WebUtility.HtmlEncode(CS3.GetText("name")) + "\" guid=\"" + Guid + "\"/>"; } CS3.Close(); } CS2.GoNext(); } CS2.Close(); } if (NodeInnerText == "") { result += System.Environment.NewLine + "\t" + "<Scripting Language=\"" + CS.GetText("ScriptingLanguageID") + "\" EntryPoint=\"" + CS.GetText("ScriptingEntryPoint") + "\" Timeout=\"" + CS.GetText("ScriptingTimeout") + "\"/>"; } else { result += System.Environment.NewLine + "\t" + "<Scripting Language=\"" + CS.GetText("ScriptingLanguageID") + "\" EntryPoint=\"" + CS.GetText("ScriptingEntryPoint") + "\" Timeout=\"" + CS.GetText("ScriptingTimeout") + "\">" + NodeInnerText + System.Environment.NewLine + "\t" + "</Scripting>"; } // // Shared Styles // using (CPCSBaseClass CS2 = cp.CSNew()) { CS2.Open("Shared Styles Add-on Rules", "addonid=" + addonid); while (CS2.OK()) { int styleId = CS2.GetInteger("styleId"); using (CPCSBaseClass CS3 = cp.CSNew()) { CS3.Open("shared styles", "ID=" + styleId); if (CS3.OK()) { string Guid = CS3.GetText("ccGuid"); if (Guid == "") { Guid = cp.Utils.CreateGuid(); CS3.SetField("ccGuid", Guid); } Return_IncludeSharedStyleGuidList = Return_IncludeSharedStyleGuidList + System.Environment.NewLine + Guid; result += System.Environment.NewLine + "\t" + "<IncludeSharedStyle name=\"" + System.Net.WebUtility.HtmlEncode(CS3.GetText("name")) + "\" guid=\"" + Guid + "\"/>"; } CS3.Close(); } CS2.GoNext(); } CS2.Close(); } // // Process Triggers // NodeInnerText = ""; using (CPCSBaseClass CS2 = cp.CSNew()) { CS2.Open("Add-on Content Trigger Rules", "addonid=" + addonid); while (CS2.OK()) { int TriggerContentID = CS2.GetInteger("ContentID"); using (CPCSBaseClass CS3 = cp.CSNew()) { CS3.Open("content", "ID=" + TriggerContentID); if (CS3.OK()) { string Guid = CS3.GetText("ccGuid"); if (Guid == "") { Guid = cp.Utils.CreateGuid(); CS3.SetField("ccGuid", Guid); } NodeInnerText = NodeInnerText + System.Environment.NewLine + "\t" + "\t" + "<ContentChange name=\"" + System.Net.WebUtility.HtmlEncode(CS3.GetText("name")) + "\" guid=\"" + Guid + "\"/>"; } CS3.Close(); } CS2.GoNext(); } CS2.Close(); } if (NodeInnerText != "") { result += System.Environment.NewLine + "\t" + "<ProcessTriggers>" + NodeInnerText + System.Environment.NewLine + "\t" + "</ProcessTriggers>"; } // // Editors // if (cp.Content.IsField("Add-on Content Field Type Rules", "id")) { NodeInnerText = ""; using (CPCSBaseClass CS2 = cp.CSNew()) { CS2.Open("Add-on Content Field Type Rules", "addonid=" + addonid); while (CS2.OK()) { int fieldTypeID = CS2.GetInteger("contentFieldTypeID"); string fieldType = cp.Content.GetRecordName("Content Field Types", fieldTypeID); if (fieldType != "") { NodeInnerText = NodeInnerText + System.Environment.NewLine + "\t" + "\t" + "<type>" + fieldType + "</type>"; } CS2.GoNext(); } CS2.Close(); } if (NodeInnerText != "") { result += System.Environment.NewLine + "\t" + "<Editors>" + NodeInnerText + System.Environment.NewLine + "\t" + "</Editors>"; } } // string addonGuid = CS.GetText("ccGuid"); if ((string.IsNullOrWhiteSpace(addonGuid))) { addonGuid = cp.Utils.CreateGuid(); CS.SetField("ccGuid", addonGuid); } string NavType = CS.GetText("NavTypeID"); if ((NavType == "")) { NavType = "Add-on"; } result = "" + System.Environment.NewLine + "\t" + "<Addon name=\"" + System.Net.WebUtility.HtmlEncode(addonName) + "\" guid=\"" + addonGuid + "\" type=\"" + NavType + "\">" + ExportController.tabIndent(cp, result) + System.Environment.NewLine + "\t" + "</Addon>"; } CS.Close(); } } catch (Exception ex) { cp.Site.ErrorReport(ex, "GetAddonNode"); } return(result); }
// // ==================================================================================================== // public static string getNodeList(CPBaseClass cp, string DataRecordList, List <string> tempPathFileList, string tempExportPath) { try { string result = ""; if (DataRecordList != "") { result += System.Environment.NewLine + "\t" + "<DataRecordList>" + ExportController.EncodeCData(DataRecordList) + "</DataRecordList>"; string[] DataRecords = Strings.Split(DataRecordList, System.Environment.NewLine); string RecordNodes = ""; for (var Ptr = 0; Ptr <= Information.UBound(DataRecords); Ptr++) { string FieldNodes = ""; string DataRecordName = ""; string DataRecordGuid = ""; string DataRecord = DataRecords[Ptr]; if (DataRecord != "") { string[] DataSplit = Strings.Split(DataRecord, ","); if (Information.UBound(DataSplit) >= 0) { string DataContentName = Strings.Trim(DataSplit[0]); int DataContentId = cp.Content.GetID(DataContentName); if (DataContentId <= 0) { RecordNodes = "" + RecordNodes + System.Environment.NewLine + "\t" + "<!-- data missing, content not found during export, content=\"" + DataContentName + "\" guid=\"" + DataRecordGuid + "\" name=\"" + DataRecordName + "\" -->"; } else { bool supportsGuid = cp.Content.IsField(DataContentName, "ccguid"); string Criteria; if (Information.UBound(DataSplit) == 0) { Criteria = ""; } else { string TestString = Strings.Trim(DataSplit[1]); if (TestString == "") { // // blank is a select all // Criteria = ""; DataRecordName = ""; DataRecordGuid = ""; } else if (!supportsGuid) { // // if no guid, this is name // DataRecordName = TestString; DataRecordGuid = ""; Criteria = "name=" + cp.Db.EncodeSQLText(DataRecordName); } else if ((Strings.Len(TestString) == 38) & (Strings.Left(TestString, 1) == "{") & (Strings.Right(TestString, 1) == "}")) { // // guid {726ED098-5A9E-49A9-8840-767A74F41D01} format // DataRecordGuid = TestString; DataRecordName = ""; Criteria = "ccguid=" + cp.Db.EncodeSQLText(DataRecordGuid); } else if ((Strings.Len(TestString) == 36) & (Strings.Mid(TestString, 9, 1) == "-")) { // // guid 726ED098-5A9E-49A9-8840-767A74F41D01 format // DataRecordGuid = TestString; DataRecordName = ""; Criteria = "ccguid=" + cp.Db.EncodeSQLText(DataRecordGuid); } else if ((Strings.Len(TestString) == 32) & (Strings.InStr(1, TestString, " ") == 0)) { // // guid 726ED0985A9E49A98840767A74F41D01 format // DataRecordGuid = TestString; DataRecordName = ""; Criteria = "ccguid=" + cp.Db.EncodeSQLText(DataRecordGuid); } else { // // use name // DataRecordName = TestString; DataRecordGuid = ""; Criteria = "name=" + cp.Db.EncodeSQLText(DataRecordName); } } using (CPCSBaseClass CSData = cp.CSNew()) { if (!CSData.Open(DataContentName, Criteria, "id")) { RecordNodes = "" + RecordNodes + System.Environment.NewLine + "\t" + "<!-- data missing, record not found during export, content=\"" + DataContentName + "\" guid=\"" + DataRecordGuid + "\" name=\"" + DataRecordName + "\" -->"; } else { // // determine all valid fields // int fieldCnt = 0; string Sql = "select * from ccFields where contentid=" + DataContentId; string fieldLookupListValue = ""; string[] fieldNames = Array.Empty <string>(); int[] fieldTypes = Array.Empty <int>(); string[] fieldLookupContent = Array.Empty <string>(); string[] fieldLookupList = Array.Empty <string>(); string FieldLookupContentName; int FieldTypeNumber; string FieldName; using (CPCSBaseClass csFields = cp.CSNew()) { if (csFields.Open("content fields", "contentid=" + DataContentId)) { do { FieldName = csFields.GetText("name"); if (FieldName != "") { int FieldLookupContentID = 0; FieldLookupContentName = ""; FieldTypeNumber = csFields.GetInteger("type"); switch (Strings.LCase(FieldName)) { case "ccguid": case "name": case "id": case "dateadded": case "createdby": case "modifiedby": case "modifieddate": case "createkey": case "contentcontrolid": case "editsourceid": case "editarchive": case "editblank": case "contentcategoryid": { break; } default: { if (FieldTypeNumber == 7) { FieldLookupContentID = csFields.GetInteger("Lookupcontentid"); fieldLookupListValue = csFields.GetText("LookupList"); if (FieldLookupContentID != 0) { FieldLookupContentName = cp.Content.GetRecordName("content", FieldLookupContentID); } } //CPContentBaseClass.FieldTypeIdEnum.File switch (FieldTypeNumber) { case (int)CPContentBaseClass.FieldTypeIdEnum.File: case (int)CPContentBaseClass.FieldTypeIdEnum.FileImage: case (int)CPContentBaseClass.FieldTypeIdEnum.Lookup: case (int)CPContentBaseClass.FieldTypeIdEnum.Boolean: case (int)CPContentBaseClass.FieldTypeIdEnum.FileCSS: case (int)CPContentBaseClass.FieldTypeIdEnum.FileJavascript: case (int)CPContentBaseClass.FieldTypeIdEnum.FileText: case (int)CPContentBaseClass.FieldTypeIdEnum.FileXML: case (int)CPContentBaseClass.FieldTypeIdEnum.Currency: case (int)CPContentBaseClass.FieldTypeIdEnum.Float: case (int)CPContentBaseClass.FieldTypeIdEnum.Integer: case (int)CPContentBaseClass.FieldTypeIdEnum.Date: case (int)CPContentBaseClass.FieldTypeIdEnum.Link: case (int)CPContentBaseClass.FieldTypeIdEnum.LongText: case (int)CPContentBaseClass.FieldTypeIdEnum.ResourceLink: case (int)CPContentBaseClass.FieldTypeIdEnum.Text: case (int)CPContentBaseClass.FieldTypeIdEnum.HTML: case (int)CPContentBaseClass.FieldTypeIdEnum.FileHTML: { var oldFieldNames = fieldNames; fieldNames = new string[fieldCnt + 1]; // // this is a keeper // if (oldFieldNames != null) { Array.Copy(oldFieldNames, fieldNames, Math.Min(fieldCnt + 1, oldFieldNames.Length)); } var oldFieldTypes = fieldTypes; fieldTypes = new int[fieldCnt + 1]; if (oldFieldTypes != null) { Array.Copy(oldFieldTypes, fieldTypes, Math.Min(fieldCnt + 1, oldFieldTypes.Length)); } var oldFieldLookupContent = fieldLookupContent; fieldLookupContent = new string[fieldCnt + 1]; if (oldFieldLookupContent != null) { Array.Copy(oldFieldLookupContent, fieldLookupContent, Math.Min(fieldCnt + 1, oldFieldLookupContent.Length)); } var oldFieldLookupList = fieldLookupList; fieldLookupList = new string[fieldCnt + 1]; if (oldFieldLookupList != null) { Array.Copy(oldFieldLookupList, fieldLookupList, Math.Min(fieldCnt + 1, oldFieldLookupList.Length)); } // fieldLookupContent fieldNames[fieldCnt] = FieldName; fieldTypes[fieldCnt] = FieldTypeNumber; fieldLookupContent[fieldCnt] = FieldLookupContentName; fieldLookupList[fieldCnt] = fieldLookupListValue; fieldCnt = fieldCnt + 1; break; } } break; } } } csFields.GoNext(); }while (csFields.OK()); } csFields.Close(); } // // output records // DataRecordGuid = ""; while (CSData.OK()) { FieldNodes = ""; DataRecordName = CSData.GetText("name"); if (supportsGuid) { DataRecordGuid = CSData.GetText("ccguid"); if (DataRecordGuid == "") { DataRecordGuid = cp.Utils.CreateGuid(); CSData.SetField("ccGuid", DataRecordGuid); } } int fieldPtr; for (fieldPtr = 0; fieldPtr <= fieldCnt - 1; fieldPtr++) { FieldName = fieldNames[fieldPtr]; FieldTypeNumber = cp.Utils.EncodeInteger(fieldTypes[fieldPtr]); // Dim ContentID As Integer string FieldValue; switch (FieldTypeNumber) { case (int)CPContentBaseClass.FieldTypeIdEnum.File: case (int)CPContentBaseClass.FieldTypeIdEnum.FileImage: { // // files -- copy pathFilename to tmp folder and save pathFilename to fieldValue FieldValue = CSData.GetText(FieldName).ToString(); if ((!string.IsNullOrWhiteSpace(FieldValue))) { string pathFilename = FieldValue; cp.CdnFiles.Copy(pathFilename, tempExportPath + pathFilename, cp.TempFiles); if (!tempPathFileList.Contains(tempExportPath + pathFilename)) { tempPathFileList.Add(tempExportPath + pathFilename); string path = FileController.getPath(pathFilename); string filename = FileController.getFilename(pathFilename); result += System.Environment.NewLine + "\t" + "<Resource name=\"" + System.Net.WebUtility.HtmlEncode(filename) + "\" type=\"content\" path=\"" + System.Net.WebUtility.HtmlEncode(path) + "\" />"; } } break; } case (int)CPContentBaseClass.FieldTypeIdEnum.Boolean: { // // true/false // FieldValue = CSData.GetBoolean(FieldName).ToString(); break; } case (int)CPContentBaseClass.FieldTypeIdEnum.FileCSS: case (int)CPContentBaseClass.FieldTypeIdEnum.FileJavascript: case (int)CPContentBaseClass.FieldTypeIdEnum.FileText: case (int)CPContentBaseClass.FieldTypeIdEnum.FileXML: { // // text files // FieldValue = CSData.GetText(FieldName); FieldValue = ExportController.EncodeCData(FieldValue); break; } case (int)CPContentBaseClass.FieldTypeIdEnum.Integer: { // // integer // FieldValue = CSData.GetInteger(FieldName).ToString(); break; } case (int)CPContentBaseClass.FieldTypeIdEnum.Currency: case (int)CPContentBaseClass.FieldTypeIdEnum.Float: { // // numbers // FieldValue = CSData.GetNumber(FieldName).ToString(); break; } case (int)CPContentBaseClass.FieldTypeIdEnum.Date: { // // date // FieldValue = CSData.GetDate(FieldName).ToString(); break; } case (int)CPContentBaseClass.FieldTypeIdEnum.Lookup: { // // lookup // FieldValue = ""; int FieldValueInteger = CSData.GetInteger(FieldName); if ((FieldValueInteger != 0)) { FieldLookupContentName = fieldLookupContent[fieldPtr]; fieldLookupListValue = fieldLookupList[fieldPtr]; if ((FieldLookupContentName != "")) { // // content lookup // if (cp.Content.IsField(FieldLookupContentName, "ccguid")) { using (CPCSBaseClass CSlookup = cp.CSNew()) { CSlookup.OpenRecord(FieldLookupContentName, FieldValueInteger); if (CSlookup.OK()) { FieldValue = CSlookup.GetText("ccguid"); if (FieldValue == "") { FieldValue = cp.Utils.CreateGuid(); CSlookup.SetField("ccGuid", FieldValue); } } CSlookup.Close(); } } } else if (fieldLookupListValue != "") { // // list lookup, ok to save integer // FieldValue = FieldValueInteger.ToString(); } } break; } default: { // // text types // FieldValue = CSData.GetText(FieldName); FieldValue = ExportController.EncodeCData(FieldValue); break; } } FieldNodes = FieldNodes + System.Environment.NewLine + "\t" + "<field name=\"" + System.Net.WebUtility.HtmlEncode(FieldName) + "\">" + FieldValue + "</field>"; } RecordNodes = "" + RecordNodes + System.Environment.NewLine + "\t" + "<record content=\"" + System.Net.WebUtility.HtmlEncode(DataContentName) + "\" guid=\"" + DataRecordGuid + "\" name=\"" + System.Net.WebUtility.HtmlEncode(DataRecordName) + "\">" + ExportController.tabIndent(cp, FieldNodes) + System.Environment.NewLine + "\t" + "</record>"; CSData.GoNext(); } } CSData.Close(); } } } } } if (RecordNodes != "") { result = "" + result + System.Environment.NewLine + "\t" + "<data>" + ExportController.tabIndent(cp, RecordNodes) + System.Environment.NewLine + "\t" + "</data>"; } } return(result); } catch (Exception ex) { cp.Site.ErrorReport(ex); return(string.Empty); } }