string GetJson(Tk5NormalTableData table) { var json = string.Format("{{\"Tables\":[{0}]}}", table.JsonFields); return StringUtil.EscapeHtmlAttribute(json); }
public override void Execute() { NormalEditData pageData = ViewBag.PageData; HtmlAttribute attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close") : new HtmlAttribute("data-url", HtmlUtil.GetRetUrl((DataSet)Model)); HtmlAttribute retAttr = new HtmlAttribute("data-action", "return"); WriteLiteral("\r\n"); DefineSection("DefaultButtons", () => { WriteLiteral("\r\n <div"); WriteLiteral(" class=\"text-center clearfix\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(BootcssUtil.Button(pageData.SaveButtonCaption, "btn-submit", BootcssButton.Primary, false)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(BootcssUtil.Button(pageData.CancelCaption, "m10", BootcssButton.Default, false, attribute, retAttr)); WriteLiteral("\r\n </div>\r\n"); }); DataRow dataRow = HtmlUtil.GetMainRow((DataSet)Model, ViewBag); Tk5NormalTableData table = ViewBag.MetaData.Table; List <Tk5FieldInfoEx> hiddenFields = table.HiddenList; List <Tk5FieldInfoEx> normalFields = table.TableList; bool showCaption = pageData.ShowCaption; string dataClass = showCaption ? string.Empty : "class=\"nocaption\""; WriteLiteral("\r\n<form"); WriteAttribute("action", Tuple.Create(" action=\"", 1428), Tuple.Create("\"", 1465) , Tuple.Create(Tuple.Create("", 1437), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction , 1437), false) ); WriteLiteral(" method=\"POST\""); WriteLiteral(" id=\"PostForm\""); WriteLiteral(" class=\"tk-dataform p5 mb15\""); WriteLiteral(" role=\"form\""); WriteLiteral(" data-check=\"true\""); WriteLiteral(" data-post=\""); Write(GetJson(table)); WriteLiteral("\""); WriteLiteral(">\r\n <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1591), Tuple.Create("\"", 1612) , Tuple.Create(Tuple.Create("", 1596), Tuple.Create <System.Object, System.Int32>(table.TableName , 1596), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1613), Tuple.Create("\"", 1708) , Tuple.Create(Tuple.Create("", 1621), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable table-row", "column" + table.ColumnCount.ToString()) , 1621), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"hide\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in hiddenFields) { Write(RenderHidden(dataRow, field, true)); } WriteLiteral(" </div>\r\n <div"); WriteLiteral(" class=\"p10 pull-left w100p\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in normalFields) { string fieldString = RenderFieldItem(dataRow, field); if (fieldString != null) { Write(fieldString); } else { WriteLiteral(" <div"); WriteAttribute("class", Tuple.Create(" class=\"", 2305), Tuple.Create("\"", 2378) , Tuple.Create(Tuple.Create("", 2313), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column form-group", field.LayoutClass()) , 2313), false) ); WriteLiteral(">\r\n <dl "); Write(dataClass); WriteLiteral(">\r\n"); if (showCaption) { WriteLiteral(" <dt>"); Write(field.DisplayName); WriteLiteral("</dt>\r\n"); } WriteLiteral(" <dd>\r\n <span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(field.Control(dataRow, (DataSet)Model, true)); WriteLiteral("\r\n </span>\r\n </dd>\r\n " + " </dl>\r\n </div>\r\n"); } } WriteLiteral(" </div>\r\n </div>\r\n</form>\r\n"); Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons")); WriteLiteral("\r\n"); }
string GetJson(Tk5NormalTableData table) { var normalJson = "{\"Table\":\"Info\",\"SearchMethod\":\"Id\",\"JsonType\":\"Object\",\"Fields\":[{\"Name\":\"Company\",\"Type\":\"Text\"},{\"Name\":\"InputDate\",\"Type\":\"Date\"},{\"Name\":\"ReportId\",\"Type\":\"Hidden\"}]}"; var json = string.Format("{{\"Tables\":[{0}, {1}]}}", table.JsonFields, normalJson); return StringUtil.EscapeHtmlAttribute(json); }
string GetJson(Tk5NormalTableData table) { var json = string.Format("{{\"Tables\":[{0}]}}", table.JsonFields); return(StringUtil.EscapeHtmlAttribute(json)); }
public override void Execute() { NormalEditData pageData = ViewBag.PageData; //HtmlAttribute attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close") // : new HtmlAttribute("data-url", HtmlUtil.GetRetUrl((DataSet)Model)); //HtmlAttribute retAttr = new HtmlAttribute("data-action", "return"); DataRow dataRow = null; // HtmlUtil.GetMainRow((DataSet)Model, ViewBag); Tk5NormalTableData table = ViewBag.MetaData.Table; List <Tk5FieldInfoEx> hiddenFields = table.HiddenList; List <Tk5FieldInfoEx> normalFields = table.TableList; int columnCount = table.ColumnCount; int columnWidth = 12 / columnCount; int fieldsCount = normalFields.Count; int columnFieldCount = fieldsCount / columnCount; if ((fieldsCount % columnCount) != 0) { ++columnFieldCount; } //bool showCaption = pageData.ShowCaption; //string dataClass = showCaption ? string.Empty : "class=\"nocaption\""; WriteLiteral("\r\n"); DefineSection("DefaultButtons", () => { WriteLiteral("\r\n "); WriteLiteral("\r\n"); }); WriteLiteral("\r\n<form"); WriteAttribute("action", Tuple.Create(" action=\"", 1753), Tuple.Create("\"", 1790) , Tuple.Create(Tuple.Create("", 1762), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction , 1762), false) ); WriteLiteral(" method=\"POST\""); WriteLiteral(" id=\"PostForm\""); WriteLiteral(" class=\"tk-dataform p5 mb15\""); WriteLiteral(" role=\"form\""); WriteLiteral(" data-check=\"true\""); WriteLiteral(" data-post=\""); Write(GetJson(table)); WriteLiteral("\""); WriteLiteral(">\r\n <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1916), Tuple.Create("\"", 1937) , Tuple.Create(Tuple.Create("", 1921), Tuple.Create <System.Object, System.Int32>(table.TableName , 1921), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1938), Tuple.Create("\"", 2033) , Tuple.Create(Tuple.Create("", 1946), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable table-row", "column" + table.ColumnCount.ToString()) , 1946), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"hide\""); WriteLiteral(">\r\n "); WriteLiteral("\r\n </div>\r\n <div"); WriteLiteral(" class=\"row\""); WriteLiteral(">\r\n"); for (int i = 0; i < columnCount; ++i) { int start = i * columnFieldCount; int end = start + columnFieldCount; if (end > fieldsCount) { end = fieldsCount; } WriteLiteral(" <div"); WriteAttribute("class", Tuple.Create(" class=\"", 2605), Tuple.Create("\"", 2650) , Tuple.Create(Tuple.Create("", 2613), Tuple.Create <System.Object, System.Int32>("col-sm-" + columnWidth.ToString() , 2613), false) ); WriteLiteral(">\r\n <table"); WriteLiteral(" class=\"table\""); WriteLiteral(">\r\n <tr>\r\n <th>资产</th>\r\n " + " <th>行次</th>\r\n <th>期末数</th>\r\n " + " </tr>\r\n"); for (int j = start; j < end; ++j) { var field = normalFields[j]; Tuple <int, byte, FieldStyle> info = field.Tag as Tuple <int, byte, FieldStyle>; string intendClass = info.Item2 == 0 ? string.Empty : "class=\"pdl-" + info.Item2 + "\""; if (info.Item3 == FieldStyle.Title) { WriteLiteral(" <tr"); WriteLiteral(" class=\"info\""); WriteLiteral(">\r\n <td>"); Write(field.DisplayName); WriteLiteral("</td>\r\n <td></td>\r\n " + " <td></td>\r\n </tr>\r\n"); } else { WriteLiteral(" <tr>\r\n <td "); Write(intendClass); WriteLiteral(">"); Write(field.DisplayName); WriteLiteral("</td>\r\n <td>"); Write(info.Item1); WriteLiteral("</td>\r\n <td>\r\n " + "<span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">"); Write(field.Control(dataRow, (DataSet)Model, true)); WriteLiteral("</span>\r\n </td>\r\n </tr>" + "\r\n"); } } WriteLiteral(" </table>\r\n </div>\r\n"); } WriteLiteral(" </div>\r\n </div>\r\n</form>\r\n"); Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons")); WriteLiteral("\r\n"); }
public override void Execute() { NormalDetailData pageData = ViewBag.PageData; DataSet dataSet = Model; HtmlAttribute attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close") : new HtmlAttribute("data-url", HtmlUtil.GetRetUrl(dataSet)); HtmlAttribute retAttr = new HtmlAttribute("data-action", "return"); DataTable operators = dataSet.Tables["DetailOperator"]; Tk5NormalTableData table = ViewBag.MetaData.Table; DataRow dataRow = HtmlUtil.GetMainRow(Model, ViewBag); List <Tk5FieldInfoEx> fields = ViewBag.MetaData.Table.TableList; int captionCol = pageData.CaptionColumn; int dataCol = pageData.DataColumn; bool showHint = pageData.AppendHint; bool ignoreEmptyField = pageData.IgnoreEmptyField; WriteLiteral("\r\n"); DefineSection("DefaultButtons", () => { WriteLiteral("\r\n <div"); WriteLiteral(" class=\"text-center clearfix mt5\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(BootcssUtil.CreateDetailButtons(dataSet, dataRow)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(BootcssUtil.Button("<i class='icon-remove mr5'></i>" + pageData.CancelCaption, "", BootcssButton.Default, false, attribute, retAttr)); WriteLiteral("\r\n </div>\r\n"); }); WriteLiteral("<form"); WriteLiteral(" method=\"POST\""); WriteLiteral(" id=\"PostForm\""); WriteLiteral(" class=\"tk-dataform form-horizontal p5 mb15\""); WriteLiteral(" role=\"form\""); WriteLiteral(">\r\n <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1406), Tuple.Create("\"", 1427) , Tuple.Create(Tuple.Create("", 1411), Tuple.Create <System.Object, System.Int32>(table.TableName , 1411), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1428), Tuple.Create("\"", 1513) , Tuple.Create(Tuple.Create("", 1436), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable", "column" + table.ColumnCount.ToString()) , 1436), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"p10\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in fields) { string fieldString = RenderFieldItem(dataRow, field); string value = dataRow.GetString(field.NickName); if (fieldString != null) { Write(fieldString); } else { if (ignoreEmptyField && string.IsNullOrEmpty(value)) { continue; } WriteLiteral(" <div"); WriteAttribute("class", Tuple.Create(" class=\"", 2121), Tuple.Create("\"", 2191) , Tuple.Create(Tuple.Create("", 2129), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column", field.LayoutClass(), "pt10") , 2129), false) ); WriteLiteral(">\r\n <dl>\r\n <dt>"); Write(field.DisplayName); WriteLiteral("</dt>\r\n <dd>\r\n <span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(field.Detail(dataRow, showHint, false)); WriteLiteral("\r\n </span>\r\n </dd>\r\n " + " </dl>\r\n </div>\r\n"); } } WriteLiteral(" </div>\r\n </div>\r\n</form>\r\n"); Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons")); }
public override void Execute() { Tk5NormalTableData table = ViewBag.MetaData.Table; IEnumerable <Tk5FieldInfoEx> list = table.TableList; ObjectContainer receiver = Model.Object; WriteLiteral("\r\n"); WriteLiteral("<!DOCTYPE html>\r\n<html>\r\n<head>\r\n <title>"); Write(ViewBag.Title); WriteLiteral("</title>\r\n <meta"); WriteLiteral(" http-equiv=\"X-UA-Compatible\""); WriteLiteral(" content=\"IE=edge\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" http-equiv=\"Content-Type\""); WriteLiteral(" content=\"text/html; charset=utf-8\""); WriteLiteral(" />\r\n <meta"); WriteLiteral(" name=\"viewport\""); WriteLiteral(" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable" + "=0;\""); WriteLiteral(" />\r\n <link"); WriteLiteral(" rel=\"stylesheet\""); WriteLiteral(" type=\"text/css\""); WriteAttribute("href", Tuple.Create(" href=\"", 917), Tuple.Create("\"", 990) , Tuple.Create(Tuple.Create("", 924), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/bootstrap/css/bootstrap.min.css".AppVirutalPath() , 924), false) ); WriteLiteral(" />\r\n <link"); WriteLiteral(" rel=\"stylesheet\""); WriteLiteral(" type=\"text/css\""); WriteAttribute("href", Tuple.Create(" href=\"", 1038), Tuple.Create("\"", 1097) , Tuple.Create(Tuple.Create("", 1045), Tuple.Create <System.Object, System.Int32>("usercss/UserManager/signin.css".AppVirutalPath() , 1045), false) ); WriteLiteral(" />\r\n</head>\r\n<body"); WriteLiteral(" data-webPath=\""); Write(HtmlUtil.AppVirtualPath); WriteLiteral("\""); WriteLiteral(" id=\"WebInsertXmlPage\""); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"container-fluid\""); WriteLiteral(">\r\n <form"); WriteLiteral(" action=\".\""); WriteLiteral(" class=\"form-signin\""); WriteLiteral(" role=\"form\""); WriteLiteral(" id=\"PostForm\""); WriteLiteral(" data-post=\""); Write(GetJson(table)); WriteLiteral("\""); WriteLiteral(" >\r\n <h2"); WriteLiteral(" class=\"form-signin-heading\""); WriteLiteral(">请登录系统</h2>\r\n <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1391), Tuple.Create("\"", 1412) , Tuple.Create(Tuple.Create("", 1396), Tuple.Create <System.Object, System.Int32>(table.TableName , 1396), false) ); WriteLiteral(" class=\"tk-datatable table-row\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in list) { WriteLiteral(" <div"); WriteLiteral(" class=\"form-group\""); WriteLiteral(">\r\n <span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(field.Control(receiver, null, true)); WriteLiteral("\r\n </span>\r\n </div>\r\n"); } WriteLiteral(" </div>\r\n <button"); WriteLiteral(" class=\"btn btn-lg btn-primary btn-block btn-submit\""); WriteLiteral(">登录</button>\r\n </form>\r\n </div>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 1934), Tuple.Create("\"", 1999) , Tuple.Create(Tuple.Create("", 1940), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/lib/jquery-1.11.1.min.js".AppVirutalPath() , 1940), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2046), Tuple.Create("\"", 2116) , Tuple.Create(Tuple.Create("", 2052), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/bootstrap/js/bootstrap.min.js".AppVirutalPath() , 2052), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2163), Tuple.Create("\"", 2222) , Tuple.Create(Tuple.Create("", 2169), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/toolkit.js".AppVirutalPath() , 2169), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2269), Tuple.Create("\"", 2339) , Tuple.Create(Tuple.Create("", 2275), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.page.js".AppVirutalPath() , 2275), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2386), Tuple.Create("\"", 2460) , Tuple.Create(Tuple.Create("", 2392), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.data.js?v=5".AppVirutalPath() , 2392), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2507), Tuple.Create("\"", 2575) , Tuple.Create(Tuple.Create("", 2513), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.ui.js".AppVirutalPath() , 2513), false) ); WriteLiteral("></script>\r\n <script"); WriteLiteral(" type=\"text/javascript\""); WriteAttribute("src", Tuple.Create(" src=\"", 2622), Tuple.Create("\"", 2692) , Tuple.Create(Tuple.Create("", 2628), Tuple.Create <System.Object, System.Int32>("toolkitjs/v5/toolkit/coreT/toolkit.edit.js".AppVirutalPath() , 2628), false) ); WriteLiteral("> </script>\r\n</body>\r\n</html>\r\n"); }
public override void Execute() { NormalEditData pageData = ViewBag.PageData; HtmlAttribute attribute = pageData.DialogMode ? new HtmlAttribute("data-dialog-action", "close") : new HtmlAttribute("data-url", HtmlUtil.GetDynamicRetUrl(Model.CallerInfo)); HtmlAttribute retAttr = new HtmlAttribute("data-action", "return"); bool showCaption = pageData.ShowCaption; string dataClass = showCaption ? string.Empty : "class=\"nocaption\""; WriteLiteral("\r\n"); DefineSection("DefaultButtons", () => { WriteLiteral("\r\n <div"); WriteLiteral(" class=\"text-center\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(BootcssUtil.Button(pageData.SaveButtonCaption, "btn-submit", BootcssButton.Primary, false)); WriteLiteral("\r\n"); WriteLiteral(" "); Write(BootcssUtil.Button(pageData.CancelCaption, "m10", BootcssButton.Default, false, attribute, retAttr)); WriteLiteral("\r\n </div>\r\n"); }); EditObjectModel model = Model as EditObjectModel; ObjectContainer mainObject = model.Object;// HtmlUtil.GetMainObject(Model, ViewBag); Tk5NormalTableData table = ViewBag.MetaData.Table; List <Tk5FieldInfoEx> hiddenFields = table.HiddenList; List <Tk5FieldInfoEx> normalFields = table.TableList; WriteLiteral("\r\n<form"); WriteAttribute("action", Tuple.Create(" action=\"", 1510), Tuple.Create("\"", 1547) , Tuple.Create(Tuple.Create("", 1519), Tuple.Create <System.Object, System.Int32>(ViewBag.PageData.FormAction , 1519), false) ); WriteLiteral(" method=\"POST\""); WriteLiteral(" id=\"PostForm\""); WriteLiteral(" class=\"tk-dataform form-horizontal p5 mb15\""); WriteLiteral(" role=\"form\""); WriteLiteral(" data-check=\"true\""); WriteLiteral(" data-post=\""); Write(GetJson(table)); WriteLiteral("\""); WriteLiteral(">\r\n <div"); WriteAttribute("id", Tuple.Create(" id=\"", 1689), Tuple.Create("\"", 1710) , Tuple.Create(Tuple.Create("", 1694), Tuple.Create <System.Object, System.Int32>(table.TableName , 1694), false) ); WriteAttribute("class", Tuple.Create(" class=\"", 1711), Tuple.Create("\"", 1806) , Tuple.Create(Tuple.Create("", 1719), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-datatable table-row", "column" + table.ColumnCount.ToString()) , 1719), false) ); WriteLiteral(">\r\n <div"); WriteLiteral(" class=\"hide\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in hiddenFields) { Write(RenderHidden(mainObject, field, true)); } WriteLiteral(" </div>\r\n <div"); WriteLiteral(" class=\"p10 w100p\""); WriteLiteral(">\r\n"); foreach (Tk5FieldInfoEx field in normalFields) { string fieldString = RenderFieldItem(mainObject, field); if (fieldString != null) { Write(fieldString); } else { WriteLiteral(" <div"); WriteAttribute("class", Tuple.Create(" class=\"", 2399), Tuple.Create("\"", 2472) , Tuple.Create(Tuple.Create("", 2407), Tuple.Create <System.Object, System.Int32>(HtmlUtil.MergeClass("tk-column form-group", field.LayoutClass()) , 2407), false) ); WriteLiteral(">\r\n <dl "); Write(dataClass); WriteLiteral(">\r\n"); if (showCaption) { WriteLiteral(" <dt>"); Write(field.DisplayName); WriteLiteral("</dt>\r\n"); } WriteLiteral(" <dd>\r\n <span"); WriteLiteral(" class=\"tk-control\""); WriteLiteral(">\r\n"); WriteLiteral(" "); Write(field.Control(mainObject, model.CodeTables, true)); WriteLiteral("\r\n </span>\r\n </dd>\r\n " + " </dl>\r\n </div>\r\n"); } } WriteLiteral(" </div>\r\n </div>\r\n</form>\r\n"); Write(RenderSectionOrDefault("ModuleButtons", "DefaultButtons")); WriteLiteral("\r\n"); }