示例#1
0
        /// <summary>
        /// Setups the target dropbox.
        /// </summary>
        /// <param name="fieldContent">Content of the field.</param>
        private void SetupTargetDropbox(XElement fieldContent)
        {
            string targetCustomItemId;
            string xmlAttributeValue = InsertLinkDialogTree.GetXmlAttributeValue(fieldContent, "target");

            if (xmlAttributeValue.Equals("_blank", StringComparison.OrdinalIgnoreCase))
            {
                targetCustomItemId = string.Concat(this.TargetNewBrowserItemId, ",", this.targetBlank);
            }
            else if (xmlAttributeValue.Equals("_top", StringComparison.OrdinalIgnoreCase))
            {
                targetCustomItemId = this.targetTop;
            }
            else if (string.IsNullOrWhiteSpace(xmlAttributeValue) || xmlAttributeValue.Equals("_parent", StringComparison.OrdinalIgnoreCase))
            {
                targetCustomItemId = string.Concat(this.TargetActiveBrowserItemId, ",", this.targetParent);
            }
            else
            {
                targetCustomItemId = this.TargetCustomItemId;
                string str = xmlAttributeValue.Split(new char[] { '|' })[0];
                this.CustomUrl.Parameters["Text"] = str;
            }
            this.TargetLoadedValue.Parameters["Text"] = targetCustomItemId;
        }
示例#2
0
        /// <summary>
        /// Reads the root parameter and update root placeholders.
        /// </summary>
        private void ReadQueryParamsAndUpdatePlaceholders()
        {
            Item   item;
            string queryString = WebUtil.GetQueryString("ro");
            string str         = WebUtil.GetQueryString("hdl");

            if (!string.IsNullOrEmpty(queryString) && queryString != "{0}")
            {
                this.TreeView.Parameters["RootItem"] = queryString;
            }
            this.InsertAnchorButton.Parameters["Click"]   = string.Format(this.InsertAnchorButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str));
            this.InsertEmailButton.Parameters["Click"]    = string.Format(this.InsertEmailButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str));
            this.ListViewToggleButton.Parameters["Click"] = string.Format(this.ListViewToggleButton.Parameters["Click"], WebUtility.UrlEncode(queryString), WebUtility.UrlEncode(str));
            bool   empty  = str != string.Empty;
            string empty1 = string.Empty;

            if (empty)
            {
                empty1 = UrlHandle.Get()["va"];
            }
            if (empty1 == string.Empty)
            {
                return;
            }
            XElement xElement = XElement.Parse(empty1);

            if (InsertLinkDialogTree.GetXmlAttributeValue(xElement, "linktype") == "internal")
            {
                string xmlAttributeValue = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "id");
                if (string.IsNullOrWhiteSpace(xmlAttributeValue))
                {
                    return;
                }
                if (string.IsNullOrEmpty(queryString))
                {
                    item = null;
                }
                else
                {
                    item = ClientHost.Databases.ContentDatabase.GetItem(queryString);
                }
                Item rootItem = item ?? ClientHost.Databases.ContentDatabase.GetRootItem();
                Item mediaItemFromQueryString = SelectMediaDialog.GetMediaItemFromQueryString(xmlAttributeValue);
                if (rootItem != null && mediaItemFromQueryString != null && mediaItemFromQueryString.Paths.LongID.StartsWith(rootItem.Paths.LongID))
                {
                    this.TreeView.Parameters["PreLoadPath"] = string.Concat(rootItem.ID, mediaItemFromQueryString.Paths.LongID.Substring(rootItem.Paths.LongID.Length));
                }
                this.TextDescription.Parameters["Text"]  = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "text");
                this.AltText.Parameters["Text"]          = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "title");
                this.StyleClass.Parameters["Text"]       = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "class");
                this.QueryString.Parameters["Text"]      = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "querystring");
                this.CustomAttributes.Parameters["Text"] = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "customattributes");
                this.AnchorText.Parameters["Text"]       = InsertLinkDialogTree.GetXmlAttributeValue(xElement, "anchor");
                this.SetupTargetDropbox(xElement);
            }
        }