From a27971d7ab3d39c3974a4f748ef2e7e56cba9795 Mon Sep 17 00:00:00 2001 From: Surya Saha Date: Tue, 13 Jan 2015 19:59:17 -0500 Subject: [PATCH] make SOL100 lines on organism detail page funcational again. --- js/CXGN/Page/Form/JSFormPage.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/js/CXGN/Page/Form/JSFormPage.js b/js/CXGN/Page/Form/JSFormPage.js index 6c100765e..89a47b0ac 100644 --- a/js/CXGN/Page/Form/JSFormPage.js +++ b/js/CXGN/Page/Form/JSFormPage.js @@ -84,10 +84,18 @@ CXGN.Page.Form.JSFormPage.prototype = { url: this.getAjaxScript(), data: editableForm.serialize(true) , success: function(response) { - var x = eval("("+response+")"); + var x; + if ( (typeof response=='string')) { // && (response.charAt(0)=="{") ) { + x = eval("("+response+")"); + } + else { + x = response; //x = eval("("+response+")"); + } + if (x.error) { alert(x.error); - } else if (x.refering_page) { window.location = x.refering_page ; } + } + else if (x.refering_page) { window.location = x.refering_page ; } else if (x.html) { document.getElementById(form.getFormId() ).innerHTML = x.html + form.getFormButtons(); } else { form.printForm("view"); } }, @@ -117,16 +125,22 @@ CXGN.Page.Form.JSFormPage.prototype = { alert("Cannot print from without a objectName, action, and ajaxScript name ! "); } else if (action == 'delete') { this.printDeleteDialog(); - }else { - - //var x = jQuery.parseJSON( json ); - + } + else { jQuery.ajax({ url: this.getAjaxScript(), method: "get", data: { 'object_id': this.getObjectId(), 'action': action }, success: function(response) { - var x = eval("("+response+")"); + var x; + + if ( (typeof response=='string')) { // && (response.charAt(0)=="(") ) { + x = eval("("+response+")"); + } + if (( typeof response=='object')) { + x = eval(response); + } + if (x.login) { window.location = '/solpeople/login.pl' ; x.error = undef; -- 2.11.4.GIT