PageRenderTime 58ms CodeModel.GetById 22ms RepoModel.GetById 1ms app.codeStats 0ms

/App_Code/CSCode/StyleHelper.cs

https://github.com/eiursuajr/minGit
C# | 1833 lines | 1627 code | 135 blank | 71 comment | 250 complexity | 935a01e2c6925639235b02caf7038357 MD5 | raw file
Possible License(s): JSON

Large files files are truncated, but you can click here to view the full file

  1. using System.Web.UI.WebControls;
  2. using System.Configuration;
  3. using System.Collections;
  4. using System.Linq;
  5. using System.Data;
  6. using System.Web.Caching;
  7. using System.Xml.Linq;
  8. using System.Web.UI;
  9. using System.Diagnostics;
  10. using System.Web.Security;
  11. using System;
  12. using System.Text;
  13. using Microsoft.VisualBasic;
  14. using System.Web.UI.HtmlControls;
  15. using System.Web.SessionState;
  16. using System.Text.RegularExpressions;
  17. using System.Web.Profile;
  18. using System.Collections.Generic;
  19. using System.Web.UI.WebControls.WebParts;
  20. using System.Collections.Specialized;
  21. using System.Web;
  22. using Ektron.Cms;
  23. using Ektron.Cms.Common;
  24. using Ektron.Cms.Localization;
  25. using Ektron.Cms.Framework.UI;
  26. using Microsoft.Security.Application;
  27. public class StyleHelper
  28. {
  29. public const string ActionBarDivider = "<td><div class=\"actionbarDivider\">&nbsp;</div></td>";
  30. public static HtmlTableCell ActionBarDividerCell
  31. {
  32. get
  33. {
  34. var cell = new HtmlTableCell();
  35. cell.InnerHtml = ActionBarDivider;
  36. return cell;
  37. }
  38. }
  39. public const string PrimaryFunctionCssClass = "primary";
  40. public const string SecondaryFunctionCssClass = "secondary";
  41. public const string AddAssetButtonCssClass = "addAssetButton";
  42. public const string AddButtonCssClass = "addButton";
  43. public const string AddBookButtonCssClass = "addBookButton";
  44. public const string AddBrowseButtonCssClass = "addBrowseButton";
  45. public const string AddCommentButtonCssClass = "addCommentButton";
  46. public const string AddContentButtonCssClass = "addContentButton";
  47. public const string AddEmailButtonCssClass = "addEmailButton";
  48. public const string AddTaskButtonCssClass = "addTaskButton";
  49. public const string AddTranslationButtonCssClass = "addTranslationButton";
  50. public const string AddUserGroupButtonCssClass = "addUserGroupButton";
  51. public const string ApprovalsButtonCssClass = "approvalsButton";
  52. public const string ApproveButtonCssClass = "approveButton";
  53. public const string AssignFoldersButtonCssClass = "assignFoldersButton";
  54. public const string AssignItemsButtonCssClass = "assignItemsButton";
  55. public const string BackButtonCssClass = "backButton";
  56. public const string BrowseButtonCssClass = "browseButton";
  57. public const string CancelButtonCssClass = "cancelButton";
  58. public const string CautionButtonCssClass = "cautionButton";
  59. public const string CheckInButtonCssClass = "checkInButton";
  60. public const string CompareAnalyticsButtonCssClass = "compareAnalyticsButton";
  61. public const string CopyButtonCssClass = "copyButton";
  62. public const string ContextualHelpButtonCssClass = "contextualHelpButton";
  63. public const string CrawlFullButtonCssClass = "crawlFullButton";
  64. public const string CrawlIncrementalButtonCssClass = "crawlIncrementalButton";
  65. public const string DeclineButtonCssClass = "declineButton";
  66. public const string DeleteButtonCssClass = "deleteButton";
  67. public const string DeleteDriveButtonCssClass = "deleteDriveButton";
  68. public const string DeleteEmailButtonCssClass = "deleteEmailButton";
  69. public const string DeleteHistoryButtonCssClass = "deleteHistoryButton";
  70. public const string DownButtonCssClass = "downButton";
  71. public const string EditButtonCssClass = "editButton";
  72. public const string EditContentFormButtonCssClass = "editContentFormButton";
  73. public const string EditFallbackButtonCssClass = "editFallbackButton";
  74. public const string EditPropertiesButtonCssClass = "editPropertiesButton";
  75. public const string EditSmartformButtonCssClass = "editSmartformButton";
  76. public const string EmailButtonCssClass = "emailButton";
  77. public const string EnableButtonCssClass = "enableButton";
  78. public const string ExportButtonCssClass = "exportButton";
  79. public const string ExportTaxonomyButtonCssClass = "exportTaxonomyButton";
  80. public const string ExportTranslationButtonCssClass = "exportTranslationButton";
  81. public const string FilterReportButtonCssClass = "filterReportButton";
  82. public const string ForwardEmailButtonCssClass = "forwardEmailButton";
  83. public const string HistoryButtonCssClass = "historyButton";
  84. public const string ImportTaxonomyButtonCssClass = "importTaxonomyButton";
  85. public const string InsertButtonCssClass = "insertButton";
  86. public const string InsertBookButtonCssClass = "insertBookButton";
  87. public const string InviteButtonCssClass = "inviteButton";
  88. public const string LastStatusButtonCssClass = "lastStatusButton";
  89. public const string LocaleDoNotTranslateButtonCssClass = "localeDoNotTranslateButton";
  90. public const string LocaleNeedsTranslationButtonCssClass = "localeNeedsTranslationButton";
  91. public const string LocaleNotReadyButtonCssClass = "localeNotReadyButton";
  92. public const string LocaleOutForTranslationButtonCssClass = "localeOutForTranslationButton";
  93. public const string LocaleReadyButtonCssClass = "localeReadyButton";
  94. public const string LocaleTranslatedButtonCssClass = "localeTranslatedButton";
  95. public const string LogHistoryButtonCssClass = "logHistoryButton";
  96. public const string NextButtonCssClass = "nextButton";
  97. public const string NextDisabledButtonCssClass = "nextDisabledButton";
  98. public const string MoveButtonCssClass = "moveButton";
  99. public const string MoveContentButtonCssClass = "moveContentButton";
  100. public const string OpenFolderButtonCssClass = "openFolderButton";
  101. public const string OverwriteButtonCssClass = "overwriteButton";
  102. public const string PreApprovalButtonCssClass = "preApprovalButton";
  103. public const string PreviewButtonCssClass = "previewButton";
  104. public const string PreviousButtonCssClass = "previousButton";
  105. public const string PreviousDisabledButtonCssClass = "previousDisabledButton";
  106. public const string PreviewStatusButtonCssClass = "previewStatusButton";
  107. public const string PreviewStatusButtonCssNewClass = "previewStatusNewButton";
  108. public const string PrintButtonCssClass = "printButton";
  109. public const string PublishButtonCssClass = "publishButton";
  110. public const string RefreshButtonCssClass = "refreshButton";
  111. public const string RemoveButtonCssClass = "removeButton";
  112. public const string ReOrderButtonCssClass = "reOrderButton";
  113. public const string ReplyToEmailButtonCssClass = "replyToEmailButton";
  114. public const string ResolveConflictButtonCssClass = "resolveConflictButton";
  115. public const string RestoreButtonCssClass = "restoreButton";
  116. public const string ReviewConflictButtonCssClass = "reviewConflictButton";
  117. public const string SaveButtonCssClass = "saveButton";
  118. public const string SearchButtonCssClass = "searchButton";
  119. public const string SentEmailsButtonCssClass = "sentEmailsButton";
  120. public const string SubmitForApprovalButtonCssClass = "submitForApprovalButton";
  121. public const string SyncButtonCssClass = "syncButton";
  122. public const string TranslationButtonCssClass = "translationButton";
  123. public const string UndoCheckout = "undoCheckout";
  124. public const string UpButtonCssClass = "upButton";
  125. public const string UpdateQuicklinkButtonCssClass = "updateQuicklinkButton";
  126. public const string ViewAnalyticsButtonCssClass = "viewAnalyticsButton";
  127. public const string ViewApprovalsButtonCssClass = "viewApprovalsButton";
  128. public const string ViewBookButtonCssClass = "viewBookButton";
  129. public const string ViewDifferenceButtonCssClass = "viewDifferenceButton";
  130. public const string ViewGroupMembersButtonCssClass = "viewGroupMembersButton";
  131. public const string ViewPermissionsButtonCssClass = "viewPermissionsButton";
  132. public const string ViewPropertiesButtonCssClass = "viewPropertiesButton";
  133. public const string ViewPublishedButtonCssClass = "viewPublishedButton";
  134. public const string ViewReportButtonCssClass = "viewReportButton";
  135. public const string ViewStagedButtonCssClass = "viewStagedButton";
  136. public const string ViewTaskButtonCssClass = "viewTaskButton";
  137. public const string ViewXslButtonCssClass = "viewXslButton";
  138. public static string MergeCssClasses(string[] classNames)
  139. {
  140. var classString = "";
  141. if (classNames != null && classNames.Length > 0)
  142. {
  143. var len = classNames.Length;
  144. int i;
  145. classString = classNames[0];
  146. for (i = 1; i < len; i++ )
  147. {
  148. classString += " " + classNames[i];
  149. }
  150. }
  151. return classString;
  152. }
  153. private System.String myTemp = "";
  154. private System.Int32 MyButtonName = 100;
  155. private System.Boolean DisplayTransText = false;
  156. private EkMessageHelper m_refMsg = null;
  157. private CommonApi m_refAPI = null;
  158. private int ContentLanguage = -1;
  159. public StyleHelper()
  160. {
  161. m_refAPI = new CommonApi();
  162. string strLangID;
  163. strLangID = System.Web.HttpContext.Current.Request.QueryString["LangType"];
  164. if (strLangID != null && Information.IsNumeric(strLangID))
  165. {
  166. try
  167. {
  168. ContentLanguage = Convert.ToInt32(strLangID);
  169. }
  170. catch (Exception ex)
  171. {
  172. EkException.LogException(ex, System.Diagnostics.EventLogEntryType.Warning);
  173. EkException.WriteToEventLog((string)("Language string was: " + strLangID), System.Diagnostics.EventLogEntryType.Warning);
  174. }
  175. m_refAPI.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
  176. }
  177. else
  178. {
  179. strLangID = m_refAPI.GetCookieValue("LastValidLanguageID");
  180. if (strLangID != null && Information.IsNumeric(strLangID))
  181. {
  182. ContentLanguage = Convert.ToInt32(strLangID);
  183. }
  184. }
  185. if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
  186. {
  187. m_refAPI.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
  188. }
  189. else
  190. {
  191. m_refAPI.ContentLanguage = ContentLanguage;
  192. }
  193. DisplayTransText = m_refAPI.DisplayTransText;
  194. m_refMsg = m_refAPI.EkMsgRef;
  195. }
  196. public System.Web.UI.WebControls.BoundField CreateBoundField(string DataField, string HeaderText, string CssClass, System.Web.UI.WebControls.HorizontalAlign HeaderHorizontalAlign, System.Web.UI.WebControls.HorizontalAlign ItemHorizontalAlign, System.Web.UI.WebControls.Unit HeaderWidth, System.Web.UI.WebControls.Unit ItemWidth, bool HtmlEncode, bool ItemWrap)
  197. {
  198. System.Web.UI.WebControls.BoundField colBound = new System.Web.UI.WebControls.BoundField();
  199. colBound.DataField = DataField;
  200. colBound.HeaderText = HeaderText;
  201. colBound.HeaderStyle.CssClass = CssClass;
  202. colBound.HeaderStyle.Width = HeaderWidth;
  203. colBound.ItemStyle.Width = ItemWidth;
  204. colBound.ItemStyle.HorizontalAlign = ItemHorizontalAlign;
  205. colBound.HeaderStyle.HorizontalAlign = HeaderHorizontalAlign;
  206. colBound.HtmlEncode = HtmlEncode;
  207. colBound.ItemStyle.Wrap = ItemWrap;
  208. return colBound;
  209. }
  210. public System.String HyperlinkWCaption(System.String HrefPath, System.String DisplayText, System.String HeaderText, System.String specialEvents)
  211. {
  212. StringBuilder result = null;
  213. try
  214. {
  215. result = new StringBuilder();
  216. result.Append("<a href=\"" + HrefPath + "\" onMouseOver=\"");
  217. if (DisplayTransText)
  218. {
  219. if (HeaderText != "")
  220. {
  221. //result.Append("ShowTransString(\'" + HeaderText.Replace("\'", "\\\'") + "\');");
  222. }
  223. }
  224. result.Append("\" onMouseOut=\"");
  225. if (DisplayTransText)
  226. {
  227. if (HeaderText != "")
  228. {
  229. //result.Append("HideTransString();");
  230. }
  231. }
  232. result.Append("\">" + DisplayText + "</a>");
  233. MyButtonName++;
  234. }
  235. catch (Exception)
  236. {
  237. result.Length = 0;
  238. }
  239. finally
  240. {
  241. }
  242. return (result.ToString());
  243. }
  244. public System.String GetButtonEvents(System.String ImageFile, System.String hrefPath, System.String altText, System.String specialEvents)
  245. {
  246. StringBuilder result = null;
  247. try
  248. {
  249. result = new StringBuilder();
  250. result.Append("<td ");
  251. result.Append("id=\"image_cell_" + MyButtonName + "\" ");
  252. result.Append("class=\"button\" title=\"" + altText + "\">");
  253. result.Append("<a id=\"image_link_" + MyButtonName + "\" href=\"" + hrefPath + "\" " + specialEvents + " ");
  254. result.Append("onMouseOver=\"RollOver(this);\" onMouseOut=\"RollOut(this);\" style=\"cursor: default;\">");
  255. result.Append("<img onClick=\"" + "SelectButton(this);" + "\" src=\"" + ImageFile + "\" id=\"image_" + MyButtonName + "\" class=\"button\">");
  256. result.Append("</a></td>");
  257. MyButtonName++;
  258. }
  259. catch (Exception)
  260. {
  261. result.Length = 0;
  262. }
  263. return (result.ToString());
  264. }
  265. public System.String GetButtonEventsWCaption(System.String imageFile, System.String hrefPath, System.String altText, System.String HeaderText, System.String specialEvents)
  266. {
  267. return GetButtonEventsWCaption(imageFile, hrefPath, altText, HeaderText, specialEvents, null, false);
  268. }
  269. public System.String GetButtonEventsWCaption(System.String imageFile, System.String hrefPath, System.String altText, System.String HeaderText, System.String specialEvents, System.String aTagClassName)
  270. {
  271. return GetButtonEventsWCaption(imageFile, hrefPath, altText, HeaderText, specialEvents, aTagClassName, false);
  272. }
  273. public System.String GetButtonEventsWCaption(System.String imageFile, System.String hrefPath, System.String altText, System.String HeaderText, System.String specialEvents, System.String aTagClassName, bool isPrimary)
  274. {
  275. StringBuilder result = null;
  276. try
  277. {
  278. result = new StringBuilder();
  279. result.Append("<td ");
  280. result.Append("id=\"image_cell_" + MyButtonName + "\" ");
  281. if (isPrimary && aTagClassName != BackButtonCssClass && aTagClassName != CancelButtonCssClass)
  282. {
  283. result.Append("class=\"button\">");
  284. }
  285. else
  286. {
  287. result.Append("class=\"button\" title=\"" + HeaderText.Replace("\'", "\\\'") + "\">");
  288. }
  289. result.Append("<a ");
  290. string priorityCssClass = (isPrimary) ? PrimaryFunctionCssClass : SecondaryFunctionCssClass;
  291. if (!String.IsNullOrEmpty(aTagClassName))
  292. {
  293. result.Append("class=\"" + MergeCssClasses(new string[2] { priorityCssClass, aTagClassName }) + "\" ");
  294. }
  295. else
  296. {
  297. result.Append("class=\"" + priorityCssClass + "\" ");
  298. }
  299. result.Append("id=\"image_link_" + MyButtonName + "\" href=\"" + hrefPath + "\" " + specialEvents + " ");
  300. result.Append("onMouseOver=\"");
  301. if (DisplayTransText)
  302. {
  303. if (HeaderText != "")
  304. {
  305. //result.Append("ShowTransString(\'" + HeaderText.Replace("\'", "\\\'") + "\');");
  306. }
  307. }
  308. result.Append("RollOver(this);\" onMouseOut=\"");
  309. if (DisplayTransText)
  310. {
  311. if (HeaderText != "")
  312. {
  313. //result.Append("HideTransString();");
  314. }
  315. }
  316. result.Append("RollOut(this);\"");
  317. result.Append(" style=\"cursor: default;\">");
  318. if (isPrimary)
  319. {
  320. if (aTagClassName == BackButtonCssClass || aTagClassName == CancelButtonCssClass)
  321. {
  322. // leave blank for icon.
  323. }
  324. else
  325. {
  326. result.Append(HeaderText);
  327. }
  328. }
  329. else
  330. {
  331. result.Append("<img onClick=\"" + "SelectButton(this);" + "\" src=\"" + imageFile + "\" id=\"image_" + MyButtonName + "\" class=\"button\">");
  332. }
  333. result.Append("</a></td>");
  334. MyButtonName++;
  335. }
  336. catch (Exception)
  337. {
  338. result.Length = 0;
  339. }
  340. finally
  341. {
  342. }
  343. return (result.ToString());
  344. }
  345. /// <summary>
  346. /// Converts an ASP.Net image button so it works in the CMS400 toolbar
  347. /// All your code is handled in the codebehind for the button click
  348. /// </summary>
  349. /// <param name="btn">button to update</param>
  350. /// <param name="altText">alt text for button for flyover help</param>
  351. /// <param name="HeaderText">text to put in toolbar header on mouseover of button</param>
  352. /// <remarks></remarks>
  353. public void MakeToolbarButton(ImageButton btn, string altText, string HeaderText)
  354. {
  355. btn.AlternateText = altText;
  356. // btn.Attributes.Add("onMouseOver", "ShowTransString(\'" + HeaderText + "\'); RollOver(this);");
  357. // btn.Attributes.Add("onMouseOut", "HideTransString(); RollOut(this);");
  358. btn.Attributes.Add("style", "cursor:default;");
  359. btn.Attributes.Add("style", "border-width:1px");
  360. }
  361. public System.String GetTitleBar(System.String Title)
  362. {
  363. StringBuilder result = new StringBuilder();
  364. try
  365. {
  366. result.Append("<span id=\"WorkareaTitlebar\">" + Title + "</span>");
  367. result.Append("<span style=\"display:none\" id=\"_WorkareaTitlebar\"></span>");
  368. }
  369. catch (Exception)
  370. {
  371. result.Length = 0;
  372. }
  373. return (result.ToString());
  374. }
  375. public System.String GetShowAllActiveLanguage(System.Boolean showAllOpt, System.String bgColor, System.String OnChangeEvt, System.String SelLang)
  376. {
  377. return GetShowAllActiveLanguage(showAllOpt, bgColor, OnChangeEvt, SelLang, false);
  378. }
  379. public System.String GetShowAllActiveLanguage(System.Boolean showAllOpt, System.String bgColor, System.String OnChangeEvt, System.String SelLang, bool showOnlySiteEnabled)
  380. {
  381. return ("<td>" + ShowAllActiveLanguage(showAllOpt, bgColor, OnChangeEvt, SelLang, showOnlySiteEnabled) + "</td>");
  382. }
  383. public System.String ShowAllActiveLanguage(System.Boolean showAllOpt, System.String bgColor, System.String OnChangeEvt, System.String SelLang)
  384. {
  385. return ShowAllActiveLanguage(showAllOpt, bgColor, OnChangeEvt, SelLang, false);
  386. }
  387. public System.String ShowAllActiveLanguage(System.Boolean showAllOpt, System.String bgColor, System.String OnChangeEvt, System.String SelLang, bool showOnlySiteEnabled)
  388. {
  389. StringBuilder result = new StringBuilder();
  390. LanguageData[] language_data;
  391. SiteAPI m_refSiteApi = new SiteAPI();
  392. int LanguageId = m_refSiteApi.ContentLanguage;
  393. try
  394. {
  395. if (OnChangeEvt == "")
  396. {
  397. OnChangeEvt = "SelLanguage(this.value)";
  398. }
  399. if (SelLang.Trim() != "")
  400. {
  401. LanguageId = Convert.ToInt32(SelLang);
  402. }
  403. language_data = m_refSiteApi.GetAllActiveLanguages();
  404. result = new StringBuilder();
  405. if (m_refAPI.EnableMultilingual == 1)
  406. {
  407. result.Append("<select id=\"frm_langID\" name=\"frm_langID\" OnChange=\"" + OnChangeEvt + "\">" + "\r\n");
  408. if (showAllOpt)
  409. {
  410. result.Append("<option value=\"" + Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES + "\"");
  411. if (LanguageId == Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
  412. {
  413. result.Append(" selected=\"selected\"");
  414. }
  415. result.Append(">");
  416. result.Append("All");
  417. result.Append("</option>");
  418. }
  419. if (!(language_data == null))
  420. {
  421. for (int iLang = 0; iLang <= language_data.Length - 1; iLang++)
  422. {
  423. LanguageData with_1 = language_data[iLang];
  424. if (with_1.Id != 0 && (with_1.SiteEnabled || showOnlySiteEnabled == false))
  425. {
  426. result.Append("<option value=\"" + with_1.Id + "\"");
  427. if (LanguageId == with_1.Id)
  428. {
  429. result.Append(" selected=\"selected\"");
  430. }
  431. else
  432. {
  433. }
  434. result.Append(">");
  435. result.Append(with_1.LocalName);
  436. result.Append("</option>");
  437. }
  438. }
  439. }
  440. result.Append("</select>");
  441. }
  442. }
  443. catch (Exception)
  444. {
  445. result.Length = 0;
  446. }
  447. return (result.ToString());
  448. }
  449. //Public Shared Function GetClientScript() As String
  450. public string GetClientScript()
  451. {
  452. StringBuilder result;
  453. try
  454. {
  455. CommonApi m_refAPI = new CommonApi();
  456. if ((!(System.Web.HttpContext.Current.Request.QueryString["LangType"] == null)) && (System.Web.HttpContext.Current.Request.QueryString["LangType"] != ""))
  457. {
  458. m_refAPI.ContentLanguage = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["LangType"]);
  459. }
  460. System.Web.UI.Page page = HttpContext.Current.Handler as System.Web.UI.Page;
  461. Packages.Ektron.Workarea.Core.Register(page);
  462. Ektron.Cms.API.JS.RegisterJS(page, m_refAPI.AppPath + "java/stylehelper.js", "EktronStyleHelperJS");
  463. result = new StringBuilder();
  464. result.Append("<script type=\"text/javascript\">" + "\r\n");
  465. result.Append("<!--//--><![CDATA[//><!--" + "\r\n");
  466. result.Append(" " + "\r\n");
  467. result.Append("var g_relativeClassPath = \'" + m_refAPI.AppPath + "csslib/\';" + "\r\n");
  468. result.Append("g_relativeClassPath = g_relativeClassPath.toLowerCase();" + "\r\n");
  469. result.Append("UpdateWorkareaTitleToolbars();" + "\r\n");
  470. result.Append(" " + "\r\n");
  471. result.Append("function GetRelativeClassPath() {" + "\r\n");
  472. result.Append(" return(g_relativeClassPath);" + "\r\n");
  473. result.Append("}" + "\r\n");
  474. result.Append(" " + "\r\n");
  475. result.Append("function UpdateWorkareaTitleToolbars() {" + "\r\n");
  476. result.Append(" if (document.styleSheets.length > 0) {" + "\r\n");
  477. result.Append(" MakeClassPathRelative(\'*\', \'button\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  478. result.Append(" MakeClassPathRelative(\'*\', \'button-over\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  479. result.Append(" MakeClassPathRelative(\'*\', \'button-selected\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  480. result.Append(" MakeClassPathRelative(\'*\', \'button-selectedOver\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  481. result.Append(" MakeClassPathRelative(\'*\', \'ektronToolbar\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  482. result.Append(" MakeClassPathRelative(\'*\', \'ektronTitlebar\', \'backgroundImage\', \'" + m_refAPI.AppImgPath + "\', g_relativeClassPath)" + "\r\n");
  483. result.Append(" } else {" + "\r\n");
  484. result.Append(" setTimeout(\'UpdateWorkareaTitleToolbars()\', 500);" + "\r\n");
  485. result.Append(" }" + "\r\n");
  486. result.Append("}" + "\r\n");
  487. /*result.Append("function ShowTransString(Text) {" + "\r\n");
  488. result.Append("var ObjId = \"WorkareaTitlebar\";" + "\r\n");
  489. result.Append("var ObjShow = document.getElementById(\'_\' + ObjId);" + "\r\n");
  490. result.Append("var ObjHide = document.getElementById(ObjId);" + "\r\n");
  491. result.Append("if ((typeof ObjShow != \"undefined\") && (ObjShow != null)) {" + "\r\n");
  492. result.Append("ObjShow.innerHTML = Text;" + "\r\n");
  493. result.Append("ObjShow.style.display = \"inline\";" + "\r\n");
  494. result.Append("if ((typeof ObjHide != \"undefined\") && (ObjHide != null)) {" + "\r\n");
  495. result.Append("ObjHide.style.display = \"none\";" + "\r\n");
  496. result.Append("}" + "\r\n");
  497. result.Append("}" + "\r\n");
  498. result.Append("}");
  499. result.Append("function HideTransString() {" + "\r\n");
  500. result.Append("var ObjId = \"WorkareaTitlebar\";" + "\r\n");
  501. result.Append("var ObjShow = document.getElementById(ObjId);" + "\r\n");
  502. result.Append("var ObjHide = document.getElementById(\'_\' + ObjId);" + "\r\n");
  503. result.Append("if ((typeof ObjShow != \"undefined\") && (ObjShow != null)) {" + "\r\n");
  504. result.Append("ObjShow.style.display = \"inline\";");
  505. result.Append("if ((typeof ObjHide != \"undefined\") && (ObjHide != null)) {" + "\r\n");
  506. result.Append("ObjHide.style.display = \"none\";" + "\r\n");
  507. result.Append("}" + "\r\n");
  508. result.Append("}" + "\r\n");
  509. result.Append("}" + "\r\n");*/
  510. result.Append("function GetCellObject(MyObj) {" + "\r\n");
  511. result.Append("var tmpName = \"\";" + "\r\n");
  512. result.Append("tmpName = MyObj.id;" + "\r\n");
  513. result.Append("if (tmpName.indexOf(\"link_\") >= 0) {" + "\r\n");
  514. result.Append("tmpName = tmpName.replace(\"link_\", \"cell_\");" + "\r\n");
  515. result.Append("}");
  516. result.Append("else if (tmpName.indexOf(\"cell_\") >= 0) {" + "\r\n");
  517. result.Append("tmpName = tmpName;" + "\r\n");
  518. result.Append("}" + "\r\n");
  519. result.Append("else {" + "\r\n");
  520. result.Append("tmpName = tmpName.replace(\"image_\", \"image_cell_\");" + "\r\n");
  521. result.Append("}" + "\r\n");
  522. result.Append("MyObj = document.getElementById(tmpName);" + "\r\n");
  523. result.Append("return (MyObj);" + "\r\n");
  524. result.Append("}" + "\r\n");
  525. result.Append("var g_OldBtnObject = null;" + "\r\n");
  526. result.Append("function ClearPrevBtn() {" + "\r\n");
  527. result.Append("if (g_OldBtnObject){" + "\r\n");
  528. result.Append(" RollOut(g_OldBtnObject);" + "\r\n");
  529. result.Append(" g_OldBtnObject = null;" + "\r\n");
  530. result.Append("}" + "\r\n");
  531. result.Append("}" + "\r\n");
  532. result.Append("function RollOver(MyObj) {" + "\r\n");
  533. result.Append("ClearPrevBtn();" + "\r\n");
  534. result.Append("g_OldBtnObject = MyObj;" + "\r\n");
  535. result.Append("MyObj = GetCellObject(MyObj);");
  536. result.Append("MyObj.className = \"button-over\";" + "\r\n");
  537. result.Append("}" + "\r\n");
  538. result.Append("function RollOut(MyObj) {" + "\r\n");
  539. result.Append("if (g_OldBtnObject == MyObj){" + "\r\n");
  540. result.Append("g_OldBtnObject = null;" + "\r\n");
  541. result.Append("}" + "\r\n");
  542. result.Append("MyObj = GetCellObject(MyObj);" + "\r\n");
  543. result.Append("MyObj.className = \"button\";" + "\r\n");
  544. result.Append("}" + "\r\n");
  545. result.Append("function SelectButton(MyObj) {" + "\r\n");
  546. result.Append("}" + "\r\n");
  547. result.Append("function UnSelectButtons() { " + "\r\n");
  548. result.Append("var iLoop = 100; " + "\r\n");
  549. result.Append("while (document.getElementById(\"image_cell_\" + iLoop.toString()) != null) { " + "\r\n");
  550. result.Append("document.getElementById(\"image_cell_\" + iLoop.toString()).className = \"button\"; " + "\r\n");
  551. result.Append("iLoop++; " + "\r\n");
  552. result.Append("} " + "\r\n");
  553. result.Append("} " + "\r\n");
  554. result.Append("function Trim (string) { " + "\r\n");
  555. result.Append("if (string.length > 0) { " + "\r\n");
  556. result.Append("string = RemoveLeadingSpaces (string); " + "\r\n");
  557. result.Append("} " + "\r\n");
  558. result.Append("if (string.length > 0) { " + "\r\n");
  559. result.Append("string = RemoveTrailingSpaces(string); " + "\r\n");
  560. result.Append("} " + "\r\n");
  561. result.Append("return string; " + "\r\n");
  562. result.Append("} " + "\r\n");
  563. result.Append("function RemoveLeadingSpaces(string) {");
  564. result.Append("while(string.substring(0, 1) == \" \") { " + "\r\n");
  565. result.Append("string = string.substring(1, string.length); " + "\r\n");
  566. result.Append("} " + "\r\n");
  567. result.Append("return string; " + "\r\n");
  568. result.Append("} " + "\r\n");
  569. result.Append("function RemoveTrailingSpaces(string) { " + "\r\n");
  570. result.Append("while(string.substring((string.length - 1), string.length) == \" \") { " + "\r\n");
  571. result.Append("string = string.substring(0, (string.length - 1)); " + "\r\n");
  572. result.Append("} " + "\r\n");
  573. result.Append("return string; " + "\r\n");
  574. result.Append("} " + "\r\n");
  575. result.Append("function SelLanguage(inVal) { " + "\r\n");
  576. myTemp = (string)(System.Web.HttpContext.Current.Request.ServerVariables["PATH_INFO"].Substring(System.Convert.ToInt32(System.Web.HttpContext.Current.Request.ServerVariables["PATH_INFO"].LastIndexOf("/") + 1)));
  577. //myTemp = myTemp + "?" + Ektron.Cms.API.JS.Escape(Strings.Replace(System.Web.HttpContext.Current.Request.ServerVariables["QUERY_STRING"], "LangType", "", 1, -1, 0));
  578. myTemp = myTemp + "?" + Ektron.Cms.API.JS.Escape(EkFunctions.UrlEncode(System.Web.HttpContext.Current.Request.ServerVariables["QUERY_STRING"].ToString().Replace("LangType", "")));
  579. myTemp = myTemp.Replace("\'", "\"");
  580. myTemp = myTemp.Replace("\\x", "\\\\x");
  581. myTemp = myTemp.Replace("\\\\\\x", "\\\\x");
  582. myTemp = myTemp.Replace("\\u", "\\\\u");
  583. myTemp = myTemp.Replace("\\\\\\u", "\\\\u");
  584. myTemp = myTemp.Replace("&amp;", "&");
  585. myTemp = myTemp.Replace("SelectAll=1&", "");
  586. result.Append("top.notifyLanguageSwitch(inVal, -1)" + "\r\n");
  587. result.Append("document.location = decodeURIComponent(\'" + myTemp + "&LangType=\' + inVal) ; " + "\r\n");
  588. result.Append("} " + "\r\n");
  589. result.Append("//--><!]]>" + "\r\n");
  590. result.Append("</script> " + "\r\n");
  591. }
  592. catch (Exception)
  593. {
  594. result = new StringBuilder();
  595. }
  596. finally
  597. {
  598. }
  599. return (result.ToString());
  600. }
  601. public string GetAddAnchor(int Id)
  602. {
  603. string sResult = "";
  604. string sFormQuery = "";
  605. try
  606. {
  607. if (((!(System.Web.HttpContext.Current.Request.QueryString["ContType"] == null)) && (System.Web.HttpContext.Current.Request.QueryString["ContType"].ToString() == "2")) || ((!(Ektron.Cms.CommonApi.GetEcmCookie()["ContType"] == null)) && (Ektron.Cms.CommonApi.GetEcmCookie()["ContType"].ToString() == "2")))
  608. {
  609. sFormQuery = (string)("&folder_id=" + Id); //& "&callbackpage=content.aspx&parm1=action&value1=viewcontentbycategory&parm2=folder_id&value2=" & Id
  610. }
  611. sResult = (string)(GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/add.png", "#", m_refMsg.GetMessage("alt add content button text"), m_refMsg.GetMessage("btn add content"), "onclick=\"AddNewContent(\'LangType=" + ContentLanguage + "&type=add&createtask=1&id=" + Id + sFormQuery + "&" + GetBackParams() + "\');return false;\" "));
  612. }
  613. catch (Exception)
  614. {
  615. sResult = "";
  616. }
  617. return sResult;
  618. }
  619. public string GetAddAnchorByContentType(long Id, int contType, bool AllowNonFormattedHTML)
  620. {
  621. string sResult = "";
  622. string sFormQuery = "";
  623. try
  624. {
  625. if (contType == 2)
  626. {
  627. sFormQuery = (string)("&folder_id=" + Id); //& "&callbackpage=content.aspx&parm1=action&value1=viewcontentbycategory&parm2=folder_id&value2=" & Id
  628. }
  629. sResult = (string)("AddNewContent(\'LangType=" + ContentLanguage + "&type=add&createtask=1&id=" + Id + "&folderid=" + Id + sFormQuery + "&" + GetBackParams());
  630. if (AllowNonFormattedHTML)
  631. {
  632. sResult += "&AllowHTML=1";
  633. }
  634. sResult += "\', " + contType + ");";
  635. }
  636. catch (Exception)
  637. {
  638. sResult = "";
  639. }
  640. return sResult;
  641. }
  642. public string GetTypeOverrideAddAnchor(long Id, long xml_id, int contType)
  643. {
  644. string sResult = "AddNewContent(\'LangType=" + ContentLanguage + "&type=add&createtask=1&id=" + Id + "&xid=" + xml_id + "&" + GetBackParams() + "\'," + contType + "); ";
  645. return sResult;
  646. }
  647. public string GetAddOtherAnchor(object id)
  648. {
  649. string sResult = GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/add.png", "#", m_refMsg.GetMessage("alt add content button text"), m_refMsg.GetMessage("btn add content"), "OnClick=\"showMultiMenu(event)\" ");
  650. return sResult;
  651. }
  652. public string GetAddOtherMenuStyle()
  653. {
  654. string returnValue;
  655. string html = "" + "\r\n";
  656. html += "<STYLE>" + "\r\n";
  657. html += " #xmladdMenu { " + "\r\n";
  658. html += " position: absolute; " + "\r\n";
  659. html += " visibility: hidden; " + "\r\n";
  660. html += " width: 120px; " + "\r\n";
  661. html += " background-color: lightgrey; " + "\r\n";
  662. html += " layer-background-color: lightgrey; " + "\r\n";
  663. html += " border: 2px outset white; " + "\r\n";
  664. html += " } " + "\r\n";
  665. html += " .A:Menu { " + "\r\n";
  666. html += " color: black; " + "\r\n";
  667. html += " text-decoration: none; " + "\r\n";
  668. html += " cursor: default; " + "\r\n";
  669. html += " width: 100% " + "\r\n";
  670. html += " } " + "\r\n";
  671. html += " .A:MenuOn { " + "\r\n";
  672. html += " color: white; " + "\r\n";
  673. html += " text-decoration: none; " + "\r\n";
  674. html += " background-color: darkblue; " + "\r\n";
  675. html += " cursor: default; " + "\r\n";
  676. html += " width: 100% " + "\r\n";
  677. html += " } " + "\r\n";
  678. html += "</STYLE> " + "\r\n";
  679. returnValue = html;
  680. return returnValue;
  681. }
  682. public string GetAddBlogPostAnchor(long Id)
  683. {
  684. string sResult = "";
  685. try
  686. {
  687. sResult = (string)(GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/add.png", "#", m_refMsg.GetMessage("alt add blogpost button text"), m_refMsg.GetMessage("btn add blogpost"), "OnClick=\"javascript:AddNewContent(\'LangType=" + ContentLanguage + "&type=add&createtask=1&id=" + Id + "&" + GetBackParams() + "\');return false;\" "));
  688. }
  689. catch (Exception)
  690. {
  691. sResult = "";
  692. }
  693. return sResult;
  694. }
  695. public string GetAddForumPostAnchor(long Id)
  696. {
  697. string sResult = "";
  698. try
  699. {
  700. sResult = (string)(GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/add.png", "#", m_refMsg.GetMessage("alt add forumpost button text"), m_refMsg.GetMessage("btn add forumpost"), "OnClick=\"javascript:AddNewContent(\'LangType=" + ContentLanguage + "&type=add&createtask=1&id=" + Id + "&" + GetBackParams() + "\');return false;\" "));
  701. }
  702. catch (Exception)
  703. {
  704. sResult = "";
  705. }
  706. return sResult;
  707. }
  708. public string GetAddMultiAnchor(long id, int ContType)
  709. {
  710. return (GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/add.png", "#", "Add Several Files", m_refMsg.GetMessage("btn add content"), "OnClick=\"javascript:AddNewContent(\'LangType=" + ContentLanguage + "&type=add&multi=" + ContType + "&createtask=1&id=" + id + "&" + GetBackParams() + "\', " + Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes + ");return false;\" "));
  711. }
  712. private string GetBackParams()
  713. {
  714. StringBuilder backURL;
  715. object Value;
  716. backURL = new StringBuilder();
  717. backURL.Append("back_file=content.aspx");
  718. Value = System.Web.HttpContext.Current.Request.QueryString["action"];
  719. if (Strings.Len(Value) > 0)
  720. {
  721. backURL.Append("&back_action=" + Value);
  722. }
  723. Value = System.Web.HttpContext.Current.Request.QueryString["folder_id"];
  724. if (Strings.Len(Value) > 0)
  725. {
  726. backURL.Append("&back_folder_id=" + Value);
  727. }
  728. Value = System.Web.HttpContext.Current.Request.QueryString["id"];
  729. if (Strings.Len(Value) > 0)
  730. {
  731. backURL.Append("&back_id=" + Value);
  732. }
  733. Value = ContentLanguage;
  734. if (Strings.Len(Value) > 0)
  735. {
  736. backURL.Append("&back_LangType=" + ContentLanguage);
  737. }
  738. return (backURL.ToString());
  739. }
  740. public string StatusWithToolTip(string Status)
  741. {
  742. string ToolTip = "";
  743. StringBuilder result = null;
  744. try
  745. {
  746. result = new StringBuilder();
  747. switch (Status.ToUpper())
  748. {
  749. case "A":
  750. ToolTip = "The content has been through the workflow and published on the Web site.";
  751. break;
  752. case "O":
  753. ToolTip = "The content is currently being edited, and has not been checked in for publishing.";
  754. break;
  755. case "I":
  756. ToolTip = "The content has been checked in for other users to edit.";
  757. break;
  758. case "S":
  759. ToolTip = "The content block has been saved and submitted into the approval chain.";
  760. break;
  761. case "M":
  762. ToolTip = "This content has been requested to be deleted from Ektron CMS400.";
  763. break;
  764. case "P":
  765. ToolTip = "This content has been approved,but the Go Live date hasn’t occurred yet.";
  766. break;
  767. case "T":
  768. ToolTip = "This content has been submitted, but waiting for completion of associated tasks.";
  769. break;
  770. case "D":
  771. ToolTip = "This content has been mark for delete on the Go Live date.";
  772. break;
  773. }
  774. result.Append("<a href=\"#Status\" onmouseover=\"ddrivetip(\'" + ToolTip + "\',\'ADC5EF\', 300);\" onmouseout=\"hideddrivetip();\" onclick=\"return false;\">" + Status + "</a>");
  775. }
  776. catch (Exception)
  777. {
  778. }
  779. finally
  780. {
  781. }
  782. return (result.ToString());
  783. }
  784. public string GetPermLayerTop()
  785. {
  786. string result = "";
  787. bool bNS6 = false;
  788. if ((Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["http_user_agent"]).ToUpper()).IndexOf("GECKO") + 1 > 0)
  789. {
  790. bNS6 = true;
  791. }
  792. else
  793. {
  794. bNS6 = false;
  795. }
  796. if (!(bNS6))
  797. {
  798. result = result + "<ILAYER name=\"permLayer\"><LAYER name=\"standard\" visibility=\"show\"><NOLAYER>";
  799. }
  800. result = result + "<div id=\"standard\" style=\"display: block;\">";
  801. if (!(bNS6))
  802. {
  803. result = result + "</NOLAYER>";
  804. }
  805. return (result);
  806. }
  807. public string GetPermLayerMid()
  808. {
  809. string result = "";
  810. bool bNS6 = false;
  811. if ((Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["http_user_agent"]).ToUpper()).IndexOf("GECKO") + 1 > 0)
  812. {
  813. bNS6 = true;
  814. }
  815. else
  816. {
  817. bNS6 = false;
  818. }
  819. if (!(bNS6))
  820. {
  821. result = result + "</LAYER><LAYER name=\"advanced\" visibility=\"hidden\"><NOLAYER>";
  822. }
  823. result = result + "</div><div id=\"advanced\" style=\"display: none;\">";
  824. if (!(bNS6))
  825. {
  826. result = result + "</NOLAYER>";
  827. }
  828. return (result);
  829. }
  830. public string GetPermLayerBottom()
  831. {
  832. bool bNS6 = false;
  833. string result = "";
  834. if ((Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["http_user_agent"]).ToUpper()).IndexOf("GECKO") + 1 > 0)
  835. {
  836. bNS6 = true;
  837. }
  838. else
  839. {
  840. bNS6 = false;
  841. }
  842. if (!(bNS6))
  843. {
  844. result = result + "</LAYER></ILAYER><NOLAYER>";
  845. }
  846. result = result + "</div>";
  847. if (!(bNS6))
  848. {
  849. result = result + "</NOLAYER>";
  850. }
  851. return (result);
  852. }
  853. public int PermissionFlag(bool PermFlag)
  854. {
  855. int result = 0;
  856. if (PermFlag)
  857. {
  858. result = 1;
  859. }
  860. return (result);
  861. }
  862. public string GetEnableAllPrompt()
  863. {
  864. string enableAll;
  865. enableAll = "<div id=\"enablealldiv\" class=\"clearfix\">";
  866. enableAll += "<a href=\"#EnableAll\" class=\"button greenHover buttonLeft buttonCheckAll\" onclick=\"return SelectAllPerms();\" title=\"" + m_refMsg.GetMessage("enable all permissions") + "\">" + m_refMsg.GetMessage("generic Enable All") + "</a>";
  867. enableAll += "<a href=\"#DisableAll\" class=\"button redHover buttonLeft buttonClear\" onclick=\"return UnselectAllPerms();\" title=\"" + m_refMsg.GetMessage("generic Disable All") + "\">" + m_refMsg.GetMessage("generic Disable All") + "</a>";
  868. enableAll += "</div>";
  869. return enableAll;
  870. }
  871. public string GetSwapNavPrompt()
  872. {
  873. bool bNS6 = false;
  874. string result = "";
  875. if ((Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["http_user_agent"]).ToUpper()).IndexOf("GECKO") + 1 > 0)
  876. {
  877. bNS6 = true;
  878. }
  879. else
  880. {
  881. bNS6 = false;
  882. }
  883. if (!(bNS6))
  884. {
  885. result = result + "<ILAYER name=\"messLayer\"><LAYER name=\"advancedMess\" visibility=\"show\"><NOLAYER>";
  886. }
  887. result = result + "<div id=\"advancedMess\" style=\"display: block;\">";
  888. if (!(bNS6))
  889. {
  890. result = result + "</NOLAYER>";
  891. }
  892. result = result + "<a href=\"#\" onClick=\"SwapPermDisplay();return false;\" title=\"" + m_refMsg.GetMessage("alt display adv perms text") + "\" alt=\"" + m_refMsg.GetMessage("alt display adv perms text") + "\">" + m_refMsg.GetMessage("display advanced permissions msg") + "</a>";
  893. if (!(bNS6))
  894. {
  895. result = result + "<NOLAYER>";
  896. }
  897. result = result + "</div>";
  898. if (!(bNS6))
  899. {
  900. result = result + "</NOLAYER></LAYER><LAYER name=\"standardMess\" visibility=\"hidden\"><NOLAYER>";
  901. }
  902. result = result + "<div id=\"standardMess\" style=\"display: none;\">";
  903. if (!(bNS6))
  904. {
  905. result = result + "</NOLAYER>";
  906. }
  907. result = result + "<a href=\"#\" onClick=\"SwapPermDisplay();return false;\" title=\"" + m_refMsg.GetMessage("alt display std perms text") + "\" alt=\"" + m_refMsg.GetMessage("alt display std perms text") + "\">" + m_refMsg.GetMessage("display standard permissions msg") + "</a>";
  908. if (!(bNS6))
  909. {
  910. result = result + "<NOLAYER>";
  911. }
  912. result = result + "</div>";
  913. if (!(bNS6))
  914. {
  915. result = result + "</NOLAYER></LAYER></ILAYER>";
  916. }
  917. return (result);
  918. }
  919. public string GetMemberShipNavSwap(string action, string strType, object id, object membership)
  920. {
  921. string result = "";
  922. if ((string)membership == "true")
  923. {
  924. result = "<a href=\"content.aspx?LangType=" + ContentLanguage + "&action=" + action + "&type=" + strType + "&id=" + id.ToString() + "&membership=false\">" + m_refMsg.GetMessage("lbl view cms users") + "</a>";
  925. }
  926. else
  927. {
  928. result = "<a href=\"content.aspx?LangType=" + ContentLanguage + "&action=" + action + "&type=" + strType + "&id=" + id + "&membership=true\">" + m_refMsg.GetMessage("lbl view memberShip users") + "</a>";
  929. }
  930. return (result);
  931. }
  932. public string GetCatalogEditAnchor(long Id, int Type, bool bFromApproval)
  933. {
  934. return GetCatalogEditAnchor(Id, Type, bFromApproval, false);
  935. }
  936. public string GetCatalogEditAnchor(long Id, int Type, bool bFromApproval, bool isPrimary)
  937. {
  938. string result = "";
  939. string SRC = "";
  940. string str;
  941. string backStr;
  942. if (bFromApproval)
  943. {
  944. backStr = "back_file=approval.aspx";
  945. }
  946. else
  947. {
  948. backStr = "back_file=content.aspx";
  949. }
  950. str = System.Web.HttpContext.Current.Request.QueryString["action"];
  951. if (str.Length > 0)
  952. {
  953. backStr = backStr + "&back_action=" + str;
  954. }
  955. if (bFromApproval)
  956. {
  957. if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.QueryString["page"]))
  958. {
  959. str = System.Web.HttpContext.Current.Request.QueryString["page"];
  960. if (str.Length > 0)
  961. {
  962. backStr = backStr + "&back_page=" + str;
  963. }
  964. }
  965. }
  966. if (!bFromApproval)
  967. {
  968. str = System.Web.HttpContext.Current.Request.QueryString["folder_id"];
  969. if (str.Length > 0)
  970. {
  971. backStr = backStr + "&back_folder_id=" + str;
  972. }
  973. }
  974. str = System.Web.HttpContext.Current.Request.QueryString["id"];
  975. if (str.Length > 0)
  976. {
  977. backStr = backStr + "&back_id=" + str;
  978. }
  979. if (!(System.Web.HttpContext.Current.Request.QueryString["callerpage"] == null))
  980. {
  981. str = AntiXss.UrlEncode(System.Web.HttpContext.Current.Request.QueryString["callerpage"]);
  982. if (str.Length > 0)
  983. {
  984. backStr = backStr + "&back_callerpage=" + str;
  985. }
  986. }
  987. if (!(System.Web.HttpContext.Current.Request.QueryString["origurl"] == null))
  988. {
  989. str = System.Web.HttpContext.Current.Request.QueryString["origurl"];
  990. if (str.Length > 0)
  991. {
  992. backStr = backStr + "&back_origurl=" + EkFunctions.UrlEncode(str);
  993. }
  994. }
  995. str = ContentLanguage.ToString();
  996. if (str.Length > 0)
  997. {
  998. backStr = backStr + "&back_LangType=" + str + "&rnd=" + System.Convert.ToInt32(Conversion.Int((10 * VBMath.Rnd()) + 1));
  999. }
  1000. SRC = (string)("commerce/catalogentry.aspx?close=false&LangType=" + ContentLanguage + "&id=" + Id + "&type=update&" + backStr);
  1001. if (bFromApproval)
  1002. {
  1003. SRC += "&pullapproval=true";
  1004. }
  1005. result = GetButtonEventsWCaption(m_refAPI.AppPath + "images/UI/Icons/contentEdit.png", "#", m_refMsg.GetMessage("alt edit button text"), m_refMsg.GetMessage("btn edit"), "OnClick=\"javascript:top.document.getElementById(\'ek_main\').src=\'" + SRC + "\';return false;\"" + ",\'EDIT\',790,580,1,1);return false;\"", EditButtonCssClass, isPrimary);
  1006. return (result);
  1007. }
  1008. public string GetPageBuilderEditAnchor(long Id, int languageId, string quickLink)
  1009. {
  1010. return GetPageBuilderEditAnchor(Id, languageId, quickLink, false);
  1011. }
  1012. public string GetPageBuilderEditAnchor(long Id, int languageId, string quickLink, bool isPrimary)
  1013. {
  1014. //make popup window with link to this pageids wireframe, and pass in the id and an edit flag
  1015. ContentAPI capi = new ContentAPI();
  1016. FolderData fd = capi.GetFolderById(capi.GetFolderIdForContentId(Id));
  1017. string URL = "";
  1018. Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon();
  1019. URL = u.GetAliasForContent(Id);
  1020. if (URL == string.Empty || fd.IsDomainFolder)
  1021. {
  1022. URL = quickLink;
  1023. }
  1024. if (URL.Contains("?"))
  1025. {
  1026. URL = URL + "&ektronPageBuilderEdit=true";
  1027. }
  1028. else
  1029. {
  1030. URL = URL + "?ektronPageBuilderEdit=true";
  1031. }
  1032. if (URL.IndexOf("LangType=") == -1)
  1033. {
  1034. URL = URL + "&LangType=" + languageId.ToString();
  1035. }
  1036. URL = this.m_refAPI.SitePath + URL;
  1037. URL = GetButtonEventsWCaption(m_refAPI.AppImgPath + "layout_edit.gif", "#", m_refMsg.GetMessage("generic edit page layout"), m_refMsg.GetMessage("generic edit page layout"), "OnClick=\"window.open(\'" + URL + "\', \'CMS400EditPage\');return false;\"", EditButtonCssClass, isPrimary);
  1038. return URL;
  1039. }
  1040. public string GetPageBuilderEditAnchor(long Id, ContentData contentdata)
  1041. {
  1042. return GetPageBuilderEditAnchor(Id, contentdata, false);
  1043. }
  1044. public string GetPageBuilderEditAnchor(long Id, ContentData contentdata, bool isPrimary)
  1045. {
  1046. //make popup window with link to this pageids wireframe, and pass in the id and an edit flag
  1047. string URL = "";
  1048. if (contentdata.SubType == EkEnumeration.CMSContentSubtype.PageBuilderData || contentdata.SubType == EkEnumeration.CMSContentSubtype.PageBuilderMasterData)
  1049. {
  1050. if (contentdata.ContType == (int)EkEnumeration.CMSContentType.Content || (contentdata.ContType == (int)EkEnumeration.CMSContentType.Archive_Content && contentdata.EndDateAction != 1))
  1051. {
  1052. URL = GetPageBuilderEditAnchor(Id, contentdata.LanguageId, contentdata.Quicklink, isPrimary);
  1053. }
  1054. }
  1055. return URL;
  1056. }
  1057. public string GetEditAnchor(long Id, int Type, bool bFromApproval, EkEnumeration.CMSContentSubtype subType)
  1058. {
  1059. return GetEditAnchor(Id, Type, bFromApproval, subType, false);
  1060. }
  1061. public string GetEditAnchor(long Id, int Type, bool bFromApproval, EkEnumeration.CMSContentSubtype subType, bool isPrimary)
  1062. {
  1063. string result = "";
  1064. string SRC = "";
  1065. string str;
  1066. string backStr;
  1067. if (Type == 3333)
  1068. {
  1069. return GetCatalogEditAnchor(Id, Type, bFromApproval, isPrimary

Large files files are truncated, but you can click here to view the full file