protected void OpenWebDAVView()
 {
     if (!WebDAVConfiguration.IsWebDAVEnabled(true))
     {
         Context.ClientPage.ClientResponse.Alert(Translate.Text("Drag & Drop is supported for IE only."));
     }
     else
     {
         Item selectionItem = this.Treeview.GetSelectionItem();
         if (selectionItem == null)
         {
             Context.ClientPage.ClientResponse.Alert(Translate.Text("Select an item first."));
         }
         else
         {
             selectionItem = WebDAVUtil.GetBrowseRootItem(selectionItem);
             NameValueCollection parameters = new NameValueCollection();
             parameters["id"]       = selectionItem.ID.ToString();
             parameters["language"] = selectionItem.Language.ToString();
             parameters["version"]  = selectionItem.Version.ToString();
             parameters["database"] = selectionItem.Database.Name;
             Context.ClientPage.Start(this, "OpenWebDAVBrowser", parameters);
         }
     }
 }
 protected override void OnLoad(EventArgs e)
 {
     Assert.ArgumentNotNull(e, "e");
     base.OnLoad(e);
     if (!Context.ClientPage.IsEvent)
     {
         if (!WebDAVConfiguration.IsWebDAVEnabled(true))
         {
             this.OpenWebDAVViewButton.Visible = false;
         }
         MediaBrowserOptions options = MediaBrowserOptions.Parse();
         Item root = options.Root;
         if (root != null)
         {
             this.MediaDataContext.Root = root.ID.ToString();
         }
         Item selectedItem = options.SelectedItem;
         if (selectedItem != null)
         {
             this.MediaDataContext.Folder = selectedItem.ID.ToString();
         }
         Item folder = this.MediaDataContext.GetFolder();
         Assert.IsNotNull(folder, "Item not found.");
         this.UpdateSelection(folder);
     }
 }
        protected void OpenWebDAVBrowser(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            string   path     = args.Parameters["id"];
            string   name     = args.Parameters["language"];
            string   str3     = args.Parameters["version"];
            string   str4     = args.Parameters["database"];
            Database database = Factory.GetDatabase(str4);

            Assert.IsNotNull(database, "database");
            Item item = database.GetItem(path, Language.Parse(name), Sitecore.Data.Version.Parse(str3));

            if (item == null)
            {
                SheerResponse.Alert(Translate.Text("Item not found."), new string[0]);
            }
            else if (!args.IsPostBack)
            {
                WebDAVOptions webDAVOptions = WebDAVUtil.GetWebDAVOptions(item);
                if (webDAVOptions == null)
                {
                    SheerResponse.Alert(Translate.Text("Cannot create WebDAV Url."), new string[0]);
                }
                else
                {
                    ID        id   = WebDAVConfiguration.SaveOptions(webDAVOptions);
                    UrlString str5 = new UrlString(Context.Site.XmlControlPage);
                    str5["xmlcontrol"] = "Sitecore.Shell.Applications.WebDAV.WebDAVBrowser";
                    str5["oid"]        = id.ToString();
                    SheerResponse.ShowModalDialog(str5.ToString(), true);
                    args.WaitForPostBack();
                }
            }
            else
            {
                this.Treeview.Refresh(item);
            }
        }