fix for json and some other bugs

This commit is contained in:
Harry Bomrah 2012-11-22 16:31:37 +08:00
parent e453cfce9c
commit 90fd9de5a8
3 changed files with 36 additions and 24 deletions

View File

@ -1,5 +1,6 @@
orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ // this init journal papers
this.initializeJournalPapers.formCallback = function(data){
if(data.success){
o.notify(data.msg,"success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}else{

View File

@ -2,8 +2,10 @@
//harry
//Inititialize function will initialize desktop
//callback-method will be called after desktop controlled ajax call;
//callback-method will be called after desktop controlled ajax call
//container=true is the area where the view will be loaded
//load = true is used to load the list element by default
//response-type = "json"|"script"|"xml|html" default is json
$.extend($.expr[':'], {
@ -101,10 +103,10 @@ var orbitDesktop = function(dom){
window.o[o.data_method](target,url,cache);
}
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
});
})
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]").trigger("click"));
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
cache = true;
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
@ -135,13 +137,22 @@ var orbitDesktop = function(dom){
$("body").on("submit","form[form-type=ajax_form]",function(){
var callback_method = $(this).attr("callback-method");
var dt = null;
dt = $(this).attr("response-type");
if(dt == null){
dt = "json";
}
var options = {
dataType : dt,
success:function(responseText, statusText, xhr, $form){
if(typeof callback_method != "undefined"){
if(callback_method != ""){
window.o[o.data_method][callback_method](responseText,statusText,xhr,$form);
}
}
},
error:function(){
o.notify("Please try again later!","imp");
}
}
$(this).ajaxSubmit(options);

View File

@ -2,7 +2,7 @@ defaults: &defaults
host: localhost
# slaves:
# - host: slave1.local
port: 37017
port: 27017
# - host: slave2.local
# port: 27019