public void paramhelpeditor(string code) { PropertyBag["content"] = myapp.files.Read("doc/reportparameters/" + code + ".html"); PropertyBag["code"] = code; PropertyBag["parameter"] = new ReportParametersRepository().Get(code); PropertyBag["advancedScripts"] = new[]{ "yui/utilities/utilities", "yui/container/container", "yui/menu/menu", "yui/button/button", "yui/editor/editor-beta", "editor"}; PropertyBag["advancedCss"] = new[]{ "scripts/yui/fonts/fonts-min", "scripts/yui/container/assets/skins/sam/container", "scripts/yui/button/assets/skins/sam/button", "scripts/yui/editor/assets/skins/sam/editor", "scripts/yui/yahoo-dom-event/yahoo-dom-event", "scripts/yui/menu/assets/skins/sam/menu"}; }
public void setparamhelp(string code,string content) { var p = new ReportParametersRepository().Get(code); myapp.files.Write("~/"+p.Level+"/doc/reportparameters/" + code + ".html", content); RenderText("OK"); }
public void getparamhelp(string code) { var content = myapp.files.Read("doc/reportparameters/" + code + ".html"); content = makeparamWiki(content); PropertyBag["content"] = content; PropertyBag["code"] = code; PropertyBag["parameter"] = new ReportParametersRepository().Get(code); }
private string makeparamWiki(string content) { return content.replace(@"\[\[(?<code>[\w\d]+)\]\]", m => { var code = m.Groups["code"].Value; var parameter = new ReportParametersRepository().Get(code); if(parameter.HasHelp()) { return string.Format( @"<span class=""showlink"" title=""Открыть справку"" onclick=""zeta.report.getparamdoc('{0}')"">{0} ({1})</span>", code, parameter.Name); }else { if(myapp.roles.IsInRole("ADMIN") || myapp.roles.IsInRole("DOCWRITER")) { return string.Format( @"<span class=""createlink"" title=""Создать справку"" onclick=""zeta.report.editparamdoc('{0}')"">{0} ({1})</span>", code, parameter.Name); }else { return string.Format( @"<span class=""notexisted"" title=""Справка на данный момент отсутствует"">{0} ({1})</span>", code, parameter.Name); } } }, RegexOptions.Compiled); }
protected override string getText(string code, string title, bool existed) { code = code.Replace("rp/", ""); var p = new ReportParametersRepository().Get(code); return p.Code + " (" + p.Name + ")"; }