protected static function resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model)
 {
     $canvasIFrameSelector = "#" . BuilderCanvasWizardView::CANVAS_IFRAME_ID;
     $canvasActionUrl = static::resolveCanvasActionUrl();
     $refreshCanvasLinkSelector = "#" . BuilderCanvasWizardView::REFRESH_CANVAS_FROM_SAVED_TEMPLATE_LINK_ID;
     $originalBaseTemplateIdSelector = static::resolveOriginalBaseTemplateIdHiddenInputJQuerySelector();
     $baseTemplateIdSelector = static::resolveBaseTemplateIdHiddenInputJQuerySelector();
     // Begin Not Coding Standard
     $script = "\n                                initEmailTemplateEditor();\n                                selectedBaseTemplateId  = \$('" . $baseTemplateIdSelector . "').val();\n                                originalBaseTemplateId  = \$('" . $originalBaseTemplateIdSelector . "').val();\n                                var canvasSourceUrl     = \$('" . $canvasIFrameSelector . "').attr('src');\n                                if (canvasSourceUrl == 'about:blank' || selectedBaseTemplateId != originalBaseTemplateId)\n                                {\n                                    // update canvas url\n                                    if (canvasSourceUrl == 'about:blank')\n                                    {\n                                        canvasSourceUrl     = '" . $canvasActionUrl . "';\n                                        canvasSourceUrl     = canvasSourceUrl.replace(/id=(\\d*)/, 'id=' + data.id);\n                                        \$('" . $canvasIFrameSelector . "').attr('src', canvasSourceUrl);\n                                    }\n                                    \$('" . $refreshCanvasLinkSelector . "').trigger('click');\n                                }\n                                \$('" . $originalBaseTemplateIdSelector . "').val(selectedBaseTemplateId);\n\n                                ";
     // End Not Coding Standard
     $parentScript = parent::resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model);
     $script = $script . PHP_EOL . $parentScript;
     return $script;
 }
 protected static function resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model)
 {
     $script = static::resolveHideCanvasScript();
     $parentScript = parent::resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model);
     $script = $script . PHP_EOL . $parentScript;
     return $script;
 }
 /**
  * Resolve Ajax options for when clicking apply on editable form.
  * @return array
  */
 protected function resolveAjaxPostForApplyClickAjaxOptions()
 {
     $hiddenInputId = ZurmoHtml::activeId($this->model, 'id');
     $message = Zurmo::t('EmailTemplatesModule', 'There was an error applying changes');
     $ajaxArray = ComponentForEmailTemplateWizardView::resolveErrorAjaxCallback($message);
     //$ajaxArray['cache']         = 'false'; //todo: should by default be used.
     $ajaxArray['url'] = $this->resolveFormActionUrl();
     $ajaxArray['type'] = 'POST';
     // Begin Not Coding Standard
     $ajaxArray['data'] = 'js:$("#' . $this->resolveApplyLinkId() . '").closest("form").serialize()';
     $ajaxArray['beforeSend'] = "js:function()\n                                        {\n                                            emailTemplateEditor.freezeLayoutEditor();\n                                        }";
     $ajaxArray['success'] = "js:function (html)\n                                        {\n                                            var replaceElementId        = \$('#" . $hiddenInputId . "').val();\n                                            var replaceElementInIframe  = \$('#" . BuilderCanvasWizardView::CANVAS_IFRAME_ID . "')\n                                                                            .contents().find('#' + replaceElementId).parent();\n                                            replaceElementInIframe.replaceWith(html);\n                                            " . $this->getAjaxScriptForInitSortableElements() . "\n                                            emailTemplateEditor.unfreezeLayoutEditor();\n                                            emailTemplateEditor.canvasChanged();\n                                            emailTemplateEditor.addPlaceHolderForEmptyCells();\n                                        }";
     // End Not Coding Standard
     return $ajaxArray;
 }
 protected static function resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model)
 {
     $actionId = Yii::app()->getController()->getAction()->getId();
     $templateIdSelector = static::resolveTemplateIdHiddenInputJQuerySelector($model);
     $script = "if ('create' == '" . $actionId . "')\n                                            {\n                                                //update id\n                                                \$('" . $templateIdSelector . "').val(data.id);\n                                            }\n                                            ";
     $parentScript = parent::resolveSuccessAjaxCallbackForPageTransition($formName, $nextPageClassName, $validationInputId, $progressPerStep, $stepCount, $model);
     $script = $script . PHP_EOL . $parentScript;
     return $script;
 }
 protected function registerScripts()
 {
     parent::registerScripts();
     $this->registerSetIsDraftToZeroOnSaveScript();
 }