Ejemplo n.º 1
0
        protected override string GetClickScript(string siteUrl, string clickScript, IDictionary inst, SPWeb thisWeb, bool useView, bool includeFilters, List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters, string fj, bool flag)
        {
            string        id       = string.Empty;
            UploadControl uploader = null;

            if ("c".Equals(inst ["m"]))
            {
                return(string.Empty);
            }
            if (WebPart != null)
            {
                if ((!uploaders.TryGetValue(id = inst ["id"] + string.Empty, out uploader)) && ((uploader = Page.LoadControl("~/_controltemplates/roxority_UploadZen/Uploader.ascx") as UploadControl) != null))
                {
                    uploaders [id]    = uploader;
                    uploader.ID       = id;
                    uploader.action   = inst;
                    uploader.menuItem = this;
                }
                if (uploader != null)
                {
                    if (!panel.Controls.Contains(cssLink))
                    {
                        try {
                            panel.Controls.Add(cssLink);
                            if (!Context.Items.Contains("roxUplCss"))
                            {
                                cssLink.Text = string.Format(cssIncludes, siteUrl, ProductPage.Version) + cssLink.Text;
                                Context.Items.Add("roxUplCss", new object());
                            }
                            panel.Controls.Add(new LiteralControl("</div>"));
                        } catch {
                        }
                    }
                    if (!panel.Controls.Contains(uploader))
                    {
                        try {
                            panel.Controls.AddAt(++ctlPos, uploader);
                        } catch {
                        }
                    }
                    if (!WebPart.Controls.Contains(panel))
                    {
                        try {
                            WebPart.Controls.Add(panel);
                        } catch {
                        }
                    }
                }
            }
            return((uploader == null) ? string.Empty : "roxUps['" + uploader.ClientID + "'].show();");
        }
Ejemplo n.º 2
0
        protected override void CreateChildControls()
        {
            IDictionary    action = null, defAction = null;
            LiteralControl ctl = new LiteralControl("<div id=\"rox_content\">");

            foreach (IDictionary dict in Instances)
            {
                if ("default".Equals(dict ["id"]))
                {
                    defAction = dict;
                }
                else if (uploadAction.Equals(dict ["id"]))
                {
                    action = dict;
                }
            }
            if ((action != null) || (defAction != null))
            {
                uploader          = Page.LoadControl("~/_controltemplates/roxority_UploadZen/Uploader.ascx") as UploadControl;
                uploader.action   = ((action == null) ? defAction : action);
                uploader.menuItem = new UploadZenMenuItem()
                {
                    uploadWebPart = this
                };
                uploader.webPart = this;
                if (!Context.Items.Contains("roxUplCss"))
                {
                    Context.Items.Add("roxUplCss", new object());
                    ctl.Text = string.Format(UploadZenMenuItem.cssIncludes, uploader.WebUrl, ProductPage.Version) + ctl.Text;
                }
                if (!(ProductPage.Config <bool> (null, "_nojquery") || Page.Items.Contains("jquery")))
                {
                    Page.Items ["jquery"] = new object();
                    Page.ClientScript.RegisterClientScriptInclude("jquery", uploader.WebUrl + "/_layouts/" + ProductPage.AssemblyName + "/jQuery.js?v=" + ProductPage.Version);
                }
                Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName + "_plup", uploader.WebUrl + "/_layouts/" + ProductPage.AssemblyName + "/plup.js?v=" + ProductPage.Version);
                Page.ClientScript.RegisterClientScriptInclude(ProductPage.AssemblyName, uploader.WebUrl + "/_layouts/" + ProductPage.AssemblyName + "/" + ProductPage.AssemblyName + ".js?v=" + ProductPage.Version);
                Controls.Add(ctl);
                Controls.Add(uploader);
                Controls.Add(new LiteralControl("</div>"));
            }
        }