step4.html.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <div id='mainContent' class='main-content'>
  2. <div class="display-content">
  3. <div class="cell">
  4. <div class='panel panel-position panel-padding'>
  5. <div class='panel-heading'>
  6. <div class='panel-title ptitle'>
  7. <?php echo $pivot->name;?>
  8. <?php if(common::hasPriv('pivot', 'export')):?>
  9. <a href="#" class="btn btn-link design-export pull-right hidden" data-toggle="modal" data-target="#export"><?php echo '<i class="icon-export muted"> </i>' . $lang->export;?></a>
  10. <?php endif;?>
  11. </div>
  12. </div>
  13. <div class="panel-body">
  14. <div id="datagridSpanExample4" class="datagrid">
  15. <div class='panel-body clear-padding clear-overflow'>
  16. <div id='filterContent' class='filterContent'>
  17. <div id="filterItems"></div>
  18. <div id='queryButton4' class='queryButton'>
  19. <button type="button" onclick='queryFilter()' class="btn btn-secondary save-step"><?php echo $lang->pivot->query;?></button>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="config-content" id="sidebar">
  29. <div class="cell">
  30. <div class='panel'>
  31. <div class='panel-heading border-bottom lang-heading'>
  32. <div class='panel-title'>
  33. <?php echo $lang->pivot->legendBasicInfo;?>
  34. <div class="pull-right lang-set">
  35. <?php echo html::commonButton($lang->pivot->setLang, "data-toggle='modal' data-name='{$lang->pivot->setLang}' data-target='#setLang'", 'btn btn-info add-filter')?>
  36. </div>
  37. </div>
  38. </div>
  39. <div class=''>
  40. <div class='basic-padding'>
  41. <div class='tabs clear-padding'>
  42. <div class='tab-content'>
  43. <div class='tab-pane active' id='legendBasicInfo'>
  44. <form method="post" class="form-ajax" id="releaseForm">
  45. <table class="table table-form">
  46. <tbody>
  47. <tr>
  48. <th class='basic-width basic-thpadding'><?php echo $lang->pivot->group;?></th>
  49. <td>
  50. <?php echo html::select('group[]', $groups, $pivot->group, "class='chosen form-control' data-max_drop_width='200' onchange='basicChange(\"group\", this)' multiple");?>
  51. </td>
  52. </tr>
  53. <tr>
  54. <th class='basic-width basic-thpadding'><?php echo $lang->pivot->name;?></th>
  55. <td class='w-400px required'>
  56. <?php $clientLang = $this->app->getClientLang();?>
  57. <?php echo html::input("name[$clientLang]", zget($pivot->names, $clientLang, ''), "class='form-control' data-lang='{$clientLang}' onchange='basicChange(\"names\", this)'");?>
  58. </td>
  59. </tr>
  60. <tr>
  61. <th class='basic-width basic-thpadding'><?php echo $lang->pivot->desc;?></th>
  62. <td><?php echo html::textarea("desc[$clientLang]", zget($pivot->descs, $clientLang, ''), "rows='7' class='form-control' data-lang='{$clientLang}' onchange='basicChange(\"descs\", this)'");?></td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. </form>
  67. </div>
  68. <div class='tab-pane' id='legendConfig'>
  69. <table class="table table-data">
  70. <tbody>
  71. </tbody>
  72. </table>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class='panel pull-bottom'>
  80. <div class='panel-heading'>
  81. <div class='panel-footer'>
  82. <?php echo '<button type="button" class="btn btn-primary btn-publish" onclick="publish()">' . $lang->pivot->publish . '</button>';?>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <template id='queryFilterItemTpl'>
  90. <div class='filter-item filter-item-{index} input-group' data-index='{index}'>
  91. <span class='field-name input-group-addon'>{name}</span>
  92. <div class="default-block hidden"><?php echo html::input('default', '', "class='form-control form-input '")?></div>
  93. <div class="default-block hidden"><?php echo html::input('default', '', "class='form-control form-date '")?></div>
  94. <div class="default-block hidden"><?php echo html::input('default', '', "class='form-control form-datetime '")?></div>
  95. <div class="default-block hidden"><?php echo html::select('default', '', '', "class='form-control form-select multiple'");?></div>
  96. </div>
  97. </template>
  98. <div class="modal fade" id='setLang'>
  99. <div class="modal-dialog">
  100. <div class="modal-content">
  101. <div class="modal-header">
  102. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button>
  103. <h2 class="modal-title"><?php echo $lang->pivot->setLang;?></h2>
  104. </div>
  105. <div class="modal-body">
  106. <table class="table table-form">
  107. <tr>
  108. <th><?php echo $lang->pivot->name;?></th>
  109. <td>
  110. <ul class='nav nav-tabs'>
  111. <?php $clientLang = $this->app->getClientLang();?>
  112. <?php foreach($config->langs as $langKey => $currentLang):?>
  113. <?php $active = $langKey == $clientLang ? 'active' : ''?>
  114. <li class='<?php echo $active;?>'><?php echo html::a('#name_'. str_replace('-', '_', $langKey), $currentLang, '', "data-toggle='tab'");?></li>
  115. <?php endforeach;?>
  116. </ul>
  117. <div class='tab-content'>
  118. <?php foreach($config->langs as $langKey => $currentLang):?>
  119. <?php $active = $langKey == $clientLang ? 'active' : ''?>
  120. <div class='tab-pane <?php echo $active?>' id='name_<?php echo str_replace('-', '_', $langKey);?>'>
  121. <?php echo html::input("name[$langKey]", zget($pivot->names, $langKey, ''), "id='name{$langKey}' data-lang='{$langKey}' class='form-control'");?>
  122. </div>
  123. <?php endforeach;?>
  124. </div>
  125. <div id='name'></div>
  126. </td>
  127. </tr>
  128. <tr>
  129. <th><?php echo $lang->pivot->desc;?></th>
  130. <td>
  131. <ul class='nav nav-tabs'>
  132. <?php $clientLang = $this->app->getClientLang();?>
  133. <?php foreach($config->langs as $langKey => $currentLang):?>
  134. <?php $active = $langKey == $clientLang ? 'active' : ''?>
  135. <li class='<?php echo $active;?>'><?php echo html::a('#desc_'. str_replace('-', '_', $langKey), $currentLang, '', "data-toggle='tab'");?></li>
  136. <?php endforeach;?>
  137. </ul>
  138. <div class='tab-content'>
  139. <?php foreach($config->langs as $langKey => $currentLang):?>
  140. <?php $active = $langKey == $clientLang ? 'active' : ''?>
  141. <div class='tab-pane <?php echo $active?>' id='desc_<?php echo str_replace('-', '_', $langKey);?>'>
  142. <?php echo html::textarea("desc[$langKey]", zget($pivot->descs, $langKey, ''), "id='desc{$langKey}' data-lang='{$langKey}' rows='5' class='form-control'");?>
  143. </div>
  144. <?php endforeach;?>
  145. </div>
  146. <div id='desc'></div>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td colspan='2' class='form-actions text-center'>
  151. <?php echo html::commonButton($lang->save, "id='saveLang'", 'btn btn-primary');?>
  152. </td>
  153. </tr>
  154. </table>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <script>
  160. function basicChange(field, obj)
  161. {
  162. var pivot = DataStorage.clone('pivot');
  163. if(!pivot['names']) pivot['names'] = {};
  164. if(!pivot['descs']) pivot['descs'] = {};
  165. if(pivot)
  166. {
  167. if(field == 'group')
  168. {
  169. pivot[field] = '';
  170. if($('#legendBasicInfo [name^=group]').val()) pivot[field] = $('#legendBasicInfo [name^=group]').val().join(',');
  171. }
  172. else
  173. {
  174. var lang = $(obj).data('lang');
  175. pivot[field][lang] = $(obj).val();
  176. }
  177. }
  178. DataStorage.pivot = pivot;
  179. }
  180. $('#setLang').on('show.zui.modal', function()
  181. {
  182. initData();
  183. $('#saveLang').click(function()
  184. {
  185. $('#setLang').modal('hide');
  186. })
  187. });
  188. function initData()
  189. {
  190. var pivot = DataStorage.clone('pivot');
  191. $('input[name^=name]').each(function()
  192. {
  193. var lang = $(this).data('lang');
  194. if(pivot['names']) $(this).val(pivot['names'][lang]);
  195. });
  196. $('textarea[name^=desc]').each(function()
  197. {
  198. var lang = $(this).data('lang');
  199. if(pivot['descs']) $(this).val(pivot['descs'][lang]);
  200. });
  201. }
  202. $('#setLang').on('hide.zui.modal', function()
  203. {
  204. var pivot = DataStorage.clone('pivot');
  205. if(!pivot['names']) pivot['names'] = {};
  206. if(!pivot['descs']) pivot['descs'] = {};
  207. $('#setLang input[name^=name]').each(function()
  208. {
  209. var lang = $(this).data('lang');
  210. pivot['names'][lang] = $(this).val();
  211. });
  212. $('#setLang textarea[name^=desc]').each(function()
  213. {
  214. var lang = $(this).data('lang');
  215. pivot['descs'][lang] = $(this).val();
  216. });
  217. DataStorage.pivot = pivot;
  218. initData();
  219. });
  220. </script>