protected function registerScripts() { parent::registerScripts(); $script = ' $(".remove-dynamic-row-link.' . TimeTriggerForWorkflowForm::getType() . '").live("click", function() { $(this).parent().remove(); $("#ByTimeWorkflowWizardForm_timeTriggerAttribute").val(""); $(".NoTimeTrigger").show(); $("#time-trigger-container").hide(); return false; }); '; Yii::app()->getClientScript()->registerScript('TimeTriggerForWorkflowComponentScript', $script); }
/** * Register scripts needed for this view */ public function registerScripts() { parent::registerScripts(); $this->registerActionTypeDropDownOnChangeScript(); $this->registerActionTypeRelationDropDownOnChangeScript(); $this->registerActionTypeRelatedModelRelationDropDownOnChangeScript(); $this->registerAddActionScript(); $this->registerRemoveActionScript(); $this->registerTypeChangeScript(); $this->registerRowEditScript(); }
/** * @param integer $rowCount * @param Array $emailMessages * @return array */ protected function renderEmailMessages(&$rowCount, $emailMessages) { assert('is_int($rowCount)'); assert('is_array($emailMessages)'); $items = array(); foreach ($emailMessages as $emailMessage) { $inputPrefixData = array(get_class($this->model), ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES, (int) $rowCount); $rowCounterInputId = ComponentForWorkflowWizardView::resolveRowCounterInputId(ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES); $view = new EmailMessageRowForWorkflowComponentView($emailMessage, $rowCount, $inputPrefixData, $this->form, get_class($this->model), $rowCounterInputId); $view->addWrapper = false; $items[] = array('content' => $view->render()); $rowCount++; } return $items; }
public function actionAddEmailMessage($moduleClassName, $type, $rowNumber) { $form = new WizardActiveForm(); $form->id = WorkflowWizardView::getFormId(); $form->enableAjaxValidation = true; //ensures error validation populates correctly $rowCounterInputId = ComponentForWorkflowWizardView::resolveRowCounterInputId(ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES); $wizardFormClassName = WorkflowToWizardFormAdapter::getFormClassNameByType($type); $model = ComponentForWorkflowFormFactory::makeByComponentType($moduleClassName, $moduleClassName::getPrimaryModelName(), $type, ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES); $inputPrefixData = array($wizardFormClassName, ComponentForWorkflowForm::TYPE_EMAIL_MESSAGES, (int) $rowNumber); $form->setInputPrefixData($inputPrefixData); $view = new EmailMessageRowForWorkflowComponentView($model, (int) $rowNumber, $inputPrefixData, $form, WorkflowToWizardFormAdapter::getFormClassNameByType($type), $rowCounterInputId); $content = $view->render(); $form->renderAddAttributeErrorSettingsScript($view::getFormId()); Yii::app()->getClientScript()->setToAjaxMode(); Yii::app()->getClientScript()->render($content); echo $content; }
protected function registerScripts() { parent::registerScripts(); $script = ' $(".droppable-dynamic-rows-container.' . static::getTreeType() . '").live("drop", function(event, ui) { ' . $this->getAjaxForDroppedAttribute() . ' }); $(".item-to-place", "#' . static::getTreeType() . 'TreeArea").live("dblclick", function(event) { ' . $this->getAjaxForDoubleClickedAttribute() . ' }); $(".remove-dynamic-row-link.' . static::getTreeType() . '").live("click", function() { size = $(this).parent().parent().parent().find("li").size(); $(this).parent().parent().remove(); //removes the <li> if (size < 2) { $(".' . static::getZeroComponentsClassName() . '").show(); } ' . $this->getWorkflowAttributeRowAddOrRemoveExtraScript() . ' return false; }); '; Yii::app()->getClientScript()->registerScript(static::getTreeType() . 'WorkflowComponentForTreeScript', $script); }