includes/clientside/static/rank-manager.js
changeset 794 720516162012
parent 779 609e35845ec3
child 823 4596c40aaa94
equal deleted inserted replaced
793:c0724bf6039b 794:720516162012
   504           var response = parseJSON(ajax.responseText);
   504           var response = parseJSON(ajax.responseText);
   505         }
   505         }
   506         catch(e)
   506         catch(e)
   507         {
   507         {
   508           handle_invalid_json(ajax.responseText);
   508           handle_invalid_json(ajax.responseText);
       
   509         }
       
   510         if ( response.error )
       
   511         {
       
   512           if ( response.error == 'need_auth_to_admin' )
       
   513           {
       
   514             load_component('login');
       
   515             var rid = rank_id;
       
   516             ajaxDynamicReauth(function()
       
   517               {
       
   518                 ajaxInitRankEdit(rid);
       
   519               });
       
   520           }
       
   521           else
       
   522           {
       
   523             alert(response.error);
       
   524           }
       
   525           return false;
   509         }
   526         }
   510         var editor = new RankEditorControl(response);
   527         var editor = new RankEditorControl(response);
   511         editor.onsubmit = ajaxRankEditHandleSaveExisting;
   528         editor.onsubmit = ajaxRankEditHandleSaveExisting;
   512         editor.ondelete = ajaxRankEditHandleDelete;
   529         editor.ondelete = ajaxRankEditHandleDelete;
   513         var container = document.getElementById('admin_ranks_container_right');
   530         var container = document.getElementById('admin_ranks_container_right');
   607           }
   624           }
   608         }
   625         }
   609         else
   626         else
   610         {
   627         {
   611           whitey.parentNode.removeChild(whitey);
   628           whitey.parentNode.removeChild(whitey);
   612           miniPromptMessage({
   629           if ( response.error == 'need_auth_to_admin' )
   613               title: $lang.get('acpur_err_save_failed_title'),
   630           {
   614               message: response.error,
   631             load_component('login');
   615               buttons: [
   632             ajaxDynamicReauth(function()
   616                 {
   633               {
   617                   text: $lang.get('etc_ok'),
   634                 ajaxRankEditHandleSave(editor, switch_new);
   618                   color: 'red',
   635               });
   619                   style: {
   636           }
   620                     fontWeight: 'bold'
   637           else
   621                   },
   638           {
   622                   onclick: function()
   639             miniPromptMessage({
       
   640                 title: $lang.get('acpur_err_save_failed_title'),
       
   641                 message: response.error,
       
   642                 buttons: [
   623                   {
   643                   {
   624                     miniPromptDestroy(this);
   644                     text: $lang.get('etc_ok'),
       
   645                     color: 'red',
       
   646                     style: {
       
   647                       fontWeight: 'bold'
       
   648                     },
       
   649                     onclick: function()
       
   650                     {
       
   651                       miniPromptDestroy(this);
       
   652                     }
   625                   }
   653                   }
   626                 }
   654                 ]
   627               ]
   655             });
   628           });
   656           }
   629         }
   657         }
   630       }
   658       }
   631     }, true);
   659     }, true);
   632 }
   660 }
   633 
   661 
   731             }, 1500);
   759             }, 1500);
   732         }
   760         }
   733         else
   761         else
   734         {
   762         {
   735           whitey.parentNode.removeChild(whitey);
   763           whitey.parentNode.removeChild(whitey);
   736           miniPromptMessage({
   764           if ( response.error == 'need_auth_to_admin' )
   737               title: $lang.get('acpur_err_delete_failed_title'),
   765           {
   738               message: response.error,
   766             load_component('login');
   739               buttons: [
   767             ajaxDynamicReauth(function()
   740                 {
   768               {
   741                   text: $lang.get('etc_ok'),
   769                 ajaxRankEditDeleteConfirmed(editor);
   742                   color: 'red',
   770               });
   743                   style: {
   771           }
   744                     fontWeight: 'bold'
   772           else
   745                   },
   773           {
   746                   onclick: function()
   774             miniPromptMessage({
       
   775                 title: $lang.get('acpur_err_delete_failed_title'),
       
   776                 message: response.error,
       
   777                 buttons: [
   747                   {
   778                   {
   748                     miniPromptDestroy(this);
   779                     text: $lang.get('etc_ok'),
       
   780                     color: 'red',
       
   781                     style: {
       
   782                       fontWeight: 'bold'
       
   783                     },
       
   784                     onclick: function()
       
   785                     {
       
   786                       miniPromptDestroy(this);
       
   787                     }
   749                   }
   788                   }
   750                 }
   789                 ]
   751               ]
   790             });
   752           });
   791           }
   753         }
   792         }
   754       }
   793       }
   755     }, true);
   794     }, true);
   756 }
   795 }