98 lines
3.6 KiB
C#
98 lines
3.6 KiB
C#
using System;
|
|
using System.Web.UI;
|
|
using GZTW.AyaNova.BLL;
|
|
|
|
public partial class Wiki : BaseEditPage
|
|
{
|
|
|
|
protected void Page_Init()
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
//referenced on page
|
|
public string sDeletePrompt = "";
|
|
|
|
private WikiPage mWikiPage;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
sDeletePrompt = Util.LocaleText("UI.Label.DeletePrompt");
|
|
|
|
//Initialize controls on first page load
|
|
if (!this.IsPostBack)//The only post back would be to edit the page
|
|
{
|
|
mWikiPage = null;
|
|
TypeAndID tid = TypeAndID.ParseAyaURLQueryParameter(Request.Url.Query);
|
|
if (tid == null)
|
|
{
|
|
//might be an id= url from the search main grid hit so try that
|
|
string idstring = Request.QueryString["id"];
|
|
Guid oID = Guid.Empty;
|
|
if (!string.IsNullOrEmpty(idstring))
|
|
{
|
|
oID = new Guid(idstring);
|
|
mWikiPage = WikiPage.GetItem(oID);
|
|
tid = new TypeAndID(mWikiPage.RootObjectType, mWikiPage.RootObjectID);
|
|
}
|
|
else
|
|
{
|
|
//problem, malformed url
|
|
throw new System.ApplicationException("Wiki->Url TypeAndID not recognized: " + Request.Url.Query);
|
|
}
|
|
|
|
}
|
|
|
|
if (Util.CurrentUser.IsClientOrHeadOfficeAccount)
|
|
{
|
|
//case 1169, no longer automatically denied
|
|
if (Util.IntegrationData.ClientViewWorkorderWiki != true || tid.RootObjectType != RootObjectTypes.WorkorderService)
|
|
Util.Denied(Context);
|
|
}
|
|
|
|
|
|
//stop gap (in case people are trying to use a saved url or something)
|
|
if (!WikiPage.ShowWikiLink(tid))
|
|
Util.Denied(Context);
|
|
|
|
if(mWikiPage==null)
|
|
mWikiPage = WikiPage.GetItem(tid);
|
|
|
|
//set the wikipageid in the hidden form variable
|
|
this.wikipageid.Value = mWikiPage.ID.ToString();
|
|
litContent.Text =mWikiPage.GetContentAsWBIReadyHTML(false) ;
|
|
litFiles.Text = mWikiPage.GetFileListContentForWBI();
|
|
|
|
this.Title = Util.LocaleText("O.WikiPage") + " - " + NameFetcher.GetItem(new TypeAndID(mWikiPage.RootObjectType, mWikiPage.RootObjectID)).RecordName;
|
|
|
|
if (Util.CurrentUser.IsClientOrHeadOfficeAccount)
|
|
{
|
|
btnEdit.Visible = false;
|
|
btnUpload.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
btnEdit.Visible = WikiPage.CanEditWikiPage(tid);
|
|
bool bFilesReadOnly = AyaBizUtils.Right("Object.AyaFile") < (int)SecurityLevelTypes.ReadWrite;
|
|
btnUpload.Visible = !bFilesReadOnly;
|
|
rwUpload.NavigateUrl = "upload.aspx" + TypeAndID.ToAyaURLQueryParameter(RootObjectTypes.WikiPage, mWikiPage.ID);
|
|
}
|
|
// rwUpload.Behaviors = Telerik.Web.UI.WindowBehaviors.Close | Telerik.Web.UI.WindowBehaviors.Resize;
|
|
|
|
|
|
}
|
|
}
|
|
protected void btnEdit_Click(object sender, ImageClickEventArgs e)
|
|
{
|
|
|
|
Response.Redirect("WikiEdit.aspx?id=" + Request.Form["wikipageid"]);
|
|
}
|
|
|
|
protected void btnUpload_Click(object sender, ImageClickEventArgs e)
|
|
{
|
|
//TODO: have this open a radwindow i.e. window.radopen and then somehow trigger a refresh when the radwindow closes
|
|
// Response.Redirect("upload.aspx"+TypeAndID.ToAyaURLQueryParameter(RootObjectTypes.WikiPage,new Guid(Request.Form["wikipageid"])));
|
|
}
|
|
}
|