Skip to content

Commit

Permalink
Issue #2 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
Luc Gosso committed Oct 12, 2017
1 parent 54a72ac commit e77286c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyVersion("1.3.0")]
[assembly: AssemblyFileVersion("1.3.0")]
42 changes: 24 additions & 18 deletions QuickNavigatorItemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public IDictionary<string, QuickNavigatorMenuItem> GetMenuItems(ContentReference
{
if (!String.IsNullOrEmpty(item))
{
dictionary.Add(item, DoMagic(item, currentContent));
var menu = DoMagic(item, currentContent);
if (menu!=null)
dictionary.Add(item, menu);
}
}

Expand All @@ -73,31 +75,35 @@ private QuickNavigatorMenuItem DoMagic(string item, ContentReference currentCont
return new QuickNavigatorMenuItem("Find", find, null, "true", null);
}

if (HttpContext.Current.User.IsInRole("WebAdmins"))

if (item == "admin")
{
if (item == "admin")
{
if (!HttpContext.Current.User.IsInRole("WebAdmins"))
return null;

var editUrl = GetEditUrl() + EPiServer.Editor.PageEditing.GetEditUrl(currentContent);
editUrl = editUrl.Replace("#", "admin/#");
var editUrl = GetEditUrl() + EPiServer.Editor.PageEditing.GetEditUrl(currentContent);
editUrl = editUrl.Replace("#", "admin/#");

return new QuickNavigatorMenuItem("/shell/cms/menu/admin", editUrl, null, "true", null);
}
return new QuickNavigatorMenuItem("/shell/cms/menu/admin", editUrl, null, "true", null);
}

if (item == "contenttype")
{
var editUrl = GetEditUrl() + EPiServer.Editor.PageEditing.GetEditUrl(currentContent);
if (item == "contenttype")
{
if (!HttpContext.Current.User.IsInRole("WebAdmins"))
return null;

var editUrl = GetEditUrl() + EPiServer.Editor.PageEditing.GetEditUrl(currentContent);

PageData pd = null;
PageData pd = null;

if (this.contentLoader.TryGet<PageData>(currentContent, out pd))
{
editUrl = editUrl.Replace("#", "admin/?customdefaultpage=admin/EditContentType.aspx?typeId=" + pd.ContentTypeID + "#");
var n = LocalizationService.Current.GetString("/addon/quicknav/pagetype", "Admin pagetype") + " " + pd.PageTypeName;
return new QuickNavigatorMenuItem(n, editUrl, null, "true", null);
}
if (this.contentLoader.TryGet<PageData>(currentContent, out pd))
{
editUrl = editUrl.Replace("#", "admin/?customdefaultpage=admin/EditContentType.aspx?typeId=" + pd.ContentTypeID + "#");
var n = LocalizationService.Current.GetString("/addon/quicknav/pagetype", "Admin pagetype") + " " + pd.PageTypeName;
return new QuickNavigatorMenuItem(n, editUrl, null, "true", null);
}
}


if (item == "logout")
{
Expand Down

0 comments on commit e77286c

Please sign in to comment.