示例#1
0
        protected List <TreeElement> ctPages_Populate(object sender, PopulateEventArgs e)
        {
            List <TreeElement> result = new List <TreeElement>(100);

            NamespaceInfo selectedNamespace = Pages.FindNamespace(currentWiki, lstNamespace.SelectedValue);
            NamespaceInfo currentNamespace  = DetectNamespaceInfo();

            foreach (PageContent pi in Pages.GetPages(currentWiki, selectedNamespace))
            {
                string formattedTitle    = FormattingPipeline.PrepareTitle(currentWiki, pi.Title, false, FormattingContext.Other, pi.FullName);
                string onClickJavascript = "javascript:";
                // Populate the page title box if the title is different to the page name
                if (pi.FullName != pi.Title)
                {
                    // Supply the page title to the Javascript that sets the page title on the page
                    // We can safely escape the \ character, but the " character is interpreted by the browser even if it is escaped to Javascript, so we can't allow it.
                    // The non-wysiwyg version escapes ' and replaces " with escaped ', but ' breaks the html insertion, so remove it altogether
                    // Similarly, < on it's own is fine, but causes problems when combined with text and > to form a tag.  Safest to remove < characters to prevent
                    // breaking the drop-down.
                    onClickJavascript += "SetValue('txtPageTitle', '" + pi.Title.Replace("\\", "\\\\").Replace("'", "").Replace("\"", "").Replace("<", "") + "');";
                }
                else
                {
                    onClickJavascript += "SetValue('txtPageTitle', '');";
                }
                // Populate the page name (#468: add ++ to all ReverseFormatter to work)
                onClickJavascript += "return SetValue('txtPageName', '" + (selectedNamespace != currentNamespace ? "++" : "") + pi.FullName + "');";
                TreeElement item = new TreeElement((selectedNamespace != currentNamespace ? "++" : "") + pi.FullName, formattedTitle, onClickJavascript);
                result.Add(item);
            }
            return(result);
        }
示例#2
0
        protected List<TreeElement> ctPages_Populate(object sender, PopulateEventArgs e)
        {
            string currentNamespace = DetectNamespace();
            if(string.IsNullOrEmpty(currentNamespace)) currentNamespace = null;

            List<TreeElement> result = new List<TreeElement>(100);
            foreach(PageInfo pi in Pages.GetPages(Pages.FindNamespace(lstNamespace.SelectedValue))) {
                string pageNamespace = NameTools.GetNamespace(pi.FullName);
                if(string.IsNullOrEmpty(pageNamespace)) pageNamespace = null;
                PageContent cont = Content.GetPageContent(pi, true);
                string formattedTitle = FormattingPipeline.PrepareTitle(cont.Title, false, FormattingContext.Other, pi);
                string onClickJavascript = "javascript:";
                // Populate the page title box if the title is different to the page name
                if (pi.FullName != cont.Title) {
                    // Supply the page title to the Javascript that sets the page title on the page
                    // We can safely escape the \ and ' characters, but the " character is interpreted by the browser even if it is escaped to Javascript, so we can't allow it.
                    // Instead we replace it with an escaped single quote.
                    // Similarly, < on it's own is fine, but causes problems when combined with text and > to form a tag.  Safest to remove < characters to prevent
                    // breaking the drop-down.
                    onClickJavascript += "SetValue('txtPageTitle', '" + cont.Title.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\"", "\\'").Replace("<", "") + "');";
                }
                else {
                    onClickJavascript += "SetValue('txtPageTitle', '');";
                }
                // Populate the page name
                onClickJavascript += "return SetValue('txtPageName', '" +
                    ((pageNamespace == currentNamespace ? NameTools.GetLocalName(pi.FullName) : ("++" + pi.FullName))).Replace("++++", "++") + "');";
                TreeElement item = new TreeElement(pi.FullName, formattedTitle, onClickJavascript);
                result.Add(item);
            }
            return result;
        }
        protected List<TreeElement> ctPages_Populate(object sender, PopulateEventArgs e)
        {
            List<TreeElement> result = new List<TreeElement>(100);

            NamespaceInfo selectedNamespace = Pages.FindNamespace(lstNamespace.SelectedValue);
            NamespaceInfo currentNamespace = DetectNamespaceInfo();

            foreach(PageInfo pi in Pages.GetPages(selectedNamespace)) {
                PageContent cont = Content.GetPageContent(pi, true);
                string formattedTitle = FormattingPipeline.PrepareTitle(cont.Title, false, FormattingContext.Other, pi);
                string onClickJavascript = "javascript:";
                // Populate the page title box if the title is different to the page name
                if (pi.FullName != cont.Title) {
                    // Supply the page title to the Javascript that sets the page title on the page
                    // We can safely escape the \ character, but the " character is interpreted by the browser even if it is escaped to Javascript, so we can't allow it.
                    // The non-wysiwyg version escapes ' and replaces " with escaped ', but ' breaks the html insertion, so remove it altogether
                    // Similarly, < on it's own is fine, but causes problems when combined with text and > to form a tag.  Safest to remove < characters to prevent
                    // breaking the drop-down.
                    onClickJavascript += "SetValue('txtPageTitle', '" + cont.Title.Replace("\\", "\\\\").Replace("'", "").Replace("\"", "").Replace("<", "") + "');";
                }
                else {
                    onClickJavascript += "SetValue('txtPageTitle', '');";
                }
                // Populate the page name (#468: add ++ to all ReverseFormatter to work)
                onClickJavascript += "return SetValue('txtPageName', '" + (selectedNamespace != currentNamespace ? "++" : "") + pi.FullName + "');";
                TreeElement item = new TreeElement((selectedNamespace != currentNamespace ? "++" : "") + pi.FullName, formattedTitle, onClickJavascript);
                result.Add(item);
            }
            return result;
        }
示例#4
0
        protected List <TreeElement> ctPages_Populate(object sender, PopulateEventArgs e)
        {
            string currentNamespace = DetectNamespace();

            if (string.IsNullOrEmpty(currentNamespace))
            {
                currentNamespace = null;
            }

            List <TreeElement> result = new List <TreeElement>(100);

            foreach (PageInfo pi in Pages.GetPages(Pages.FindNamespace(lstNamespace.SelectedValue)))
            {
                string pageNamespace = NameTools.GetNamespace(pi.FullName);
                if (string.IsNullOrEmpty(pageNamespace))
                {
                    pageNamespace = null;
                }

                PageContent cont              = Content.GetPageContent(pi, true);
                string      formattedTitle    = FormattingPipeline.PrepareTitle(cont.Title, false, FormattingContext.Other, pi);
                string      onClickJavascript = "javascript:";
                // Populate the page title box if the title is different to the page name
                if (pi.FullName != cont.Title)
                {
                    // Supply the page title to the Javascript that sets the page title on the page
                    // We can safely escape the \ and ' characters, but the " character is interpreted by the browser even if it is escaped to Javascript, so we can't allow it.
                    // Instead we replace it with an escaped single quote.
                    // Similarly, < on it's own is fine, but causes problems when combined with text and > to form a tag.  Safest to remove < characters to prevent
                    // breaking the drop-down.
                    onClickJavascript += "SetValue('txtPageTitle', '" + cont.Title.Replace("\\", "\\\\").Replace("'", "\\'").Replace("\"", "\\'").Replace("<", "") + "');";
                }
                else
                {
                    onClickJavascript += "SetValue('txtPageTitle', '');";
                }
                // Populate the page name
                onClickJavascript += "return SetValue('txtPageName', '" +
                                     ((pageNamespace == currentNamespace ? NameTools.GetLocalName(pi.FullName) : ("++" + pi.FullName))).Replace("++++", "++") + "');";
                TreeElement item = new TreeElement(pi.FullName, formattedTitle, onClickJavascript);
                result.Add(item);
            }
            return(result);
        }
示例#5
0
        protected List <TreeElement> cibImages_Populate(object sender, PopulateEventArgs e)
        {
            IFilesStorageProviderV40 p = Collectors.CollectorsBox.FilesProviderCollector.GetProvider(lstProviderImages.SelectedValue, currentWiki);

            return(BuildImagesSubTree(p, "/"));
        }
        protected List <TreeElement> ctFiles_Populate(object sender, PopulateEventArgs e)
        {
            IFilesStorageProviderV30 p = Collectors.FilesProviderCollector.GetProvider(lstProviderFiles.SelectedValue);

            return(BuildFilesSubTree(p, "/"));
        }
示例#7
0
 protected List<TreeElement> ctFiles_Populate(object sender, PopulateEventArgs e)
 {
     IFilesStorageProviderV30 p = Collectors.FilesProviderCollector.GetProvider(lstProviderFiles.SelectedValue);
     return BuildFilesSubTree(p, "/");
 }