Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.
 All Data Structures Functions Variables Pages
TaskModalEditView.php
1 <?php
2  /*********************************************************************************
3  * Zurmo is a customer relationship management program developed by
4  * Zurmo, Inc. Copyright (C) 2017 Zurmo Inc.
5  *
6  * Zurmo is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Affero General Public License version 3 as published by the
8  * Free Software Foundation with the addition of the following permission added
9  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10  * IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
11  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
12  *
13  * Zurmo is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Affero General Public License along with
19  * this program; if not, see http://www.gnu.org/licenses or write to the Free
20  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA.
22  *
23  * You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
24  * Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
25  *
26  * The interactive user interfaces in original and modified versions
27  * of this program must display Appropriate Legal Notices, as required under
28  * Section 5 of the GNU Affero General Public License version 3.
29  *
30  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31  * these Appropriate Legal Notices must retain the display of the Zurmo
32  * logo and Zurmo copyright notice. If the display of the logo is not reasonably
33  * feasible for technical reasons, the Appropriate Legal Notices must display the words
34  * "Copyright Zurmo Inc. 2017. All rights reserved".
35  ********************************************************************************/
40  {
44  public static function getDefaultMetadata()
45  {
46  $metadata = array(
47  'global' => array(
48  'toolbar' => array(
49  'elements' => array(
50  array('type' => 'SaveButton'),
51  array('type' => 'ModalCancelLink',
52  'htmlOptions' => 'eval:static::resolveHtmlOptionsForCancel()'
53  )
54  ),
55  ),
56  'derivedAttributeTypes' => array(
57  'TasksForModalActivityItems',
58  'DerivedExplicitReadWriteModelPermissions',
59  ),
60  'nonPlaceableAttributeNames' => array(
61  'latestDateTime',
62  'completed',
63  'completedDateTime'
64  ),
65  'panelsDisplayType' => FormLayout::PANELS_DISPLAY_TYPE_FIRST,
66  'panels' => array(
67  array(
68  'rows' => array(
69  array('cells' =>
70  array(
71  array(
72  'elements' => array(
73  array('attributeName' => 'name', 'type' => 'Text'),
74  ),
75  ),
76  )
77  ),
78  array('cells' =>
79  array(
80  array(
81  'elements' => array(
82  array('attributeName' => 'description', 'type' => 'TextArea'),
83  ),
84  ),
85  )
86  ),
87  ),
88  ),
89  array(
90  'rows' => array(
91  array('cells' =>
92  array(
93  array(
94  'elements' => array(
95  array('attributeName' => 'status', 'type' => 'TaskStatusDropDown'),
96  ),
97  ),
98  )
99  ),
100  array('cells' =>
101  array(
102  array(
103  'elements' => array(
104  array('attributeName' => 'requestedByUser', 'type' => 'User'),
105  ),
106  ),
107  )
108  ),
109  array('cells' =>
110  array(
111  array(
112  'elements' => array(
113  array('attributeName' => 'owner', 'type' => 'User'),
114  ),
115  ),
116  )
117  ),
118  array('cells' =>
119  array(
120  array(
121  'elements' => array(
122  array('attributeName' => 'dueDateTime', 'type' => 'DateTime'),
123  ),
124  ),
125  )
126  ),
127  array('cells' =>
128  array(
129  array(
130  'elements' => array(
131  array('attributeName' => 'null', 'type' => 'TasksForModalActivityItems'),
132  ),
133  ),
134  )
135  ),
136  array('cells' =>
137  array(
138  array(
139  'elements' => array(
140  array('attributeName' => 'project', 'type' => 'Project'),
141  ),
142  ),
143  )
144  ),
145  array('cells' =>
146  array(
147  array(
148  'elements' => array(
149  array('attributeName' => 'null',
150  'type' => 'DerivedExplicitReadWriteModelPermissions'),
151  ),
152  ),
153  )
154  ),
155  ),
156  ),
157  ),
158  ),
159  );
160  return $metadata;
161  }
162 
166  protected function getNewModelTitleLabel()
167  {
168  return null;
169  }
170 
174  protected static function getFormId()
175  {
176  return 'task-modal-edit-form';
177  }
178 
182  protected static function resolveHtmlOptionsForCancel()
183  {
184  return array(
185  'onclick' => '$("#ModalView").parent().dialog("close");'
186  );
187  }
188 
189  protected function resolveModalIdFromGet()
190  {
191  $modalId = Yii::app()->request->getParam('modalId');
192  if ($modalId == null)
193  {
194  $modalId = TasksUtil::getModalContainerId();
195  }
196  return $modalId;
197  }
198 
204  {
205  //Would be used from kanban board
206  $sourceKanbanBoardId = Yii::app()->request->getParam('sourceKanbanBoardId');
207 
208  //Would be used from other source
209  $sourceId = Yii::app()->request->getParam('sourceId');
210  $modalId = $this->resolveModalIdFromGet();
211  $relationModelId = Yii::app()->request->getParam('relationModelId');
212  $copyAction = Yii::app()->request->getParam('action', null);
213  $action = TasksUtil::resolveModalSaveActionNameForByRelationModelId($relationModelId, $copyAction);
214  $url = Yii::app()->createUrl('tasks/default/' . $action, GetUtil::getData());
215  // Begin Not Coding Standard
216  return array('enableAjaxValidation' => true,
217  'clientOptions' => array(
218  'beforeValidate' => 'js:$(this).beforeValidateAction',
219  'afterValidate' => 'js:function(form, data, hasError){
220  if(hasError)
221  {
222  form.find(".attachLoading:first").removeClass("loading");
223  form.find(".attachLoading:first").removeClass("loading-ajax-submit");
224  }
225  else
226  {
227  ' . $this->renderConfigSaveAjax($this->getFormId(), $url, $sourceKanbanBoardId, $modalId, $sourceId) . '
228  }
229  return false;
230  }',
231  'validateOnSubmit' => true,
232  'validateOnChange' => false,
233  'inputContainer' => 'td'
234  )
235  );
236  // End Not Coding Standard
237  }
238 
239  protected function renderConfigSaveAjax($formId, $url, $sourceKanbanBoardId, $modalId, $sourceId)
240  {
241  // Begin Not Coding Standard
242  if ($sourceId == null)
243  {
244  $kanbanRefreshScript = TasksUtil::resolveExtraCloseScriptForModalAjaxOptions($sourceKanbanBoardId);
245  }
246  else
247  {
248  $kanbanRefreshScript = TasksUtil::resolveExtraCloseScriptForModalAjaxOptions($sourceId);
249  }
251  // Begin Not Coding Standard
252  $options = array(
253  'type' => 'POST',
254  'data' => 'js:$("#' . $formId . '").serialize()',
255  'url' => $url,
256  'update' => '#' . $modalId,
257  'complete' => "function(XMLHttpRequest, textStatus){
258  $('#" . $modalId . "').dialog('option', 'title', '" . $title . "');
259  " . $kanbanRefreshScript . "}"
260  );
261  // End Not Coding Standard
262  return ZurmoHtml::ajax($options);
263  }
264 
265  protected function renderRightSideFormLayoutForEdit($form)
266  {
267  return null;
268  }
269 
270  public static function getDesignerRulesType()
271  {
272  return 'TaskModalEditView';
273  }
274 
278  protected function resolveElementInformationDuringFormLayoutRender(& $elementInformation)
279  {
280  parent::resolveElementInformationDuringFormLayoutRender($elementInformation);
281  if ($elementInformation['attributeName'] == 'description')
282  {
283  $elementInformation['rows'] = 2;
284  }
285  }
286 
291  protected function getFormLayoutUniqueId()
292  {
293  return 'task-modal-edit-form-layout';
294  }
295  }
296 ?>
static getModalContainerId()
Definition: TasksUtil.php:127
static resolveHtmlOptionsForCancel()
resolveElementInformationDuringFormLayoutRender(&$elementInformation)
static resolveModalSaveActionNameForByRelationModelId($relationModelId, $copyAction=null)
Definition: TasksUtil.php:639
static getModalDetailsTitle()
Definition: TasksUtil.php:71
Generated on Fri Jul 10 2020 07:10:35
Account Suspended
Account Suspended
This Account has been suspended.
Contact your hosting provider for more information.