Exemplo n.º 1
0
        public static bool GetMinMaxContentVisibile( Control objButton, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType )
        {
            if( HttpContext.Current != null )
            {
                switch( ePersistanceType )
                {
                    case MinMaxPersistanceType.Page:

                        string sExpanded = ClientAPI.GetClientVariable( objButton.Page, objButton.ClientID + ":exp" );
                        if( !String.IsNullOrEmpty( sExpanded ) )
                        {
                            bool boolResult;
                            if(Boolean.TryParse( sExpanded, out boolResult ))
                            {
                                return boolResult;
                            }
                            return !blnDefaultMin;
                        }
                        else
                        {
                            return ! blnDefaultMin;
                        }
                        
                    case MinMaxPersistanceType.Cookie:

                        if( intModuleId != - 1 )
                        {
                            HttpCookie objModuleVisible = HttpContext.Current.Request.Cookies["_Module" + intModuleId + "_Visible"];
                            if( objModuleVisible != null )
                            {
                                return objModuleVisible.Value != "false";
                            }
                            else
                            {
                                return ! blnDefaultMin;
                            }
                        }
                        else
                        {
                            return true;
                        }
                        
                    case MinMaxPersistanceType.None:

                        return ! blnDefaultMin;
                }
            }
            
            return false;
            
        }
Exemplo n.º 2
0
 public static bool MinMaxContentVisibile(Control objButton, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     if (HttpContext.Current != null)
     {
         switch (ePersistanceType)
         {
             case MinMaxPersistanceType.Page:
                 string sExpanded = ClientAPI.GetClientVariable(objButton.Page, objButton.ClientID + ":exp");
                 if (!String.IsNullOrEmpty(sExpanded))
                 {
                     return sExpanded == "1" ? true : false;
                 }
                 else
                 {
                     return !blnDefaultMin;
                 }
             case MinMaxPersistanceType.Cookie:
                 if (intModuleId != -1)
                 {
                     HttpCookie objModuleVisible = HttpContext.Current.Request.Cookies["_Module" + intModuleId + "_Visible"];
                     if (objModuleVisible != null)
                     {
                         return objModuleVisible.Value != "false";
                     }
                     else
                     {
                         return !blnDefaultMin;
                     }
                 }
                 else
                 {
                     return true;
                 }
             case MinMaxPersistanceType.Personalization:
                 string strVisible = Convert.ToString(Personalization.GetProfile(Globals.GetAttribute(objButton, "userctr"), Globals.GetAttribute(objButton, "userkey")));
                 if (string.IsNullOrEmpty(strVisible))
                 {
                     return blnDefaultMin;
                 }
                 else
                 {
                     return Convert.ToBoolean(strVisible);
                 }
             default:
                 return !blnDefaultMin;
         }
     }
     return Null.NullBoolean;
 }
Exemplo n.º 3
0
 public static void MinMaxContentVisibile(Control objButton, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType, bool value)
 {
     MinMaxContentVisibile(objButton, -1, blnDefaultMin, ePersistanceType, value);
 }
Exemplo n.º 4
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;
                }
            }
        }
Exemplo n.º 5
0
        public static bool MinMaxContentVisibile(Control objButton, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
        {
            if (HttpContext.Current != null)
            {
                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.Page:
                    string sExpanded = ClientAPI.GetClientVariable(objButton.Page, objButton.ClientID + ":exp");
                    if (!String.IsNullOrEmpty(sExpanded))
                    {
                        return(sExpanded == "1" ? true : false);
                    }
                    else
                    {
                        return(!blnDefaultMin);
                    }

                case MinMaxPersistanceType.Cookie:
                    if (intModuleId != -1)
                    {
                        HttpCookie objModuleVisible = HttpContext.Current.Request.Cookies["_Module" + intModuleId + "_Visible"];
                        if (objModuleVisible != null)
                        {
                            return(objModuleVisible.Value != "false");
                        }
                        else
                        {
                            return(!blnDefaultMin);
                        }
                    }
                    else
                    {
                        return(true);
                    }

                case MinMaxPersistanceType.Personalization:
                    string strVisible = Convert.ToString(Personalization.GetProfile(Globals.GetAttribute(objButton, "userctr"), Globals.GetAttribute(objButton, "userkey")));
                    if (string.IsNullOrEmpty(strVisible))
                    {
                        return(blnDefaultMin);
                    }
                    else
                    {
                        return(Convert.ToBoolean(strVisible));
                    }

                default:
                    return(!blnDefaultMin);
                }
            }
            return(Null.NullBoolean);
        }
Exemplo n.º 6
0
 public static bool MinMaxContentVisibile(Control objButton, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     return(MinMaxContentVisibile(objButton, -1, blnDefaultMin, ePersistanceType));
 }
Exemplo n.º 7
0
 public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                 int intAnimationFrames)
 {
     EnableMinMax(objButton, objContent, intModuleId, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType, intAnimationFrames, null, null);
 }
Exemplo n.º 8
0
 public static void EnableMinMax(Control objButton, Control objContent, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType)
 {
     EnableMinMax(objButton, objContent, -1, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType);
 }
Exemplo n.º 9
0
 public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     EnableMinMax(objButton, objContent, intModuleId, blnDefaultMin, "", "", ePersistanceType);
 }
Exemplo n.º 10
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Allows a button and a content area to support client side min/max functionality.
 /// </summary>
 /// <param name="objButton">Control that when clicked causes content area to be hidden/shown.</param>
 /// <param name="objContent">Content area that is hidden/shown.</param>
 /// <param name="blnDefaultMin">If content area is to be defaulted to minimized pass in true.</param>
 /// <param name="ePersistanceType">How to store current state of min/max.  Cookie, Page, None.</param>
 /// <remarks>
 /// This method's purpose is to provide a higher level of abstraction between the ClientAPI and the module developer.
 /// </remarks>
 public static void EnableMinMax(Control objButton, Control objContent, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     EnableMinMax(objButton, objContent, -1, blnDefaultMin, string.Empty, string.Empty, ePersistanceType);
 }
Exemplo n.º 11
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;
                }
            }
        }
Exemplo n.º 12
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());
            }
        }
Exemplo n.º 13
0
        public static bool GetMinMaxContentVisibile(Control objButton, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
        {
            if (HttpContext.Current != null)
            {
                switch (ePersistanceType)
                {
                case MinMaxPersistanceType.Page:

                    string sExpanded = ClientAPI.GetClientVariable(objButton.Page, objButton.ClientID + ":exp");
                    if (!String.IsNullOrEmpty(sExpanded))
                    {
                        bool boolResult;
                        if (Boolean.TryParse(sExpanded, out boolResult))
                        {
                            return(boolResult);
                        }
                        return(!blnDefaultMin);
                    }
                    else
                    {
                        return(!blnDefaultMin);
                    }

                case MinMaxPersistanceType.Cookie:

                    if (intModuleId != -1)
                    {
                        HttpCookie objModuleVisible = HttpContext.Current.Request.Cookies["_Module" + intModuleId + "_Visible"];
                        if (objModuleVisible != null)
                        {
                            return(objModuleVisible.Value != "false");
                        }
                        else
                        {
                            return(!blnDefaultMin);
                        }
                    }
                    else
                    {
                        return(true);
                    }

                case MinMaxPersistanceType.None:

                    return(!blnDefaultMin);
                }
            }

            return(false);
        }
Exemplo n.º 14
0
 public static void MinMaxContentVisibile(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:
                 var objModuleVisible = new HttpCookie("_Module" + intModuleId + "_Visible");
                 if (objModuleVisible != null)
                 {
                     objModuleVisible.Value = value.ToString().ToLower();
                     objModuleVisible.Expires = DateTime.MaxValue;
                     HttpContext.Current.Response.AppendCookie(objModuleVisible);
                 }
                 break;
             case MinMaxPersistanceType.Personalization:
                 Personalization.SetProfile(Globals.GetAttribute(objButton, "userctr"), Globals.GetAttribute(objButton, "userkey"), value.ToString());
                 break;
         }
     }
 }
Exemplo n.º 15
0
 public static void EnableMinMax(Control objButton, Control objContent, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType)
 {
     EnableMinMax(objButton, objContent, -1, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType);
 }
Exemplo n.º 16
0
 public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     EnableMinMax(objButton, objContent, intModuleId, blnDefaultMin, "", "", ePersistanceType);
 }
Exemplo n.º 17
0
 public static void EnableMinMax(Control objButton, Control objContent, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                 string strPersonalizationNamingCtr, string strPersonalizationKey)
 {
     EnableMinMax(objButton, objContent, -1, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType, 5, strPersonalizationNamingCtr, strPersonalizationKey);
 }
Exemplo n.º 18
0
 public static void EnableMinMax(Control objButton, Control objContent, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                 string strPersonalizationNamingCtr, string strPersonalizationKey)
 {
     EnableMinMax(objButton, objContent, -1, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType, 5, strPersonalizationNamingCtr, strPersonalizationKey);
 }
Exemplo n.º 19
0
 public static void EnableMinMax(Control objButton, Control objContent, int intModuleId, bool blnDefaultMin, string strMinIconLoc, string strMaxIconLoc, MinMaxPersistanceType ePersistanceType,
                                 int intAnimationFrames)
 {
     EnableMinMax(objButton, objContent, intModuleId, blnDefaultMin, strMinIconLoc, strMaxIconLoc, ePersistanceType, intAnimationFrames, null, null);
 }
Exemplo n.º 20
0
        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);
            }
        }
Exemplo n.º 21
0
        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))
            {
                ClientAPI.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);
            }
        }
Exemplo n.º 22
0
 public static void MinMaxContentVisibile(Control objButton, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType, bool value)
 {
     MinMaxContentVisibile(objButton, -1, blnDefaultMin, ePersistanceType, value);
 }
Exemplo n.º 23
0
 public static bool MinMaxContentVisibile(Control objButton, bool blnDefaultMin, MinMaxPersistanceType ePersistanceType)
 {
     return MinMaxContentVisibile(objButton, -1, blnDefaultMin, ePersistanceType);
 }
Exemplo n.º 24
0
        public static void MinMaxContentVisibile(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:
                    var objModuleVisible = new HttpCookie("_Module" + intModuleId + "_Visible", value.ToString().ToLowerInvariant())
                    {
                        Expires = DateTime.MaxValue,
                        Path    = (!string.IsNullOrEmpty(Common.Globals.ApplicationPath) ? Common.Globals.ApplicationPath : "/")
                    };
                    HttpContext.Current.Response.AppendCookie(objModuleVisible);
                    break;

                case MinMaxPersistanceType.Personalization:
                    Personalization.SetProfile(Globals.GetAttribute(objButton, "userctr"), Globals.GetAttribute(objButton, "userkey"), value.ToString());
                    break;
                }
            }
        }
Exemplo n.º 25
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());
            }
        }