Exemple #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnLoad runs just before the Skin is rendered.
        /// </summary>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            this.InvokeSkinEvents(SkinEventType.OnSkinPreRender);
            var isSpecialPageMode = UrlUtils.InPopUp() || this.Request.QueryString["dnnprintmode"] == "true";

            if (TabPermissionController.CanAddContentToPage() && Globals.IsEditMode() && !isSpecialPageMode)
            {
                // Register Drag and Drop plugin
                JavaScript.RequestRegistration(CommonJs.DnnPlugins);
                ClientResourceManager.RegisterStyleSheet(this.Page, "~/resources/shared/stylesheets/dnn.dragDrop.css", FileOrder.Css.FeatureCss);
                ClientResourceManager.RegisterScript(this.Page, "~/resources/shared/scripts/dnn.dragDrop.js");

                // Register Client Script
                var sb = new StringBuilder();
                sb.AppendLine(" (function ($) {");
                sb.AppendLine("     $(document).ready(function () {");
                sb.AppendLine("         $('.dnnSortable').dnnModuleDragDrop({");
                sb.AppendLine("             tabId: " + this.PortalSettings.ActiveTab.TabID + ",");
                sb.AppendLine("             draggingHintText: '" + Localization.GetSafeJSString("DraggingHintText", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dragHintText: '" + Localization.GetSafeJSString("DragModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropHintText: '" + Localization.GetSafeJSString("DropModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropTargetText: '" + Localization.GetSafeJSString("DropModuleTarget", Localization.GlobalResourceFile) + "'");
                sb.AppendLine("         });");
                sb.AppendLine("     });");
                sb.AppendLine(" } (jQuery));");

                var script = sb.ToString();
                if (ScriptManager.GetCurrent(this.Page) != null)
                {
                    // respect MS AJAX
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "DragAndDrop", script, true);
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "DragAndDrop", script, true);
                }
            }
        }
Exemple #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// OnLoad runs just before the Skin is rendered.
        /// </summary>
        /// <history>
        ///     [cnurse]    04/17/2009  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            InvokeSkinEvents(SkinEventType.OnSkinPreRender);

            if (TabPermissionController.CanAddContentToPage() && Globals.IsEditMode() && !HttpContext.Current.Request.Url.ToString().Contains("popUp=true"))
            {
                //Register Drag and Drop plugin
                jQuery.RegisterDnnJQueryPlugins(Page);
                ClientResourceManager.RegisterStyleSheet(Page, "~/resources/shared/stylesheets/dnn.dragDrop.css", FileOrder.Css.FeatureCss);
                ClientResourceManager.RegisterScript(Page, "~/resources/shared/scripts/dnn.dragDrop.js");

                //Register Client Script
                var sb = new StringBuilder();
                sb.AppendLine(" (function ($) {");
                sb.AppendLine("     $(document).ready(function () {");
                sb.AppendLine("         $('.dnnSortable').dnnModuleDragDrop({");
                sb.AppendLine("             tabId: " + PortalSettings.ActiveTab.TabID + ",");
                sb.AppendLine("             draggingHintText: '" + Localization.GetSafeJSString("DraggingHintText", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dragHintText: '" + Localization.GetSafeJSString("DragModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropHintText: '" + Localization.GetSafeJSString("DropModuleHint", Localization.GlobalResourceFile) + "',");
                sb.AppendLine("             dropTargetText: '" + Localization.GetSafeJSString("DropModuleTarget", Localization.GlobalResourceFile) + "'");
                sb.AppendLine("         });");
                sb.AppendLine("     });");
                sb.AppendLine(" } (jQuery));");

                var script = sb.ToString();
                if (ScriptManager.GetCurrent(Page) != null)
                {
                    // respect MS AJAX
                    ScriptManager.RegisterStartupScript(Page, GetType(), "DragAndDrop", script, true);
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "DragAndDrop", script, true);
                }
            }
        }
Exemple #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ProcessPane processes the Attributes for the PaneControl
        /// </summary>
        /// -----------------------------------------------------------------------------
        public void ProcessPane()
        {
            if (PaneControl != null)
            {
                //remove excess skin non-validating attributes
                PaneControl.Attributes.Remove("ContainerType");
                PaneControl.Attributes.Remove("ContainerName");
                PaneControl.Attributes.Remove("ContainerSrc");

                if (Globals.IsLayoutMode())
                {
                    PaneControl.Visible = true;

                    //display pane border
                    string cssclass = PaneControl.Attributes["class"];
                    if (string.IsNullOrEmpty(cssclass))
                    {
                        PaneControl.Attributes["class"] = CPaneOutline;
                    }
                    else
                    {
                        PaneControl.Attributes["class"] = cssclass.Replace(CPaneOutline, "").Trim().Replace("  ", " ") + " " + CPaneOutline;
                    }
                    //display pane name
                    var ctlLabel = new Label {
                        Text = "<center>" + Name + "</center><br />", CssClass = "SubHead"
                    };
                    PaneControl.Controls.AddAt(0, ctlLabel);
                }
                else
                {
                    if (PaneControl.Visible == false && TabPermissionController.CanAddContentToPage())
                    {
                        PaneControl.Visible = true;
                    }

                    if (CanCollapsePane())
                    {
                        //This pane has no controls so set the width to 0
                        if (PaneControl.Attributes["style"] != null)
                        {
                            PaneControl.Attributes.Remove("style");
                        }
                        if (PaneControl.Attributes["class"] != null)
                        {
                            PaneControl.Attributes["class"] = PaneControl.Attributes["class"] + " DNNEmptyPane";
                        }
                        else
                        {
                            PaneControl.Attributes["class"] = "DNNEmptyPane";
                        }
                    }

                    //Add support for drag and drop
                    if (Globals.IsEditMode()) // this call also checks for permission
                    {
                        if (PaneControl.Attributes["class"] != null)
                        {
                            PaneControl.Attributes["class"] = PaneControl.Attributes["class"] + " dnnSortable";
                        }
                        else
                        {
                            PaneControl.Attributes["class"] = "dnnSortable";
                        }
                    }
                }
            }
        }
Exemple #4
0
        private bool ProcessModule(ModuleInfo module)
        {
            bool success = true;

            if (ModulePermissionController.CanViewModule(module) && module.IsDeleted == false &&
                ((module.StartDate < DateTime.Now && module.EndDate > DateTime.Now) || Globals.IsLayoutMode() || Globals.IsEditMode()))
            {
                Pane pane = GetPane(module);

                if (pane != null)
                {
                    success = InjectModule(pane, module);
                }
                else
                {
                    var lex = new ModuleLoadException(Localization.GetString("PaneNotFound.Error"));
                    Controls.Add(new ErrorContainer(PortalSettings, MODULELOAD_ERROR, lex).Container);
                    Exceptions.LogException(lex);
                }
            }
            return(success);
        }