private void InitCollector(Boolean isEditing) { Collector = new CollectorControl(); CallbackHandler handler = new CallbackHandler("ThemeConfigurationCallbackHandler"); handler.OnCallback += handler_OnCallback; var popup = new HTMLText(String.Format(@" <div class=""modal fade"" id=""popupThemeLoader""> <div class=""modal-dialog modal-lg""> <div class=""modal-content""> <div class=""modal-header""> <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close""><span aria-hidden=""true"">×</span></button> <h4 class=""modal-title"">Theme CSS uploading</h4> </div> <div class=""modal-body""> <div class=""form-group""> <label for=""themeName"">Theme name</label> <input name=""themeName"" type=""text"" class=""form-control"" id=""themeName"" placeholder=""Name of destination theme folder""> </div> <div class=""form-group""> <label for=""bootstrapCSS"">Bootstrap CSS</label> <textarea name=""bootstrapCSS"" class=""form-control"" rows=""20"" id=""bootstrapCSS"" placeholder=""Main Bootstrap CSS content""></textarea> </div> </div> <div class=""modal-footer""> <button type=""button"" class=""btn btn-default pull-right"" data-dismiss=""modal"">Cancel</button> <button type=""button"" class=""btn btn-default pull-right"" data-dismiss=""modal"" onclick="" startProgress(); setTimeout(function() {{ {0} }}, 1000);"">OK</button> </div> </div> </div> </div> ", handler.GetScript("'save'"))); var popupButton = new HTMLText(@"<button class=""btn btn-default btn-sm"" type=""button"" onclick=""$('#popupThemeLoader').modal();""><span class=""glyphicon glyphicon-upload""></span> Upload</button>"); Collector.Controls.Add(Edit); if (isEditing) { Collector.Controls.Add(popup); Collector.Controls.Add(popupButton); } }
/// <summary> /// Fills the portal DS. /// </summary> /// <param name="responseInfo">The response info.</param> /// <returns></returns> private DataSet FillPortalDS(ref ServiceResponseInfo responseInfo) { DataSet ds = new DataSet(); try { ds = CreatePortalDS(ds); string strTmp, strLink, strBaseLink; string strModuleFriendlyName, strModuleID, strItemID; string strTabID, strModuleGuidID, strModuleTitle; string strLocate; DataRow dr; for (int row = 0; row < responseInfo.Items.Count; row++) { dr = ds.Tables["ServiceItemList"].NewRow(); //ServiceResponseInfoItemExt item = (ServiceResponseInfoItemExt) responseInfo.Items[row]; ServiceResponseInfoItem item = (ServiceResponseInfoItem)responseInfo.Items[row]; strModuleFriendlyName = item.FriendlyName; strModuleID = item.ModuleID.ToString(); strItemID = item.ItemID.ToString(); strTabID = item.PageID.ToString(); strModuleGuidID = item.GeneralModDefID.ToString().ToUpper(); strModuleTitle = item.ModuleTitle; strLocate = "mID=" + strModuleID + "&ItemID=" + strItemID; if (requestInfo.ShowID) { strModuleFriendlyName += " (ID=" + strModuleID + ")"; strModuleTitle += " (ID=" + strModuleID + ")"; } if (requestInfo.LocalMode) { strBaseLink = Path.ApplicationRoot + "/"; } else { strBaseLink = requestInfo.Url; } switch (strModuleGuidID) { case "2D86166C-4BDC-4A6F-A028-D17C2BB177C8": //Discussions strLink = strBaseLink + "DesktopModules/Discussion/DiscussionView.aspx?" + strLocate; break; case "2502DB18-B580-4F90-8CB4-C15E6E531012": //Tasks strLink = strBaseLink + "DesktopModules/Tasks/TasksView.aspx?" + strLocate; break; default: strLink = strBaseLink + "DesktopDefault.aspx?tabID=" + strTabID; break; } if (requestInfo.PortalAlias.Length != 0) { strLink += "&Alias=" + requestInfo.PortalAlias; } //if (showImage) //{ // dr["Image"] = "<a href='" + strLink + "'>" + strModuleGuidID + ".gif" + "</a>"; //} if (showModuleFriendlyName) { dr["Module"] = strModuleFriendlyName; } if (showModuleTitle) { dr["Module Title"] = strModuleTitle; } if (showTitle) { if (strModuleGuidID == "0B113F51-FEA3-499A-98E7-7B83C192FDBB" || //Html Document strModuleGuidID == "2B113F51-FEA3-499A-98E7-7B83C192FDBB") //Html WYSIWYG Edit (V2) { // We use the database field [rb.Modules].[ModuleTitle]: strTmp = strModuleTitle; } else { if (item.Title == string.Empty) { strTmp = "missing"; } else { strTmp = item.Title; } } dr["Title"] = "<a href='" + strLink + "' Target='" + Target + "'>" + strTmp + "</a>"; } if (showDescription) { if (item.Description == string.Empty) { strTmp = "missing"; } else { strTmp = item.Description; } // Remove any html tags: HTMLText html = SearchHelper.DeleteBeforeBody(Server.HtmlDecode(strTmp)); dr["Description"] = html.InnerText; } if (showCreatedByUser) { if (item.CreatedByUser == string.Empty) { strTmp = string.Empty; } else { strTmp = item.CreatedByUser; } // 15/7/2004 added localization by Mario Endara [email protected] if (strTmp == "unknown") { strTmp = General.GetString("UNKNOWN", "unknown"); } dr["User"] = strTmp; } if (showCreatedDate) { try { strTmp = item.CreatedDate.ToShortDateString(); } catch { strTmp = string.Empty; } // If date is an empty string the date "1/1/1900" is returned. if (strTmp == "1/1/1900") { strTmp = string.Empty; } dr["Date"] = strTmp; } if (showLink) { dr["Link"] = "<a href='" + strLink + "' Target='" + Target + "'>" + strLink + "</a>"; } if (showTabName) { if (item.PageName == string.Empty) { strTmp = "missing"; } else { strTmp = item.PageName; } if (requestInfo.ShowID && strTmp != "missing") { strTmp = strTmp + "(ID=" + item.PageID + ")"; } if (requestInfo.PortalAlias.Length != 0) { dr["Tab"] = "<a href='" + strBaseLink + "DesktopDefault.aspx?tabID=" + strTabID + "&Alias=" + requestInfo.PortalAlias + "' Target='" + Target + "'>" + strTmp + "</a>"; } else { dr["Tab"] = "<a href='" + strBaseLink + "DesktopDefault.aspx?tabID=" + strTabID + "' Target='" + Target + "'>" + strTmp + "</a>"; } } ds.Tables["ServiceItemList"].Rows.Add(dr); } } catch (Exception e) { lblStatus.Text = "Error when reading list. Problem: " + e.Message; return(null); } return(ds); }
private DataSet FillPortalDS(int portalID, int userID, SqlDataReader portalSearchResult, out int hits) { hits = 0; DataSet ds = new DataSet(); try { ds = CreatePortalDS(ds); string strTmp, strLink, strModuleName; string strModuleID, strItemID, strLocate; string strTabID, strTabName; string strModuleGuidID, strModuleTitle; DataRow dr; try { while (hits <= maxHits && portalSearchResult.Read()) { dr = ds.Tables["PortalSearch"].NewRow(); strModuleName = portalSearchResult.GetString(0); strModuleID = portalSearchResult.GetInt32(3).ToString(); strItemID = portalSearchResult.GetInt32(4).ToString(); strLocate = "mID=" + strModuleID + "&ItemID=" + strItemID; strTabID = portalSearchResult.GetInt32(7).ToString(); strTabName = portalSearchResult.GetString(8).ToString(); strModuleGuidID = portalSearchResult.GetGuid(9).ToString().ToUpper(); strModuleTitle = portalSearchResult.GetString(10); //strLink = Rainbow.Settings.Path.ApplicationRoot; // [email protected] // Changed the way links were created so that it utilises BuildUrl. switch (strModuleGuidID) { case "2D86166C-4BDC-4A6F-A028-D17C2BB177C8": //Discussions // Mark McFarlane // added support for a new page that lets you view an entire thread // URL requires tabID = 0 strLink = HttpUrlBuilder.BuildUrl("~/DesktopModules/Discussion/DiscussionViewThread.aspx", 0, strLocate); break; case "2502DB18-B580-4F90-8CB4-C15E6E531012": //Tasks strLink = HttpUrlBuilder.BuildUrl("~/DesktopModules/Tasks/TasksView.aspx", Convert.ToInt32(strTabID), strLocate); break; case "87303CF7-76D0-49B1-A7E7-A5C8E26415BA": //Articles // Rob Siera // Added support to link to the article itself, instead op the page of with article module strLink = HttpUrlBuilder.BuildUrl("~/DesktopModules/Articles/ArticlesView.aspx", 0, strLocate); break; case "EC24FABD-FB16-4978-8C81-1ADD39792377": //Products // Manu int tabID = PortalSettings.GetRootTab(Convert.ToInt32(strTabID), portalSettings.DesktopTabs).TabID; strLink = HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", tabID, "mID=" + strModuleID + "&ItemID=" + strTabID); break; case "875254B7-2471-491F-BAF8-4AFC261CC224": //EnhancedHtml // José Viladiu // Added support to link to the specific page strLink = HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", Convert.ToInt32(strTabID), strLocate); break; default: strLink = HttpUrlBuilder.BuildUrl(Convert.ToInt32(strTabID)); // "/DesktopDefault.aspx?tabID=" + ; break; } //if (showImage) //{ // dr["Image"] = "<a href='" + strLink + "'>" + strModuleGuidID + ".gif" + "</a>"; //} if (showModuleName) { dr["Module"] = strModuleName; } if (showModuleTitle) { dr["Module Title"] = strModuleTitle; } if (showTitle) { if (strModuleGuidID == "0B113F51-FEA3-499A-98E7-7B83C192FDBB" || //Html Document strModuleGuidID == "2B113F51-FEA3-499A-98E7-7B83C192FDBB") //Html WYSIWYG Edit (V2) { // We use the database field [rb.Modules].[ModuleTitle]: strTmp = strModuleTitle; } else { if (portalSearchResult.IsDBNull(1)) { strTmp = Esperantus.Localize.GetString("PORTALSEARCH_MISSING", "Missing", null); } else { strTmp = portalSearchResult.GetString(1); } } dr["Title"] = "<a href='" + strLink + "'>" + strTmp + "</a>"; dr["cleanTitle"] = strTmp; } if (showAbstract) { if (portalSearchResult.IsDBNull(2)) { strTmp = Esperantus.Localize.GetString("PORTALSEARCH_MISSING", "Missing", null); } else { strTmp = portalSearchResult.GetString(2); } // Remove any html tags: HTMLText html = SearchHelper.DeleteBeforeBody(Server.HtmlDecode(strTmp)); dr["Abstract"] = html.InnerText; } if (showCreatedByUser) { if (portalSearchResult.IsDBNull(5)) { strTmp = Esperantus.Localize.GetString("PORTALSEARCH_MISSING", "Missing", null); } else { strTmp = portalSearchResult.GetString(5); } // 15/7/2004 added localization by Mario Endara [email protected] if (strTmp == "unknown") { strTmp = Esperantus.Localize.GetString("UNKNOWN", "unknown"); } dr["User"] = strTmp; } if (showCreatedDate) { if (portalSearchResult.IsDBNull(6)) { strTmp = Esperantus.Localize.GetString("PORTALSEARCH_MISSING", "Missing", null); } else { try { strTmp = portalSearchResult.GetDateTime(6).ToShortDateString(); } catch { strTmp = string.Empty; } } // If GetDateTime(6) is an empty string the date "1/1/1900" is returned. if (strTmp == "1/1/1900") { strTmp = string.Empty; } dr["Date"] = strTmp; } if (showLink) { dr["Link"] = "<a href='" + strLink + "'>" + strLink + "</a>"; } if (showTabName) { if (portalSearchResult.IsDBNull(8)) { strTmp = Esperantus.Localize.GetString("PORTALSEARCH_MISSING", "Missing", null); } else { strTmp = portalSearchResult.GetString(8); } dr["Tab"] = "<a href='" + HttpUrlBuilder.BuildUrl(Convert.ToInt32(strTabID)) + "'>" + strTmp + "</a>"; } if (showTestInfo) { dr["TestInfo"] = "ModuleGuidID=" + strModuleGuidID + "<br>" + "ModuleID=" + strModuleID + ", ItemID=" + strItemID + "<br>" + "PortalID=" + portalID.ToString() + ", UserID=" + userID.ToString() + "<br>" + "TabID=" + strTabID + ", TabName=" + strTabName; } ds.Tables["PortalSearch"].Rows.Add(dr); hits++; } } finally { portalSearchResult.Close(); } } catch (Exception e) { lblHits.Text = e.Message; return(null); } return(ds); }