Exemple #1
0
    public static int UpdateLayout(string FilePath, string Xml, string TemplateName)
    {
        int status = 0;

        TemplateName = TemplateName.Trim();
        if (!Utils.ContainsXmlHeader(Xml))
        {
            Xml = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>{0}", Xml);
        }
        if (Decide.IsXmlInputValid(Xml))
        {
            string templatePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
            //string filePath = string.Format("{0}/layouts/{1}.xml",templatePath,FilePath);
            string filePath = FilePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, FilePath);

            using (StreamWriter sw = new StreamWriter(filePath))
            {
                sw.Write(Xml);
            }
            CreateLayoutControls(TemplateName, filePath);
        }
        else
        {
            status = 1;
        }
        return(status);
    }
Exemple #2
0
    public static void DeleteTheme(string TemplateName, string ThemeName)
    {
        string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string theme_dir  = target_dir + "/Themes/" + ThemeName;

        Utils.DeleteDirectory(theme_dir);
    }
Exemple #3
0
    public static int SavePreset(string TemplateName, string ActiveTheme, string ActiveWidth, List <PresetKeyValue> lstLayouts, int portalID)
    {
        List <KeyValue> lstLyts = new List <KeyValue>();

        foreach (PresetKeyValue kvp in lstLayouts)
        {
            lstLyts.Add(new KeyValue(kvp.Key, kvp.Value));
        }
        PresetInfo PresetObj = new PresetInfo();

        PresetObj.ActiveTheme = ActiveTheme;
        PresetObj.ActiveWidth = ActiveWidth;
        PresetObj.lstLayouts  = lstLyts;
        string presetPath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        string pagepreset = presetPath + "/" + TemplateConstants.PagePresetFile;

        presetPath += "/" + "pagepreset.xml";
        int presetstatus = 0;

        try
        {
            PresetHelper.WritePreset(presetPath, PresetObj);
            return(presetstatus);
        }
        catch (Exception)
        {
            throw;
        }
        finally
        {
            AppErazer.ClearSysHash(ApplicationKeys.ActivePagePreset + "_" + portalID);
            SageFrame.Common.CacheHelper.Clear("PresetList");
        }
    }
Exemple #4
0
    public static int CreateLayout(string FilePath, string Xml, string TemplateName)
    {
        string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string filePath     = templatePath + "/layouts/" + Utils.GetFileNameWithExtension(FilePath, "xml");
        int    status       = 0;

        try
        {
            if (Decide.IsXmlInputValid(Xml))
            {
                using (StreamWriter sw = new StreamWriter(filePath))
                {
                    if (!Utils.ContainsXmlHeader(Xml))
                    {
                        sw.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                    }
                    sw.Write(Xml);
                }
                CreateLayoutControls(TemplateName.Trim(), filePath);
            }
            else
            {
                status = 1;
            }
            return(status);
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemple #5
0
        private void CheckInstallModule()
        {
            string pageNames        = string.Empty;
            string usermodules      = string.Empty;
            string templateName     = TemplateName;
            string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
            string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

            if (File.Exists(authorDetailPath))
            {
                XmlDocument doc            = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
                XmlNode     node           = doc.SelectSingleNode("themedetail/notinstallmoduleList");
                string      pageModuleList = string.Empty;
                if (node != null)
                {
                    int         notinstallModule = 0;
                    XmlNodeList nodeListCount    = doc.GetElementsByTagName("notinstallmodules");
                    notinstallModule = nodeListCount.Count;
                    if (notinstallModule > 0)
                    {
                        notinstallmoduleWrapper.Visible = true;
                    }
                }
            }
        }
    private void GetNotInstallModules()
    {
        string pageNames        = string.Empty;
        string usermodules      = string.Empty;
        string templateName     = TemplateName;
        string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

        if (File.Exists(authorDetailPath))
        {
            XmlDocument doc              = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
            XmlNode     node             = doc.SelectSingleNode("themedetail/notinstallmoduleList");
            string      pageModuleList   = string.Empty;
            int         notinstallModule = 0;
            if (node != null)
            {
                XmlNodeList nodeListCount = doc.GetElementsByTagName("notinstallmodules");
                notinstallModule = nodeListCount.Count;
            }
            if (notinstallModule > 0)
            {
                StringBuilder html = new StringBuilder();
                html.Append("<a class='notinstallmodulelink' target='_Blank' href=" + GetHostURL() + "/Admin/Modules.aspx" + " >Modules <span>" + notinstallModule + "</span><div class='noinstallmodulecount'>You have " + notinstallModule + " modules to be install. </div></a>");
                ltrnotinstallModules.Text = html.ToString();
            }
        }
    }
    private void CheckInstallModule()
    {
        string pageNames        = string.Empty;
        string usermodules      = string.Empty;
        string templateName     = TemplateName;
        string templatePath     = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string authorDetailPath = string.Format("{0}/themedetails.xml", templatePath);

        if (File.Exists(authorDetailPath))
        {
            XmlDocument doc            = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(authorDetailPath);
            XmlNode     node           = doc.SelectSingleNode("themedetail/notinstallmoduleList");
            string      pageModuleList = string.Empty;
            if (node != null)
            {
                int         notinstallModule = 0;
                XmlNodeList nodeListList     = doc.GetElementsByTagName("notinstallmodules");
                notinstallModule = nodeListList.Count;
                if (notinstallModule > 0)
                {
                    foreach (XmlNode xn in nodeListList)
                    {
                        moduleList += xn.SelectSingleNode("ModuleName").InnerText + ",";
                    }
                }
            }
        }
        if (moduleList.Length > 0)
        {
            BindOnlineModules(moduleList);
        }
    }
Exemple #8
0
    public static string GenerateWireFrame(string FilePath, string TemplateName)
    {
        try
        {
            //Check For Default Layout
            BlockParser.CheckFilePath(FilePath.ToLower());
            List <XmlTag> lstXmlTags   = new List <XmlTag>();
            XmlParser     parser       = new XmlParser();
            string        templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
            string        filePath     = FilePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, FilePath);

            lstXmlTags = parser.GetXmlTags(filePath, "layout/section");
            List <XmlTag>       lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers");
            ModulePaneGenerator wg          = new ModulePaneGenerator();
            return(wg.GenerateHTML(lstXmlTags, lstWrappers, 0));
        }
        catch (Exception)
        {
            if (FilePath.ToLower().Equals("core"))
            {
                return("<div class='sfMessage sfErrormsg'>Invalid XML document<input type='button' class='sfResetCore' id='btnReset' value='Reset Core'/></div>");
            }
            else
            {
                return("<div class='sfMessage sfErrormsg'>Invalid XML document</div>");
            }
        }
    }
Exemple #9
0
    public static string ReadFiles(string TemplateName, string FilePath)
    {
        XmlParser _parser  = new XmlParser();
        string    filePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);

        filePath = FilePath != "" ? filePath + "/" + FilePath : filePath;
        string html = XmlHelper.GetXMLString(filePath);

        return(html);
    }
Exemple #10
0
    public static void DeletePreset(string TemplateName, string Preset)
    {
        string presetPath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        string pagepreset = presetPath + "/" + TemplateConstants.PagePresetFile;
        string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplateInfoFilePath_Default(TemplateName) : Utils.GetTemplateInfoFilePath(TemplateName);
        string preset_dir = target_dir + "/presets/" + Preset;

        Utils.DeleteFile(preset_dir);
        PresetHelper.DeletePresetFromPresetPages(Preset, pagepreset);
    }
Exemple #11
0
    public static PresetInfo GetPresetDetails(string TemplateName, int PortalID)
    {
        string presetPath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);

        presetPath += "/" + "pagepreset.xml";
        PresetInfo objPreset = new PresetInfo();

        try
        {
            objPreset = PresetHelper.LoadPresetDetails(presetPath);
            PageController    objPageController = new PageController();
            List <PageEntity> lstMenu           = objPageController.GetMenuFront(PortalID, false);
            foreach (PageEntity obj in lstMenu)
            {
                obj.ChildCount = lstMenu.Count(
                    delegate(PageEntity objMenu)
                {
                    return(objMenu.ParentID == obj.PageID);
                }
                    );
            }
            List <string>   lstPages  = new List <string>();
            List <KeyValue> lstLayout = new List <KeyValue>();
            foreach (KeyValue kvp in objPreset.lstLayouts)
            {
                string[]      arrPage    = kvp.Value.Split(',');
                List <string> lstNewPage = new List <string>();
                foreach (string page in arrPage)
                {
                    bool exists = lstMenu.Exists(
                        delegate(PageEntity obj)
                    {
                        return(obj.PageName.TrimStart('-') == page);
                    }
                        );
                    if (exists || page.ToLower() == "all")
                    {
                        lstNewPage.Add(page);
                    }
                }
                if (lstNewPage.Count > 0)
                {
                    lstLayout.Add(new KeyValue(kvp.Key, string.Join(",", lstNewPage.ToArray())));
                }
            }
            objPreset.lstLayouts = lstLayout;
            //PresetHelper.WritePreset(presetPath, objPreset);
            return(objPreset);
        }
        catch (Exception)
        {
            throw;
        }
    }
    public static string CreateModernLayout(string FilePath, string Xml, string TemplateName, string ascx)
    {
        string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string filePath     = templatePath + "/layouts/" + Utils.GetFileNameWithExtension(FilePath, "xml");
        int    status       = 0;

        try
        {
            //if (Decide.IsXmlInputValid(Xml))
            //{
            using (StreamWriter sw = new StreamWriter(filePath))
            {
                //if (!Utils.ContainsXmlHeader(Xml))
                //{
                //    sw.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
                //}
                sw.Write(Xml);
            }

            string controlname = string.Format("{0}.ascx", FilePath);
            if (!File.Exists(templatePath + "/" + controlname))
            {
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            else
            {
                File.Delete(templatePath + "/" + controlname);
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname))
            {
                sw.Write("<%@ Control Language=\"C#\" ClassName=\"" + FilePath + "\" %>");
                sw.Write(Environment.NewLine);
                sw.Write(ascx);
            }

            //}
            //else
            //{
            //    status = 1;
            //}
            return(FilePath);
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemple #13
0
    public static void DeleteLayout(string TemplateName, string Layout)
    {
        TemplateName = Utils.CleanString(TemplateName);
        string templatePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string fileName     = Path.GetFileName(Layout);

        Layout = string.Format("{0}/layouts/{1}.xml", templatePath, Layout);
        string controlfile = string.Format("{0}/{1}.ascx", templatePath, Path.GetFileNameWithoutExtension(Layout));

        Utils.DeleteFile(controlfile);
        Utils.DeleteFile(Layout);
    }
Exemple #14
0
 public static void DeleteTemplate(string TemplateName)
 {
     try
     {
         string target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
         Utils.DeleteDirectory(target_dir);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    public static string LoadLayouts(string templateName)
    {
        string        filePath = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        DirectoryInfo dir      = new DirectoryInfo(filePath + "/layouts");
        string        layouts  = string.Empty;

        foreach (FileInfo layout in dir.GetFiles())
        {
            string layoutName = layout.Name.Replace(".xml", "");
            layouts += ',' + layoutName;
        }
        return(layouts);
    }
Exemple #16
0
    public static List <KeyValue> LoadLayout(string TemplateName)
    {
        string          filePath   = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        DirectoryInfo   dir        = new DirectoryInfo(filePath + "/layouts");
        List <KeyValue> lstLayouts = new List <KeyValue>();

        foreach (FileInfo layout in dir.GetFiles())
        {
            lstLayouts.Add(new KeyValue(Path.GetFileNameWithoutExtension(layout.Name), layout.FullName));
        }
        lstLayouts.Insert(0, new KeyValue("Core", "Core"));
        return(lstLayouts);
    }
    public static string SingleModernLayout(string templateName, string layoutName)
    {
        string filePath = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);

        filePath = string.Format("{0}/layouts/{1}.xml", filePath, layoutName);
        string layoutValue = string.Empty;

        if (File.Exists(filePath))
        {
            CheckModernLayout(filePath, out layoutValue);
        }
        return(layoutValue);
    }
    public static bool IsModernLayout(string templateName, string layoutName)
    {
        string        templatePath    = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        string        filePath        = layoutName.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, layoutName);
        bool          ismodernLayout  = false;
        List <XmlTag> lstSectionNodes = new List <XmlTag>();
        XmlDocument   doc             = XmlHelper.LoadXMLDocument(filePath);//layout
        XmlElement    root            = doc.DocumentElement;

        if (root.Attributes["modern"] != null)
        {
            ismodernLayout = true;
        }
        return(ismodernLayout);
    }
Exemple #19
0
    public static List <KeyValue> GetThemes(string TemplateName)
    {
        string          themePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetThemePath_Default(TemplateName) : Utils.GetThemePath(TemplateName);
        DirectoryInfo   dir       = new DirectoryInfo(themePath);
        List <KeyValue> lstThemes = new List <KeyValue>();

        if (dir.Exists)
        {
            foreach (DirectoryInfo theme in dir.GetDirectories())
            {
                lstThemes.Add(new KeyValue(theme.Name, theme.FullName));
            }
        }
        return(lstThemes);
    }
Exemple #20
0
    public static List <PresetInfo> LoadActivePresets(string TemplateName)
    {
        string            presetPath       = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        List <PresetInfo> lstActivePresets = new List <PresetInfo>();
        string            pagepreset       = presetPath + "/" + TemplateConstants.PagePresetFile;

        if (File.Exists(pagepreset))
        {
            lstActivePresets = PresetHelper.ParsePreset(pagepreset, "pagepresets/page");
        }
        else
        {
            lstActivePresets.Add(PresetInfo.GetPresetPages("default", "*"));
        }
        return(lstActivePresets);
    }
Exemple #21
0
    public static List <KeyValue> GetPreviewImages(string TemplateName)
    {
        string          target_dir = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string          imagePath  = target_dir + "/screenshots/";
        List <KeyValue> lstImages  = new List <KeyValue>();
        DirectoryInfo   dirInfo    = new DirectoryInfo(imagePath);

        foreach (FileInfo file in dirInfo.GetFiles())
        {
            string ext = Path.GetExtension(file.Name);
            if (ext == ".jpg" || ext == ".png" || ext == ".gif")
            {
                lstImages.Add(new KeyValue(file.Name, file.FullName));
            }
        }
        return(lstImages);
    }
Exemple #22
0
 public static string ReadXML(string filePath, string TemplateName)
 {
     try
     {
         string templatePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
         string fileName     = Path.GetFileName(filePath);
         filePath = filePath.ToLower().Equals("core") ? string.Format("{0}/Layouts/standard/All.xml", Utils.GetTemplatePath_Default("Default")) : string.Format("{0}/layouts/{1}.xml", templatePath, filePath);
         DataSet ds = new DataSet();
         ds.ReadXml(filePath);
         string s = ds.GetXml();
         return(s);
     }
     catch (Exception)
     {
         return("Couldn't Read the XML file. Make sure it is a valid xml");
     }
 }
Exemple #23
0
    public string LoadLayout()
    {
        string        filePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        DirectoryInfo dir      = new DirectoryInfo(filePath + "/layouts");
        StringBuilder html     = new StringBuilder();

        foreach (FileInfo layout in dir.GetFiles())
        {
            string layoutName = layout.Name.Replace(".xml", "");
            html.Append("<option");
            html.Append(" value='");
            html.Append(layoutName);
            html.Append("'>");
            html.Append(layoutName);
            html.Append("</option>");
        }
        return(html.ToString());
    }
Exemple #24
0
    public static List <KeyValue> LoadPresets(string TemplateName)
    {
        string          themePath  = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        DirectoryInfo   dir        = new DirectoryInfo(themePath);
        List <KeyValue> lstPresets = new List <KeyValue>();

        if (dir.Exists)
        {
            foreach (FileInfo preset in dir.GetFiles("*.xml"))
            {
                if (!Utils.CompareStrings(preset.Name, TemplateConstants.PagePresetFile))
                {
                    lstPresets.Add(new KeyValue(preset.Name, preset.FullName));
                }
            }
        }
        return(lstPresets);
    }
    public static List <string> ModernLayoutList(string templateName)
    {
        List <string> objLayoutList = new List <string>();
        string        filePath      = Decide.IsTemplateDefault(templateName.Trim()) ? Utils.GetTemplatePath_Default(templateName) : Utils.GetTemplatePath(templateName);
        DirectoryInfo dir           = new DirectoryInfo(filePath + "/layouts");
        string        layouts       = string.Empty;

        foreach (FileInfo layout in dir.GetFiles())
        {
            string fileName     = layout.FullName;
            string layoutValue  = string.Empty;
            bool   modernLayout = CheckModernLayout(fileName, out layoutValue);
            if (modernLayout)
            {
                objLayoutList.Add(layout.Name + ",,,," + layoutValue);
            }
        }
        return(objLayoutList);
    }
Exemple #26
0
    public static void CreateLayoutControls(string TemplateName, string filePath)
    {
        BlockParser.CheckFilePath();
        string templatePath        = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        string presetPath          = Decide.IsTemplateDefault(TemplateName) ? Utils.GetPresetPath_DefaultTemplate(TemplateName) : Utils.GetPresetPath(TemplateName);
        ModulePaneGenerator mg     = new ModulePaneGenerator();
        XmlParser           parser = new XmlParser();

        try
        {
            List <XmlTag> lstXmlTag   = parser.GetXmlTags(filePath, "layout/section");
            List <XmlTag> lstWrappers = parser.GetXmlTags(filePath, "layout/wrappers");
            string        html        = mg.GenerateHTML(lstXmlTag, lstWrappers, 2);
            //html = Utils.FormatHtmlOutput(html);
            string controlclass = Path.GetFileNameWithoutExtension(filePath);
            string controlname  = string.Format("{0}.ascx", controlclass);
            if (!File.Exists(templatePath + "/" + controlname))
            {
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            else
            {
                File.Delete(templatePath + "/" + controlname);
                FileStream fs = null;
                using (fs = File.Create(templatePath + "/" + controlname))
                {
                }
            }
            using (StreamWriter sw = new StreamWriter(templatePath + "/" + controlname))
            {
                sw.Write("<%@ Control Language=\"C#\" ClassName=" + controlclass + " %>");
                sw.Write(Environment.NewLine);
                sw.Write(html);
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemple #27
0
    public void BindThemes()
    {
        string          themePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetThemePath_Default(TemplateName) : Utils.GetThemePath(TemplateName);
        List <KeyValue> lstThemes = new List <KeyValue>();

        if (Directory.Exists(themePath))
        {
            DirectoryInfo dir = new DirectoryInfo(themePath);
            foreach (DirectoryInfo theme in dir.GetDirectories())
            {
                lstThemes.Add(new KeyValue(theme.Name, theme.Name));
            }
        }
        lstThemes.Insert(0, new KeyValue("default", "default"));
        ddlThemes.DataSource    = lstThemes;
        ddlThemes.DataTextField = "Key";
        ddlThemes.DataTextField = "Value";
        ddlThemes.DataBind();
    }
Exemple #28
0
    public static TemplateInfo GetBasicSettings(string TemplateName)
    {
        TemplateInfo objTemp  = new TemplateInfo();
        string       filePath = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplateInfoFilePath_Default(TemplateName) : Utils.GetTemplateInfoFilePath(TemplateName);

        if (File.Exists(filePath))
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(filePath);
            XmlNode root = doc.DocumentElement;
            objTemp.TemplateName = root.SelectSingleNode("name").ChildNodes[0].Value;
            objTemp.Author       = root.SelectSingleNode("author").ChildNodes[0].Value;
            objTemp.Description  = root.SelectSingleNode("description").ChildNodes[0].Value;
            objTemp.Website      = root.SelectSingleNode("website").ChildNodes[0].Value;
            return(objTemp);
        }
        else
        {
            return(objTemp = TemplateHelper.CreateEmptyTemplateObject());
        }
    }
Exemple #29
0
    public static List <FileEntity> GetFiles(string TemplateName, string FolderPath)
    {
        string filePath = Decide.IsTemplateDefault(TemplateName) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);

        filePath = FolderPath != "" ? filePath + "/" + FolderPath : filePath;
        List <FileEntity> lstFiles = new List <FileEntity>();

        if (Directory.Exists(filePath))
        {
            DirectoryInfo dir = new DirectoryInfo(filePath);
            foreach (DirectoryInfo folder in dir.GetDirectories())
            {
                lstFiles.Add(new FileEntity(folder.Name, folder.FullName, "", Path.HasExtension(folder.Name) ? false : true, Size(folder), folder.CreationTime.ToShortDateString()));
            }
            foreach (FileInfo file in dir.GetFiles())
            {
                lstFiles.Add(new FileEntity(file.Name, file.FullName, Path.GetExtension(file.Name), Path.HasExtension(file.Name) ? false : true, file.Length, file.CreationTime.ToShortDateString()));
            }
        }
        return(lstFiles);
    }
Exemple #30
0
    private void BindLayout()
    {
        string        filePath   = Decide.IsTemplateDefault(TemplateName.Trim()) ? Utils.GetTemplatePath_Default(TemplateName) : Utils.GetTemplatePath(TemplateName);
        DirectoryInfo dir        = new DirectoryInfo(filePath + "/layouts");
        StringBuilder html       = new StringBuilder();
        List <string> layoutList = new List <string>();

        html.Append("<ul class='layoutList inactive' style='display:none;'>");
        foreach (FileInfo layout in dir.GetFiles())
        {
            string layoutName = layout.Name.Replace(".xml", "");
            layoutList.Add(layoutName);
            html.Append("<li>");
            html.Append(layoutName);
            html.Append("</li>");
        }
        html.Append("</ul>");
        ddlLayout.DataSource = layoutList;
        ddlLayout.DataBind();

        ltrlayoutList.Text = html.ToString();
    }