create.html.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?php
  2. /**
  3. * The create view file of workflowhook module of ZDOO.
  4. *
  5. * @copyright Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
  6. * @license 商业软件,非开源软件
  7. * @author Gang Liu <liugang@cnezsoft.com>
  8. * @package workflowhook
  9. * @version $Id$
  10. * @link http://www.zdoo.com
  11. */
  12. ?>
  13. <?php include '../../common/view/header.modal.html.php';?>
  14. <?php include '../../common/view/picker.html.php';?>
  15. <?php js::set('formulaLang', $lang->workflowfield->formula);?>
  16. <?php js::set('moduleName', $flow->module);?>
  17. <form id='createHookForm' class='hookForm' method='post' action='<?php echo inlink('create', "action=$action->id");?>'>
  18. <?php include './expression.html.php';?>
  19. <div id='conditionDIV' class='detail hide'>
  20. <div class='detail-heading'>
  21. <strong><?php echo $lang->workflowhook->condition;?></strong>
  22. </div>
  23. <div class='detail-content'>
  24. <table class='table table-form'>
  25. <tr>
  26. <th class='w-80px'></th>
  27. <td class='w-160px'></td>
  28. <td class='w-80px'></td>
  29. <td class='w-160px'></td>
  30. <td></td>
  31. <td class='w-120px'></td>
  32. </tr>
  33. <tr>
  34. <th><?php echo $lang->workflowhook->type;?></th>
  35. <td colspan='4'><?php echo html::select('conditionType', $lang->workflowhook->typeList, 'data', "class='form-control'");?></td>
  36. <td></td>
  37. </tr>
  38. <?php /* SQL TR */ ?>
  39. <?php $sqlConditionDatasources = $datasources;?>
  40. <?php unset($sqlConditionDatasources['formula']);?>
  41. <tr class='sqlTR'>
  42. <th><?php echo $lang->workflowhook->sql;?></th>
  43. <td colspan='4' class='required'><?php echo html::textarea('sql', '', "rows='5' class='form-control' placeholder='{$lang->workflowhook->placeholder->sql}'");?></td>
  44. <td></td>
  45. </tr>
  46. <tr class='sqlTR' data-key='1'>
  47. <th><?php echo $lang->workflowhook->varName;?></th>
  48. <td><?php echo html::input('varName[1]', '', "class='form-control' autocomplete='off'");?></td>
  49. <td><?php echo html::input('operator[1]', '=', "class='form-control' disabled");?></td>
  50. <td><?php echo html::select('paramType[1]', $sqlConditionDatasources, 'custom', "class='form-control chosen'");?></td>
  51. <td class='paramTD'><?php echo html::input('param[1]', '', "id='param1' class='form-control' autocomplete='off'");?></td>
  52. <td>
  53. <a href='javascript:;' class='btn addVar'><i class='icon-plus'></i></a>
  54. <a href='javascript:;' class='btn delVar'><i class='icon-close'></i></a>
  55. </td>
  56. </tr>
  57. <tr class='sqlTR'>
  58. <th><?php echo $lang->workflowhook->result;?></th>
  59. <td colspan='4'><?php echo html::select('sqlResult', $lang->workflowhook->resultList, 'empty', "class='form-control'");?></td>
  60. <td></td>
  61. </tr>
  62. <?php /* Data TR */ ?>
  63. <?php $dataConditionDatasources = $datasources;?>
  64. <?php unset($dataConditionDatasources['form']);?>
  65. <?php unset($dataConditionDatasources['record']);?>
  66. <?php unset($dataConditionDatasources['formula']);?>
  67. <tr class='dataTR' data-key='1'>
  68. <th>
  69. <?php echo $lang->workflowhook->field;?>
  70. <?php echo html::hidden("conditions[logicalOperator][1]", 'and');?>
  71. </th>
  72. <td><?php echo html::select('conditions[field][1]', $fields, '', "class='form-control chosen'");?></td>
  73. <td><?php echo html::select('conditions[operator][1]', $config->workflowhook->operatorList, 'equal', "class='form-control chosen'");?></td>
  74. <td><?php echo html::select('conditions[paramType][1]', $dataConditionDatasources, 'custom', "class='form-control chosen'");?></td>
  75. <td class='paramTD'><?php echo html::input('conditions[param][1]', '', "id='conditionsparam1' class='form-control' autocomplete='off'");?></td>
  76. <td>
  77. <a href='javascript:;' class='btn addCondition'><i class='icon-plus'></i></a>
  78. </td>
  79. </tr>
  80. </table>
  81. </div>
  82. </div>
  83. <div id='hookDIV' class='detail'>
  84. <div class='detail-heading'>
  85. <strong><?php echo $lang->workflowhook->hook;?></strong>
  86. </div>
  87. <div class='detail-content'>
  88. <table class='table table-form'>
  89. <tr>
  90. <th class='w-80px'><?php echo $lang->workflowhook->action;?></th>
  91. <td class='w-160px'><?php echo html::select('action', $lang->workflowhook->actionList, 'update', "class='form-control'");?></td>
  92. <th class='w-80px'><?php echo $lang->workflowhook->table;?></th>
  93. <td class='w-160px'><?php echo html::select('table', $tables, $flow->module, "class='form-control chosen'");?></td>
  94. <td></td>
  95. <td class='w-100px'></td>
  96. </tr>
  97. <?php /* Field TR */ ?>
  98. <tr class='fieldTR' data-key='1'>
  99. <th><?php echo $lang->workflowhook->field;?></th>
  100. <td><?php echo html::select('fields[field][1]', $fields, '', "class='form-control chosen field'");?></td>
  101. <td><?php echo html::input('operators[field][1]', '=', "class='form-control' disabled");?></td>
  102. <td><?php echo html::select('fields[paramType][1]', $datasources, 'custom', "class='form-control chosen'");?></td>
  103. <td class='paramTD'><?php echo html::input('fields[param][1]', '', "id='fieldsparam1' class='form-control' autocomplete='off'");?></td>
  104. <td>
  105. <a href='javascript:;' class='btn addField'><i class='icon-plus'></i></a>
  106. </td>
  107. </tr>
  108. <?php /* Where TR */ ?>
  109. <?php $whereDatasources = $datasources;?>
  110. <?php unset($whereDatasources['formula']);?>
  111. <tr class='whereTR' data-key='1'>
  112. <th>
  113. <?php echo $lang->workflowhook->where;?>
  114. <?php echo html::hidden("wheres[logicalOperator][1]", 'and');?>
  115. </th>
  116. <td><?php echo html::select('wheres[field][1]', $fields, 'id', "class='form-control chosen field'");?></td>
  117. <td><?php echo html::select('wheres[operator][1]', $config->workflowhook->operatorList, 'equal', "class='form-control chosen'");?></td>
  118. <td><?php echo html::select('wheres[paramType][1]', $whereDatasources, 'record', "class='form-control chosen'");?></td>
  119. <td class='paramTD'><?php echo html::input('wheres[param][1]', 'id', "id='wheresparam1' class='form-control paramValue' autocomplete='off'");?></td>
  120. <td>
  121. <a href='javascript:;' class='btn addWhere'><i class='icon-plus'></i></a>
  122. </td>
  123. </tr>
  124. <tr>
  125. <th><?php echo $lang->workflowhook->message;?></th>
  126. <td colspan='4'><?php echo html::input('message', '', "class='form-control' autocomplete='off'");?></td>
  127. <td></td>
  128. </tr>
  129. <tr>
  130. <th><?php echo $lang->comment;?></th>
  131. <td colspan='4'><?php echo html::textarea('comment', '', "class='form-control' rows='3'");?></td>
  132. <td></td>
  133. </tr>
  134. <tr>
  135. <th></th>
  136. <td class='form-actions' colspan='5'>
  137. <?php echo html::hidden('condition', 0);?>
  138. <?php echo baseHTML::a('javascript:;', $lang->workflowhook->condition, "class='btn btn-primary toggleCondition'");?>
  139. <?php echo html::submitButton();?>
  140. </td>
  141. </tr>
  142. </table>
  143. </div>
  144. </div>
  145. </form>
  146. <?php
  147. $varName = html::input('varName[KEY]', '', "class='form-control' autocomplete='off'");
  148. $operator = html::input('operator[KEY]', '=', "class='form-control' disabled");
  149. $paramType = html::select('paramType[KEY]', $sqlConditionDatasources, 'custom', "class='form-control chosen'");
  150. $param = html::input('param[KEY]', '', "id='paramKEY' class='form-control' autocomplete='off'");
  151. $varRow = <<<EOT
  152. <tr class='sqlTR' data-key='KEY'>
  153. <th></th>
  154. <td>{$varName}</td>
  155. <td>{$operator}</td>
  156. <td>{$paramType}</td>
  157. <td class='paramTD'>{$param}</td>
  158. <td>
  159. <a href='javascript:;' class='btn addVar'><i class='icon-plus'></i></a>
  160. <a href='javascript:;' class='btn delVar'><i class='icon-close'></i></a>
  161. </td>
  162. </tr>
  163. EOT;
  164. $logicOperater = html::select('conditions[logicalOperator][KEY]', $lang->workflowhook->logicalOperatorList, '', "class='form-control'");
  165. $field = html::select('conditions[field][KEY]', $fields, '', "class='form-control chosen'");
  166. $operator = html::select('conditions[operator][KEY]', $config->workflowhook->operatorList, 'equal', "class='form-control chosen'");
  167. $paramType = html::select('conditions[paramType][KEY]', $dataConditionDatasources, 'custom', "class='form-control chosen'");
  168. $param = html::input('conditions[param][KEY]', '', "id='conditionsparamKEY' class='form-control' autocomplete='off'");
  169. $conditionRow = <<<EOT
  170. <tr class='dataTR' data-key='KEY'>
  171. <th>{$logicOperater}</th>
  172. <td>{$field}</td>
  173. <td>{$operator}</td>
  174. <td>{$paramType}</td>
  175. <td class='paramTD'>{$param}</td>
  176. <td>
  177. <a href='javascript:;' class='btn addCondition'><i class='icon-plus'></i></a>
  178. <a href='javascript:;' class='btn delCondition'><i class='icon-close'></i></a>
  179. </td>
  180. </tr>
  181. EOT;
  182. $field = html::select('fields[field][KEY]', $fields, '', "class='form-control chosen field'");
  183. $operator = html::input('fields[operator][KEY]', '=', "class='form-control' disabled");
  184. $paramType = html::select('fields[paramType][KEY]', $datasources, 'custom', "class='form-control chosen'");
  185. $param = html::input('fields[param][KEY]', '', "id='fieldsparamKEY' class='form-control' autocomplete='off'");
  186. $fieldRow = <<<EOT
  187. <tr class='fieldTR' data-key='KEY'>
  188. <th></th>
  189. <td>{$field}</td>
  190. <td>{$operator}</td>
  191. <td>{$paramType}</td>
  192. <td class='paramTD'>{$param}</td>
  193. <td>
  194. <a href='javascript:;' class='btn addField'><i class='icon-plus'></i></a>
  195. <a href='javascript:;' class='btn delField'><i class='icon-close'></i></a>
  196. </td>
  197. </tr>
  198. EOT;
  199. $logicOperater = html::select('wheres[logicalOperator][KEY]', $lang->workflowhook->logicalOperatorList, '', "class='form-control'");
  200. $field = html::select('wheres[field][KEY]', $fields, '', "class='form-control field chosen'");
  201. $operator = html::select('wheres[operator][KEY]', $config->workflowhook->operatorList, 'equal', "class='form-control chosen'");
  202. $paramType = html::select('wheres[paramType][KEY]', $whereDatasources, 'custom', "class='form-control chosen'");
  203. $param = html::input('wheres[param][KEY]', '', "id='wheresparamKEY' class='form-control' autocomplete='off'");
  204. $whereRow = <<<EOT
  205. <tr class='whereTR' data-key='KEY'>
  206. <th>{$logicOperater}</th>
  207. <td>{$field}</td>
  208. <td>{$operator}</td>
  209. <td>{$paramType}</td>
  210. <td class='paramTD'>{$param}</td>
  211. <td>
  212. <a href='javascript:;' class='btn addWhere'><i class='icon-plus'></i></a>
  213. <a href='javascript:;' class='btn delWhere'><i class='icon-close'></i></a>
  214. </td>
  215. </tr>
  216. EOT;
  217. $recordFields = html::select('NAME', $fields, '', "class='form-control chosen'");
  218. js::set('recordFields', $recordFields);
  219. js::set('hookVarKey', 2);
  220. js::set('hookDataKey', 2);
  221. js::set('hookFieldKey', 2);
  222. js::set('hookWhereKey', 2);
  223. js::set('varRow', $varRow);
  224. js::set('conditionRow', $conditionRow);
  225. js::set('fieldRow', $fieldRow);
  226. js::set('whereRow', $whereRow);
  227. ?>
  228. <?php include '../../common/view/footer.modal.html.php';?>