예제 #1
0
        protected void openRepo(object sender, EventArgs e)
        {
            Guid?g = Skinning.StarterKitGuid(templateID);


            if (g == null || !Skinning.HasAvailableSkins(templateID))
            {
                bt_repo.Visible = false;
            }
            else
            {
                if (repo.HasConnection())
                {
                    try
                    {
                        rep_starterKitDesigns.DataSource = repo.Webservice.Skins(g.ToString());
                        rep_starterKitDesigns.DataBind();
                    }
                    catch (Exception ex)
                    {
                        BusinessLogic.Log.Add(BusinessLogic.LogTypes.Debug, -1, ex.ToString());

                        //ShowConnectionError();
                    }
                }
                else
                {
                    //ShowConnectionError();
                }
            }

            p_apply.Visible    = false;
            p_download.Visible = true;
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            templateID = int.Parse(Request["id"]);
            Template t = new Template(templateID);

            if (Skinning.StarterKitGuid(templateID).HasValue)
            {
                p_apply.Visible = true;

                string currentSkin  = Skinning.GetCurrentSkinAlias(templateID);
                int    templateRoot = FindTemplateRoot((CMSNode)t);

                dd_skins.Items.Add("Choose...");
                foreach (KeyValuePair <string, string> kvp in Skinning.AllowedSkins(templateRoot))
                {
                    ListItem li = new ListItem(kvp.Value, kvp.Key);
                    if (kvp.Key == currentSkin)
                    {
                        li.Selected = true;
                    }

                    dd_skins.Items.Add(li);
                }

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(templateID)))
                {
                    ph_rollback.Visible = true;
                }
            }
        }
예제 #3
0
        protected void openRepo(object sender, EventArgs e)
        {
            var g = Skinning.StarterKitGuid(_templateId);


            if (g == null || !Skinning.HasAvailableSkins(_templateId))
            {
                bt_repo.Visible = false;
            }
            else
            {
                if (_repo.HasConnection())
                {
                    try
                    {
                        rep_starterKitDesigns.DataSource = _repo.Webservice.Skins(g.ToString());
                        rep_starterKitDesigns.DataBind();
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Error <TemplateSkinning>("An error occurred", ex);

                        //ShowConnectionError();
                    }
                }
            }

            p_apply.Visible    = false;
            p_download.Visible = true;
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _templateId = int.Parse(Request["id"]);
            var t = new Template(_templateId);

            if (Skinning.StarterKitGuid(_templateId).HasValue)
            {
                p_apply.Visible = true;

                var currentSkin  = Skinning.GetCurrentSkinAlias(_templateId);
                var templateRoot = FindTemplateRoot(t);

                dd_skins.Items.Add("Choose...");
                foreach (var kvp in Skinning.AllowedSkins(templateRoot))
                {
                    var li = new ListItem(kvp.Value, kvp.Key);
                    if (kvp.Key == currentSkin)
                    {
                        li.Selected = true;
                    }

                    dd_skins.Items.Add(li);
                }

                if (!string.IsNullOrEmpty(Skinning.GetCurrentSkinAlias(_templateId)))
                {
                    ph_rollback.Visible = true;
                }
            }
        }
예제 #5
0
        override protected void OnInit(EventArgs e)
        {
            _template = new cms.businesslogic.template.Template(int.Parse(Request.QueryString["templateID"]));
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
            Panel1.hasMenu = true;

            uicontrols.MenuIconI save = Panel1.Menu.NewIcon();
            save.ImageURL       = SystemDirectories.Umbraco + "/images/editor/save.gif";
            save.OnClickCommand = "doSubmit()";
            save.AltText        = ui.Text("save");

            Panel1.Text            = ui.Text("edittemplate");
            pp_name.Text           = ui.Text("name", base.getUser());
            pp_alias.Text          = ui.Text("alias", base.getUser());
            pp_masterTemplate.Text = ui.Text("mastertemplate", base.getUser());

            // Editing buttons
            Panel1.Menu.InsertSplitter();
            uicontrols.MenuIconI umbField = Panel1.Menu.NewIcon();
            umbField.ImageURL       = UmbracoPath + "/images/editor/insField.gif";
            umbField.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDATA", ui.Text("template", "insertPageField"), 640, 550);
            umbField.AltText        = ui.Text("template", "insertPageField");

            // TODO: Update icon
            uicontrols.MenuIconI umbDictionary = Panel1.Menu.NewIcon();
            umbDictionary.ImageURL       = GlobalSettings.Path + "/images/editor/dictionaryItem.gif";
            umbDictionary.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/umbracoField.aspx?objectId=" + editorSource.ClientID + "&tagName=UMBRACOGETDICTIONARY", ui.Text("template", "insertDictionaryItem"), 640, 550);
            umbDictionary.AltText        = "Insert umbraco dictionary item";

            //uicontrols.MenuIconI umbMacro = Panel1.Menu.NewIcon();
            //umbMacro.ImageURL = UmbracoPath + "/images/editor/insMacro.gif";
            //umbMacro.AltText = ui.Text("template", "insertMacro");
            //umbMacro.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/editMacro.aspx?objectId=" + editorSource.ClientID, ui.Text("template", "insertMacro"), 470, 530);

            Panel1.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40);


            if (UmbracoSettings.UseAspNetMasterPages)
            {
                Panel1.Menu.InsertSplitter();

                uicontrols.MenuIconI umbContainer = Panel1.Menu.NewIcon();
                umbContainer.ImageURL       = UmbracoPath + "/images/editor/masterpagePlaceHolder.gif";
                umbContainer.AltText        = ui.Text("template", "insertContentAreaPlaceHolder");
                umbContainer.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/insertMasterpagePlaceholder.aspx?&id=" + _template.Id.ToString(), ui.Text("template", "insertContentAreaPlaceHolder"), 470, 320);

                uicontrols.MenuIconI umbContent = Panel1.Menu.NewIcon();
                umbContent.ImageURL       = UmbracoPath + "/images/editor/masterpageContent.gif";
                umbContent.AltText        = ui.Text("template", "insertContentArea");
                umbContent.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/insertMasterpageContent.aspx?id=" + _template.Id.ToString(), ui.Text("template", "insertContentArea"), 470, 300);
            }


            //Spit button
            Panel1.Menu.InsertSplitter();
            Panel1.Menu.NewElement("div", "splitButtonPlaceHolder", "sbPlaceHolder", 40);

            if (Skinning.StarterKitGuid(_template.Id).HasValue)
            {
                Panel1.Menu.InsertSplitter();
                uicontrols.MenuIconI umbContainer = Panel1.Menu.NewIcon();
                umbContainer.ImageURL = UmbracoPath + "/images/editor/skin.gif";
                umbContainer.AltText  = ui.Text("template", "modifyTemplateSkin");
                //umbContainer.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/TemplateSkinning.aspx?&id=" + _template.Id.ToString(), ui.Text("template", "modifyTemplateSkin"), 570, 420);
                umbContainer.OnClickCommand = "window.open('" + GlobalSettings.Path + "/canvas.aspx?redir=" + this.ResolveUrl("~/") + "&umbSkinning=true&umbSkinningConfigurator=true" + "','canvas')";
            }



            // Help
            Panel1.Menu.InsertSplitter();

            uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon();
            helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" + _template.Alias, ui.Text("template", "quickGuide"), 600, 580);
            helpIcon.ImageURL       = UmbracoPath + "/images/editor/help.png";
            helpIcon.AltText        = ui.Text("template", "quickGuide");
        }
예제 #6
0
        protected void LoadSkins()
        {
            List <string> skinNames = new List <string>();

            Guid?nullable = Skinning.StarterKitGuid(Node.GetCurrent().template);

            if (nullable.HasValue)
            {
                InstalledPackage p = InstalledPackage.GetByGuid(nullable.Value.ToString());
                if (p.Data.SkinRepoGuid != null && p.Data.SkinRepoGuid != Guid.Empty && p.Data.SkinRepoGuid.ToString() != repoGuid)
                {
                    this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(p.Data.SkinRepoGuid.ToString());
                }
            }

            if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template)))
            {
                this.pChangeSkin.Visible = false;
            }
            else if (this.repo.HasConnection())
            {
                try
                {
                    var skins = this.repo.Webservice.Skins(nullable.ToString());
                    this.rep_starterKitDesigns.DataSource = skins;
                    this.rep_starterKitDesigns.DataBind();

                    foreach (var s in skins)
                    {
                        if (!skinNames.Contains(s.Text))
                        {
                            skinNames.Add(s.Text);
                        }
                    }
                }
                catch (Exception exception)
                {
                    LogHelper.Error <SkinCustomizer>("An error occurred", exception);
                }
            }
            else
            {
                this.ShowConnectionError();
            }

            //check for local skins

            List <string> localSkins = new List <string>();
            DirectoryInfo dirInfo    = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages));

            foreach (DirectoryInfo subDur in dirInfo.GetDirectories())
            {
                var skinFile = subDur.GetFiles("skin.xml");

                if (skinFile.Length > 0)
                {
                    string c = Skin.GetSkinNameFromFile(skinFile[0].FullName);

                    if (!skinNames.Contains(c))
                    {
                        localSkins.Add(c);
                    }
                }
            }

            if (localSkins.Count > 0)
            {
                rep_starterKitDesignsLocal.DataSource = localSkins;
                rep_starterKitDesignsLocal.DataBind();
            }
            else
            {
                localSkinsContainer.Visible = false;
            }
        }