public void ReindexButton_Click(object sender, EventArgs e) { if (ServerList.SelectedItem == null) { Message.Text = "Du måste välja ett index!"; return; }
if (!siteIndex && !commonIndex) { Message.Text = "Indexeringen kunde inte slutföras."; return; } Message.Text = string.Format("Indexering av sidan {0} har startat på {1} och kommer finnas tillgänglig i indexet inom kort.",
}
public void ReindexThisButton_Click(object sender, EventArgs e) { try { if (ServerList.SelectedItem == null) { Message.Text = "Du måste välja ett index!"; return; }
Hi,
We have migrated over project from episerver 7 to episerver 8, many custom plugins are not working in Episerver 8.
I tried digging a lot but couldn't able to find any sollution.
Below is the code for the Reference.
Help will be truly appreciated
[IFrameComponentWithAuthorization(Url = "~/Consid/Plugins/EditCommands.aspx",
ReloadOnContextChange = true,
PlugInAreas = "/episerver/cms/assets",
Title = "Indexera sida/sidor",
Categories="cms",
MinHeight = 350,
MaxHeight = 500,
AllowedRoles = "WebAdmins, Administrators, Administratörer")]
public partial class EditCommands : ContentBaseUserControl
{
private string SITE_INDEX = "Site Index";
private string EK_INDEX = "EK Index";
public Dictionary Indexes
{
get
{
{
if (!indexes.Keys.Contains(index.InternName))
{
}
}
return indexes;
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (UrlRewriteProvider.Module != null)
{
UrlRewriteProvider.Module.FURLRewriteResponse = false;
}
ReindexButton.Text = "Indexera sidan '" + CurrentContent.Name + "'";
if (!IsPostBack)
{
ServerList.DataTextField = "Value";
ServerList.DataValueField = "Key";
ServerList.DataSource = Indexes;
ServerList.DataBind();
}
}
public void ReindexButton_Click(object sender, EventArgs e)
{
if (ServerList.SelectedItem == null)
{
Message.Text = "Du måste välja ett index!";
return;
}
if (!siteIndex && !commonIndex)
{
Message.Text = "Indexeringen kunde inte slutföras.";
return;
}
Message.Text = string.Format("Indexering av sidan {0} har startat på {1} och kommer finnas tillgänglig i indexet inom kort.",
}
public void ReindexThisButton_Click(object sender, EventArgs e)
{
try
{
if (ServerList.SelectedItem == null)
{
Message.Text = "Du måste välja ett index!";
return;
}
if (Url.Text != string.Empty)
{
bool siteIndex = false;
bool commonIndex = false;
ReindexUrl(Url.Text, CheckLinks.Checked, out siteIndex, out commonIndex);
CheckLinks.Checked = false;
if (!siteIndex && !commonIndex)
{
Message.Text = "Indexeringen kunde inte slutföras.";
return;
}
}
}
catch(Exception ex)
{
Message.Text = "Indexeringen kunde inte slutföras.";
}
}
private void ReindexUrl(string url, bool indexLinks, out bool notifyResultOnSite, out bool notifyResultOnCommon)
{
notifyResultOnSite = false;
notifyResultOnCommon = false;
NotifySearchIndex notifyIndex = null;
List uris = new List();
// Check sub URLs
if (indexLinks)
{
uris = SiteSeekerHelper.ExtractUriListFromHtmlMap(url, true);
}
else
{
uris.Add(new Uri(url.ReplaceDomainNameWithIp()));
}
ListItem li = ServerList.Items.FindByValue(SiteConfig.Instance.GetSearchIndex(SiteSeekerIndexes.EpiSite).InternName);
if (li != null && li.Selected)
{
li.Selected = false;
PageData pageData = null;
try
{
PageReference pr = new PageReference(CurrentContent.ContentLink.ID);
pageData = DataFactory.Instance.GetPage(pr);
}
catch (Exception)
{
pageData = DataFactory.Instance.GetPage(PageReference.StartPage);
}
notifyIndex = SearchIndexFactory.GetNotifySearchIndex(pageData.NodeSiteIndex());
notifyResultOnSite = notifyIndex.Notify(uris.ToArray());
}
li = ServerList.Items.FindByValue(SiteConfig.Instance.GetSearchIndex(SiteSeekerIndexes.CommonIndex).InternName);
if (li != null && li.Selected)
{
li.Selected = false;
notifyIndex = SearchIndexFactory.GetNotifySearchIndex(
SiteConfig.Instance.GetSearchIndex(SiteSeekerIndexes.CommonIndex).Name);
notifyResultOnCommon = notifyIndex.Notify(uris.ToArray());
}
}
}
}