update.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>数据编辑器</title>
  6. <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
  7. <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
  8. <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
  9. <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
  10. <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
  11. <script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
  12. <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor-1.2.2.min')#}"></script>
  13. <script type="text/javascript" src="{#helper\globals::getJs('xheditor/xheditor_lang/zh-cn')#}"></script>
  14. <script>
  15. $(document).ready(function(){
  16. $("#modifyForm").submit(function()
  17. {
  18. $.post($(this).attr('action'), $(this).serialize(), function(r)
  19. {
  20. if(r == null)
  21. {
  22. $.notify("系统错误,请重试", "error");
  23. };
  24. console.log(r);
  25. if(typeof r.code != 'undefined' && r.code == 0)
  26. {
  27. $.notify("保存成功", "success");
  28. }
  29. else
  30. {
  31. $.notify("保存失败", "error");
  32. }
  33. }, 'json');
  34. return false;
  35. });
  36. });
  37. </script>
  38. </head>
  39. <body>
  40. <div class="place">
  41. <span>位置:</span>
  42. <ul class="placeul">
  43. <li><a href="{#$pathes.index#}">首页</a></li>
  44. <li><a href="{#$pathes.creator#}?database={#$database#}&tableName={#$tableName#}">规则管理</a></li>
  45. <li><a href="{#$pathes.table#}?database={#$database#}&tableName={#$tableName#}">数据管理</a></li>
  46. <li>数据编辑</li>
  47. </ul>
  48. </div>
  49. <div class="formbody">
  50. <div class="formtitle"><span>基本信息</span></div>
  51. <form name="modifyForm" id="modifyForm" method="POST" action="{#helper\globals::getFullUrl("api/database/update", ".json")#}?isAjax=1">
  52. {#helper\globals::safeForm()#}
  53. <input type="hidden" name="__database" value="{#$database#}" id="__database" />
  54. <input type="hidden" name="__tableName" value="{#$tableName#}" id="__tableName" />
  55. <input type="hidden" name="__pri" value="{#$pri|join:","#}" id="__pri" />
  56. {#foreach key=key item=item from=$val#}
  57. <input type="hidden" name="{#$key#}" value="{#$item#}" />
  58. {#/foreach#}
  59. <ul class="forminfo">
  60. {#foreach key=key item=item from=$data#}
  61. <li><label>{#if isset($rules['rules']['alias'][$key]) && $rules['rules']['alias'][$key] != ''#}{#$rules['rules']['alias'][$key]#}{#else#}{#$key#}{#/if#}</label>
  62. {#if isset($rules['rules']['type'][$key]) && ($rules['rules']['type'][$key] == 'mediumtext' || $rules['rules']['type'][$key] == 'text')#}
  63. <textarea name="fields[{#$key#}]" cols="100" rows="20" class="textinput overflow-auto {#if helper\globals::hasHtmlTag($item)#}xheditor{#/if#}">{#$item#}</textarea>
  64. {#else if isset($rules['rules']['type'][$key]) && $rules['rules']['type'][$key] == 'enum'#}
  65. <div class="vocation">
  66. <select class="select1" name="fields[{#$key#}]" id="fields[{#$key#}]">
  67. {#foreach key=set item=sitem from=$rules['rules']['setsArray'][$key]#}
  68. <option value="{#$sitem#}" {#if $item == $sitem#}selected{#/if#}>{#$sitem#}</option>
  69. {#/foreach#}
  70. </select>
  71. </div>
  72. {#else#}
  73. <input name="fields[{#$key#}]" type="text" class="dfinput" value="{#$item#}" />
  74. {#/if#}
  75. <i>{#if isset($rules['rules']['length'][$key]) && $rules['rules']['length'][$key] > 0 #}最大长度{#$rules['rules']['length'][$key]#}个字符{#else#}{#/if#}</i></li>
  76. {#/foreach#}
  77. <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" value="确认保存"/></li>
  78. </ul>
  79. </form>
  80. </div>
  81. <script>
  82. $('.xheditor').xheditor({skin:'nostyle'});
  83. $(".select1").uedSelect({
  84. width : 345
  85. });
  86. </script>
  87. </body>
  88. </html>