コード例 #1
0
 public virtual FunctionalityInfo this[ ClientAPI.ClientFunctionality functionality ]
 {
     get
     {
         FunctionalityInfo _fInfo = null;
         foreach( FunctionalityInfo fInfo in List )
         {
             if( fInfo.Functionality == functionality )
             {
                 _fInfo = fInfo;
                 break;
             }
         }
         return _fInfo;
     }
     set
     {
         bool bFound = false;
         foreach( FunctionalityInfo fInfo in List )
         {
             if( fInfo.Functionality == functionality )
             {
                 //fInfo = value;
                 bFound = true;
                 break;
             }
         }
         if( ! bFound )
         {
             throw new Exception( "Item Not Found" );
         }
     }
 }
コード例 #2
0
        public static void SetMinMaxContentVisibile(Control objButton, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType, bool Value)
        {
            if (HttpContext.Current != null)
            {
                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.Page:

                    ClientAPI.RegisterClientVariable(objButton.Page, objButton.ClientID + ":exp", Convert.ToInt32(Value).ToString(), true);
                    break;

                case MinMaxPersistanceType.Cookie:

                    HttpCookie objModuleVisible = new HttpCookie("_Module" + intModuleId + "_Visible");
                    if (objModuleVisible != null)
                    {
                        objModuleVisible.Value   = Value.ToString().ToLower();
                        objModuleVisible.Expires = DateTime.MaxValue;     // never expires
                        HttpContext.Current.Response.AppendCookie(objModuleVisible);
                    }
                    break;
                }
            }
        }
コード例 #3
0
        /// <Summary>
        /// Allows any module to have drag and drop functionality enabled
        /// </Summary>
        /// <Param name="objTitle">
        /// Title element that responds to the click and dragged
        /// </Param>
        public static void EnableContainerDragAndDrop(Control objTitle, Control objContainer, int ModuleID)
        {
            if (ClientAPI.ClientAPIDisabled() == false && ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.Positioning))
            {
                AddBodyOnloadEventHandler(objTitle.Page, "__dnn_enableDragDrop()");
                ClientAPI.RegisterClientReference(objTitle.Page, ClientAPI.ClientNamespaceReferences.dnn_dom_positioning);
                ClientAPI.RegisterClientVariable(objTitle.Page, "__dnn_dragDrop", objContainer.ClientID + " " + objTitle.ClientID + " " + ModuleID + ";", false);

                string         strPanes          = "";
                string         strPaneNames      = "";
                PortalSettings objPortalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
                foreach (string strPane in objPortalSettings.ActiveTab.Panes)
                {
                    Control objCtl = Common.Globals.FindControlRecursive(objContainer.Parent, strPane);
                    if (objCtl != null)
                    {
                        strPanes += objCtl.ClientID + ";";
                    }
                    strPaneNames += strPane + ";";
                }
                ClientAPI.RegisterClientVariable(objTitle.Page, "__dnn_Panes", strPanes, true);
                ClientAPI.RegisterClientVariable(objTitle.Page, "__dnn_PaneNames", strPaneNames, true);
            }
        }
コード例 #4
0
        public static void RegisterClientReference(Page page, ClientAPI.ClientNamespaceReferences reference)
        {
            switch (reference)
            {
                case ClientAPI.ClientNamespaceReferences.dnn:
                case ClientAPI.ClientNamespaceReferences.dnn_dom:
                    if (HttpContextSource.Current.Items.Contains(LegacyPrefix + "dnn.js"))
                    {
                        break;
                    }

                    ClientResourceManager.RegisterScript(page, ClientAPI.ScriptPath + "dnn.js", 12);
                    HttpContextSource.Current.Items.Add(LegacyPrefix + "dnn.js", true);

                    if (!ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.SingleCharDelimiters))
                    {
                        ClientAPI.RegisterClientVariable(page, "__scdoff", "1", true);
                    }

                    if (!ClientAPI.UseExternalScripts)
                    {
                        ClientAPI.RegisterEmbeddedResource(page, "dnn.scripts.js", typeof (ClientAPI));
                    }
                    break;
                case ClientAPI.ClientNamespaceReferences.dnn_dom_positioning:
                    RegisterClientReference(page, ClientAPI.ClientNamespaceReferences.dnn);
                    ClientResourceManager.RegisterScript(page, ClientAPI.ScriptPath + "dnn.dom.positioning.js", 13);
                    break;
            }
        }
コード例 #5
0
ファイル: ClientAPI.cs プロジェクト: rose-nneka/Dnn.Platform
        public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                        int intAnimationFrames, string strPersonalizationNamingCtr, string strPersonalizationKey)
        {
            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
            {
                JavaScript.RegisterClientReference(objButton.Page, ClientAPI.ClientNamespaceReferences.dnn_dom);
                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.None:
                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                    if (!String.IsNullOrEmpty(strMinIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }
                    break;

                case MinMaxPersistanceType.Page:
                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                    if (!String.IsNullOrEmpty(strMinIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }
                    break;

                case MinMaxPersistanceType.Cookie:
                    if (intModuleId != -1)
                    {
                        AddAttribute(objButton, "onclick", "if (__dnn_ContainerMaxMin_OnClick(this, '" + objContent.ClientID + "')) return false;");
                        ClientAPI.RegisterClientVariable(objButton.Page, "containerid_" + objContent.ClientID, intModuleId.ToString(), true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "cookieid_" + objContent.ClientID, "_Module" + intModuleId + "_Visible", true);

                        ClientAPI.RegisterClientVariable(objButton.Page, "min_icon_" + intModuleId, strMinIconLoc, true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "max_icon_" + intModuleId, strMaxIconLoc, true);

                        ClientAPI.RegisterClientVariable(objButton.Page, "max_text", Localization.GetString("Maximize"), true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "min_text", Localization.GetString("Minimize"), true);

                        if (blnDefaultMin)
                        {
                            ClientAPI.RegisterClientVariable(objButton.Page, "__dnn_" + intModuleId + ":defminimized", "true", true);
                        }
                    }
                    break;

                case MinMaxPersistanceType.Personalization:
                    //Regardless if we determine whether or not the browser supports client-side personalization
                    //we need to store these keys to properly display or hide the content (They are needed in MinMaxContentVisible)
                    AddAttribute(objButton, "userctr", strPersonalizationNamingCtr);
                    AddAttribute(objButton, "userkey", strPersonalizationKey);
                    if (EnableClientPersonalization(strPersonalizationNamingCtr, strPersonalizationKey, objButton.Page))
                    {
                        AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");
                        if (!String.IsNullOrEmpty(strMinIconLoc))
                        {
                            AddAttribute(objButton, "max_icon", strMaxIconLoc);
                            AddAttribute(objButton, "min_icon", strMinIconLoc);
                        }
                    }
                    break;
                }
            }
            if (MinMaxContentVisibile(objButton, intModuleId, blnDefaultMin, ePersistanceType))
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", "");
                }
                else
                {
                    objContent.Visible = true;
                }
                if (!String.IsNullOrEmpty(strMinIconLoc))
                {
                    SetMinMaxProperties(objButton, strMinIconLoc, Localization.GetString("Minimize"), Localization.GetString("Minimize"));
                }
            }
            else
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", "none");
                }
                else
                {
                    objContent.Visible = false;
                }
                if (!String.IsNullOrEmpty(strMaxIconLoc))
                {
                    SetMinMaxProperties(objButton, strMaxIconLoc, Localization.GetString("Maximize"), Localization.GetString("Maximize"));
                }
            }
            if (intAnimationFrames != 5)
            {
                ClientAPI.RegisterClientVariable(objButton.Page, "animf_" + objContent.ClientID, intAnimationFrames.ToString(), true);
            }
        }
コード例 #6
0
 public ClientAPIPostBackControl(Page objPage, string strEventName, PostBackEvent objDelegate)
 {
     this.m_oEventHandlers = new Hashtable();
     ClientAPI.GetPostBackClientEvent(objPage, this, "");
     this.AddEventHandler(strEventName, objDelegate);
 }
コード例 #7
0
 private static void AddBodyOnLoad(Page objPage, string scriptKey, string strJSFunction)
 {
     ClientAPI.RegisterClientReference(objPage, ClientAPI.ClientNamespaceReferences.dnn);
     objPage.ClientScript.RegisterStartupScript(objPage.GetType(), scriptKey, strJSFunction, true);
 }
コード例 #8
0
        public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType, int intAnimationFrames)
        {
            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
            {
                ClientAPI.RegisterClientReference(objButton.Page, ClientAPI.ClientNamespaceReferences.dnn_dom);

                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.None:

                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");

                    // HACK : Modified to not error if object is null.
                    //if (strMinIconLoc.Length > 0)
                    if (!String.IsNullOrEmpty(strMaxIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }
                    break;

                case MinMaxPersistanceType.Page:

                    AddAttribute(objButton, "onclick", "if (__dnn_SectionMaxMin(this,  '" + objContent.ClientID + "')) return false;");

                    // HACK : Modified to not error if object is null.
                    //if (strMinIconLoc.Length > 0)
                    if (!String.IsNullOrEmpty(strMaxIconLoc))
                    {
                        AddAttribute(objButton, "max_icon", strMaxIconLoc);
                        AddAttribute(objButton, "min_icon", strMinIconLoc);
                    }
                    break;

                case MinMaxPersistanceType.Cookie:

                    if (intModuleId != -1)
                    {
                        AddAttribute(objButton, "onclick", "if (__dnn_ContainerMaxMin_OnClick(this, '" + objContent.ClientID + "')) return false;");
                        AddAttribute(objButton, "containerid", intModuleId.ToString());
                        AddAttribute(objButton, "cookieid", "_Module" + intModuleId + "_Visible");     //needed to set cookie on the client side

                        ClientAPI.RegisterClientVariable(objButton.Page, "min_icon_" + intModuleId, strMinIconLoc, true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "max_icon_" + intModuleId, strMaxIconLoc, true);

                        ClientAPI.RegisterClientVariable(objButton.Page, "max_text", Localization.GetString("Maximize"), true);
                        ClientAPI.RegisterClientVariable(objButton.Page, "min_text", Localization.GetString("Minimize"), true);

                        if (blnDefaultMin)
                        {
                            ClientAPI.RegisterClientVariable(objButton.Page, "__dnn_" + intModuleId + ":defminimized", "true", true);
                        }
                    }
                    break;
                }
            }

            if (GetMinMaxContentVisibile(objButton, intModuleId, blnDefaultMin, ePersistanceType))
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", "");
                }
                else
                {
                    objContent.Visible = true;
                }

                // HACK : Modified to not error if object is null.
                //if (strMinIconLoc.Length > 0)
                if (!String.IsNullOrEmpty(strMaxIconLoc))
                {
                    SetMinMaxProperties(objButton, strMinIconLoc, Localization.GetString("Minimize"), Localization.GetString("Minimize"));
                }
            }
            else
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    AddStyleAttribute(objContent, "display", "none");
                }
                else
                {
                    objContent.Visible = false;
                }

                // HACK : Modified to not error if object is null.
                //if (strMaxIconLoc.Length > 0)
                if (!String.IsNullOrEmpty(strMaxIconLoc))
                {
                    SetMinMaxProperties(objButton, strMaxIconLoc, Localization.GetString("Maximize"), Localization.GetString("Maximize"));
                }
            }

            if (intAnimationFrames != 5)
            {
                AddAttribute(objButton, "animf", intAnimationFrames.ToString());
            }
        }