Show
Ignore:
Timestamp:
08/21/10 20:31:41 (21 months ago)
Author:
ort
Message:

Избавляемся от использования JsHttpRequest? и отдаем ответы в формате JSON

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/templates/skin/new/actions/ActionBlog/invited.tpl

    r831 r996  
    3535                                                        $('blog_admin_user_add').set('value',''); 
    3636                                                         
    37                                         JsHttpRequest.query( 
    38                                                'POST '+aRouter['blog']+'ajaxaddbloginvite/',                       
    39                                                 { users: sUsers, idBlog: idBlog, security_ls_key: LIVESTREET_SECURITY_KEY }, 
    40                                                 function(result, errors) {      
    41                                                     if (!result) { 
    42                                                                         msgErrorBox.alert('Error','Please try again later');          
    43                                                                         }     
    44                                                                         if (result.bStateError) { 
    45                                                                         msgErrorBox.alert(result.sMsgTitle,result.sMsg); 
    46                                                                         } else { 
    47                                                                                 var aUsers = result.aUsers; 
    48                                                                                 aUsers.each(function(item,index) {  
    49                                                                                         if(item.bStateError){ 
    50                                                                                                 msgErrorBox.alert(item.sMsgTitle, item.sMsg); 
    51                                                                                         } else { 
    52                                                                                         addUserItem(item.sUserLogin,item.sUserWebPath); 
    53                                                                                         } 
    54                                                                                 }); 
    55                                                                         }                                  
    56                                                 }, 
    57                                                 true 
    58                                         );                                                       
     37                                                        new Request.JSON({ 
     38                                                                url: aRouter['blog']+'ajaxaddbloginvite/', 
     39                                                                noCache: true, 
     40                                                                data: { users: sUsers, idBlog: idBlog, security_ls_key: LIVESTREET_SECURITY_KEY }, 
     41                                                                onSuccess: function(result){ 
     42                                                                        if (!result) { 
     43                                                                                msgErrorBox.alert('Error','Please try again later'); 
     44                                                                        } 
     45                                                                        if (result.bStateError) { 
     46                                                                                msgErrorBox.alert(result.sMsgTitle,result.sMsg); 
     47                                                                        } else { 
     48                                                                                var aUsers = result.aUsers; 
     49                                                                                aUsers.each(function(item,index) { 
     50                                                                                        if(item.bStateError){ 
     51                                                                                                msgErrorBox.alert(item.sMsgTitle, item.sMsg); 
     52                                                                                        } else { 
     53                                                                                                addUserItem(item.sUserLogin,item.sUserWebPath); 
     54                                                                                        } 
     55                                                                                }); 
     56                                                                        } 
     57                                                                }, 
     58                                                                onFailure: function(){ 
     59                                                                        msgErrorBox.alert('Error','Please try again later'); 
     60                                                                } 
     61                                                        }).send(); 
     62                                                                                         
    5963                                                        return false; 
    6064                                                } 
     65                                                 
    6166                                                function reBlogInvite(idUser,idBlog) { 
    62                                         JsHttpRequest.query( 
    63                                                'POST '+aRouter['blog']+'ajaxrebloginvite/',                       
    64                                                 { idUser: idUser, idBlog: idBlog, security_ls_key: LIVESTREET_SECURITY_KEY }, 
    65                                                 function(result, errors) {      
    66                                                     if (!result) { 
    67                                                                         msgErrorBox.alert('Error','Please try again later');          
    68                                                                         }     
    69                                                                         if (result.bStateError) { 
    70                                                                         msgErrorBox.alert(result.sMsgTitle,result.sMsg); 
    71                                                                         } else { 
    72                                                                                 msgNoticeBox.alert(result.sMsgTitle, result.sMsg); 
    73                                                                         }                                  
    74                                                 }, 
    75                                                 true 
    76                                         );                                                       
     67                                                         
     68                                                        new Request.JSON({ 
     69                                                                url: aRouter['blog']+'ajaxrebloginvite/', 
     70                                                                noCache: true, 
     71                                                                data: { idUser: idUser, idBlog: idBlog, security_ls_key: LIVESTREET_SECURITY_KEY }, 
     72                                                                onSuccess: function(result){ 
     73                                                                        if (!result) { 
     74                                                                                msgErrorBox.alert('Error','Please try again later'); 
     75                                                                        } 
     76                                                                        if (result.bStateError) { 
     77                                                                                msgErrorBox.alert(result.sMsgTitle,result.sMsg); 
     78                                                                        } else { 
     79                                                                                msgNoticeBox.alert(result.sMsgTitle, result.sMsg); 
     80                                                                        } 
     81                                                                }, 
     82                                                                onFailure: function(){ 
     83                                                                        msgErrorBox.alert('Error','Please try again later'); 
     84                                                                } 
     85                                                        }).send(); 
    7786                                                        return false; 
    7887                                                }