Exemple #1
0
        public SiteImportWordpressModel()
        {
            this.CreateUsers   = true;
            this.MapUsers      = true;
            this.FixHtmlBodies = true;
            this.HasLoaded     = false;

            BuildFolderList();

            using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                this.PageCount = pageHelper.GetSitePageCount(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry);

                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    this.Templates = cmsHelper.Templates;

                    float iThird = (float)(this.PageCount - 1) / (float)3;
                    Dictionary <string, float> dictTemplates = null;

                    dictTemplates = pageHelper.GetPopularTemplateList(SiteData.CurrentSiteID, ContentPageType.PageType.ContentEntry);
                    if (dictTemplates.Any() && dictTemplates.First().Value >= iThird)
                    {
                        try { this.PageTemplate = dictTemplates.First().Key; } catch { }
                    }

                    dictTemplates = pageHelper.GetPopularTemplateList(SiteData.CurrentSiteID, ContentPageType.PageType.BlogEntry);
                    if (dictTemplates.Any())
                    {
                        try { this.PostTemplate = dictTemplates.First().Key; } catch { }
                    }
                }
            }
        }
        public void GetSettings(Type type)
        {
            this.ValidateSettings = null;

            if (!String.IsNullOrEmpty(this.EncodedSettings))
            {
                string        sXML          = CMSConfigHelper.DecodeBase64(this.EncodedSettings);
                XmlSerializer xmlSerializer = new XmlSerializer(type);
                using (StringReader stringReader = new StringReader(sXML)) {
                    this.ValidateSettings = xmlSerializer.Deserialize(stringReader);
                }

                if (this.ValidateSettings != null && this.ValidateSettings is IFormSettingBase)
                {
                    IFormSettingBase settings = this.ValidateSettings as IFormSettingBase;

                    if (!String.IsNullOrEmpty(settings.ValidateHumanClass))
                    {
                        Type   objType = ReflectionUtilities.GetTypeFromString(settings.ValidateHumanClass);
                        Object obj     = Activator.CreateInstance(objType);
                        this.ValidateHuman = (IValidateHuman)obj;
                        this.ValidateHuman.AltValidationFailText = settings.ValidationFailText;
                    }
                }
            }
        }
Exemple #3
0
 public PostTemplateUpdateModel()
     : base()
 {
     using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
         this.SiteTemplateList = cmsHelper.Templates;
     }
 }
        public void SaveTextWidgets()
        {
            if (this.ContentPage != null && this.ContentPage.Root_ContentID != Guid.Empty)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(this.ContentPage.Root_ContentID);

                    if (cmsHelper.cmsAdminWidget != null)
                    {
                        var ww = (from w in cmsHelper.cmsAdminWidget
                                  where w.IsLatestVersion == true &&
                                  w.IsPendingChange == true &&
                                  (w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentRichText,") ||
                                   w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentPlainText,"))
                                  select w);

                        foreach (Widget w in ww)
                        {
                            w.Save();
                        }
                    }

                    cmsHelper.cmsAdminContent = null;
                    cmsHelper.cmsAdminWidget  = null;
                }
            }
        }
        public void FetchData()
        {
            base.ReadPageNbr();
            List <PostComment> lstContents = new List <PostComment>();

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                if (SiteData.IsWebView)
                {
                    SiteNav sn = navHelper.FindByFilename(SiteData.CurrentSiteID, SiteData.CurrentScriptName);

                    if (sn != null)
                    {
                        TotalRecords = PostComment.GetCommentCountByContent(sn.Root_ContentID, !SecurityData.IsAuthEditor);
                        lstContents  = PostComment.GetCommentsByContentPageNumber(sn.Root_ContentID, this.PageNumberZeroIndex, this.PageSize, this.OrderBy, !SecurityData.IsAuthEditor);
                    }
                }
                else
                {
                    TotalRecords = 0;
                    lstContents  = new List <PostComment>();
                }
            }

            lstContents.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            this.DataSource = lstContents;
        }
Exemple #6
0
        protected HtmlHelper <ResetPasswordInfo> InitHelp()
        {
            XmlSerializer xmlSerializer = new XmlSerializer(typeof(ResetPasswordInfoSettings));
            string        sXML          = String.Empty;

            using (StringWriter stringWriter = new StringWriter()) {
                xmlSerializer.Serialize(stringWriter, _settings);
                sXML = stringWriter.ToString();
                sXML = CMSConfigHelper.EncodeBase64(sXML);
            }

            _model.Settings        = _settings;
            _model.EncodedSettings = sXML;

            var hlp = new HtmlHelper <ResetPasswordInfo>(_helper.ViewContext, new WrapperForHtmlHelper <ResetPasswordInfo>(_model, _helper.ViewData));

            string frmTag = Environment.NewLine
                            + hlp.AntiForgeryToken().ToString()
                            + Environment.NewLine
                            + hlp.HiddenFor(x => x.EncodedSettings).ToString()
                            + Environment.NewLine;

            _helper.ViewContext.Writer.Write(frmTag);

            return(hlp);
        }
        protected void LoadData()
        {
            if (this.Root_ContentID.HasValue)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(this.Root_ContentID.Value);
                    this.Widgets      = cmsHelper.cmsAdminWidget;
                    this.CachedWidget = true;

                    if (this.Widget == null)
                    {
                        this.Widget = (from w in this.Widgets
                                       where w.Root_WidgetID == this.Root_WidgetID
                                       select w).FirstOrDefault();
                    }
                }
            }
            else
            {
                using (WidgetHelper widgetHelper = new WidgetHelper()) {
                    if (this.Widget == null)
                    {
                        this.Widget         = widgetHelper.Get(this.Root_WidgetID);
                        this.Root_ContentID = this.Widget.Root_ContentID;
                    }
                }
            }

            GetCtrlName();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                gTheID = new Guid(Request.QueryString["id"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["parm"]))
            {
                imageFile = CMSConfigHelper.DecodeBase64(Request.QueryString["parm"].ToString());
            }
            if (imageFile.Contains("../") || imageFile.Contains(@"..\"))
            {
                throw new Exception("Cannot use relative paths.");
            }
            if (imageFile.Contains(":"))
            {
                throw new Exception("Cannot specify drive letters.");
            }
            if (imageFile.Contains("//") || imageFile.Contains(@"\\"))
            {
                throw new Exception("Cannot use UNC paths.");
            }

            litImgName.Text      = imageFile;
            ImageSizer1.ImageUrl = imageFile;
            ImageSizer1.ToolTip  = imageFile;

            if (!IsPostBack)
            {
                LoadForm();
            }
        }
Exemple #9
0
 protected void OverrideCache(ContentPage pageContents)
 {
     using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
         cmsHelper.OverrideKey(pageContents.Root_ContentID);
         cmsHelper.cmsAdminContent = pageContents;
         cmsHelper.cmsAdminWidget  = pageContents.GetWidgetList();
     }
 }
Exemple #10
0
 public string EncodePath(string sIn)
 {
     if (!(sIn.StartsWith(@"\") || sIn.StartsWith(@"/")))
     {
         sIn = @"/" + sIn;
     }
     return(CMSConfigHelper.EncodeBase64(sIn.ToLowerInvariant()));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.DataImport);

            lblWarning.Text = "";
            lblWarning.Attributes["style"] = "color: #000000;";

            CMSConfigHelper.CleanUpSerialData();
        }
Exemple #12
0
        public void Save()
        {
            this.CopyCount = 0;
            if (this.Widgets != null)
            {
                List <Guid> lstSel = this.Widgets.Where(x => x.Selected).Select(x => x.Root_WidgetID).ToList();

                using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                    this.SelectedPage = pageHelper.FindContentByID(SiteData.CurrentSiteID, this.SelectedItem);
                    this.Widgets      = this.SelectedPage.GetWidgetList();
                }

                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(this.Root_ContentID);

                    if (cmsHelper.cmsAdminWidget != null)
                    {
                        List <Widget> cacheWidget = cmsHelper.cmsAdminWidget;

                        List <Widget> ww = (from w in this.SelectedPage.GetWidgetList()
                                            where lstSel.Contains(w.Root_WidgetID) && w.IsLatestVersion == true
                                            select w).ToList();

                        if (ww != null)
                        {
                            this.CopyCount = ww.Count;

                            foreach (var w in ww)
                            {
                                Guid newWidget = Guid.NewGuid();

                                Widget wCpy = new Widget {
                                    Root_ContentID        = this.Root_ContentID,
                                    Root_WidgetID         = newWidget,
                                    WidgetDataID          = Guid.NewGuid(),
                                    PlaceholderName       = this.PlaceholderName,
                                    ControlPath           = w.ControlPath,
                                    ControlProperties     = w.ControlProperties,
                                    IsLatestVersion       = true,
                                    IsPendingChange       = true,
                                    IsWidgetActive        = true,
                                    IsWidgetPendingDelete = false,
                                    WidgetOrder           = w.WidgetOrder,
                                    GoLiveDate            = w.GoLiveDate,
                                    RetireDate            = w.RetireDate,
                                    EditDate = SiteData.CurrentSite.Now
                                };

                                cacheWidget.Add(wCpy);
                            }
                        }

                        cmsHelper.cmsAdminWidget = cacheWidget;
                    }
                }
            }
        }
        public void SetPage(ContentPage page)
        {
            this.ContentPage = page;

            this.OriginalFileName   = page.FileName;
            this.SelectedCategories = this.ContentPage.ContentCategories.Select(x => x.ContentCategoryID.ToString().ToLower()).ToList();
            this.SelectedTags       = this.ContentPage.ContentTags.Select(x => x.ContentTagID.ToString().ToLower()).ToList();
            this.InitSelections();

            if (this.ContentPage != null)
            {
                using (ContentPageHelper pageHelper = new ContentPageHelper()) {
                    if (this.ContentPage.Root_ContentID != Guid.Empty)
                    {
                        this.VersionHistory = (from v in pageHelper.GetVersionHistory(this.ContentPage.SiteID, this.ContentPage.Root_ContentID)
                                               join u in ExtendedUserData.GetUserList() on v.EditUserId equals u.UserId
                                               orderby v.EditDate descending
                                               select new KeyValuePair <string, string>(v.ContentID.ToString(),
                                                                                        String.Format("{0} ({1}) {2}", v.EditDate, u.UserName, (v.IsLatestVersion ? " [**] " : " ")))
                                               ).ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
                    }
                    else
                    {
                        this.ContentPage.CreateDate = DateTime.UtcNow.Date;
                        this.ContentPage.EditDate   = DateTime.UtcNow.Date;
                        this.ContentPage.ContentID  = Guid.NewGuid();

                        if (this.ContentPage.ContentType == ContentPageType.PageType.ContentEntry)
                        {
                            this.ContentPage.NavOrder = pageHelper.GetSitePageCount(this.ContentPage.SiteID, this.ContentPage.ContentType) * 2;
                        }
                        else
                        {
                            this.ContentPage.Parent_ContentID = null;
                            this.ContentPage.NavOrder         = SiteData.BlogSortOrderNumber;
                        }

                        DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);
                        this.ContentPage.GoLiveDate = dtSite;
                        this.ContentPage.RetireDate = dtSite.AddYears(200);

                        float iThird = (float)(this.ContentPage.NavOrder - 1) / (float)3;

                        Dictionary <string, float> dictTemplates = pageHelper.GetPopularTemplateList(this.ContentPage.SiteID, this.ContentPage.ContentType);
                        if (dictTemplates.Any() && dictTemplates.First().Value >= iThird)
                        {
                            try {
                                this.ContentPage.TemplateFile = dictTemplates.First().Key;
                            } catch { }
                        }
                    }
                }

                RefreshWidgetList();
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            try {
                if (context.Request.Files != null && context.Request.Files.Count > 0)
                {
                    FileDataHelper helpFile = CMSConfigHelper.GetFileDataHelper();

                    for (int i = 0; i < context.Request.Files.Count; i++)
                    {
                        HttpPostedFile file = context.Request.Files[i];

                        string dir              = context.Request["FileDirectory"].ToString() ?? @"/";
                        bool   esc              = Convert.ToBoolean(context.Request["EscapeSpaces"].ToString() ?? "false");
                        string path             = context.Server.MapPath(dir).Replace(@"\", @"/");
                        string uploadedFileName = file.FileName.Replace(@"\", @"/").Replace(@"//", @"/");

                        if (uploadedFileName.IndexOf("/") > 0)
                        {
                            uploadedFileName = uploadedFileName.Substring(uploadedFileName.LastIndexOf("/"));
                        }

                        if ((from b in helpFile.BlockedTypes
                             where uploadedFileName.ToLowerInvariant().EndsWith(String.Format(".{0}", b).ToLowerInvariant())
                             select b).Count() < 1)
                        {
                            if (esc)
                            {
                                uploadedFileName = uploadedFileName.Replace(" ", "-");
                                uploadedFileName = uploadedFileName.Replace("_", "-");
                                uploadedFileName = uploadedFileName.Replace("+", "-");
                                uploadedFileName = uploadedFileName.Replace("%20", "-");
                            }

                            string filename = (path + "/" + uploadedFileName).Replace(@"//", @"/");
                            file.SaveAs(filename);
                        }
                        else
                        {
                            throw new Exception("Blocked File Type");
                        }

                        var serial = new System.Web.Script.Serialization.JavaScriptSerializer();
                        var res    = new { name = file.FileName };
                        context.Response.Write(serial.Serialize(res));
                    }
                }
            } catch (Exception ex) {
                SiteData.WriteDebugException("fileupload", ex);
                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.TextWidget);

            if (!IsPostBack)
            {
                using (CMSConfigHelper cfg = new CMSConfigHelper()) {
                    PickerValues         = cfg.GetAllWidgetSettings(SiteID);
                    gvContent.DataSource = PickerValues;
                    gvContent.DataBind();
                }
            }
        }
        protected void DoDataBind()
        {
            List <SiteNav> lstNav = null;

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, guidContentID, !SecurityData.IsAuthEditor);
            }

            if (bClickedSort && ddlAlternateSort.SelectedIndex > 0)
            {
                switch (ddlAlternateSort.SelectedValue)
                {
                case "alpha":
                    lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                    break;

                case "datecreated":
                    lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                    break;

                case "dateupdated":
                    lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                    break;

                case "alpha2":
                    lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                    break;

                case "datecreated2":
                    lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                    break;

                case "dateupdated2":
                    lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                    break;

                default:
                    lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                    break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            GeneralUtilities.BindRepeater(rpPages, lstNav);

            if (lstNav.Count < 2)
            {
                btnSave.Visible = false;
            }
        }
        public ContentPageModel()
        {
            this.InitSelections();
            this.Mode      = "html";
            this.VisitPage = false;

            this.VersionHistory = new Dictionary <string, string>();
            this.WidgetListHtml = new List <Widget>();
            this.WidgetListText = new List <Widget>();

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                this.SiteTemplates = cmsHelper.Templates;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            pageContents = new ContentPage(SiteID, ContentPageType.PageType.ContentEntry);

            DateTime dtSite = CMSConfigHelper.CalcNearestFiveMinTime(SiteData.CurrentSite.Now);

            int  iOrder          = pageHelper.GetMaxNavOrder(SiteID) + 1;
            Guid?parentContentID = ParentPagePicker.SelectedPage;

            pageContents.Parent_ContentID = parentContentID;

            pageContents.TitleBar    = txtTitle.Text;
            pageContents.NavMenuText = txtNav.Text;
            pageContents.PageHead    = txtHead.Text;
            pageContents.FileName    = txtFileName.Text;

            pageContents.MetaDescription = txtDescription.Text;
            pageContents.MetaKeyword     = txtKey.Text;

            pageContents.Heartbeat_UserId = SecurityData.CurrentUserGuid;
            pageContents.EditHeartbeat    = dtSite.AddMinutes(5);

            pageContents.EditUserId      = SecurityData.CurrentUserGuid;
            pageContents.IsLatestVersion = true;
            pageContents.EditDate        = SiteData.CurrentSite.Now;
            pageContents.NavOrder        = iOrder;
            pageContents.PageActive      = false;
            pageContents.ShowInSiteMap   = true;
            pageContents.ShowInSiteNav   = true;
            pageContents.ContentType     = ContentPageType.PageType.ContentEntry;

            pageContents.GoLiveDate = dtSite;
            pageContents.RetireDate = dtSite.AddYears(200);

            pageContents.SavePageEdit();

            pnlAdd.Visible   = false;
            pnlSaved.Visible = true;

            litPageName.Text   = pageContents.FileName;
            lnkNew.NavigateUrl = pageContents.FileName;

            if (pageContents.FileName.ToLowerInvariant().EndsWith(SiteData.DefaultDirectoryFilename))
            {
                VirtualDirectory.RegisterRoutes(true);
            }

            Master.ShowSave();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentIndex);

            RedirectIfNoSite();

            CMSConfigHelper.CleanUpSerialData();

            if (!IsPostBack)
            {
                ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();
            }

            LoadGrid();
        }
Exemple #20
0
        public void ReconstructSettings()
        {
            this.Settings = null;

            if (!String.IsNullOrEmpty(this.EncodedSettings))
            {
                string        sXML          = CMSConfigHelper.DecodeBase64(this.EncodedSettings);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(LogoutInfoSettings));
                using (StringReader stringReader = new StringReader(sXML)) {
                    this.Settings = (LogoutInfoSettings)xmlSerializer.Deserialize(stringReader);
                }
            }

            this.IsLoggedIn = SecurityData.IsAuthenticated;
        }
Exemple #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.User.Identity.IsAuthenticated)
            {
                FormsAuthentication.SignOut();
                Response.Redirect(SiteFilename.LogonURL);
            }

            if (SecurityData.CurrentUser != null)
            {
                userName = SecurityData.CurrentUser.UserName;
            }

            if (!SecurityData.IsAdmin)
            {
                tabUserSecurity.Visible = false;
            }

            tabUserAdmin.Visible  = tabUserSecurity.Visible;
            tabGroupAdmin.Visible = tabUserSecurity.Visible;
            tabSites.Visible      = tabUserSecurity.Visible;

            if (SiteData.CurretSiteExists)
            {
                litServerTime.Text = SiteData.CurrentSite.Now.ToString() + " " + SiteData.CurrentSite.TimeZoneIdentifier;
                litSiteIdent.Text  = SiteData.CurrentSite.SiteName;
                litTag.Text        = SiteData.CurrentSite.SiteTagline;

                if (!String.IsNullOrEmpty(SiteData.CurrentSite.SiteName) && !String.IsNullOrEmpty(SiteData.CurrentSite.SiteTagline))
                {
                    litSiteIdent.Text = SiteData.CurrentSite.SiteName.Trim() + ":   ";
                }
            }
            else
            {
                litServerTime.Text = DateTime.UtcNow.ToString() + " UTC";
            }

            LoadFooterCtrl(plcFooter, ControlLocation.MainFooter);

            litCMSBuildInfo.Text = SiteData.CarrotCakeCMSVersion;
            litVersion.Text      = SiteData.CarrotCakeCMSVersionMM;

            tabModules.Visible = CMSConfigHelper.HasAdminModules();

            HideWhenNoSiteProfileExists();
        }
Exemple #22
0
        public void SortChildren()
        {
            List <SiteNav> lstNav = null;

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                lstNav = navHelper.GetChildNavigation(SiteData.CurrentSiteID, this.Root_ContentID, !SecurityData.IsAuthEditor);
            }

            if (!String.IsNullOrEmpty(this.SelectedSort))
            {
                switch (this.SelectedSort)
                {
                case "alpha":
                    lstNav = lstNav.OrderBy(x => x.NavMenuText).ToList();
                    break;

                case "datecreated":
                    lstNav = lstNav.OrderBy(x => x.CreateDate).ToList();
                    break;

                case "dateupdated":
                    lstNav = lstNav.OrderBy(x => x.EditDate).ToList();
                    break;

                case "alpha2":
                    lstNav = lstNav.OrderByDescending(x => x.NavMenuText).ToList();
                    break;

                case "datecreated2":
                    lstNav = lstNav.OrderByDescending(x => x.CreateDate).ToList();
                    break;

                case "dateupdated2":
                    lstNav = lstNav.OrderByDescending(x => x.EditDate).ToList();
                    break;

                default:
                    lstNav = lstNav.OrderBy(x => x.NavOrder).ToList();
                    break;
                }
            }

            lstNav.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            this.Pages = lstNav;
        }
Exemple #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSkinEdit);

            if (!String.IsNullOrEmpty(Request.QueryString["path"]))
            {
                sTemplateFileQS = Request.QueryString["path"].ToString();
                sTemplateFile   = CMSConfigHelper.DecodeBase64(sTemplateFileQS);
                sFullFilePath   = HttpContext.Current.Server.MapPath(sTemplateFile);
                sEditFile       = sFullFilePath;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["alt"]))
            {
                string sAltFileQS = Request.QueryString["alt"].ToString();
                string sAltFile   = CMSConfigHelper.DecodeBase64(sAltFileQS);
                sEditFile = HttpContext.Current.Server.MapPath(sAltFile);
            }

            litSkinFileName.Text = sTemplateFile;

            litEditFileName.Text = sEditFile.Replace(Server.MapPath("~"), @"\");

            if (File.Exists(sEditFile))
            {
                if (!IsPostBack)
                {
                    using (StreamReader sr = new StreamReader(sEditFile)) {
                        txtPageContents.Text = sr.ReadToEnd();
                    }
                }

                litDateMod.Text = File.GetLastWriteTime(sEditFile).ToString();

                if (sFullFilePath.LastIndexOf(@"\") > 0)
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"\"));
                }
                else
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"/"));
                }

                SetSourceFiles(sDirectory);
            }
        }
Exemple #24
0
        public SiteSkinModel(string encodedPath)
            : this()
        {
            this.EncodedPath  = encodedPath;
            this.TemplateFile = CMSConfigHelper.DecodeBase64(encodedPath);
            this.FullFilePath = HttpContext.Current.Server.MapPath(this.TemplateFile);

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                this.Template = cmsHelper.Templates.Where(x => x.TemplatePath.ToLowerInvariant() == this.TemplateFile.ToLowerInvariant()).FirstOrDefault();
            }

            var ifo = new FileInfo(this.TemplateFile);

            this.TemplateFolder = ifo.Directory.FullName;

            this.EditFile = this.TemplateFile;
        }
        public void Save()
        {
            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                Widget ww = null;

                if (this.CachedWidget)
                {
                    cmsHelper.OverrideKey(this.Root_ContentID.Value);
                    this.Widgets = cmsHelper.cmsAdminWidget;

                    ww = (from w in this.Widgets
                          where w.Root_WidgetID == this.Root_WidgetID
                          select w).FirstOrDefault();
                }
                else
                {
                    using (WidgetHelper widgetHelper = new WidgetHelper()) {
                        ww = widgetHelper.Get(this.Root_WidgetID);
                    }
                }

                if (ww != null)
                {
                    ww.IsPendingChange       = true;
                    ww.IsWidgetActive        = this.Widget.IsWidgetActive;
                    ww.IsWidgetPendingDelete = this.Widget.IsWidgetPendingDelete;

                    ww.EditDate   = SiteData.CurrentSite.Now;
                    ww.GoLiveDate = this.Widget.GoLiveDate;
                    ww.RetireDate = this.Widget.RetireDate;

                    if (this.CachedWidget)
                    {
                        this.Widgets.RemoveAll(x => x.Root_WidgetID == this.Root_WidgetID);
                        this.Widgets.Add(ww);
                        cmsHelper.cmsAdminWidget = this.Widgets.OrderBy(x => x.WidgetOrder).ToList();
                    }
                    else
                    {
                        ww.Save();
                    }
                }
            }
        }
Exemple #26
0
        protected void GetCtrlName()
        {
            string sName = String.Empty;

            if (this.Widget != null)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    CMSPlugin plug = (from p in cmsHelper.ToolboxPlugins
                                      where p.FilePath.ToLower() == this.Widget.ControlPath.ToLower()
                                      select p).FirstOrDefault();

                    if (plug != null)
                    {
                        sName = plug.Caption;
                    }
                }
            }

            this.WidgetCaption = sName;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                gTheID = new Guid(Request.QueryString["id"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["parm"]))
            {
                sImageFile = CMSConfigHelper.DecodeBase64(Request.QueryString["parm"].ToString());
            }

            litImgName.Text      = sImageFile;
            ImageSizer1.ImageUrl = sImageFile;
            ImageSizer1.ToolTip  = sImageFile;

            if (!IsPostBack)
            {
                LoadForm();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogIndex);

            RedirectIfNoSite();

            CMSConfigHelper.CleanUpSerialData();

            if (!IsPostBack)
            {
                txtDate.Text = SiteData.CurrentSite.Now.ToShortDateString();
                ContentPage cp = pageHelper.GetLatestPosts(SiteData.CurrentSiteID, 2, false).FirstOrDefault();
                if (cp != null)
                {
                    txtDate.Text = cp.GoLiveDate.ToShortDateString();
                }

                ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();
            }

            LoadGrid();
        }
        public void RefreshWidgetList()
        {
            this.WidgetListHtml = new List <Widget>();
            this.WidgetListText = new List <Widget>();

            if (this.ContentPage != null && this.ContentPage.Root_ContentID != Guid.Empty)
            {
                using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                    cmsHelper.OverrideKey(this.ContentPage.Root_ContentID);

                    this.WidgetListHtml = (from w in cmsHelper.cmsAdminWidget
                                           where w.IsLatestVersion == true &&
                                           w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentRichText,")
                                           select w).ToList();

                    this.WidgetListText = (from w in cmsHelper.cmsAdminWidget
                                           where w.IsLatestVersion == true &&
                                           w.ControlPath.StartsWith("CLASS:Carrotware.CMS.UI.Components.ContentPlainText,")
                                           select w).ToList();
                }
            }
        }
        public ModuleInfo()
        {
            this.OpenTab          = 0;
            this.SelectedTab      = 0;
            this.SelectedCssClass = "notSelectedModule";

            this.SelectedArea             = CMSConfigHelper.PluginAreaPath;
            this.SelectedAreaName         = String.Empty;
            this.SelectedPluginAreaName   = String.Empty;
            this.SelectedPluginActionName = String.Empty;

            this.CurrentAction     = String.Empty;
            this.CurrentController = String.Empty;
            this.CurrentActionFull = String.Empty;

            this.Modules     = new List <CMSAdminModule>();
            this.RouteValues = new RouteValueDictionary();

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                this.Modules = cmsHelper.AdminModules;
            }
        }