73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using System;
|
|
using System.Web.Mvc;
|
|
using GZTW.AyaNova.BLL;
|
|
using ri.util;
|
|
|
|
namespace ri.Controllers
|
|
{
|
|
public class WikiFileController : Controller
|
|
{
|
|
//
|
|
// GET: /WikiFile/
|
|
|
|
public ActionResult Index(Guid Id, int aytype)
|
|
{
|
|
RootObjectTypes rot = (RootObjectTypes)aytype;
|
|
TypeAndID sourceTid = new TypeAndID(rot, Id);
|
|
WikiPage c = WikiPage.GetItem(sourceTid);
|
|
formInit(c, sourceTid, false);
|
|
ViewBag.titleName = NameFetcher.GetItem((RootObjectTypes)aytype, Id, true).RecordName;
|
|
return View(c);
|
|
}
|
|
|
|
|
|
#region Menu and rights
|
|
|
|
private void formInit(WikiPage c, TypeAndID sourceTid, bool editMode)
|
|
{
|
|
|
|
//set rights
|
|
util.ay.setViewBagRights(ViewBag, RootObjectTypes.WikiPage);
|
|
|
|
//this is to hide normal save button only
|
|
ViewBag.ayReadOnly = true;
|
|
|
|
#region Generate menu
|
|
ayMenu m = new ayMenu();
|
|
m.title = "O.AyaFile";
|
|
m.icon = "icon-WikiFile";
|
|
|
|
|
|
if (!editMode && WikiPage.CanEditWikiPage(sourceTid))
|
|
{
|
|
//add edit link here
|
|
|
|
//m.menuItems.Add(new ayMenuItem("navitem", "UI.Command.Edit", ay.WikiUrl(sourceTid.RootObjectType, sourceTid.ID, Url, true), "icon-Edit"));
|
|
|
|
}
|
|
else
|
|
{
|
|
//windows ayanova has a save menu option
|
|
//and the toolbar for editing but that will likely be inside the edit control anyway so
|
|
//probably nothing to add here
|
|
|
|
}
|
|
|
|
|
|
m.menuItems.Add(new ayMenuItem("scriptitem", "UI.Command.RecordHistory", "alert('" +
|
|
ay.RecordHistoryText(c.Creator, c.Modifier, c.Created, c.Modified) +
|
|
"')", "icon-RecordHistory"));
|
|
|
|
|
|
ViewBag.ayMenu = m;
|
|
#endregion generate menu
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|