setverification.html.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php
  2. /**
  3. * The set verification view file of workflowaction 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 workflowaction
  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('moduleName', $flow->module);?>
  16. <form id='ajaxForm' method='post' action='<?php echo inlink('setVerification', "id=$action->id");?>'>
  17. <table class='table table-form' id='verificationTable'>
  18. <tr>
  19. <th class='w-80px'></th>
  20. <td class='w-160px'></td>
  21. <td class='w-80px'></td>
  22. <td class='w-160px'></td>
  23. <td></td>
  24. <td class='w-120px'></td>
  25. </tr>
  26. <tr>
  27. <th><?php echo $lang->workflowverification->type;?></th>
  28. <td colspan='4'><?php echo html::select('type', $lang->workflowverification->typeList, !empty($action->verifications->type) ? $action->verifications->type : 'no', "class='form-control'");?></td>
  29. <td></td>
  30. </tr>
  31. <?php /* SQL TR */ ?>
  32. <tr class='sqlTR'>
  33. <th><?php echo $lang->workflowverification->sql;?></th>
  34. <td colspan='4' class='required'>
  35. <?php echo html::textarea('sql', !empty($action->verifications->sql) ? $action->verifications->sql : '', "rows='5' class='form-control' placeholder='{$lang->workflowverification->placeholder->sql}'");?>
  36. </td>
  37. <td></td>
  38. </tr>
  39. <?php $varKey = 1;?>
  40. <?php if(!empty($action->verifications->sqlVars)):?>
  41. <?php foreach($action->verifications->sqlVars as $sqlVar):?>
  42. <tr class='sqlTR' data-key='<?php echo $varKey;?>'>
  43. <th><?php echo $lang->workflowverification->varName;?></th>
  44. <td><?php echo html::input("varName[$varKey]", $sqlVar->varName, "class='form-control'");?></td>
  45. <th><?php echo $lang->workflowverification->varValue;?></th>
  46. <td ><?php echo html::select("paramType[$varKey]", $datasources, $sqlVar->paramType, "class='form-control chosen'");?></td>
  47. <td class='paramTD'><?php echo html::input("param[$varKey]", $sqlVar->param, "id='param{$varKey}' class='form-control paramValue'");?></td>
  48. <td>
  49. <a href='javascript:;' class='btn addVar'><i class='icon-plus icon-large'></i></a>
  50. <a href='javascript:;' class='btn delVar'><i class='icon-close icon-large'></i></a>
  51. </td>
  52. </tr>
  53. <?php $varKey++;?>
  54. <?php endforeach;?>
  55. <?php else:?>
  56. <tr class='sqlTR' data-key='<?php echo $varKey;?>'>
  57. <th><?php echo $lang->workflowverification->varName;?></th>
  58. <td><?php echo html::input("varName[$varKey]", '', "class='form-control'");?></td>
  59. <th><?php echo $lang->workflowverification->varValue;?></th>
  60. <td><?php echo html::select("paramType[$varKey]", $datasources, $action->action == 'create' ? 'form' : 'record', "class='form-control chosen'");?></td>
  61. <td class='paramTD'><?php echo html::input("param[$varKey]", '', "id='param{$varKey}' class='form-control'");?></td>
  62. <td>
  63. <a href='javascript:;' class='btn addVar'><i class='icon-plus icon-large'></i></a>
  64. <a href='javascript:;' class='btn delVar'><i class='icon-close icon-large'></i></a>
  65. </td>
  66. </tr>
  67. <?php $varKey++;?>
  68. <?php endif;?>
  69. <tr class='sqlTR'>
  70. <th><?php echo $lang->workflowverification->result;?></th>
  71. <td colspan='4'><?php echo html::select('sqlResult', $lang->workflowverification->resultList, isset($action->verifications->sqlResult) ? $action->verifications->sqlResult : 'empty', "class='form-control'");?></td>
  72. </tr>
  73. <?php /* Data TR */ ?>
  74. <?php $dataKey = 1;?>
  75. <?php $conditionDatasources = $datasources;?>
  76. <?php unset($conditionDatasources['form']);?>
  77. <?php unset($conditionDatasources['record']);?>
  78. <?php if(!empty($action->verifications->fields)):?>
  79. <?php foreach($action->verifications->fields as $key => $verification):?>
  80. <tr class='dataTR' data-key='<?php echo $dataKey;?>'>
  81. <th>
  82. <?php if($key == 0):?>
  83. <?php echo $lang->workflowverification->field;?>
  84. <?php echo html::hidden("verifications[logicalOperator][$dataKey]", $verification->logicalOperator);?>
  85. <?php else:?>
  86. <?php echo html::select("verifications[logicalOperator][$dataKey]", $lang->workflowverification->logicalOperatorList, $verification->logicalOperator, "class='form-control'");?>
  87. <?php endif;?>
  88. </th>
  89. <td><?php echo html::select("verifications[field][$dataKey]", $fields, $verification->field, "class='form-control chosen'");?></td>
  90. <td><?php echo html::select("verifications[operator][$dataKey]", $config->workflowaction->operatorList, $verification->operator, "class='form-control chosen'");?></td>
  91. <td><?php echo html::select("verifications[paramType][$dataKey]", $conditionDatasources, $verification->paramType, "class='form-control chosen'");?></td>
  92. <td class='paramTD'>
  93. <?php $param = is_array($verification->param) ? implode(',', $verification->param) : $verification->param;?>
  94. <?php echo html::input("verifications[param][$dataKey]", $verification->param, "id='verificationsparam{$dataKey}' class='form-control paramValue'");?>
  95. </td>
  96. <td>
  97. <a href='javascript:;' class='btn addVerification'><i class='icon-plus icon-large'></i></a>
  98. <?php if($key > 0):?>
  99. <a href='javascript:;' class='btn delVerification'><i class='icon-close icon-large'></i></a>
  100. <?php endif;?>
  101. </td>
  102. </tr>
  103. <?php $dataKey++;?>
  104. <?php endforeach;?>
  105. <?php else:?>
  106. <tr class='dataTR' data-key='<?php echo $dataKey;?>'>
  107. <th>
  108. <?php if(empty($action->verifications->fields)):?>
  109. <?php echo $lang->workflowverification->field;?>
  110. <?php echo html::hidden("verifications[logicalOperator][$dataKey]", 'and');?>
  111. <?php else:?>
  112. <?php echo html::select("verifications[logicalOperator][$dataKey]", $lang->workflowverification->logicalOperatorList, 'and', "class='form-control'");?>
  113. <?php endif;?>
  114. </th>
  115. <td><?php echo html::select("verifications[field][$dataKey]", $fields, '', "class='form-control chosen'");?></td>
  116. <td><?php echo html::select("verifications[operator][$dataKey]", $config->workflowaction->operatorList, 'equal', "class='form-control chosen'");?></td>
  117. <td><?php echo html::select("verifications[paramType][$dataKey]", $conditionDatasources, 'custom', "class='form-control chosen'");?></td>
  118. <td class='paramTD'><?php echo html::input("verifications[param][$dataKey]", '', "id='verificationsparam{$dataKey}' class='form-control'");?></td>
  119. <td>
  120. <a href='javascript:;' class='btn addVerification'><i class='icon-plus icon-large'></i></a>
  121. <?php if(!empty($action->verifications->fields)):?>
  122. <a href='javascript:;' class='btn delVerification'><i class='icon-close icon-large'></i></a>
  123. <?php endif;?>
  124. </td>
  125. </tr>
  126. <?php $dataKey++;?>
  127. <?php endif;?>
  128. <tr class='messageTR'>
  129. <th><?php echo $lang->workflowverification->message;?></th>
  130. <td colspan='4' class='required'>
  131. <?php echo html::input('message', isset($action->verifications->message) ? $action->verifications->message : '', "class='form-control' placeholder='{$lang->workflowverification->placeholder->message}'");?>
  132. </td>
  133. </tr>
  134. <tr>
  135. <th></th>
  136. <td class='form-actions' colspan='5'>
  137. <?php echo html::submitButton();?>
  138. </td>
  139. </tr>
  140. </table>
  141. </form>
  142. <?php
  143. $varName = html::input('varName[KEY]', '', "class='form-control'");
  144. $paramType = html::select('paramType[KEY]', $datasources, 'custom', "class='form-control chosen'");
  145. $param = html::input('param[KEY]', '', "id='paramKEY' class='form-control'");
  146. $varRow = <<<EOT
  147. <tr class='sqlTR' data-key='KEY'>
  148. <th>{$lang->workflowverification->varName}</th>
  149. <td>{$varName}</td>
  150. <th>{$lang->workflowverification->varValue}</th>
  151. <td>{$paramType}</td>
  152. <td class='paramTD'>{$param}</td>
  153. <td>
  154. <a href='javascript:;' class='btn addVar'><i class='icon-plus icon-large'></i></a>
  155. <a href='javascript:;' class='btn delVar'><i class='icon-close icon-large'></i></a>
  156. </td>
  157. </tr>
  158. EOT;
  159. $logicOperater = html::select('verifications[logicalOperator][KEY]', $lang->workflowverification->logicalOperatorList, '', "class='form-control'");
  160. $field = html::select('verifications[field][KEY]', $fields, '', "class='form-control chosen'");
  161. $operator = html::select('verifications[operator][KEY]', $config->workflowaction->operatorList, 'equal', "class='form-control chosen'");
  162. $paramType = html::select('verifications[paramType][KEY]', $conditionDatasources, 'custom', "class='form-control chosen'");
  163. $param = html::input( 'verifications[param][KEY]', '', "id='verificationparamKEY' class='form-control'");
  164. $verificationRow = <<<EOT
  165. <tr class="dataTR" data-key='KEY'>
  166. <th>{$logicOperater}</th>
  167. <td>{$field}</td>
  168. <td>{$operator}</td>
  169. <td>{$paramType}</td>
  170. <td class='paramTD'>{$param}</td>
  171. <td>
  172. <a href='javascript:;' class='btn addVerification'><i class='icon-plus icon-large'></i></a>
  173. <a href='javascript:;' class='btn delVerification'><i class='icon-close icon-large'></i></a>
  174. </td>
  175. </tr>
  176. EOT;
  177. $recordFields = html::select('NAME', $fields, '', "class='form-control chosen'");
  178. js::set('recordFields', $recordFields);
  179. js::set('verificationVarKey', $varKey);
  180. js::set('verificationDataKey', $dataKey);
  181. js::set('formFields', '');
  182. js::set('varRow', $varRow);
  183. js::set('verificationRow', $verificationRow);
  184. ?>
  185. <?php include '../../common/view/footer.modal.html.php';?>