private void DisplaySiteAlias() { System.Text.StringBuilder sJS = new System.Text.StringBuilder(); Ektron.Cms.SiteAliasApi _refSiteAliasApi = new Ektron.Cms.SiteAliasApi(); System.Collections.Generic.List<Ektron.Cms.Common.SiteAliasData> siteAliasList = new System.Collections.Generic.List<Ektron.Cms.Common.SiteAliasData>(); Ektron.Cms.PagingInfo page = new Ektron.Cms.PagingInfo(); siteAliasList = _refSiteAliasApi.GetList(page, _FolderData.Id); viewSiteAliasList.InnerHtml = "<table width=\"100%\">"; foreach (Ektron.Cms.Common.SiteAliasData item in siteAliasList) { viewSiteAliasList.InnerHtml = viewSiteAliasList.InnerHtml + "<tr><td><img src=\"" + _ContentApi.AppPath + "images/ui/icons/folderSite.png\" /></td>"; viewSiteAliasList.InnerHtml = viewSiteAliasList.InnerHtml + "<td>" + item.SiteAliasName + "</td></tr>"; } viewSiteAliasList.InnerHtml = viewSiteAliasList.InnerHtml + "</table>"; }
private void PostBack_DoFindContent() { pagedata = new Collection(); try { SearchAssetRequest sar = new SearchAssetRequest(); Ektron.Cms.Content.EkContent ekc; Ektron.Cms.UrlAliasing.UrlAliasManualApi _manualAliasApi; Ektron.Cms.UrlAliasing.UrlAliasAutoApi _autoAliasApi; System.Collections.Generic.List<UrlAliasManualData> manualAliasList; System.Collections.Generic.List<UrlAliasAutoData> autoAliasList; string tempURL; string strLibPath = ""; string strContentID = ""; long contentID = 0; string strFormID = ""; string strAssetName = ""; string strLibtype = ""; PagingInfo page; int index = 0; int contentType = 0; ekc = m_refContentApi.EkContentRef; strLibPath = (string)((!(Request.QueryString["libpath"] == null)) ? (Request.QueryString["libpath"]) : ""); strContentID = (string)((!(Request.QueryString["content_id"] == null)) ? (Request.QueryString["content_id"]) : ""); strFormID = (string)((!(Request.QueryString["form_id"] == null)) ? (Request.QueryString["form_id"]) : ""); strAssetName = (string)((!(Request.QueryString["asset_name"] == null)) ? (Request.QueryString["asset_name"]) : ""); strLibtype = (string)((!(Request.QueryString["libtype"] == null)) ? (Request.QueryString["libtype"]) : ""); contentID = EkFunctions.ReadDbLong(strContentID); contentType = Convert.ToInt32(m_refContentApi.EkContentRef.GetContentType(contentID)); if (strLibPath != "") { m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES; } // Fixed #13770, search links from a form if ((strLibPath != "") || (strContentID != "") || (strFormID != "") || (strAssetName != "")) { // Checking links from known content block sar = new SearchAssetRequest(); sar.FolderID = 0; sar.Recursive = true; sar.SearchContent = true; sar.AllowFragments = true; sar.SearchInHTML = true; sar.SearchForms = true; sar.SearchCatalog = System.Convert.ToBoolean(contentType == EkConstants.CMSContentType_CatalogEntry); string domain; domain = ""; if ((strFormID != "") || (strContentID != "")) { // see if content is in a domain folder which always uses linkit.aspx string id; if (strFormID != "") { id = strFormID; } else { id = strContentID; } domain = m_refContentApi.GetDomainByContentId(Convert.ToInt64(id)); } if (strAssetName != "" && !m_refContentApi.RequestInformationRef.LinkManagement) { sar.SearchText = strAssetName.Replace("\'", "\'"); sar.SearchType = EkEnumeration.SearchTypes.AndWords; } else if ((strAssetName != "") && (strLibtype != "images")) { sar.SearchType = EkEnumeration.SearchTypes.OrWords; //AndWords sar.SearchText = (string)("linkit.aspx?LinkIdentifier=id&ItemId=" + strContentID + ",showcontent.aspx?id=" + strContentID); //If searching for content linked to DMS image (from library) } else if ((strAssetName != "") && (strLibtype == "images")) { sar.SearchType = EkEnumeration.SearchTypes.OrWords; //AndWords sar.SearchText = strAssetName; } else if (strLibPath != "") { if ((m_refContentApi.RequestInformationRef.LinkManagement || (domain != null)) && ((strLibtype != "images") && strLibtype != "files") && (strLibtype != "hyperlinks")) { //This is only for quicklink search //if content is in a domain folder, linkit.aspx will redirect to the proper domain if (strFormID != "") { sar.SearchText = (string)("linkit.aspx?LinkIdentifier=ekfrm&ItemId=" + strFormID); } else { sar.SearchText = (string)("linkit.aspx?LinkIdentifier=id&ItemId=" + strContentID); } } else { sar.SearchText = strLibPath; } sar.SearchType = EkEnumeration.SearchTypes.AndWords; } else if ((m_refContentApi.RequestInformationRef.LinkManagement || (domain != null)) && (strFormID != "")) { // if content is in a domain folder, linkit.aspx will redirect to the proper domain sar.SearchText = (string)("linkit.aspx?LinkIdentifier=ekfrm&ItemId=" + strFormID); sar.SearchType = EkEnumeration.SearchTypes.AndWords; } else if (strContentID != "") { _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi(); _autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi(); page = new Ektron.Cms.PagingInfo(); long.TryParse(strContentID, out contentID); manualAliasList = _manualAliasApi.GetList(page, contentID, true, EkEnumeration.UrlAliasingOrderBy.None); autoAliasList = _autoAliasApi.GetListForContent(contentID); tempURL = string.Empty; for (index = 0; index <= manualAliasList.Count - 1; index++) { tempURL += (string)(manualAliasList[index].DisplayAlias + " "); } for (index = 0; index <= autoAliasList.Count - 1; index++) { tempURL += (string)(autoAliasList[index].AliasName + " "); } // We check the alias and add that as the or phrase. sar.SearchText = (string)("id=" + strContentID); if (tempURL != "" && domain != "") { sar.SearchText += (string)(" " + domain + "/" + tempURL); } else if (tempURL != "" && domain == "") { sar.SearchText += (string)(" " + m_refContentApi.SitePath + tempURL); } sar.SearchType = EkEnumeration.SearchTypes.OrWords; } else { // Not sure if GetAllAliasedPageNameByCID needs form id or content id, // but all we've got at this point is form id. // We check the alias and add that as the or phrase. _manualAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasManualApi(); _autoAliasApi = new Ektron.Cms.UrlAliasing.UrlAliasAutoApi(); page = new Ektron.Cms.PagingInfo(); long.TryParse(strContentID, out contentID); manualAliasList = _manualAliasApi.GetList(page, contentID, true, EkEnumeration.UrlAliasingOrderBy.None); autoAliasList = _autoAliasApi.GetListForContent(contentID); tempURL = string.Empty; for (index = 0; index <= manualAliasList.Count - 1; index++) { tempURL += (string)(manualAliasList[index].DisplayAlias + " "); } for (index = 0; index <= autoAliasList.Count - 1; index++) { tempURL += (string)(autoAliasList[index].AliasName + " "); } sar.SearchText = (string)("ekfrm=" + strFormID); if (tempURL != "" && domain != "") { sar.SearchText += (string)(" " + domain + "/" + tempURL); } else if (tempURL != "" && domain == "") { sar.SearchText += (string)(" " + m_refContentApi.SitePath + tempURL); } sar.SearchType = EkEnumeration.SearchTypes.OrWords; } } else { sar = CustomFields.Populate_AssetRequestObjectFromForm(null); } sar.isWorkareaSearch = true; sar.ItemLanguageID = this.ContentLanguage; SearchContentItem[] sic; sar.CurrentPage = m_intCurrentPage; string cacheKey; if (sar.SearchText != "") { cacheKey = sar.SearchText + sar.SearchType.ToString() + sar.SearchAssets.ToString() + sar.Teaser_SearchText + sar.Title_SearchText + sar.FolderID.ToString(); } else { cacheKey = (string)("Blank" + sar.SearchType.ToString() + sar.SearchAssets.ToString() + sar.Teaser_SearchText + sar.Title_SearchText + sar.FolderID.ToString()); } if (!(Cache[cacheKey] == null)) { sar.SearchResults = (SearchCacheData[])Cache[cacheKey]; } //cms_LoadSearchResult stored proc doesn't return SearchAssetRequest.RecordsAffected value if we do not pass pagesize: Defect:46642 if ((!(Request.Form[isPostData.UniqueID] == null)) || (m_strPageAction == "dofindcontent")) { sar.PageSize = m_refContentApi.RequestInformationRef.PagingSize; } sic = ekc.SearchAssets(ref sar); if ((Cache[cacheKey] == null) && sar.SearchResults != null) { Cache.Add(cacheKey, sar.SearchResults, null, DateTime.Now.AddSeconds(120), TimeSpan.Zero, CacheItemPriority.Normal, null); } m_intTotalPages = sar.TotalPages; m_intTotalRecords = sar.RecordsAffected; PageSettings(); search_result = sic; StringBuilder strHiddenText = new StringBuilder(); if (!((Request.Form[isPostData.UniqueID] == null)) && m_intTotalPages > 1) { foreach (object AvailableItem in Request.Form) { if (AvailableItem.ToString().ToLower().IndexOf("ecm", 0, 3) != -1) { strHiddenText.Append("<input type=\"hidden\" id=\"" + AvailableItem + "\" name=\"" + AvailableItem + "\" value=\"" + Request.Form[AvailableItem.ToString()] + "\">"); } } HiddenData.Text = strHiddenText.ToString(); } //Since viewstate is false for the page, ensure the active tab is set correctly. //mvSearch.ActiveViewIndex = Convert.ToInt32(hdnSelectedTab.Value); if (Convert.ToInt32(hdnSelectedTab.Value) == 0) uxSearchTabs.SetActiveTab(uxTabBasic); else uxSearchTabs.SetActiveTab(uxTabAdvanced); hmenuSelected.Value = hdnSelectedTab.Value; string strViewMode; //If there is no dropdown on the page ie. clicked on a page link in results, //use old value of dropdown from the hidden field pageMode //else use dropdown value and, update pageMode if (!(Request.Form["selDisplayMode"] == null)) { strViewMode = (string)(Request.Form["selDisplayMode"].ToLower()); pageMode.Value = strViewMode; } else { strViewMode = (string)pageMode.Value; } if ((strViewMode != null) && (strViewMode.CompareTo("graphical") == 0)) { iconListOutputLit.Text = " Processing..."; BuildGraphicalResults(sar); } else if ((strViewMode != null) && (strViewMode.CompareTo("mixed") == 0)) { Populate_SearchResultGrid_Content_Mixed(sar); } else { // Default to text mode: Populate_SearchResultGrid_Content(sar); } if (strLibPath != "") { m_refContentApi.ContentLanguage = ContentLanguage; } //mvSearch.SetActiveView(vwSearchAdvanced); uxSearchTabs.SetActiveTab(uxTabAdvanced); } catch (Exception ex) { throw (new Exception("[iSearch.asx.vb->Postback_DoFindContent] " + ex.Message)); } }
private UserGroupData[] GetSearchedUsers() { ValidatePermissions(); List<UserData> userDataList; Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty> userCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty>(); Ektron.Cms.Framework.Users.User userFrameworkApi = new Ektron.Cms.Framework.Users.User(Ektron.Cms.Framework.ApiAccessMode.Admin); int i = 0; int j = 0; int count = 0; UserGroupData[] userGroupData = null; int permissionUserType = System.Convert.ToInt32(_IsMembership ? ContentAPI.PermissionUserType.Membership : ContentAPI.PermissionUserType.Cms); Ektron.Cms.UserGroupData[] emptyUserGroupData = null; string assignedUser = (string) hdnAssignedUserGroupIds.Value; _AssignedUsers = assignedUser.Split(",".ToCharArray()); //set paging size Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo(); if (! this._IsSearch) { pageInfo.CurrentPage = _CurrentPage + 1; pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; } //_UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", permissionUserType, ContentAPI.PermissionRequestType.UnAssigned, pageInfo) userCriteria.PagingInfo = pageInfo; userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText); userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsMemberShip, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership); userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "internaladmin"); userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "builtin"); userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsDeleted, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, true); userDataList = userFrameworkApi.GetList(userCriteria); while (i < userDataList.Count) { for (j = 0; j <= _AssignedUsers.Length - 2; j++) { if (Convert.ToInt64(_AssignedUsers[j]) == userDataList[i].Id) { userDataList.Remove(userDataList[i]); } if (userDataList.Count == 0) { goto endOfWhileLoop; } } i++; } endOfWhileLoop: i = 0; if (userDataList.Count > 0) { if (userDataList.Count == 1) { userGroupData = new UserGroupData[userDataList.Count + 1]; } else { userGroupData = new UserGroupData[userDataList.Count - 1 + 1]; } //isAssignedUser = isAssigned(_UserGroupData, userDataList) //If (isAssignedUser = False) Then foreach (UserData user in userDataList) { userGroupData[i] = new UserGroupData(); userGroupData[i].UserId = user.Id; userGroupData[i].UserName = user.Username; userGroupData[i].GroupId = -1; userGroupData[i].IsMemberShipUser = user.IsMemberShip; i++; } //End If } //Return IIf(userGroupDataItem.GroupId <> -1, userGroupDataItem.GroupId.ToString(), userGroupDataItem.UserId.ToString()) if (userGroupData != null) { for (j = 0; j <= userGroupData.Length - 1; j++) { if (userGroupData[j] == null) { count++; } } if (count == userGroupData.Length) { return emptyUserGroupData; } else { return userGroupData; } } _TotalPages = pageInfo.TotalPages; return emptyUserGroupData; }
private UserGroupData[] GetSearchedGroups() { ValidatePermissions(); //set paging size Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo(); System.Collections.Generic.List<Ektron.Cms.UserGroupData> groupList = new System.Collections.Generic.List<Ektron.Cms.UserGroupData>(); int i = 0; int j; pageInfo.CurrentPage = _CurrentPage + 1; pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; UserGroupData[] userGroupData = null; Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty> userGroupCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty>(); userGroupCriteria.PagingInfo = pageInfo; userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText); userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.IsMembershipGroup, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership); string assignedUser = (string) hdnAssignedUserGroupIds.Value; _AssignedUsers = assignedUser.Split(",".ToCharArray()); groupList = _UserApi.GetUserGroupList(userGroupCriteria); if (groupList.Count > 0) { while (i < groupList.Count) { for (j = 0; j <= _AssignedUsers.Length - 2; j++) { if (Convert.ToInt64(_AssignedUsers[j]) == groupList[i].GroupId) { groupList.Remove(groupList[i]); } if (groupList.Count == 0) { goto endOfWhileLoop; } } i++; } endOfWhileLoop: if (groupList.Count == 1) { userGroupData = new UserGroupData[groupList.Count + 1]; } else { userGroupData = new UserGroupData[groupList.Count - 1 + 1]; } i = 0; //isAssignedUser = isAssigned(_UserGroupData, userDataList) //If (isAssignedUser = False) Then foreach (UserGroupData groupData in groupList) { userGroupData[i] = new UserGroupData(); userGroupData[i].GroupId = groupData.GroupId; userGroupData[i].GroupName = groupData.GroupName; userGroupData[i].UserId = -1; userGroupData[i].IsMemberShipUser = groupData.IsMemberShipGroup; i++; } //End If } _TotalPages = pageInfo.TotalPages; return userGroupData; }
private void GetPermissionDataAll() { //set paging size Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo(); pageInfo.CurrentPage = _CurrentPage + 1; pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize; switch (_PermissionSelectType) { case "1": //Default int permissionUserType = System.Convert.ToInt32(_IsMembership ? ContentAPI.PermissionUserType.Membership : ContentAPI.PermissionUserType.Cms); if(_IsMembership) _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "All",ContentAPI.PermissionUserType.Membership, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); else _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "All",ContentAPI.PermissionUserType.Cms, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); break; case "2": //CMS User _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "Users", ContentAPI.PermissionUserType.Cms, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); break; //UserGroupDataFilter(FilterType.User) case "3": //CMS Group _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "Groups", ContentAPI.PermissionUserType.Cms, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); break; //UserGroupDataFilter(FilterType.Group) case "4": //Member User _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "Users", ContentAPI.PermissionUserType.Membership, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); break; //UserGroupDataFilter(FilterType.User) case "5": //Member Group _UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", "Groups", ContentAPI.PermissionUserType.Membership, ContentAPI.PermissionRequestType.UnAssigned, pageInfo); break; //UserGroupDataFilter(FilterType.Group) } _TotalPages = pageInfo.TotalPages; }
private void DisplaySiteAlias() { System.Text.StringBuilder sJS = new System.Text.StringBuilder(); Ektron.Cms.SiteAliasApi _refSiteAliasApi = new Ektron.Cms.SiteAliasApi(); System.Collections.Generic.List<Ektron.Cms.Common.SiteAliasData> siteAliasList; Ektron.Cms.PagingInfo pagingInfo = new Ektron.Cms.PagingInfo(); int index = 0; siteAliasList = _refSiteAliasApi.GetList(pagingInfo, _FolderData.Id); if (siteAliasList != null) { sJS.Append("arSiteAliasNames = new Array("); foreach (Ektron.Cms.Common.SiteAliasData item in siteAliasList) { if (item != null) { if (index != 0) { sJS.Append(","); } sJS.Append("new item(\'" + item.SiteAliasName + "\'," + index + ")"); index++; } } sJS.AppendLine(");"); sJS.AppendLine("renderSiteAliasNames();"); } Page.ClientScript.RegisterStartupScript(this.GetType(), "renderSiteAliasNames", sJS.ToString(), true); }