diff --git a/module/api/control.php b/module/api/control.php index 0bfb2eae9e..b6b7e883ec 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -577,8 +577,8 @@ class api extends control $this->action->create('api', $api->id, 'Created'); - if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); - return $this->sendSuccess(array('locate' => helper::createLink('api', 'index', "libID={$api->lib}&moduleID=0&apiID={$api->id}"))); + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => 'true', 'callback' => "parentLocate({$api->id})")); + return $this->sendSuccess(array('locate' => helper::createLink('api', 'index', "libID={$api->lib}&moduleID={$api->module}&apiID={$api->id}"))); } $libs = $this->doc->getLibs('api', '', $libID); diff --git a/module/api/js/create.js b/module/api/js/create.js index 8d0e441826..0ec3979d61 100644 --- a/module/api/js/create.js +++ b/module/api/js/create.js @@ -84,3 +84,17 @@ var app = new Vue({ } } }) + +/** + * locate link in parent. + * + * @param int $apiID + * @access public + * @return void + */ +function parentLocate(apiID) +{ + config.onlybody = 'no'; + var link = createLink('api', 'index', 'libID=0&moduleID=0&apiID=' + apiID) + '#app=doc'; + window.parent.$.apps.open(link); +} diff --git a/module/doc/js/selectlibtype.js b/module/doc/js/selectlibtype.js index c35c113429..152ca82038 100644 --- a/module/doc/js/selectlibtype.js +++ b/module/doc/js/selectlibtype.js @@ -9,7 +9,7 @@ */ function redirectParentWindow(objectType, libID, moduleID, docType) { - if(objectType == 'api') + if(docType == 'api') { parent.$.closeModal(function() { diff --git a/www/js/jquery/form/zentao.js b/www/js/jquery/form/zentao.js index 34249373ec..0f8a8c0fdd 100644 --- a/www/js/jquery/form/zentao.js +++ b/www/js/jquery/form/zentao.js @@ -3,8 +3,8 @@ $.extend( { ajaxForm: function(formID, callback) { - form = $(formID); - var options = + form = $(formID); + var options = { target : null, timeout : config.timeout, @@ -111,7 +111,7 @@ $.extend( } /** - * The response.result is fail. + * The response.result is fail. */ /* The result.message is just a string. */ @@ -138,7 +138,7 @@ $.extend( errorMSG += ''; /* Append error message, set style and set the focus events. */ - $('#' + errorLabel).remove(); + $('#' + errorLabel).remove(); var isInputGroup = $(errorOBJ).closest('.input-group').size(); var $showOBJ = isInputGroup ? $(errorOBJ).closest('.input-group').parent() : $(errorOBJ).parent(); $showOBJ.append(errorMSG); @@ -153,7 +153,7 @@ $.extend( if(!triggered[i]) { $(this).removeAttr('style') - $('#' + errorLabel).remove(); + $('#' + errorLabel).remove(); triggered[i] = true; } }); @@ -164,7 +164,7 @@ $.extend( if(!triggered[i]) { $(this).removeAttr('style') - $('#' + errorLabel).remove(); + $('#' + errorLabel).remove(); triggered[i] = true; } }); @@ -187,7 +187,7 @@ $.extend( /* Call ajaxSubmit to sumit the form. */ form.submit(function() - { + { $(this).trigger('clearplaceholder'); $(this).ajaxSubmit(options); return false; // Prevent the submitting event of the browser. @@ -199,7 +199,7 @@ $.extend( { $(formID).find(':submit').attr('disabled', true); }, - + /* Enable a form. */ enableForm:function(formID) {