protected void Page_Load(object sender, System.EventArgs e) { try { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; CurrentUserId = m_refCommon.RequestInformationRef.UserId; m_refContent = m_refCommon.EkContentRef; m_refMsg = m_refCommon.EkMsgRef; RegisterResources(); //TODO: Ross - Not sure which role to check if ((CurrentUserId == 0) || (Convert.ToBoolean(m_refCommon.RequestInformationRef.IsMembershipUser) && m_refContent.IsARoleMember((long)Ektron.Cms.Common.EkEnumeration.CmsRoleIds.TaxonomyAdministrator, CurrentUserId, false) == false)) { Response.Redirect("login.aspx?fromLnkPg=1", false); return; } else { AppImgPath = m_refCommon.AppImgPath; EnableMultilingual = m_refCommon.EnableMultilingual; if ((Request.QueryString["action"] != null) && Request.QueryString["action"] != "") { m_strPageAction = Request.QueryString["action"].ToLower(); } Utilities.SetLanguage(m_refCommon); MenuLanguage = m_refCommon.ContentLanguage; switch (m_strPageAction) { case "deleted": Message.Text = m_refMsg.GetMessage("lbl menu") + " \'" + Request.QueryString["title"] + "\' " + m_refMsg.GetMessage("lbl deleted"); Message.Text = Message.Text + "<script language=\"javascript\">" + "\r\n"; Message.Text = Message.Text + "top.refreshMenuAccordion(" + MenuLanguage + ");" + "\r\n"; Message.Text = Message.Text + "</script>" + "\r\n"; break; case "viewcontent": case "removeitems": Control m_vi; m_vi = (Control)(LoadControl("controls/menu/viewitems.ascx")); m_vi.ID = "menu"; DataHolder.Controls.Add(m_vi); break; case "viewmenu": Control m_va; m_va = (Control)(LoadControl("controls/menu/viewmenu.ascx")); m_va.ID = "menuprops"; DataHolder.Controls.Add(m_va); break; } } } catch (System.Threading.ThreadAbortException) { //Do nothing } catch (Exception ex) { Response.Redirect((string)("reterror.aspx?info=" + EkFunctions.UrlEncode(ex.Message + ".") + "&LangType=" + MenuLanguage), false); } }
public bool IsWorkflowAdmin(long userId) { EkRequestInformation requestInfo = ObjectFactory.GetRequestInfoProvider().GetRequestInformation(); EkContent EkContentInstance = new EkContent(requestInfo); IUserGroup _usergroupmanager = ObjectFactory.GetUserGroup(requestInfo); if (EkContentInstance.IsARoleMember((long)EkEnumeration.CmsRoleIds.ContentWorkflowAdmin, requestInfo.UserId, true) || _usergroupmanager.IsUserInGroup(requestInfo.UserId, 1) || requestInfo.CallerId == EkConstants.InternalAdmin) { return true; } else { return false; } }
protected void Page_Load(object sender, EventArgs e) { capi = new ContentAPI(); m_refContent = new EkContent(capi.RequestInformationRef); if (!(_siteApi.IsAdmin() || m_refContent.IsARoleMember((long)Ektron.Cms.Common.EkEnumeration.CmsRoleIds.SyncAdmin, capi.RequestInformationRef.UserId, false))) { Response.Redirect("blank.htm", false); } else { InitializeHeader(); InitializeTitleBar(); InitializeContent(); } }
private void Page_Load(System.Object sender, System.EventArgs e) { //Put user code to initialize the page here RegisterResources(); m_refContentApi = new ContentAPI(); m_refMsg = m_refContentApi.EkMsgRef; AppImgPath = m_refContentApi.AppImgPath; ContentLanguage = m_refContentApi.ContentLanguage; m_refContent = m_refContentApi.EkContentRef; SetServerJSVariables(); if (m_refContent.IsAllowed(0, 0, "users", "IsAdmin", 0) == true || m_refContent.IsARoleMember(11, m_refContent.RequestInformation.UserId, false) == true) { bIsAdmin = true; } if (Request.Browser.Platform.IndexOf("Win") == -1) { m_bIsMac = true; } else { m_bIsMac = false; } EnableMultilingual = m_refContentApi.EnableMultilingual; if (!(Request.QueryString["action"] == null)) { m_strPageAction = Request.QueryString["action"]; if (m_strPageAction.Length > 0) { m_strPageAction = m_strPageAction.ToLower(); } } if (Request.QueryString["orderby"] != "") { m_strOrderBy = Request.QueryString["orderby"]; } }
private void Page_Load(System.Object sender, System.EventArgs e) { PermissionData security_lib_data; string strBrowserCode = ""; if (Request.Browser.Type.IndexOf("IE") != -1) { _IsBrowserIE = true; } if (!String.IsNullOrEmpty(Request.QueryString["type"])) { _IsProduct = System.Convert.ToBoolean(Request.QueryString["type"].ToLower() == "product"); } _MessageHelper = _ContentApi.EkMsgRef; _EkContent = _ContentApi.EkContentRef; if (_EkContent.IsAllowed(0, 0, "users", "IsLoggedIn", 0) == false || _EkContent.IsAllowed(0, 0, "users", "IsAdmin", 0) == false) { if ((_IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.CommerceAdmin), _EkContent.RequestInformation.UserId, false)) || (! _IsProduct && ! _EkContent.IsARoleMember(Convert.ToInt64(EkEnumeration.CmsRoleIds.AdminXmlConfig), _EkContent.RequestInformation.UserId, false))) { Utilities.ShowError(_MessageHelper.GetMessage("com: user does not have permission")); } } RegisterResources(); StyleSheetJS.Text = _StyleHelper.GetClientScript(); _CurrentUserId = _ContentApi.UserId; _ContentLanguage = _ContentApi.ContentLanguage; _AppImgPath = _ContentApi.AppImgPath; _AppImgPath = _ContentApi.AppPath; _SitePath = _ContentApi.SitePath; _AppeWebPath = _ContentApi.ApplicationPath + _ContentApi.AppeWebPath; _AppName = _ContentApi.AppName; _Id = Convert.ToInt64(Request.QueryString["id"]); _PageAction = Request.QueryString["action"]; _Var1 = Request.ServerVariables["SERVER_NAME"]; _LanguageData = (new SiteAPI()).GetLanguageById(_ContentLanguage); _Var2 = _EkContent.GetEditorVariablev2_0(_Id, _PageAction); if (_LanguageData != null) { _LocaleFileNumber = Convert.ToString(_LanguageData.Id); strBrowserCode = _LanguageData.BrowserCode; } Page.Title = _AppName + " " + _MessageHelper.GetMessage("edit content page title") + " \"" + Ektron.Cms.CommonApi.GetEcmCookie()["username"] + "\""; _LocaleFileString = GetLocaleFileString(_LocaleFileNumber); SiteAPI refSiteApi = new SiteAPI(); SettingsData settings_data; settings_data = refSiteApi.GetSiteVariables(refSiteApi.UserId); _AppLocaleString = GetLocaleFileString(settings_data.Language); _SelectedEditControl = "eWebEditPro"; bool bIsMac = false; try { if (Request.Browser.Platform.IndexOf("Win") == -1) { bIsMac = true; } if (bIsMac) { _SelectedEditControl = "ContentDesigner"; } else { if (ConfigurationManager.AppSettings["ek_DataDesignControl"] != null) { _SelectedEditControl = (string) (ConfigurationManager.AppSettings["ek_DataDesignControl"].ToString()); } } } catch (Exception) { _SelectedEditControl = "ContentDesigner"; } if (_SelectedEditControl == "eWebEditPro") { EditorJS.Text = Utilities.EditorScripts(_Var2, _AppeWebPath, strBrowserCode); } else { EditorJS.Text = ""; } security_lib_data = _ContentApi.LoadPermissions(_Id, "folder", 0); _UploadPrivs = security_lib_data.CanAddToFileLib || security_lib_data.CanAddToImageLib; _EditAction = Request.QueryString["editaction"]; if (!(Page.IsPostBack)) { if (_EditAction == "cancel") { //do nothing } else { DisplayControl(); } } else { UpdateEditDesign(); } jsAppeWebPath.Text = _AppeWebPath; jsAppLocaleString.Text = _AppLocaleString; jsSitePath.Text = _SitePath; jsPath.Text = Strings.Replace(_Path, "\\", "\\\\", 1, -1, 0); jsTitle.Text = _MessageHelper.GetMessage("generic title label"); jsXmlStyle.Text = _MessageHelper.GetMessage("lbl select style for xml design"); jsInputTmpStyleSheet.Text = "<input type=\"text\" maxlength=\"255\" size=\"45\" value=\"" + _StyleSheet + "\" name=\"stylesheet\" id=\"stylesheet\" onchange=\"SetStyleSheetFromInput();\" />"; jsTmpStyleSheet.Text = _StyleSheet; jshdnContentLanguage.Text = "<input type=\"hidden\" name=\"content_language\" value=\"" + _ContentLanguage + "\"/>"; jshdnMaxContLength.Text = "<input type=\"hidden\" name=\"maxcontentsize\" value=\"" + _MaxContLength + "\"/>"; jshdnXml_id.Text = "<input type=\"hidden\" name=\"xml_collection_id\" value=\"" + _XmlId + "\"/>"; jshdnIndex_cms.Text = "<input type=\"hidden\" name=\"index_cms\" value=\"" + _IndexCms + "\"/>"; jshdniSegment.Text = "<input type=\"hidden\" name=\"numberoffields\" value=\"" + _Segment + "\"/>"; jsMaxContLength.Text = _MaxContLength.ToString(); jsEditorMsg.Text = _MessageHelper.GetMessage("lbl wait editor not loaded"); sContentInvalid.Text = _MessageHelper.GetMessage("msg content invalid"); sDesignIncompatible.Text = _MessageHelper.GetMessage("msg design incompatible"); sContinue.Text = _MessageHelper.GetMessage("msg wish to continue"); sWarnOnUnload.Text = _MessageHelper.GetMessage("js: alert confirm close no save"); }
private void PopulateGridData(bool ShowFolders) { bool showQDContentOnly = System.Convert.ToBoolean(Request.QueryString["qdo"] == "1"); string enableQDOparam = ""; if (showQDContentOnly) { enableQDOparam = "&qdo=1"; } System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn(); bool bDoNotShow = false; colBound.DataField = "ITEM1"; colBound.HeaderText = ""; colBound.ItemStyle.CssClass = "info"; colBound.ItemStyle.Wrap = false; colBound.HeaderStyle.Height = Unit.Percentage(0); ContentGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "ITEM2"; colBound.HeaderText = ""; colBound.ItemStyle.CssClass = "info"; colBound.ItemStyle.Wrap = false; colBound.HeaderStyle.Height = Unit.Percentage(0); ContentGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "ITEM3"; colBound.HeaderText = ""; colBound.ItemStyle.CssClass = "info"; colBound.ItemStyle.Wrap = false; colBound.HeaderStyle.Height = Unit.Percentage(0); ContentGrid.Columns.Add(colBound); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("ITEM1", typeof(string))); dt.Columns.Add(new DataColumn("ITEM2", typeof(string))); dt.Columns.Add(new DataColumn("ITEM3", typeof(string))); dr = dt.NewRow(); if (ShowFolders) { dr[0] = MsgHelper.GetMessage("alt Please select content by navigating the folders below") + "<br>"; } else { dr[0] = ""; } dr[1] = "remove-item"; dr[2] = "remove-item"; dt.Rows.Add(dr); dr = dt.NewRow(); dr[0] = "Path: <span class=\"pathInfo\">" + fPath + "</span>"; dr[1] = "remove-item"; dr[2] = "remove-item"; dt.Rows.Add(dr); dr = dt.NewRow(); if (locID != 0 && rec) { string linkMarkup = ""; linkMarkup = (string)("<a href=\"collections.aspx?Action=AddLink" + status + "&LangType=" + ContentLanguage + "&nId=" + nId + "&folderid=" + FolderId + "&subfolderid=" + (backId) + enableQDOparam); if (!String.IsNullOrEmpty(Request.QueryString["back"])) { linkMarkup = linkMarkup + "&back=" + EkFunctions.UrlEncode(Request.QueryString["back"]); } if (!String.IsNullOrEmpty(Request.QueryString["noworkarea"])) { linkMarkup = linkMarkup + "&noworkarea=" + Request.QueryString["noworkarea"]; } if (AddType == "menu") { linkMarkup = linkMarkup + "&addto=" + (AddType); linkMarkup = linkMarkup + "&iframe=" + Request.QueryString["iframe"] + NoWorkAreaAttribute; } linkMarkup = linkMarkup + "&title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\">"; m_refContent = m_refContentApi.EkContentRef; //Users might not have collection rights with the parent folders # Defect: 47566 if (AddType != "menu" && (m_refContent.IsAllowed(backId, 0, "Folder", "Collections", 0)) || m_refContent.IsARoleMember((long)EkEnumeration.CmsRoleIds.AminCollectionMenu, m_refContent.RequestInformation.CallerId, false) || m_refContent.IsARoleMember((long)EkEnumeration.CmsRoleIds.AdminCollection, m_refContent.RequestInformation.CallerId, false)) { dr[0] = linkMarkup + "<img src=\"" + AppPath + "images/UI/Icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" /></a>" + linkMarkup + "..</a>"; } else if (AddType == "menu") { dr[0] = linkMarkup + "<img src=\"" + AppPath + "images/UI/Icons/folderUp.png" + "\" border=\"0\" title=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic previous dir text") + "\" /></a>" + linkMarkup + "..</a>"; } } dr[1] = " "; dr[2] = " "; dt.Rows.Add(dr); if (cFolders != null) { foreach (Collection folder in cFolders) { EkEnumeration.FolderType foldertype = (EkEnumeration.FolderType)Enum.Parse(typeof(EkEnumeration.FolderType), folder["FolderType"].ToString()); if ((EkEnumeration.FolderType.Content == foldertype) || (EkEnumeration.FolderType.Blog == foldertype) || (EkEnumeration.FolderType.Domain == foldertype) || (EkEnumeration.FolderType.Catalog == foldertype) || (EkEnumeration.FolderType.Calendar == foldertype) || (EkEnumeration.FolderType.Community == foldertype)) { dr = dt.NewRow(); dr[0] += "<a href=\"collections.aspx?Action=AddLink" + status + "&LangType=" + ContentLanguage + "&nId=" + nId + "&folderid=" + FolderId + "&subfolderid=" + folder["ID"] + NoWorkAreaAttribute + enableQDOparam; if (AddType == "menu") { dr[0] += "&addto=" + AddType + "&iframe=" + Request.QueryString["iframe"]; } if (!string.IsNullOrEmpty(Request.QueryString["back"])) { dr[0] = dr[0] + "&back=" + Server.UrlEncode(Request.QueryString["back"]); } string linkValue = dr[0].ToString(); string folder_img = ""; EkEnumeration.FolderType folderType = (EkEnumeration.FolderType)Enum.Parse(typeof(EkEnumeration.FolderType), folder["FolderType"].ToString()); switch (folderType) { case EkEnumeration.FolderType.Domain: folder_img = (string)(AppPath + "images/UI/Icons/folderSite.png"); break; case EkEnumeration.FolderType.Community: folder_img = (string)(AppPath + "images/UI/Icons/folderCommunity.png"); break; case EkEnumeration.FolderType.Catalog: folder_img = (string)(AppPath + "images/UI/Icons/folderGreen.png"); break; case EkEnumeration.FolderType.Calendar: folder_img = (string)(AppPath + "images/UI/Icons/folderCalendar.png"); break; default: folder_img = (string)(AppPath + "images/UI/Icons/folder.png"); break; } dr[0] += "&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\"><img src=\"" + folder_img + "\" title=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" alt=\"" + m_refMsg.GetMessage("alt: generic view folder content text") + "\" /></a>" + linkValue + ("&title=\"" + m_refMsg.GetMessage("alt: generic view folder content text")) + "\">" + folder["Name"].ToString() + "</a>"; if (m_refContentApi.RequestInformationRef.EnableReplication && (Convert.ToInt32(folder["ReplicationMethod"]) == 1)) { dr[0] += " (QuickDeploy)"; } dr[1] = " "; dr[2] = " "; dt.Rows.Add(dr); } } } string ContentName; int lLoop = 0; string cLinkArray = ""; string fLinkArray = ""; string cLanguagesArray = ""; bool IsAdded = false; // For displaying child content - exclude this for reports foreach (ContentBase contInfo in cConts) { if ((Ektron.Cms.Common.EkConstants.CMSContentType_AllTypes == g_ContentTypeSelected) || (Convert.ToInt32(contInfo.ContentType) == g_ContentTypeSelected)) { bDoNotShow = false; IsAdded = IsContentInEcmCollection(contInfo.Id); if (contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.Forms) { ContentName = (string)(AppPath + "linkit.aspx?LinkIdentifier=ekfrm&ItemID=" + contInfo.Id); //m_refContent.GetContentFormlink(contInfo.Id, contInfo.FolderId) } else if (((Convert.ToInt32(contInfo.ContentType) >= Ektron.Cms.Common.EkConstants.ManagedAsset_Min && Convert.ToInt32(contInfo.ContentType) <= Ektron.Cms.Common.EkConstants.ManagedAsset_Max) || (contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.Assets)) && (contInfo.ContentType != Ektron.Cms.Common.EkEnumeration.CMSContentType.Multimedia)) { ContentName = (string)(AppPath + "linkit.aspx?LinkIdentifier=ID&ItemID=" + contInfo.Id); //m_refContent.GetContentQlink(contInfo.Id, contInfo.FolderId) if (ContentName.ToLower().IndexOf("javascript") + 1 > 0) { ContentName = ""; } } else if ((contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.Content) || (contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.Content) || (contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.Multimedia) || (contInfo.ContentType == Ektron.Cms.Common.EkEnumeration.CMSContentType.CatalogEntry)) { ContentName = (string)(AppPath + "linkit.aspx?LinkIdentifier=ID&ItemID=" + contInfo.Id); //m_refContent.GetContentQlink(contInfo.Id, contInfo.FolderId) } else { //do not show bDoNotShow = true; } if (contInfo.ContentSubType == Ektron.Cms.Common.EkEnumeration.CMSContentSubtype.PageBuilderMasterData) { bDoNotShow = true; } if (!(bDoNotShow)) { dr = dt.NewRow(); if (IsAdded) { dr[0] = " " + getContentTypeIcon(contInfo) + "<input size= " + contInfo.Id + " type=\"hidden\" name=\"frm_hidden" + lLoop + "\" value=\"0\">" + "<input type=\"checkbox\" disabled=\"disabled\" checked=\"checked\" name=\"content\" value=\"" + contInfo.Id + "\" ID=\"content\">" + contInfo.Title + "<input type=\"hidden\" name=\"frm_languages" + lLoop + "\" value=\"" + contInfo.Language + "\">"; } else { dr[0] = " " + getContentTypeIcon(contInfo) + "<input size= " + contInfo.Id + " type=\"hidden\" name=\"frm_hidden" + lLoop + "\" value=\"0\">" + "<input type=\"checkbox\" name=\"content\" value=\"" + contInfo.Id + "\" ID=\"content\" onclick=\"document.forms[0][\'frm_hidden" + (lLoop) + "\'].value=(this.checked?" + contInfo.Id + " : 0);\">" + contInfo.Title + "<input type=\"hidden\" name=\"frm_languages" + lLoop + "\" value=\"" + contInfo.Language + "\">"; } dr[1] = "remove-item"; dr[2] = "remove-item"; dt.Rows.Add(dr); } cLinkArray = cLinkArray + "," + contInfo.Id; cLanguagesArray = cLanguagesArray + "," + contInfo.Language; fLinkArray = fLinkArray + "," + FolderId; lLoop++; } } if (cLinkArray.Length > 0) { cLinkArray = cLinkArray.Remove(0, 1); fLinkArray = fLinkArray.Remove(0, 1); cLanguagesArray = cLanguagesArray.Remove(0, 1); } DataView dv = new DataView(dt); ContentGrid.DataSource = dv; ContentGrid.DataBind(); }