// // ==================================================================================================== /// <summary> /// Addon entry /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { try { // // -- return(string.Empty); } catch (Exception ex) { CP.Site.ErrorReport(ex); throw; } }
// // ==================================================================================================== // public static string getLayout(BaseClasses.CPBaseClass CP, string layoutName, string layoutGuid, string layoutFilename) { try { // // -- install default detail layout LayoutModel layout = DbBaseModel.create <LayoutModel>(CP, layoutGuid); if ((layout == null)) { // // -- no layout found, create it layout = DbBaseModel.addDefault <LayoutModel>(CP); layout.name = layoutName; layout.ccguid = layoutGuid; layout.save(CP); } if (string.IsNullOrEmpty(layout.layout.content)) { // // -- content is blank, populate with layoutfilename BaseClasses.CPBlockBaseClass block = CP.BlockNew(); block.Load(CP.CdnFiles.Read(layoutFilename)); layout.layout.content = block.GetInner("body"); if (string.IsNullOrEmpty(layout.layout.content)) { layout.layout.content = block.GetHtml(); } layout.save(CP); } // // -- exit if not editing if (!CP.User.IsEditingAnything) { return(layout.layout.content); } // // -- wrap with edit return(CP.Content.GetEditWrapper(layout.layout.content, layout.contentControlId, layout.id)); } catch (Exception ex) { CP.Site.ErrorReport(ex); throw; } }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="cp"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass cp) { LibraryFilesModel image = DbBaseModel.create <LibraryFilesModel>(cp, constants.guidTemplateHeaderBrandLibraryFile); if (image == null) { image = DbBaseModel.addDefault <LibraryFilesModel>(cp); image.ccguid = constants.guidTemplateHeaderBrandLibraryFile; image.name = "Theme-Brand-Img"; image.filename = GenericController.populateFileField(cp, @"themehelpers\Brand-Default.png", LibraryFilesModel.tableMetadata.tableNameLower, "filename", image.id); image.save(cp); } StringBuilder result = new StringBuilder("<img"); result.Append(" src=\"" + cp.Http.CdnFilePathPrefix + image.filename + "\""); if (!image.width.Equals(0)) { result.Append(" width=\"" + image.width + "\""); } if (!image.height.Equals(0)) { result.Append(" height=\"" + image.height + "\""); } if (!string.IsNullOrEmpty(image.description)) { string encodedMsg = cp.Utils.EncodeHTML(image.description); result.Append(" alt=\"" + encodedMsg + "\" title=\"" + encodedMsg + "\""); } result.Append(">"); // // -- if not editing, return a linked image if (!cp.User.IsEditingAnything) { return("<a href=\"/\">" + result.ToString() + "</a>"); } // // -- editing, no link return(cp.Content.GetEditWrapper(result.ToString(), image.contentControlId, image.id)); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-Phone", "{F3CF29BC-9E94-4DFB-9B47-0866B635D570}", "themehelpers\\Theme-Content-Phone.html")); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-Location", "{407BBDE5-5542-4088-B904-8FE21F68B6D7}", "themehelpers\\Theme-Content-Location.html")); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-SocialMediaLinks", "{88045A70-3E59-478A-A694-1D4AC0240728}", "themehelpers\\Theme-Content-SocialMediaLinks.html")); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-Contact", "{6053D0D5-B245-4EE1-8A6A-A92B485C6B1F}", "themehelpers\\Theme-Content-Contact.html")); }
// // ==================================================================================================== /// <summary> /// Execute the menuing navbar-nav with the common themehelpers instance id for the header menu /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { CP.Doc.SetProperty("instanceId", "Theme-Header-Navbar-Li-List"); return(CP.Addon.Execute(constants.guidNavbarLiListAddon)); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-About", "{D3D3806E-E714-4283-BD33-0BCD0C14E80A}", "themehelpers\\Theme-Content-About.html")); }
/// <summary> /// The only exposed method of an addon. Performs the functions for this part of the the add-on and returns an object, typically a string. For add-ons executing on a web page or as a remove method, the returned string is added to the page where the addon is placed. For addons run as processes, the returned string is logged in the process log. /// </summary> /// <param name="CP">An instance of the CPBaseClass with a valid CP.MyAddon object pointing to the current addon parameters (values for this addon in the database)</param> /// <returns></returns> /// <remarks></remarks> public abstract object Execute(BaseClasses.CPBaseClass CP);
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-Hours", "{51CC66CF-CD1C-42E7-93A6-7B66B6745068}", "themehelpers\\Theme-Content-Hours.html")); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Content-Copyright", "{97E9AB77-438A-47E8-B372-1A491B255748}", "themehelpers\\Theme-Content-Copyright.html").Replace("{year}", DateTime.Now.Year.ToString())); }
// // ==================================================================================================== /// <summary> /// /// </summary> /// <param name="CP"></param> /// <returns></returns> public override object Execute(BaseClasses.CPBaseClass CP) { return(GenericController.getLayout(CP, "Theme-Brand-Name", "{D085B986-98CB-4915-933B-83170BDFF9D7}", "themehelpers\\Theme-Brand-Name.html")); }