本文整理汇总了C#中ContentAPI.GetFolderById方法的典型用法代码示例。如果您正苦于以下问题:C# ContentAPI.GetFolderById方法的具体用法?C# ContentAPI.GetFolderById怎么用?C# ContentAPI.GetFolderById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentAPI
的用法示例。
在下文中一共展示了ContentAPI.GetFolderById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewMetaData
private void ViewMetaData(ContentData data)
{
System.Text.StringBuilder result = new System.Text.StringBuilder();
string strResult = "";
string strImagePath = "";
FolderData fldr_Data = new FolderData();
ContentAPI contentapi = new ContentAPI();
fldr_Data = contentapi.GetFolderById(data.FolderId);
if (data != null)
{
List<ContentMetaData> displayMetaDataList = new List<ContentMetaData>();
for (int i = 0; i < data.MetaData.Length; i++)
{
string typeName = data.MetaData[i].TypeName;
if (!typeName.StartsWith("L10n", StringComparison.OrdinalIgnoreCase) && !typeName.StartsWith("Xliff", StringComparison.OrdinalIgnoreCase) && data.MetaData[i].Type.ToString() != "ImageSelector")
{
displayMetaDataList.Add(data.MetaData[i]);
}
else if (data.MetaData[i].Type.ToString() == "ImageSelector")
{
data.MetaData[i].Text = data.MetaData[i].Text.Replace(SitePath + "assets/", "");
data.MetaData[i].Text = System.Text.RegularExpressions.Regex.Replace(data.MetaData[i].Text, "\\?.*", "");
displayMetaDataList.Add(data.MetaData[i]);
}
}
if (displayMetaDataList.Count > 0)
{
strResult = Ektron.Cms.CustomFields.WriteFilteredMetadataForView(displayMetaDataList.ToArray(), m_intFolderId, false).Trim();
}
strImagePath = data.Image;
if (strImagePath.IndexOf(this.AppImgPath + "spacer.gif") != -1)
{
strImagePath = "";
}
//if ((fldr_Data.IsDomainFolder == true || fldr_Data.DomainProduction != "") && SitePath != "/")
//{
// if (strImagePath.IndexOf("http://") != -1)
// {
// strImagePath = strImagePath.Substring(strImagePath.IndexOf("http://"));
// data.ImageThumbnail = data.ImageThumbnail.Substring(data.ImageThumbnail.IndexOf("http://"));
// }
// else
// {
// if (strImagePath != "")
// {
// strImagePath = strImagePath.Replace(SitePath, "");
// data.ImageThumbnail = data.ImageThumbnail.Replace(SitePath, "");
// strImagePath = (string)("http://" + fldr_Data.DomainProduction + "/" + strImagePath);
// data.ImageThumbnail = (string)("http://" + fldr_Data.DomainProduction + "/" + data.ImageThumbnail);
// }
// }
//}
//else if ((fldr_Data.IsDomainFolder == true || fldr_Data.DomainProduction != "") && SitePath == "/")
//{
// if (strImagePath.IndexOf("http://") != -1)
// {
// strImagePath = strImagePath.Substring(strImagePath.IndexOf("http://"));
// data.ImageThumbnail = data.ImageThumbnail.Substring(data.ImageThumbnail.IndexOf("http://"));
// }
// else
// {
// if (strImagePath != "")
// {
// strImagePath = (string)("http://" + fldr_Data.DomainProduction + "/" + strImagePath.Substring(1));
// data.ImageThumbnail = (string)("http://" + fldr_Data.DomainProduction + "/" + data.ImageThumbnail.Substring(1));
// }
// }
//}
//else if (fldr_Data.IsDomainFolder == false && strImagePath.IndexOf("http://") != -1)
//{
// if (strImagePath.IndexOf(SitePath) == 0)
// {
// strImagePath = Strings.Replace(strImagePath, SitePath, "", 1, 1, 0);
// data.ImageThumbnail = Strings.Replace(data.ImageThumbnail, SitePath, "", 1, 1, 0);
// }
//}
//strImagePath = strImagePath;//Strings.Replace(strImagePath, SitePath, "", 1, 1, 0);
data.ImageThumbnail = data.ImageThumbnail;// Strings.Replace(data.ImageThumbnail, SitePath, "", 1, 1, 0);
if (fldr_Data.FolderType != 9)
{
// display tag info for this library item
System.Text.StringBuilder taghtml = new System.Text.StringBuilder();
taghtml.Append("<fieldset style=\"margin:10px\">");
taghtml.Append("<legend>" + m_refMsg.GetMessage("lbl personal tags") + "</legend>");
taghtml.Append("<div style=\"height: 80px; overflow: auto;\" >");
if (content_data.Id > 0)
{
LocalizationAPI localizationApi = new LocalizationAPI();
TagData[] tdaUser;
tdaUser = (new Ektron.Cms.Community.TagsAPI()).GetTagsForObject(content_data.Id, Ektron.Cms.Common.EkEnumeration.CMSObjectTypes.Content, m_refContentApi.ContentLanguage);
if (tdaUser != null && tdaUser.Length > 0)
{
foreach (TagData td in tdaUser)
//.........这里部分代码省略.........
示例2: GetPageBuilderEditAnchor
public string GetPageBuilderEditAnchor(long Id, int languageId, string quickLink, bool isPrimary)
{
//make popup window with link to this pageids wireframe, and pass in the id and an edit flag
ContentAPI capi = new ContentAPI();
FolderData fd = capi.GetFolderById(capi.GetFolderIdForContentId(Id));
AliasData aliasData = new AliasData();
string URL = "";
AliasSettings aliasSettings = ObjectFactory.GetAliasSettingsManager(this.m_refAPI.RequestInformationRef).Get();
if (aliasSettings.IsAliasingEnabled)
{
IAliasManager aliasManager = ObjectFactory.GetAliasManager(this.m_refAPI.RequestInformationRef);
aliasData = aliasManager.GetAlias(Id, languageId, EkEnumeration.TargetType.Content);
URL = aliasData.Alias;
}
// Note that the internal API changed, if a content items has a default alias it will be passed into this funciton as param quicklink.
// Keeping this code incase other places are calling this function without alias in quicklink param
if (String.IsNullOrEmpty(URL))
{
URL = quickLink;
}
// If it is a multi site, use the quicklink as the alias will not function in other domains. ALias is tied to domain.
if (fd.IsDomainFolder && aliasData != null && !string.IsNullOrEmpty(aliasData.TargetURL))
{
URL = aliasData.TargetURL.TrimStart('/');
}
else if (fd.IsDomainFolder)
{
URL = URL.TrimStart('/');
}
if (URL.Contains("?"))
{
URL = URL + "&ektronPageBuilderEdit=true";
}
else
{
URL = URL + "?ektronPageBuilderEdit=true";
}
if (URL.IndexOf("LangType=") == -1)
{
URL = URL + "&LangType=" + languageId.ToString();
}
URL = this.m_refAPI.SitePath + URL;
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);
return URL;
}
示例3: Page_Load
/// <summary>
/// This page generates the data (with HTML markup) to support the ajax
/// folder tree (SelectFolder).
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
contentAPI = new Ektron.Cms.ContentAPI();
siteAPI = new Ektron.Cms.SiteAPI();
string cleanupId = Request.QueryString["cleanupid"];
string controlId = Request.QueryString["controlid"];
long folderId = long.Parse(Request.QueryString["folderid"]);
string checkAddParam = Request.QueryString["CheckAddPermissions"];
if (!String.IsNullOrEmpty(checkAddParam))
{
bool.TryParse(checkAddParam, out checkAddPermissions);
}
string showSpecialFoldersParam = Request.QueryString["ShowSpecialFolders"];
if (!String.IsNullOrEmpty(showSpecialFoldersParam))
{
bool.TryParse(showSpecialFoldersParam, out showSpecialFolders);
}
string retval = string.Empty;
if (folderId != -1)
{
retval = "<div id=\"ekDiv" + controlId + "_" + folderId + "\">" +
GenerateTreeHtml(controlId, folderId) + "</div>";
}
else
{
string folderHtml = string.Empty;
FolderData rootFolder = contentAPI.GetFolderById(0);
if (rootFolder != null)
{
folderHtml = GenerateFolderHtml(controlId, rootFolder);
}
else
{
folderHtml = "You do not have the permissions necessary to view the folder structure.";
}
retval = "<div id=\"ekDiv" + controlId + "_" + folderId + "\"><ul>" + folderHtml + "</ul></div>";
}
retval = "expandCallback(\"" + controlId +
"\", \"" + folderId + "\", \"" +
Escape(retval) +
"\"); cleanUp(\"" + cleanupId + "\");";
Response.Write(retval);
Response.End();
}
示例4: GetPageBuilderEditAnchor
public string GetPageBuilderEditAnchor(long Id, int languageId, string quickLink, bool isPrimary)
{
//make popup window with link to this pageids wireframe, and pass in the id and an edit flag
ContentAPI capi = new ContentAPI();
FolderData fd = capi.GetFolderById(capi.GetFolderIdForContentId(Id));
string URL = "";
Ektron.Cms.API.UrlAliasing.UrlAliasCommon u = new Ektron.Cms.API.UrlAliasing.UrlAliasCommon();
URL = u.GetAliasForContent(Id);
if (URL == string.Empty || fd.IsDomainFolder)
{
URL = quickLink;
}
if (URL.Contains("?"))
{
URL = URL + "&ektronPageBuilderEdit=true";
}
else
{
URL = URL + "?ektronPageBuilderEdit=true";
}
if (URL.IndexOf("LangType=") == -1)
{
URL = URL + "&LangType=" + languageId.ToString();
}
URL = this.m_refAPI.SitePath + URL;
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);
return URL;
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
m_refMsg = m_refSiteApi.EkMsgRef;
ContentAPI capi = new ContentAPI();
if (_fid > -1)
{
FolderData fd = capi.GetFolderById(_fid, true, false);
if (fd != null)
{
if (fd.FolderTaxonomy.Length == 0)
{
noTaxonomies.Text = m_refMsg.GetMessage("generic no taxonomy");
noTaxonomies.ToolTip = m_refMsg.GetMessage("generic no taxonomy");
}
taxRequired.InnerText = fd.CategoryRequired.ToString().ToLower();
if (!IsPostBack)
{
taxonomies.DataSource = fd.FolderTaxonomy;
taxonomies.DataBind();
if (fd.FolderTaxonomy.Length > 0 && defaultTaxID > -1)
{
//output path to selected taxonomy
TaxonomyRequest taxrequest = new TaxonomyRequest();
taxrequest.IncludeItems = false;
taxrequest.Page = Page;
taxrequest.TaxonomyLanguage = capi.RequestInformationRef.ContentLanguage;
taxrequest.TaxonomyId = defaultTaxID;
taxrequest.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content;
TaxonomyData td = capi.EkContentRef.LoadTaxonomy(ref taxrequest);
if (td != null)
{
txtselectedTaxonomyNodes.Text = td.TaxonomyPath;
}
}
}
}
}
else
{
if (!IsPostBack)
{
Ektron.Cms.API.Content.Taxonomy tax = new Ektron.Cms.API.Content.Taxonomy();
TaxonomyRequest tr = new TaxonomyRequest();
tr.IncludeItems = false;
tr.Depth = 1;
tr.Page = Page;
tr.TaxonomyId = 0;
tr.TaxonomyLanguage = capi.RequestInformationRef.ContentLanguage;
tr.TaxonomyType = Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content;
tr.TaxonomyItemType = Ektron.Cms.Common.EkEnumeration.TaxonomyItemType.Content;
TaxonomyBaseData[] td = capi.EkContentRef.ReadAllSubCategories(tr);
taxonomies.DataSource = td;
taxonomies.DataBind();
}
}
// Register JS
JS.RegisterJS(this, JS.ManagedScript.EktronJS);
JS.RegisterJS(this, JS.ManagedScript.EktronTreeviewJS);
// Register CSS
Css.RegisterCss(this, Css.ManagedStyleSheet.EktronTreeviewCss);
}
示例6: CaptureTaxonomy
private string CaptureTaxonomy(long contentId, long folderId)
{
StringBuilder taxonomyOutput = new StringBuilder();
Folder myFolderApi = new Folder();
FolderData myFolderData;
ContentAPI myContentApi = new ContentAPI();
TaxonomyBaseData[] myTaxonomyBaseData;
List<long> myTaxonomyIds = new List<long>();
System.Text.StringBuilder Js;
Js = new System.Text.StringBuilder();
long iTmpCaller = myContentApi.RequestInformationRef.CallerId;
long iTmpuserID = myContentApi.RequestInformationRef.UserId;
int ContentLanguage = EkConstants.CONTENT_LANGUAGES_UNDEFINED;
if (!(Page.Request.QueryString["LangType"] == null))
{
if (Page.Request.QueryString["LangType"] != "")
{
ContentLanguage = Convert.ToInt32(Page.Request.QueryString["LangType"]);
myContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
}
else
{
if (myContentApi.GetCookieValue("LastValidLanguageID") != "")
{
ContentLanguage = Convert.ToInt32(myContentApi.GetCookieValue("LastValidLanguageID"));
}
}
}
else
{
if (myContentApi.GetCookieValue("LastValidLanguageID") != "")
{
ContentLanguage = Convert.ToInt32(myContentApi.GetCookieValue("LastValidLanguageID"));
}
}
if (ContentLanguage == EkConstants.CONTENT_LANGUAGES_UNDEFINED)
{
myContentApi.ContentLanguage = EkConstants.ALL_CONTENT_LANGUAGES;
}
else
{
myContentApi.ContentLanguage = ContentLanguage;
}
myContentApi.RequestInformationRef.CallerId = Ektron.Cms.Common.EkConstants.InternalAdmin;
myContentApi.RequestInformationRef.UserId = Ektron.Cms.Common.EkConstants.InternalAdmin;
myFolderData = myContentApi.GetFolderById(folderId, true);
myTaxonomyBaseData = myFolderData.FolderTaxonomy;
myContentApi.RequestInformationRef.CallerId = iTmpCaller;
myContentApi.RequestInformationRef.UserId = iTmpuserID;
if (!String.IsNullOrEmpty(Request.QueryString["TaxonomyId"]))
{
jsTaxRedirectID.Text=taxonomyselectedtree.Value = Request.QueryString["TaxonomyId"].ToString();
}
SetTaxonomy(contentId, folderId);
Js.Append("function ValidateTax(){").Append(Environment.NewLine);
if (myTaxonomyBaseData.Length > 0 && (myTaxonomyBaseData != null))
{
if (myFolderData.CategoryRequired == true)
{
Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=\"\";").Append(Environment.NewLine);
Js.Append(" for(var i=0;i<taxonomytreearr.length;i++){").Append(Environment.NewLine);
Js.Append(" if(document.getElementById(\"taxonomyselectedtree\").value==\"\"){").Append(Environment.NewLine);
Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=taxonomytreearr[i];").Append(Environment.NewLine);
Js.Append(" }else{").Append(Environment.NewLine);
Js.Append(" document.getElementById(\"taxonomyselectedtree\").value=document.getElementById(\"taxonomyselectedtree\").value+\",\"+taxonomytreearr[i];").Append(Environment.NewLine);
Js.Append(" }").Append(Environment.NewLine);
Js.Append(" } ").Append(Environment.NewLine);
Js.Append(" if (Trim(document.getElementById(\'taxonomyselectedtree\').value) == \'\') { ").Append(Environment.NewLine);
Js.Append(" alert(\'" + m_refMsg.GetMessage("js tax cat req") + "\'); ").Append(Environment.NewLine);
Js.Append(" return false; ").Append(Environment.NewLine);
Js.Append(" } ").Append(Environment.NewLine);
Js.Append(" return true; }").Append(Environment.NewLine);
}
else
{
Js.Append(" return true;}").Append(Environment.NewLine);
}
ltrTaxJS.Text = Js.ToString();
ltrShowTaxonomy.Text = "<li><a id=\"taxonomyAnchor\" href=\"#\" onclick=\"dmsMetadataShowHideCategory(\'taxonomy\');return false;\" title=\"View Taxonomy\">" + m_refMsg.GetMessage("viewtaxonomytabtitle") + "</a></li>";
string addTaxonomy = "<div id=" + "\"" + "TreeOutput" + "\"" + "></div>";
return addTaxonomy;
}
else
{
Js.Append(" return true;}").Append(Environment.NewLine);
ltrTaxJS.Text = Js.ToString();
string addTaxonomyEmpty = "<div id=\"EmptyTree\"></div>";
return addTaxonomyEmpty;
}
}