Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Allows the scroll position on the page to be moved to the top of the passed in control.
 /// </summary>
 /// <param name="objControl">Control to scroll to.</param>
 /// -----------------------------------------------------------------------------
 public void ScrollToControl(Control objControl)
 {
     if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.Positioning))
     {
         JavaScript.RegisterClientReference(this, ClientAPI.ClientNamespaceReferences.dnn_dom_positioning);
         ClientAPI.RegisterClientVariable(this, "ScrollToControl", objControl.ClientID, true);
         DNNClientAPI.SetScrollTop(this.Page);
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Allows the scroll position on the page to be moved to the top of the passed in control.
 /// </summary>
 /// <param name="objControl">Control to scroll to</param>
 /// <remarks>
 /// </remarks>
 public void ScrollToControl(Control objControl)
 {
     if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.Positioning))
     {
         ClientAPI.RegisterClientReference(this, ClientAPI.ClientNamespaceReferences.dnn_dom_positioning); //client side needs to calculate the top of a particluar control (elementTop)
         ClientAPI.RegisterClientVariable(this, "ScrollToControl", objControl.ClientID, true);
         DNNClientAPI.AddBodyOnloadEventHandler(Page, "__dnn_setScrollTop();");
     }
 }
Exemplo n.º 4
0
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Allows the scroll position on the page to be moved to the top of the passed in control.
 /// </summary>
 /// <param name="objControl">Control to scroll to</param>
 /// <remarks>
 /// </remarks>
 /// <history>
 ///     [Jon Henning]	3/30/2005	Created
 /// </history>
 /// -----------------------------------------------------------------------------
 public void ScrollToControl(Control objControl)
 {
     if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.Positioning))
     {
         ClientAPI.RegisterClientReference(this, ClientAPI.ClientNamespaceReferences.dnn_dom_positioning);
         ClientAPI.RegisterClientVariable(this, "ScrollToControl", objControl.ClientID, true);
         DNNClientAPI.AddBodyOnloadEventHandler(Page, "__dnn_setScrollTop();");
     }
 }
Exemplo n.º 5
0
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            //writer.AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)
            if (this.EditEnabled)
            {
                writer.AddAttribute("sysimgpath", this.SystemImagesPath);
                if (this.LabelEditCssClass.Length > 0)
                {
                    writer.AddAttribute("cssEdit", this.LabelEditCssClass);
                }
                if (this.WorkCssClass.Length > 0)
                {
                    writer.AddAttribute("cssWork", this.WorkCssClass);
                }

                if (this.MouseOverCssClass.Length > 0)
                {
                    writer.AddAttribute("cssOver", this.MouseOverCssClass);
                }

                if (this.EventName != "onclick")
                {
                    writer.AddAttribute("eventName", this.EventName);
                }

                if (this.MultiLine)
                {
                    writer.AddAttribute("multiline", "1");
                }

                if (this.RichTextEnabled)
                {
                    writer.AddAttribute("richtext", "1");
                }

                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP))
                {
                    writer.AddAttribute("callback", ClientAPI.GetCallbackEventReference(this, "'[TEXT]'", "this.callBackSuccess", "this", "this.callBackFail", "this.callBackStatus"));
                }

                if (this.CallbackStatusFunction.Length > 0)
                {
                    writer.AddAttribute("callbackSF", this.CallbackStatusFunction);
                }
            }
        }
Exemplo n.º 6
0
        private void RegisterToolbarScript()
        {
            string strId = this.UniqueID;

            if (this.ReuseToolBar)
            {
                strId = this.ID;
            }
            if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, strId + "_toolbar"))
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
                    ClientAPI.RegisterStartUpScript(this.Page, strId + "_toolbar", string.Format("<script>dnn.controls.toolbars['{0}']={1};</script>", strId, this.ToJSON()));
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP) && ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XML))
                {
                    SupportsClientAPI = true;
                    ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_xml);
                    ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn_xmlhttp);

                    if (this.Page.ClientScript.IsClientScriptBlockRegistered("AjaxFaq.js") == false)
                    {
                        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "AjaxFaq.js", "<script language=javascript src=\"" + this.ControlPath + "scripts/AjaxFaq.js\"></script>");
                    }
                }

                if (!IsPostBack)
                {
                    //Fill the categories panel
                    BindCategories();

                    //Bind the FAQ data
                    BindData();

                    //Is the user allowed to sort the questions ?
                    if (Settings["UserSort"] != null && Convert.ToBoolean(Settings["UserSort"]) && RequestFaqId < 0)
                    {
                        //Set default sort order
                        pnlSortbox.Visible    = true;
                        drpSort.SelectedValue = DefaultSorting.ToString();
                    }
                    else
                    {
                        pnlSortbox.Visible = false;
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemplo n.º 8
0
        private void DnnTree_PreRender(object sender, EventArgs e)
        {
            RegisterClientScript();
            Page.RegisterRequiresPostBack(this);
            UpdateNodes(this.TreeNodes);   //update all imageindex properties

            if (this.IsDownLevel == false)
            {
                ClientAPI.RegisterClientVariable(this.Page, this.ClientID + "_xml", this.TreeNodes.ToXml(), true);
            }
            else
            {
                ViewState["xml"] = this.TreeNodes.ToXml();
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
                {
                    ClientAPI.RegisterClientReference(this.Page, ClientAPI.ClientNamespaceReferences.dnn);
                    if (this.SelectedTreeNodes.Count > 0)
                    {
                        ClientAPI.RegisterClientVariable(this.Page, this.ClientID + "_selNode", ((TreeNode)this.SelectedTreeNodes[1]).ToJSON(false), true);
                    }
                }
            }
        }
Exemplo n.º 9
0
        public bool RegisterToolBar(Control objAssociatedControl, string strShowEventName, string strHideEventName, string strToolBarActionHandler, string ToolBarScriptPath)
        {
            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML))
            {
                DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference(this.Page, DotNetNuke.UI.Utilities.ClientAPI.ClientNamespaceReferences.dnn_dom);

                if (!ClientAPI.IsClientScriptBlockRegistered(this.Page, "dnn.controls.dnntoolbarstub.js"))
                {
                    ClientAPI.RegisterClientScriptBlock(this.Page, "dnn.controls.dnntoolbarstub.js", "<script src=\"" + ToolBarScriptPath + "dnn.controls.dnntoolbarstub.js\"></script>");
                }

                string strJS = string.Format("__dnn_toolbarHandler('{0}','{1}','{2}',{3},'{4}','{5}')", this.UniqueID, objAssociatedControl.ClientID, this.NamingContainer.UniqueID, strToolBarActionHandler, strShowEventName, strHideEventName);
                if (objAssociatedControl is WebControl)
                {
                    ((WebControl)objAssociatedControl).Attributes.Add(strShowEventName, strJS);
                }
                else if (objAssociatedControl is HtmlControl)
                {
                    ((HtmlControl)objAssociatedControl).Attributes.Add(strShowEventName, strJS);
                }
                return(true);
            }
            return(false);
        }
 /// -----------------------------------------------------------------------------
 /// <summary>
 /// Helper function that determines whether the client-side functionality is possible
 /// </summary>
 /// -----------------------------------------------------------------------------
 private bool SupportsRichClient()
 {
     return(ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.DHTML));
 }
Exemplo n.º 11
0
        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            //writer.AddAttribute(HtmlTextWriterAttribute.Class, Me.CssClass)

            writer.AddAttribute("sysimgpath", this.SystemImagesPath);
            if (this.Target.Length > 0)
            {
                writer.AddAttribute("target", this.Target);
            }

            //css attributes
            if (this.TextSuggestCssClass.Length > 0)
            {
                writer.AddAttribute("tscss", this.TextSuggestCssClass);
            }
            if (this.DefaultNodeCssClass.Length > 0)
            {
                writer.AddAttribute("css", this.DefaultNodeCssClass);
            }
            if (this.DefaultChildNodeCssClass.Length > 0)
            {
                writer.AddAttribute("csschild", this.DefaultChildNodeCssClass);
            }
            if (this.DefaultNodeCssClassOver.Length > 0)
            {
                writer.AddAttribute("csshover", this.DefaultNodeCssClassOver);
            }
            if (this.DefaultNodeCssClassSelected.Length > 0)
            {
                writer.AddAttribute("csssel", this.DefaultNodeCssClassSelected);
            }

            if (this.JSFunction.Length > 0)
            {
                writer.AddAttribute("js", this.JSFunction);
            }
            if (Strings.Len(this.Delimiter) > 0)
            {
                writer.AddAttribute("del", this.Delimiter.ToString());
            }
            switch (this.IDToken)
            {
            case eIDTokenChar.None:

                break;

            case eIDTokenChar.Brackets:

                writer.AddAttribute("idtok", "[~]");
                break;

            case eIDTokenChar.Paranthesis:

                writer.AddAttribute("idtok", "(~)");
                break;
            }

            if (this.MinCharacterLookup > 1)
            {
                writer.AddAttribute("minchar", this.MinCharacterLookup.ToString());
            }
            if (this.MaxSuggestRows != 10)
            {
                writer.AddAttribute("maxrows", this.MaxSuggestRows.ToString());
            }
            if (this.LookupDelay != 500)
            {
                writer.AddAttribute("ludelay", this.LookupDelay.ToString());
            }
            if (this.CaseSensitive)
            {
                writer.AddAttribute("casesens", "1");
            }

            writer.AddAttribute("postback", ClientAPI.GetPostBackEventReference(this, "[TEXT]" + ClientAPI.COLUMN_DELIMITER + "Click"));

            if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP))
            {
                writer.AddAttribute("callback", ClientAPI.GetCallbackEventReference(this, "this.getText()", "this.callBackSuccess", "this", "this.callBackFail", "this.callBackStatus"));
            }

            if (this.CallbackStatusFunction.Length > 0)
            {
                writer.AddAttribute("callbackSF", this.CallbackStatusFunction);
            }

            if (this.JSFunction.Length > 0)
            {
                writer.AddAttribute("js", this.JSFunction);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [jbrinkman]	5/6/2004	Created
        ///		[jhenning] 2/22/2005	Added properties
        /// </history>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, m_objMenu.CssClass);
            writer.AddAttribute(HtmlTextWriterAttribute.Name, m_objMenu.UniqueID);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, m_objMenu.ClientID);

            writer.AddAttribute("orient", Convert.ToInt32(m_objMenu.Orientation).ToString());
            writer.AddAttribute("sysimgpath", m_objMenu.SystemImagesPath);
            if (m_objMenu.Target.Length > 0)
            {
                writer.AddAttribute("target", m_objMenu.Target);
            }

            //--- imagelist logic ---
            if (m_objMenu.ImageList.Count > 0)
            {
                SortedList objImagePaths    = new SortedList();
                string     strList          = "";
                string     strImagePathList = "";
                NodeImage  objNodeImage;
                foreach (NodeImage tempLoopVar_objNodeImage in m_objMenu.ImageList)
                {
                    objNodeImage = tempLoopVar_objNodeImage;
                    if (objNodeImage.ImageUrl.IndexOf("/") > -1)
                    {
                        string strPath  = objNodeImage.ImageUrl.Substring(0, objNodeImage.ImageUrl.LastIndexOf("/") + 1);
                        string strImage = objNodeImage.ImageUrl.Substring(objNodeImage.ImageUrl.LastIndexOf("/") + 1);
                        if (objImagePaths.ContainsValue(strPath) == false)
                        {
                            objImagePaths.Add(objImagePaths.Count, strPath);
                        }
                        objNodeImage.ImageUrl = string.Format("[{0}]{1}", objImagePaths.IndexOfValue(strPath).ToString(), strImage);
                    }
                    strList += ((strList.Length > 0) ? "," : "").ToString() + objNodeImage.ImageUrl;
                }
                for (int intPaths = 0; intPaths <= objImagePaths.Count - 1; intPaths++)
                {
                    strImagePathList += ((strImagePathList.Length > 0) ? "," : "").ToString() + objImagePaths.GetByIndex(intPaths).ToString();
                }
                writer.AddAttribute("imagelist", strList);
                writer.AddAttribute("imagepaths", strImagePathList);
            }

            //--- urllist logic ---'
            //Dim objUsedTokens As ArrayList = New ArrayList
            //Me.AssignUrlTokens(m_objMenu.MenuNodes, Nothing, objUsedTokens)
            //If objUsedTokens.Count > 0 Then
            //	writer.AddAttribute("urllist", Join(objUsedTokens.ToArray(), ","))				  'comma safe?!?!?!
            //End If

            if (m_objMenu.RootArrowImage.Length > 0)
            {
                writer.AddAttribute("rarrowimg", m_objMenu.RootArrowImage);
            }
            if (m_objMenu.ChildArrowImage.Length > 0)
            {
                writer.AddAttribute("carrowimg", m_objMenu.ChildArrowImage);
            }
            if (m_objMenu.WorkImage.Length > 0)
            {
                writer.AddAttribute("workimg", m_objMenu.WorkImage);
            }

            //css attributes
            if (m_objMenu.DefaultNodeCssClass.Length > 0)
            {
                writer.AddAttribute("css", m_objMenu.DefaultNodeCssClass);
            }
            if (m_objMenu.DefaultChildNodeCssClass.Length > 0)
            {
                writer.AddAttribute("csschild", m_objMenu.DefaultChildNodeCssClass);
            }
            if (m_objMenu.DefaultNodeCssClassOver.Length > 0)
            {
                writer.AddAttribute("csshover", m_objMenu.DefaultNodeCssClassOver);
            }
            if (m_objMenu.DefaultNodeCssClassSelected.Length > 0)
            {
                writer.AddAttribute("csssel", m_objMenu.DefaultNodeCssClassSelected);
            }
            if (m_objMenu.MenuBarCssClass.Length > 0)
            {
                writer.AddAttribute("mbcss", m_objMenu.MenuBarCssClass);
            }
            if (m_objMenu.MenuCssClass.Length > 0)
            {
                writer.AddAttribute("mcss", m_objMenu.MenuCssClass);
            }
            if (m_objMenu.DefaultIconCssClass.Length > 0)
            {
                writer.AddAttribute("cssicon", m_objMenu.DefaultIconCssClass);
            }

            if (m_objMenu.JSFunction.Length > 0)
            {
                writer.AddAttribute("js", m_objMenu.JSFunction);
            }
            if (m_objMenu.UseTables == false)
            {
                writer.AddAttribute("usetables", "0");
            }
            if (m_objMenu.EnablePostbackState)
            {
                writer.AddAttribute("enablepbstate", "1");
            }
            if (m_objMenu.MouseOutDelay != 1000)
            {
                writer.AddAttribute("moutdelay", m_objMenu.MouseOutDelay.ToString());
            }
            if (m_objMenu.MouseInDelay != 250)
            {
                writer.AddAttribute("mindelay", m_objMenu.MouseInDelay.ToString());
            }

            writer.AddAttribute("postback", ClientAPI.GetPostBackEventReference(m_objMenu, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "Click"));

            if (m_objMenu.PopulateNodesFromClient)
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP))
                {
                    writer.AddAttribute("callback", ClientAPI.GetCallbackEventReference(m_objMenu, "'[NODEXML]'", "this.callBackSuccess", "oMNode", "this.callBackFail", "this.callBackStatus"));
                }
                else
                {
                    writer.AddAttribute("callback", ClientAPI.GetPostBackClientHyperlink(m_objMenu, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "OnDemand"));
                }
                if (m_objMenu.CallbackStatusFunction.Length > 0)
                {
                    writer.AddAttribute("callbacksf", m_objMenu.CallbackStatusFunction);
                }
            }

            if (m_objMenu.JSFunction.Length > 0)
            {
                writer.AddAttribute("js", m_objMenu.JSFunction);
            }
            //writer.RenderBeginTag(HtmlTextWriterTag.P)			 '//SAFARI DOES NOT LIKE DIV TAG!!!
            writer.RenderBeginTag(HtmlTextWriterTag.Span);   //TODO: TEST SAFARI!
            //RenderChildren(writer)	'no longer rendering children for uplevel, only sending down xml and client is responsible
            writer.RenderEndTag();
        }
Exemplo n.º 13
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "DNNTree");
            writer.AddAttribute(HtmlTextWriterAttribute.Name, _tree.UniqueID);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, _tree.ClientID);   //_tree.UniqueID.Replace(":", "_"))

            writer.AddAttribute("sysimgpath", _tree.SystemImagesPath);
            writer.AddAttribute("indentw", _tree.IndentWidth.ToString());
            if (_tree.ExpandCollapseImageWidth != 12)
            {
                writer.AddAttribute("expcolimgw", _tree.ExpandCollapseImageWidth.ToString());
            }
            if (_tree.CheckBoxes)
            {
                writer.AddAttribute("checkboxes", "1");
            }
            if (_tree.Target.Length > 0)
            {
                writer.AddAttribute("target", _tree.Target);
            }

            if (_tree.ImageList.Count > 0)
            {
                string    strList = "";
                NodeImage objNodeImage;
                foreach (NodeImage tempLoopVar_objNodeImage in _tree.ImageList)
                {
                    objNodeImage = tempLoopVar_objNodeImage;
                    strList     += ((strList.Length > 0) ? "," : "").ToString() + objNodeImage.ImageUrl;
                }
                writer.AddAttribute("imagelist", strList);
            }

            //css attributes
            if (_tree.DefaultNodeCssClass.Length > 0)
            {
                writer.AddAttribute("css", _tree.DefaultNodeCssClass);
            }
            if (_tree.DefaultChildNodeCssClass.Length > 0)
            {
                writer.AddAttribute("csschild", _tree.DefaultChildNodeCssClass);
            }
            if (_tree.DefaultNodeCssClassOver.Length > 0)
            {
                writer.AddAttribute("csshover", _tree.DefaultNodeCssClassOver);
            }
            if (_tree.DefaultNodeCssClassSelected.Length > 0)
            {
                writer.AddAttribute("csssel", _tree.DefaultNodeCssClassSelected);
            }
            if (_tree.DefaultIconCssClass.Length > 0)
            {
                writer.AddAttribute("cssicon", _tree.DefaultIconCssClass);
            }

            if (_tree.JSFunction.Length > 0)
            {
                writer.AddAttribute("js", _tree.JSFunction);
            }

            if (_tree.WorkImage.Length > 0)
            {
                writer.AddAttribute("workimg", _tree.WorkImage);
            }
            if (_tree.AnimationFrames != 5)
            {
                writer.AddAttribute("animf", _tree.AnimationFrames.ToString());
            }
            writer.AddAttribute("expimg", _tree.ExpandedNodeImage);
            writer.AddAttribute("colimg", _tree.CollapsedNodeImage);
            writer.AddAttribute("postback", ClientAPI.GetPostBackEventReference(_tree, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "Click"));

            if (_tree.PopulateNodesFromClient)
            {
                if (ClientAPI.BrowserSupportsFunctionality(ClientAPI.ClientFunctionality.XMLHTTP))
                {
                    writer.AddAttribute("callback", ClientAPI.GetCallbackEventReference(_tree, "'[NODEXML]'", "this.callBackSuccess", "oTNode", "this.callBackFail", "this.callBackStatus"));
                }
                else
                {
                    writer.AddAttribute("callback", ClientAPI.GetPostBackClientHyperlink(_tree, "[NODEID]" + ClientAPI.COLUMN_DELIMITER + "OnDemand"));
                }
                if (_tree.CallbackStatusFunction.Length > 0)
                {
                    writer.AddAttribute("callbackSF", _tree.CallbackStatusFunction);
                }
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderEndTag();
        }