Exemple #1
0
        protected override void RenderContents(HtmlTextWriter writer)
        {
            bool             inEditMode = false;
            SPWebPartManager swpm       = (SPWebPartManager)SPWebPartManager.GetCurrentWebPartManager(this.Page);

            inEditMode = !swpm.GetDisplayMode().AllowPageDesign;

            if (inEditMode)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "webpartzone");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                base.RenderBody(writer);
                writer.RenderEndTag();
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ms-SPButton ms-WPAddButton");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "CoreInvoke('ShowWebPartAdder', '" + SPHttpUtility.EcmaScriptStringLiteralEncode(this.ID) + "');return false;");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                //writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:");
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "CoreInvoke('ShowWebPartAdder', '" + SPHttpUtility.EcmaScriptStringLiteralEncode(this.ID) + "');return false;");
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
                //writer.Write(SPHttpUtility.HtmlEncode(WebPartPageResource.GetString("WebPartQuickAdd_AddANewWebPart")));
                //base.RenderBody(writer);
                writer.RenderEndTag();
                writer.RenderEndTag();
                writer.RenderEndTag();

                base.RenderContents(writer);
            }
        }
Exemple #2
0
        /// <summary>
        /// Determines whether the page is in edit mode.
        /// </summary>
        /// <param name="page">The current page.</param>
        /// <returns></returns>
        private static bool IsEditMode(Page page)
        {
            if (page == null)
            {
                return(false);
            }
            SPWebPartManager manager = WebPartManager.GetCurrentWebPartManager(page) as SPWebPartManager;

            return(manager != null && manager.GetDisplayMode().AllowPageDesign);
        }
Exemple #3
0
        protected override void AddItemToPage(System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, int zoneIndex, System.Web.UI.WebControls.WebParts.WebPart webPart)
        {
            WebPartManager   currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page);
            SPWebPartManager spmanager             = currentWebPartManager as SPWebPartManager;

            if (spmanager != null)
            {
                webPart = spmanager.AddWebPart(webPart, zone, zoneIndex);
            }
            else
            {
                webPart = currentWebPartManager.AddWebPart(webPart, zone, zoneIndex);
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Page != null && Page.IsPostBack)
            {
                string _target = this.Page.Request["__EVENTTARGET"];
                string _event  = this.Page.Request["__EVENTARGUMENT"];

                if (_target == parentPart.ClientID)
                {
                    if (_event == "DeleteWebPart")
                    {
                        SPWebPartManager spwpm = WebPartManager.GetCurrentWebPartManager(Page) as SPWebPartManager;
                        spwpm.DeleteWebPart(this.parentPart);
                    }
                }
            }
        }
Exemple #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            spWebPartManager = WP.WebPartManager.GetCurrentWebPartManager(this) as SPWebPartManager;


            if (spWebPartManager.SupportedDisplayModes.Contains(WP.WebPartManager.CatalogDisplayMode))
            {
                lnkCatM.Visible = true;
            }
            else
            {
                lnkCatM.Visible = false;
            }

            //SPContext.Current.Web.AllowUnsafeUpdates = true; // GET
            //SPList list = SPContext.Current.Web.Lists["AutThors"];
            //listView1.ListName = list.ID.ToString("B").ToUpper();
            //listView1.ViewGuid = list.Views[0].ID.ToString("B").ToUpper();
            //spWebPartManager.AddWebPart(listView1, leftZone, 1);
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            try
            {
                if (!Page.IsPostBack)
                {
                    MacAddress = GetMacAdress();
                }

                if (SPWebPartManager.GetCurrentWebPartManager(Page).DisplayMode != WebPartManager.BrowseDisplayMode)
                {
                    _licenseExpirationDate = LicenseManager.LicenseExpirationDate;
                    _isTrial = LicenseManager.IsTrial;
                }
            }
            catch (Exception ex)
            {
                Logger.Default.Error(LogLocation, "User - " + Page.Request.LogonUserIdentity.Name + " ; Error = " + ex.Message, ex);
            }
        }
        // The method which fires the Event
        void OnCloseWebPart(object sender, EventArgs e)
        {
            SPWebPartManager spwpm = WebPartManager.GetCurrentWebPartManager(Page) as SPWebPartManager;

            spwpm.DeleteWebPart(this.parentPart);
        }
        public static void GetFilterInfo(IDictionary inst, string schemaName, ref string clickScript, System.Web.UI.WebControls.WebParts.WebPart webPart, Page page, ref bool includeFilters, ref string fj, ref List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters)
        {
            SPWebPartManager currentWebPartManager = null;

            System.Web.UI.WebControls.WebParts.WebPart part = null;
            IList           list  = null;
            List <string>   list2 = new List <string>();
            List <object[]> list3 = new List <object[]>();

            includeFilters = false;
            string filterCaml = "";

            if (inst["filter"] != null)
            {
                try
                {
                    includeFilters = (bool)inst["filter"];
                }
                catch
                {
                    includeFilters = false;
                }
            }
            if (includeFilters && !IsLic(2))
            {
                includeFilters = false;
                clickScript    = "alert('" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", new object[] { ProductPage.GetProductResource("PC_" + schemaName + "_filter", new object[0]), "Basic" })) + "');";
            }
            if (includeFilters && (effectiveFilters == null))
            {
                effectiveFilters = new List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > >();
                try
                {
                    currentWebPartManager = WebPartManager.GetCurrentWebPartManager(page) as SPWebPartManager;
                }
                catch
                {
                }
                if ((webPart != null) && (currentWebPartManager != null))
                {
                    foreach (System.Web.UI.WebControls.WebParts.WebPart part2 in ProductPage.TryEach <System.Web.UI.WebControls.WebParts.WebPart>(currentWebPartManager.WebParts))
                    {
                        if (part2.GetType().AssemblyQualifiedName == "roxority_FilterZen.roxority_FilterWebPart, roxority_FilterZen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a2103dd0c3e898e1")
                        {
                            foreach (System.Web.UI.WebControls.WebParts.WebPart part3 in ((getConnPartMethod == null) ? (getConnPartMethod = part2.GetType().GetMethod("GetConnectedParts", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, System.Type.EmptyTypes, null)) : getConnPartMethod).Invoke(part2, null) as IEnumerable <System.Web.UI.WebControls.WebParts.WebPart> )
                            {
                                if (part3.ID.Equals(webPart.ID))
                                {
                                    part = part2;
                                    break;
                                }
                            }
                        }
                        if (part != null)
                        {
                            break;
                        }
                    }
                }
                if (part != null)
                {
                    try
                    {
                        if (!((bool)part.GetType().GetMethod("LicEd", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(part, new object[] { 2 })))
                        {
                            clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt", new object[0])) + "');";
                            part        = null;
                        }
                    }
                    catch
                    {
                        clickScript = "alert('" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt", new object[0])) + "');";
                        part        = null;
                    }
                }
                fj = string.Empty;
                if (part != null)
                {
                    try
                    {
                        filterCaml = ((roxority_FilterZen.roxority_FilterWebPart)(part)).GeneratedQuery;
                        list       = ((partFiltersProp == null) ? (partFiltersProp = part.GetType().GetProperty("PartFilters", BindingFlags.Public | BindingFlags.Instance)) : partFiltersProp).GetValue(part, null) as IList;
                        fj         = ((partJsonProp == null) ? (partJsonProp = part.GetType().GetProperty("JsonFilters", BindingFlags.Public | BindingFlags.Instance)) : partJsonProp).GetValue(part, null) as string;
                        list2.AddRange(((string)((camlAndProp == null) ? (camlAndProp = part.GetType().GetProperty("CamlFiltersAndCombined", BindingFlags.Public | BindingFlags.Instance)) : camlAndProp).GetValue(part, null)).Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
                    }
                    catch
                    {
                    }
                    if (list != null)
                    {
                        foreach (object obj3 in list)
                        {
                            if (kvpValProp == null)
                            {
                                kvpValProp = obj3.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
                            }
                            object obj2 = kvpValProp.GetValue(obj3, null);
                            if (obj2 != null)
                            {
                                if (fpKeyProp == null)
                                {
                                    fpKeyProp = obj2.GetType().GetProperty("Key", BindingFlags.Public | BindingFlags.Instance);
                                }
                                if (fpValProp == null)
                                {
                                    fpValProp = obj2.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
                                }
                                if (fpOpProp == null)
                                {
                                    fpOpProp = obj2.GetType().GetProperty("CamlOperator", BindingFlags.Public | BindingFlags.Instance);
                                }
                                list3.Add(new object[] { fpKeyProp.GetValue(obj2, null), fpValProp.GetValue(obj2, null), (CamlOperator)Enum.Parse(typeof(CamlOperator), fpOpProp.GetValue(obj2, null).ToString(), true) });
                            }
                        }
                    }
                    foreach (object[] objArray in list3)
                    {
                        int num2;
                        KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > item = new KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> >(objArray[0] as string, new KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool>(new List <KeyValuePair <string, CamlOperator> >(), list2.Contains(objArray[0] as string)));
                        int num = num2 = -1;
                        foreach (KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > pair2 in effectiveFilters)
                        {
                            num2++;
                            if (pair2.Key == item.Key)
                            {
                                num  = num2;
                                item = pair2;
                                break;
                            }
                        }
                        item.Value.Key.Add(new KeyValuePair <string, CamlOperator>(objArray[1] as string, (CamlOperator)objArray[2]));
                        if (num >= 0)
                        {
                            effectiveFilters[num] = item;
                        }
                        else
                        {
                            effectiveFilters.Add(item);
                        }
                    }
                }
            }
            fj += "((((((" + filterCaml + "))))))";
        }
Exemple #9
0
        // public String CurrentBlockButtonDetails = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as BlockButtons;
            SPWebPartManager webPartManager = (SPWebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);
            Guid             WebPartGuid    = webPartManager.GetStorageKey(webPart);

            WebPartUniqueID = WebPartGuid.ToString().Replace("-", String.Empty);;

            if (IsPostBack)
            {
                if (NeedToSave.Value == "true")
                {
                    WBLogging.Debug("Saving the new details: " + BlockButtonsDetails.Value);

                    string[] newDetails = BlockButtonsDetails.Value.WBxTrim().Split(',');

                    if (newDetails.Length != 5)
                    {
                        WBLogging.Debug("The details sent to this page have the wrong structure: " + BlockButtonsDetails.Value);
                        return;
                    }

                    webPart.BlockButtonsWidth   = WBUtils.PutBackDelimiterCharacters(newDetails[0]);
                    webPart.BlockButtonsHeight  = WBUtils.PutBackDelimiterCharacters(newDetails[1]);
                    webPart.BlockButtonsDetails = WBUtils.PutBackDelimiterCharacters(newDetails[2]);

                    // We're not editing this extra parts via the pop-up dialog so we're not saving them either - this code is here just for illustration:
                    // webPart.CssExtraClass = WBUtils.PutBackDelimiterCharacters(newDetails[3]);
                    // webPart.CssExtraStyles = WBUtils.PutBackDelimiterCharacters(newDetails[4]);

                    webPartManager.SaveChanges(WebPartGuid);

                    SPContext.Current.Web.Update();
                }
            }

            CSSExtraClass  = webPart.CssExtraClass;
            CSSExtraStyles = webPart.CssExtraStyles;
            SetHeight      = webPart.BlockButtonsHeight;

            String html = "";

            String[] buttonsDetails = webPart.BlockButtonsDetails.Split('^');

            int index = 0;

            foreach (String buttonDetails in buttonsDetails)
            {
                string[] details = buttonDetails.Split('|');

                string title       = details[0].Trim();
                string link        = details[1].Trim();
                string extraText   = details[2].Trim();
                string buttonColor = details[3].Trim();

                int buttonBorderColorIndex = 4;
                int textColorIndex         = 5;

                if (details.Length > 6)
                {
                    buttonBorderColorIndex = 5;
                    textColorIndex         = 7;
                }

                string buttonBorderColor = details[buttonBorderColorIndex].Trim();
                string textColor         = details[textColorIndex].Trim();

                html += "<td>\n<a class=\"block-button-link " + CSSExtraClass + "\"  id=\"wbf-block-button-link-" + WebPartUniqueID + "-" + index + "\" href=\"" + link + "\">\n";
                html += "<div class=\"block-button block-button-group-" + WebPartUniqueID + " " + CSSExtraClass + "\" id=\"wbf-block-button-" + WebPartUniqueID + "-" + index + "\" style=\"background-color: " + buttonColor + "; border-color: " + buttonBorderColor + "; color: " + textColor + "; width: " + webPart.BlockButtonsWidth + "; height: " + webPart.BlockButtonsHeight + ";\">\n";
                html += "<div class=\"block-button-content " + CSSExtraClass + "\">\n";
                html += "<div class=\"block-button-title " + CSSExtraClass + "\" id=\"wbf-block-button-title-" + WebPartUniqueID + "-" + index + "\" " + ((String.IsNullOrEmpty(title)) ? " style=\" display: none;\"" : "") + ">" + title + "</div>\n";
                html += "<div class=\"block-button-extra-text " + CSSExtraClass + "\" id=\"wbf-block-button-extra-text-" + WebPartUniqueID + "-" + index + "\" " + ((String.IsNullOrEmpty(extraText)) ? " style=\" display: none;\"" : "") + ">" + extraText + "</div> \n";
                html += "</div></div></a></td>";

                index++;
            }

            BlockButtons.Text = html;

            if ((SPContext.Current.FormContext.FormMode == SPControlMode.Edit) ||
                (webPartManager.DisplayMode == WebPartManager.EditDisplayMode))
            {
                String[] detailsToEdit = new String[5];

                detailsToEdit[0] = WBUtils.ReplaceDelimiterCharacters(webPart.BlockButtonsWidth);
                detailsToEdit[1] = WBUtils.ReplaceDelimiterCharacters(webPart.BlockButtonsHeight);
                detailsToEdit[2] = WBUtils.ReplaceDelimiterCharacters(webPart.BlockButtonsDetails.WBxTrim());
                detailsToEdit[3] = WBUtils.ReplaceDelimiterCharacters(webPart.CssExtraClass);
                detailsToEdit[4] = WBUtils.ReplaceDelimiterCharacters(webPart.CssExtraStyles);

                String currentDetails = String.Join(",", detailsToEdit);

                currentDetails = HttpUtility.UrlEncode(currentDetails);

                BlockButtonsDetails.Value = currentDetails;

                InEditMode = true;
                EditBlockButtonsButton.OnClientClick = "WBF_editBlockButtons(WBF_EditDialogCallback" + WebPartUniqueID + ", \"" + BlockButtonsDetails.ClientID + "\"); return false;";
            }
            else
            {
                EditBlockButtonsButton.OnClientClick = "";
            }


            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "UpdateBlockButtons" + WebPartUniqueID, String.Format("WBF_checkBlockButtonsHeights('{0}', '{1}');", WebPartUniqueID, SetHeight), true);
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as WorkBoxExplorer;

            SPWebPartManager webPartManager = (SPWebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);

            if ((SPContext.Current.FormContext.FormMode == SPControlMode.Edit) ||
                (webPartManager.DisplayMode == WebPartManager.EditDisplayMode))
            {
                InEditMode = true;
            }

            SearchScope = WBUtils.UrlDataEncode(webPart.SearchScope);

            SelectedWorkBoxes.AllowSorting = true;
            SelectedWorkBoxes.Sorting     += new GridViewSortEventHandler(SelectedWorkBoxes_Sorting);

            SelectedWorkBoxes.AllowPaging                   = true;
            SelectedWorkBoxes.PageIndexChanging            += new GridViewPageEventHandler(SelectedWorkBoxes_PageIndexChanging);
            SelectedWorkBoxes.PagerSettings.Mode            = PagerButtons.Numeric;
            SelectedWorkBoxes.PagerSettings.Position        = PagerPosition.Bottom;
            SelectedWorkBoxes.PagerSettings.PageButtonCount = 50;
            SelectedWorkBoxes.PagerSettings.Visible         = true;
            SelectedWorkBoxes.PageSize = 30;

            // this odd statement is required in order to get the pagination to work with an SPGridView!
            SelectedWorkBoxes.PagerTemplate = null;

            CoreResultsWebPart.UseLocationVisualization = false;
            CoreResultsWebPart.PropertiesToRetrieve     = string.Empty;
            CoreResultsWebPart.SelectColumns            = @"<Columns>  <Column Name=""WorkId""/>  <Column Name=""Rank""/>  <Column Name=""Title""/>  <Column Name=""Author""/>  <Column Name=""Size""/>  <Column Name=""Path""/>  <Column Name=""Description""/>  <Column Name=""Write""/>  <Column Name=""SiteName""/>  <Column Name=""CollapsingStatus""/>  <Column Name=""HitHighlightedSummary""/>  <Column Name=""HitHighlightedProperties""/>  <Column Name=""ContentClass""/>  <Column Name=""IsDocument""/>  <Column Name=""PictureThumbnailURL""/>  <Column Name=""PopularSocialTags""/>  <Column Name=""PictureWidth""/>  <Column Name=""PictureHeight""/>  <Column Name=""DatePictureTaken""/>  <Column Name=""ServerRedirectedURL""/>  <Column Name=""SiteTitle""/>  <Column Name=""SPWebURL""/>  <Column Name=""OwningTeam""/>  </Columns>";
            CoreResultsWebPart.XslLink = "/Style Library/WBF/wb-explorer-search-results.xslt";

            //CoreResultsWebPart.DisplayAlertMeLink = true;
            //CoreResultsWebPart.AllowConnect = false;


            SPWeb  web  = SPContext.Current.Web;
            SPSite site = SPContext.Current.Site;

            WBTaxonomy recordsTypesTaxonomy = WBTaxonomy.GetRecordsTypes(SPContext.Current.Site);

            string teamGUIDString = "";

            Team = WBTeam.GetFromTeamSite(SPContext.Current);
            if (Team == null)
            {
                return;
            }

            if (Team.IsCurrentUserTeamOwnerOrSystemAdmin())
            {
                canSaveDefaultView = true;
            }

            // RefinementByOwningTeam = "owningteam%3D%22%23" + (Team.Id.ToString().Replace(" ", "%20").Replace("#", "%23").Replace("-", "%2D")) + "%22";
            // RefinementByOwningTeam = "owningteam%3D%22" + (Team.Name.ToString().Replace(" ", "%20").Replace("#", "%23").Replace("-", "%2D")) + "%22";
            RefinementByOwningTeam = WBUtils.UrlDataEncode("owningteam=\"" + Team.Name + "\"");

            teamGUIDString = WBExtensions.WBxToString(Team.Id);
            string recordsTypesListUrl = Team.RecordsTypesListUrl;

            if (recordsTypesListUrl == null || recordsTypesListUrl == "")
            {
                //recordsTypesListUrl = web.Url + "/Lists/Configure%20Teams%20Records%20Classes";
                NotSetupText = "(<i>The team has no records types list setup yet.</i>)";
                return;
            }

            // urm ... this is a real mess - a hidden field and a view state - it's a mashup mess!!
            String selectedRecordsTypeGUID = Request.QueryString["recordsTypeGUID"];

            if (String.IsNullOrEmpty(selectedRecordsTypeGUID))
            {
                String guidString = HiddenRecordsTypeGUIDField.Value;
                if (guidString != null && guidString != "")
                {
                    SelectedRecordsTypeGUID = guidString;
                }
            }
            else
            {
                SelectedRecordsTypeGUID          = selectedRecordsTypeGUID;
                HiddenRecordsTypeGUIDField.Value = selectedRecordsTypeGUID;
            }



            using (SPWeb configWeb = site.OpenWeb(recordsTypesListUrl))
            {
                ConfigurationList = configWeb.GetList(recordsTypesListUrl);
                if (ConfigurationList != null)
                {
                    if (!ConfigurationList.Fields.ContainsField("Records Class"))
                    {
                        ConfigurationList = null;
                        NotSetupText      = "(<i>The configuration list " + recordsTypesListUrl + " has no 'Records Class' column.</i>)";
                    }
                }
                else
                {
                    NotSetupText = "(<i>The configuration list " + recordsTypesListUrl + " was not set up correctly or does not exist.</i>)";
                }

                if (ConfigurationList != null)
                {
                    TeamAdminRecordsTypesTreeView.Nodes.Clear();
                    OurWorkRecordsTypesTreeView.Nodes.Clear();
                    CouncilWideRecordsTypesTreeView.Nodes.Clear();

                    TeamAdminRecordsTypesFilter.Nodes.Clear();
                    OurWorkRecordsTypesFilter.Nodes.Clear();
                    CouncilWideRecordsTypesFilter.Nodes.Clear();

                    foreach (SPListItem item in ConfigurationList.Items)
                    {
                        try
                        {
                            WBRecordsType recordsClass      = new WBRecordsType(recordsTypesTaxonomy, WBExtensions.WBxGetColumnAsString(item, "Records Class"));
                            TreeNode      createNewNodes    = createNodes(recordsClass, Team, false);
                            TreeNode      forFilteringNodes = createNodes(recordsClass, Team, true);

                            string groupName = item.WBxGetColumnAsString("Records Group");
                            if (groupName.Equals("Team admin"))
                            {
                                addNodesToTreeView(TeamAdminRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(TeamAdminRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }

                            if (groupName.Equals("Our work"))
                            {
                                addNodesToTreeView(OurWorkRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(OurWorkRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }

                            if (groupName.Equals("Council-wide business"))
                            {
                                addNodesToTreeView(CouncilWideRecordsTypesTreeView, createNewNodes, selectedRecordsTypeGUID);
                                addNodesToTreeView(CouncilWideRecordsTypesFilter, forFilteringNodes, selectedRecordsTypeGUID);
                            }
                        }
                        catch (Exception exception)
                        {
                            WBUtils.logMessage("The error message was: " + exception.Message);
                        }
                    }
                }
            }


            if (!IsPostBack)
            {
                List <String> ascendingDescendingOptions = new List <String>();
                ascendingDescendingOptions.Add("Ascending");
                ascendingDescendingOptions.Add("Descending");

                AscendingDescendingChoice.DataSource = ascendingDescendingOptions;
                AscendingDescendingChoice.DataBind();

                List <String> statusOptions = new List <String>();
                statusOptions.Add("Open");
                statusOptions.Add("Closed");
                statusOptions.Add("Deleted");
                statusOptions.Add("Any");

                StatusFilter.DataSource = statusOptions;
                StatusFilter.DataBind();


                List <String> involvementOptions = new List <String>();
                involvementOptions.Add(FILTER_INVOLVEMENT__OWNS);
                involvementOptions.Add(FILTER_INVOLVEMENT__INVOLVED);
                involvementOptions.Add(FILTER_INVOLVEMENT__VISITING);

                InvolvementFilter.DataSource = involvementOptions;
                InvolvementFilter.DataBind();

                if (!LoadDefaultView())
                {
                    SetSortColumn(WBColumn.WorkBoxDateLastModified);
                    GridViewSortDirection        = SortDirection.Descending;
                    SelectedViewStyle            = VIEW_STYLE__ICONS;
                    StatusCheckBox.Checked       = false;
                    RecordsTypeCheckBox.Checked  = true;
                    LastModifiedCheckBox.Checked = true;
                    DateCreatedCheckBox.Checked  = true;

                    StatusFilter.WBxSafeSetSelectedValue("Any");
                }


                WBLogging.Debug("Not in post back so setting guid value to be: " + SelectedRecordsTypeGUID);
                RefreshBoundData();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as PickedDocumentsGroup;

            SPWebPartManager webPartManager = (SPWebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);

            Guid WebPartGuid = webPartManager.GetStorageKey(webPart);

            WebPartUniqueID = WebPartGuid.ToString().Replace("-", String.Empty);;

            //EditRelatedDocumentsButton.OnClientClick = "WorkBoxFramework_editRelatedDocuments(WBF_EditDialogCallback" + WebPartUniqueID + ", \"" + webPart.PickedDocumentsDetails + "\"); return false;";


            String[] detailsToSave = new String[5];

            detailsToSave[0] = WBUtils.ReplaceDelimiterCharacters(webPart.Title);
            detailsToSave[1] = WBUtils.ReplaceDelimiterCharacters(webPart.DocumentsGroupDescription);
            detailsToSave[2] = WBUtils.ReplaceDelimiterCharacters(webPart.DocumentsGroupSubjectTags);
            detailsToSave[3] = WBUtils.ReplaceDelimiterCharacters(webPart.DocumentsGroupCoverage);
            detailsToSave[4] = WBUtils.ReplaceDelimiterCharacters(webPart.PickedDocumentsDetails.WBxTrim());

            String currentDetails = String.Join(",", detailsToSave);

            WBLogging.Debug("Current details: " + currentDetails);

            if (IsPostBack)
            {
                if (NeedToSave.Value == "true")
                {
                    WBLogging.Debug("Trying to save value: " + NewDocumentsGroupDetails.Value);

                    string[] newDetails = NewDocumentsGroupDetails.Value.WBxTrim().Split(',');

                    if (newDetails.Length != 5)
                    {
                        WBLogging.Debug("The details sent to this page have the wrong structure: " + NewDocumentsGroupDetails.Value);
                        Description.Text = "(the web part has not yet been edited).";
                        return;
                    }


                    webPart.Title = WBUtils.PutBackDelimiterCharacters(newDetails[0]);
                    webPart.DocumentsGroupDescription = WBUtils.PutBackDelimiterCharacters(newDetails[1]);
                    webPart.DocumentsGroupSubjectTags = WBUtils.PutBackDelimiterCharacters(newDetails[2]);
                    webPart.DocumentsGroupCoverage    = WBUtils.PutBackDelimiterCharacters(newDetails[3]);
                    webPart.PickedDocumentsDetails    = WBUtils.PutBackDelimiterCharacters(newDetails[4]);

                    webPartManager.SaveChanges(WebPartGuid);

                    SPContext.Current.File.Update();
                    SPContext.Current.Web.Update();

                    currentDetails = NewDocumentsGroupDetails.Value.WBxTrim();

                    WBLogging.Debug("New current details: " + currentDetails);
                }
            }

            if (!String.IsNullOrEmpty(currentDetails) && !currentDetails.Contains(","))
            {
                WBLogging.Generic.Unexpected("The PickRelatedDocuments web part had an odd value: " + currentDetails);
                currentDetails = "";
            }

            if ((SPContext.Current.FormContext.FormMode == SPControlMode.Edit) ||
                (webPartManager.DisplayMode == WebPartManager.EditDisplayMode))
            {
                EditPanel.Visible = true;
                InEditMode        = true;
                EditDocumentsGroupButton.OnClientClick = "WorkBoxFramework_editDocumentsGroup(WBF_EditDialogCallback" + WebPartUniqueID + ", \"" + currentDetails + "\"); return false;";
            }
            else
            {
                EditPanel.Visible = false;
                EditDocumentsGroupButton.OnClientClick = "";
            }



            WBLogging.Debug("PickedDocumentsGroup currentDetails: " + currentDetails);


            Title.Text       = webPart.Title;
            Description.Text = WBUtils.MaybeAddParagraphTags(webPart.DocumentsGroupDescription);

            WBTermCollection <WBTerm> allSubjects = new WBTermCollection <WBTerm>(null, webPart.DocumentsGroupSubjectTags);

            SubjectTags.Text = allSubjects.Names();
            Coverage.Text    = webPart.DocumentsGroupCoverage;


            if (String.IsNullOrEmpty(webPart.PickedDocumentsDetails))
            {
                DocumentsList.Text = "<ul><li>(No documents picked)</li></ul>";
                DocumentsToView    = false;
                return;
            }

            String extranetRecordsLibraryURL = WBFWebPartsUtils.GetExtranetLibraryURL(SPContext.Current.Site);

            SPSite extranetRecordsSite    = null;
            SPWeb  extranetRecordsWeb     = null;
            SPList extranetRecordsLibrary = null;

            try
            {
                string[] documentsDetailsArray = webPart.PickedDocumentsDetails.Split(';');

                String publicRecordsLibraryURL = WBFWebPartsUtils.GetRecordsLibraryURL(SPContext.Current.Site);

                using (SPSite publicRecordsSite = new SPSite(publicRecordsLibraryURL))
                    using (SPWeb publicRecordsWeb = publicRecordsSite.OpenWeb())
                    {
                        SPList publicRecordsLibrary = publicRecordsWeb.GetList(publicRecordsLibraryURL);

                        String html = "<ul>\n";

                        foreach (string documentDetails in documentsDetailsArray)
                        {
                            string[] documentDetailsArray = documentDetails.Split('|');

                            if (documentDetailsArray.Length != 4)
                            {
                                WBLogging.Generic.Unexpected("Badly formatted document details in PickRelatedDocuments web part: " + currentDetails + " - Ignoring these details");
                                continue;
                            }

                            string zone     = documentDetailsArray[0];
                            string recordID = documentDetailsArray[1];
                            string sourceID = documentDetailsArray[2];
                            string filename = documentDetailsArray[3];

                            SPListItem item = null;

                            if (zone == "Public Extranet")
                            {
                                if (extranetRecordsLibrary == null)
                                {
                                    extranetRecordsSite    = new SPSite(extranetRecordsLibraryURL);
                                    extranetRecordsWeb     = extranetRecordsSite.OpenWeb();
                                    extranetRecordsLibrary = extranetRecordsWeb.GetList(extranetRecordsLibraryURL);
                                }

                                item = WBFWebPartsUtils.GetRecord(extranetRecordsSite, extranetRecordsWeb, extranetRecordsLibrary, zone, recordID);
                            }
                            else
                            {
                                item = WBFWebPartsUtils.GetRecord(publicRecordsSite, publicRecordsWeb, publicRecordsLibrary, zone, recordID);
                            }

                            if (item == null)
                            {
                                if (InEditMode)
                                {
                                    html += "<li><i>(Could not find document)</i></li>";
                                }
                            }
                            else
                            {
                                DocumentsToView = true;

                                string title = item.WBxGetAsString(WBColumn.Title);
                                if (String.IsNullOrEmpty(title))
                                {
                                    title = Path.GetFileNameWithoutExtension(item.Name);
                                }

                                string extension = Path.GetExtension(item.Name).Replace(".", "").ToUpper();

                                string additionalText = "";
                                long   fileLength     = (item.File.Length / 1024);
                                additionalText = ", " + fileLength + "KB";

                                if (item.WBxHasValue(WBColumn.ReferenceDate))
                                {
                                    DateTime referenceDate       = (DateTime)item.WBxGet(WBColumn.ReferenceDate);
                                    string   referenceDateString = string.Format("{0}-{1}-{2}",
                                                                                 referenceDate.Year.ToString("D4"),
                                                                                 referenceDate.Month.ToString("D2"),
                                                                                 referenceDate.Day.ToString("D2"));

                                    additionalText += ", " + referenceDateString;
                                }

                                html += String.Format("<li><img src=\"{0}\" alt=\"{1}\"/><a target=\"_blank\" href=\"{2}\">{1}</a> <span>({3})</span></li>",
                                                      WBUtils.DocumentIcon16(item.WBxGetAsString(WBColumn.Name)),
                                                      title,
                                                      item.WBxGetAsString(WBColumn.EncodedAbsoluteURL),
                                                      extension + additionalText);
                            }
                        }

                        html += "</ul>\n";

                        DocumentsList.Text = html;
                    }
            }
            catch (Exception exception)
            {
                if (InEditMode)
                {
                    DocumentsList.Text = "An error occurred: " + exception.Message;
                }
                else
                {
                    DocumentsToView = false;
                }
            }
            finally
            {
                if (extranetRecordsWeb != null)
                {
                    extranetRecordsWeb.Dispose();
                }
                if (extranetRecordsSite != null)
                {
                    extranetRecordsSite.Dispose();
                }
            }
        }
        protected void Initialize()
        {
            try
            {
                if (String.IsNullOrEmpty(Script) == false)
                {
                    VerifySignature();
                }

                if (Debug && PowerWebPartHelper.IsPowerUser)
                {
                    debugHost = new PowerWebPartDebugHost(this);
                    runspace  = RunspaceFactory.CreateRunspace(debugHost);
                    debugHost.StartDebugSession();
                }
                else
                {
                    runspace = RunspaceFactory.CreateRunspace();
                }

                runspace.Open();

                eventHandlerDelegate = new EventHandler(EventDispatcher);

                SPContext ctx = SPContext.Current;
                runspace.SessionStateProxy.SetVariable("this", this);
                runspace.SessionStateProxy.SetVariable("viewState", this.ViewState);
                runspace.SessionStateProxy.SetVariable("spContext", ctx);
                runspace.SessionStateProxy.SetVariable("httpContext", HttpContext.Current);
                runspace.SessionStateProxy.SetVariable("site", ctx.Site);
                runspace.SessionStateProxy.SetVariable("web", ctx.Web);
                runspace.SessionStateProxy.SetVariable("list", ctx.List);
                runspace.SessionStateProxy.SetVariable("item", ctx.Item);
                runspace.SessionStateProxy.SetVariable("webpart", WebPart);
                runspace.SessionStateProxy.SetVariable("debug", Debug);

                if (this.Page != null)
                {
                    runspace.SessionStateProxy.SetVariable("scriptManager", ScriptManager.GetCurrent(this.Page));
                    runspace.SessionStateProxy.SetVariable("isPostBack", this.Page.IsPostBack);
                    runspace.SessionStateProxy.SetVariable("page", this.Page);
                    runspace.SessionStateProxy.SetVariable("webPartManager", SPWebPartManager.GetCurrentWebPartManager(Page));
                }


                if (String.IsNullOrEmpty(Script) == false)
                {
                    string coreScript = PowerWebPartHelper.CoreScript;

                    if (!String.IsNullOrEmpty(coreScript))
                    {
                        Pipeline tmpPipe = CreatePipeline();
                        tmpPipe.Commands.AddScript(coreScript);
                        if (Debug && PowerWebPartHelper.IsPowerUser && String.IsNullOrEmpty(DebugOptions) == false)
                        {
                            tmpPipe.Commands.AddScript("Set-PSDebug " + DebugOptions);
                        }
                        InvokePipeline(tmpPipe, false);
                    }

                    if (!String.IsNullOrEmpty(Script))
                    {
                        LoadScriptFunctions();
                    }
                }
            }
            catch (Exception ex)
            {
                powerWebPartException = new PowerControlException("Initialization", ex);
            }
        }
Exemple #13
0
        public static void GetFilterInfo(IDictionary inst, string schemaName, ref string clickScript, SystemWebPart webPart, Page page, ref bool includeFilters, ref string fj, ref List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > effectiveFilters)
        {
            int              i1, i2;
            object           val;
            SPWebPartManager wpMan      = null;
            SystemWebPart    filterPart = null;
            IList            flist      = null;
            List <string>    andFilters = new List <string> ();
            List <object []> filters    = new List <object []> ();
            KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > kvp;

            includeFilters = false;
            if (inst ["filter"] != null)
            {
                try {
                    includeFilters = (bool)inst ["filter"];
                } catch {
                    includeFilters = false;
                }
            }
            if (includeFilters && !IsLic(2))
            {
                includeFilters = false;
                clickScript    = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetResource("NopeEd", ProductPage.GetProductResource("PC_" + schemaName + "_filter"), "Basic")) + "\');";
            }
            if (includeFilters && (effectiveFilters == null))
            {
                effectiveFilters = new List <KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > > ();
                try {
                    wpMan = SPWebPartManager.GetCurrentWebPartManager(page) as SPWebPartManager;
                } catch {
                }
                if ((webPart != null) && (wpMan != null))
                {
                    foreach (SystemWebPart wp in ProductPage.TryEach <SystemWebPart> (wpMan.WebParts))
                    {
                        if (wp.GetType().AssemblyQualifiedName == ProductPage.FILTERZEN_TYPENAME)
                        {
                            foreach (SystemWebPart cwp in (((getConnPartMethod == null) ? (getConnPartMethod = wp.GetType().GetMethod("GetConnectedParts", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly, null, Type.EmptyTypes, null)) : getConnPartMethod).Invoke(wp, null) as IEnumerable <SystemWebPart>))
                            {
                                if (cwp.ID.Equals(webPart.ID))
                                {
                                    filterPart = wp;
                                    break;
                                }
                            }
                        }
                        if (filterPart != null)
                        {
                            break;
                        }
                    }
                }
                if (filterPart != null)
                {
                    try {
                        if (!((bool)filterPart.GetType().GetMethod("LicEd", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(filterPart, new object [] { 2 })))
                        {
                            clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt")) + "\');";
                            filterPart  = null;
                        }
                    } catch {
                        clickScript = "alert(\'" + SPEncode.ScriptEncode(ProductPage.GetProductResource("Old_NoFilterZenEnt")) + "\');";
                        filterPart  = null;
                    }
                }
                fj = string.Empty;
                if (filterPart != null)
                {
                    try {
                        flist = ((partFiltersProp == null) ? (partFiltersProp = filterPart.GetType().GetProperty("PartFilters", BindingFlags.Instance | BindingFlags.Public)) : partFiltersProp).GetValue(filterPart, null) as IList;
                        fj    = ((partJsonProp == null) ? (partJsonProp = filterPart.GetType().GetProperty("JsonFilters", BindingFlags.Instance | BindingFlags.Public)) : partJsonProp).GetValue(filterPart, null) as string;
                        andFilters.AddRange(((string)((camlAndProp == null) ? (camlAndProp = filterPart.GetType().GetProperty("CamlFiltersAndCombined", BindingFlags.Instance | BindingFlags.Public)) : camlAndProp).GetValue(filterPart, null)).Split(new char [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
                    } catch {
                    }
                    if (flist != null)
                    {
                        foreach (object kv in flist)
                        {
                            if (kvpValProp == null)
                            {
                                kvpValProp = kv.GetType().GetProperty("Value", BindingFlags.Instance | BindingFlags.Public);
                            }
                            if ((val = kvpValProp.GetValue(kv, null)) != null)
                            {
                                if (fpKeyProp == null)
                                {
                                    fpKeyProp = val.GetType().GetProperty("Key", BindingFlags.Public | BindingFlags.Instance);
                                }
                                if (fpValProp == null)
                                {
                                    fpValProp = val.GetType().GetProperty("Value", BindingFlags.Public | BindingFlags.Instance);
                                }
                                if (fpOpProp == null)
                                {
                                    fpOpProp = val.GetType().GetProperty("CamlOperator", BindingFlags.Public | BindingFlags.Instance);
                                }
                                filters.Add(new object [] { fpKeyProp.GetValue(val, null), fpValProp.GetValue(val, null), (CamlOperator)Enum.Parse(typeof(CamlOperator), fpOpProp.GetValue(val, null).ToString(), true) });
                            }
                        }
                    }
                    foreach (object [] f in filters)
                    {
                        kvp = new KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > (f [0] as string, new KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> (new List <KeyValuePair <string, CamlOperator> > (), andFilters.Contains(f [0] as string)));
                        i1  = i2 = -1;
                        foreach (KeyValuePair <string, KeyValuePair <List <KeyValuePair <string, CamlOperator> >, bool> > k in effectiveFilters)
                        {
                            i2++;
                            if (k.Key == kvp.Key)
                            {
                                i1  = i2;
                                kvp = k;
                                break;
                            }
                        }
                        kvp.Value.Key.Add(new KeyValuePair <string, CamlOperator> (f [1] as string, (CamlOperator)f [2]));
                        if (i1 >= 0)
                        {
                            effectiveFilters [i1] = kvp;
                        }
                        else
                        {
                            effectiveFilters.Add(kvp);
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            webPart = this.Parent as PickRelatedDocuments;

            SPWebPartManager webPartManager = (SPWebPartManager)WebPartManager.GetCurrentWebPartManager(this.Page);

            Guid WebPartGuid = webPartManager.GetStorageKey(webPart);

            WebPartUniqueID = WebPartGuid.ToString().Replace("-", String.Empty);;

            //EditRelatedDocumentsButton.OnClientClick = "WorkBoxFramework_editRelatedDocuments(WBF_EditDialogCallback" + WebPartUniqueID + ", \"" + webPart.PickedDocumentsDetails + "\"); return false;";

            String[] detailsToSave = new String[3];

            detailsToSave[0] = WBUtils.ReplaceDelimiterCharacters(webPart.Title);
            detailsToSave[1] = WBUtils.ReplaceDelimiterCharacters(webPart.RelatedDocumentsDescription);
            detailsToSave[2] = WBUtils.ReplaceDelimiterCharacters(webPart.PickedDocumentsDetails.WBxTrim());

            String currentDetails         = String.Join(",", detailsToSave);
            String pickedDocumentsDetails = webPart.PickedDocumentsDetails.WBxTrim();


            if (IsPostBack)
            {
                if (NeedToSave.Value == "true")
                {
                    string[] newDetails = NewRelatedDocumentsDetails.Value.WBxTrim().Split(',');

                    if (newDetails.Length != 3)
                    {
                        WBLogging.Debug("The details sent to this page have the wrong structure: " + NewRelatedDocumentsDetails.Value);
                        Description.Text = "(the web part has not yet been edited).";
                        return;
                    }

                    if (WBFWebPartsUtils.ShowDescription(SPContext.Current.Site))
                    {
                        webPart.Title = WBUtils.PutBackDelimiterCharacters(newDetails[0]);
                        webPart.RelatedDocumentsDescription = WBUtils.PutBackDelimiterCharacters(newDetails[1]);
                    }
                    webPart.PickedDocumentsDetails = WBUtils.PutBackDelimiterCharacters(newDetails[2]);

                    webPartManager.SaveChanges(WebPartGuid);

                    SPContext.Current.File.Update();
                    SPContext.Current.Web.Update();

                    currentDetails         = NewRelatedDocumentsDetails.Value.WBxTrim();
                    pickedDocumentsDetails = webPart.PickedDocumentsDetails;
                }
            }

            if (!String.IsNullOrEmpty(currentDetails) && !currentDetails.Contains(","))
            {
                WBLogging.Generic.Unexpected("The PickRelatedDocuments web part had an odd value: " + currentDetails);
                currentDetails = "";
            }

            Description.Text = WBUtils.MaybeAddParagraphTags(webPart.RelatedDocumentsDescription);
            if (!String.IsNullOrEmpty(Description.Text) && WBFWebPartsUtils.ShowDescription(SPContext.Current.Site))
            {
                showDescription = true;
            }


            if ((SPContext.Current.FormContext.FormMode == SPControlMode.Edit) ||
                (webPartManager.DisplayMode == WebPartManager.EditDisplayMode))
            {
                EditPanel.Visible = true;
                InEditMode        = true;
                EditRelatedDocumentsButton.OnClientClick = "WorkBoxFramework_editRelatedDocuments(WBF_EditDialogCallback" + WebPartUniqueID + ", \"" + stripDownDetailsForEditing(currentDetails) + "\"); return false;";
            }
            else
            {
                EditPanel.Visible = false;
                EditRelatedDocumentsButton.OnClientClick = "";
            }



            WBLogging.Debug("PickRelatedDocuments currentDetails: " + currentDetails);


            if (String.IsNullOrEmpty(pickedDocumentsDetails))
            {
                DocumentList.Text = "<ul><li>(No documents picked)</li></ul>";
                DocumentsToView   = false;
                return;
            }

            try
            {
                string[] documentsDetailsArray = pickedDocumentsDetails.Split(';');

                String recordsLibraryURL = WBFWebPartsUtils.GetRecordsLibraryURL(SPContext.Current.Site);

                using (SPSite site = new SPSite(recordsLibraryURL))
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList library = web.GetList(recordsLibraryURL);

                        String html = "<ul>\n";

                        foreach (string documentDetails in documentsDetailsArray)
                        {
                            string[] documentDetailsArray = documentDetails.Split('|');

                            if (documentDetailsArray.Length != 4)
                            {
                                WBLogging.Generic.Unexpected("Badly formatted document details in PickRelatedDocuments web part: " + currentDetails + " - Ignoring these details");
                                continue;
                            }

                            string zone     = documentDetailsArray[0];
                            string recordID = documentDetailsArray[1];
                            string sourceID = documentDetailsArray[2];
                            string filename = documentDetailsArray[3];

                            SPListItem item = WBFWebPartsUtils.GetRecord(site, web, library, zone, recordID);

                            if (item == null)
                            {
                                if (InEditMode)
                                {
                                    html += "<li><i>(Could not find document)</i></li>";
                                }
                            }
                            else
                            {
                                DocumentsToView = true;

                                string title = item.WBxGetAsString(WBColumn.Title);
                                if (String.IsNullOrEmpty(title))
                                {
                                    title = Path.GetFileNameWithoutExtension(item.Name);
                                }

                                string extension = Path.GetExtension(item.Name).Replace(".", "").ToUpper();

                                string additionalText = "";

                                if (WBFWebPartsUtils.ShowKBFileSize(SPContext.Current.Site))
                                {
                                    long fileLength = (item.File.Length / 1024);
                                    additionalText = ", " + fileLength + "KB";
                                }

                                if (WBFWebPartsUtils.ShowFileIcons(SPContext.Current.Site))
                                {
                                    title = String.Format("<img src=\"{0}\" alt=\"{1}\" class=\"wbf-picked-doc-image\"/> {1}",
                                                          WBUtils.DocumentIcon16(item.Name),
                                                          title);
                                }

                                html += "<li><a target=\"_blank\" href=\"" + item.WBxGetAsString(WBColumn.EncodedAbsoluteURL) + "\">" + title + "</a> <span>(" + extension + additionalText + ")</span></li>";
                            }
                        }

                        html += "</ul>\n";

                        DocumentList.Text = html;
                    }
            }
            catch (Exception exception)
            {
                if (InEditMode)
                {
                    DocumentList.Text = "An error occurred: " + exception.Message;
                }
                else
                {
                    DocumentsToView = false;
                }
            }
        }