예제 #1
0
        private void AddToolbarButton(umbracoPage page)
        {
            int pageId;

            int.TryParse(HttpContext.Current.Request.QueryString["id"], out pageId);

            // TODO: Hack for differing querystrings / consolidate
            if (pageId == 0)
            {
                int.TryParse(HttpContext.Current.Request.QueryString["templateID"], out pageId);
            }
            if (pageId == 0)
            {
                int.TryParse(HttpContext.Current.Request.QueryString["macroID"], out pageId);
            }

            var menu = (ScrollingMenu)Utility.FindControl <Control>((Control c) => c.ClientID.EndsWith("_menu"), page.Page);

            if (menu == null)
            {
                var tabView = (TabView)Utility.FindControl <Control>((Control c) => c.ID == "TabView1", page.Page);

                foreach (TabPage page3 in tabView.GetPanels())
                {
                    page3.Menu.InsertSplitter();
                    AddMenuIcon(page3.Menu, page, pageId);
                }
            }
            else
            {
                menu.InsertSplitter();
                AddMenuIcon(menu, page, pageId);
            }
        }
예제 #2
0
        void umbracoPage_Load(object sender, EventArgs e)
        {
            umbracoPage pageReference = (umbracoPage)sender;

            string path = pageReference.Page.Request.Path.ToLower();


            if (path.EndsWith("settings/views/editview.aspx") == true || path.EndsWith("settings/edittemplate.aspx"))
            {
                bool webforms = path.EndsWith("settings/edittemplate.aspx");

                Control c2 = GetPanel1Control(pageReference);

                if (c2 != null)
                {
                    UmbracoPanel panel = (UmbracoPanel)c2;

                    //Insert splitter in menu to make menu nicer on the eye
                    panel.Menu.InsertSplitter();

                    //Add new image button
                    ImageButton bundleBtn = panel.Menu.NewImageButton();
                    bundleBtn.ToolTip       = "Create script/style bundle";
                    bundleBtn.ImageUrl      = webforms ? "../../App_Plugins/Optimus/Icons/bundle_menu_icon.png" : "../../../App_Plugins/Optimus/Icons/bundle_menu_icon.png";
                    bundleBtn.OnClientClick = webforms ?
                                              @"var selection = UmbEditor.IsSimpleEditor? jQuery('#body_editorSource').getSelection().text : UmbEditor._editor.getSelection();
                                                UmbClientMgr.openModalWindow('/App_Plugins/Optimus/Dialog?webforms=true&snippet='+selection, 'Create Bundle', true, 550, 350);
                                                return false;"
                                                :
                                              @"var selection = UmbEditor.IsSimpleEditor? jQuery('#body_editorSource').getSelection().text : UmbEditor._editor.getSelection();
                                                UmbClientMgr.openModalWindow('/App_Plugins/Optimus/Dialog?snippet='+selection, 'Create Bundle', true, 550, 350);
                                                return false;"                                                                                                                                                                                                                                                                                                                                                ;
                }
            }
        }
예제 #3
0
        private void AddMenuIcon(ScrollingMenu menu, umbracoPage page, int pageId)
        {
            var title = Configuration.GetUmbracoObjectsByPagePath(page.Request.Path).First().Name + " Usages";

            MenuIconI ni = menu.NewIcon();

            ni.AltText        = "View Usages";
            ni.OnClickCommand = string.Format("UmbClientMgr.openModalWindow('plugins/census/usages.aspx?sourcePage={0}&sourceId={1}', '{2}', true, 600, 500, 0, 0); return false;", page.Request.Path, pageId, title);
            ni.ImageURL       = string.Concat(Configuration.PluginDirectory, "census-toolbar-icon.png");

            TweakMenuButton(ref page);
        }
예제 #4
0
        private void TweakMenuButton(ref umbracoPage page)
        {
            // Fix CSS cursor
            var js = @"<script type='text/javascript'>
            $(document).ready(function() {
                $('.editorIcon[alt]').each(
                    function() { 
                        if ($(this).attr('alt').indexOf('View Usages') != -1) {
                            $(this).css('cursor', 'pointer');
                        } });
                    });
            </script>";

            page.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "censusJsFixCursor", js);

            // Fix positioning on TinyMCE pages
            var css = "<style type='text/css'>.mceToolbarExternal{padding-left: 15px;}</style>";

            page.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "censusCssFixPositioning", css);
        }
예제 #5
0
        private Control GetPanel1Control(umbracoPage up)
        {
            var cph = (ContentPlaceHolder)up.FindControl("body");

            return(CompatibilityHelper.IsVersion7OrNewer ? cph.FindControl("body_Panel1_container") : cph.FindControl("Panel1"));
        }
예제 #6
0
        private Control GetPanel1Control(umbracoPage up)
        {
            ContentPlaceHolder cph = (ContentPlaceHolder)up.FindControl("body");

            return(cph.FindControl("Panel1"));
        }