includes/clientside/sbedit.js
changeset 407 35d94240a197
parent 365 cc6bf4d63684
child 885 a86a69394a95
equal deleted inserted replaced
406:7468a663315f 407:35d94240a197
     2 function ajaxDisenableBlock(id)
     2 function ajaxDisenableBlock(id)
     3 {
     3 {
     4   disenable_currentBlock = document.getElementById('disabled_'+id);
     4   disenable_currentBlock = document.getElementById('disabled_'+id);
     5   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id='+id), function()
     5   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=disenable&ajax=true&noheaders&id='+id), function()
     6     {
     6     {
     7       if(ajax.readyState == 4)
     7       if ( ajax.readyState == 4 && ajax.status == 200 )
     8       {
     8       {
     9         if(ajax.responseText == 'GOOD')
     9         if(ajax.responseText == 'GOOD')
    10         {
    10         {
    11           if(disenable_currentBlock.style.display == 'none')
    11           if(disenable_currentBlock.style.display == 'none')
    12           {
    12           {
    29 function ajaxDeleteBlock(id, oElm)
    29 function ajaxDeleteBlock(id, oElm)
    30 {
    30 {
    31   delete_currentBlock = { 0 : id, 1 : oElm };
    31   delete_currentBlock = { 0 : id, 1 : oElm };
    32   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=delete&ajax=true&noheaders&id='+id), function()
    32   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=delete&ajax=true&noheaders&id='+id), function()
    33     {
    33     {
    34       if(ajax.readyState == 4)
    34       if ( ajax.readyState == 4 && ajax.status == 200 )
    35       {
    35       {
    36         if(ajax.responseText == 'GOOD')
    36         if(ajax.responseText == 'GOOD')
    37         {
    37         {
    38           e = delete_currentBlock[1];
    38           e = delete_currentBlock[1];
    39           e = e.parentNode.parentNode;
    39           e = e.parentNode.parentNode;
    51 function ajaxEditBlock(id, oElm)
    51 function ajaxEditBlock(id, oElm)
    52 {
    52 {
    53   blockEdit_current = { 0 : id, 1 : oElm };
    53   blockEdit_current = { 0 : id, 1 : oElm };
    54   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=getsource&noheaders&id='+id), function()
    54   ajaxGet(makeUrlNS('Special', 'EditSidebar', 'action=getsource&noheaders&id='+id), function()
    55     {
    55     {
    56       if(ajax.readyState == 4)
    56       if ( ajax.readyState == 4 && ajax.status == 200 )
    57       {
    57       {
    58         id = blockEdit_current[0];
    58         id = blockEdit_current[0];
    59         oElm = blockEdit_current[1];
    59         oElm = blockEdit_current[1];
    60         var thediv = document.createElement('div');
    60         var thediv = document.createElement('div');
    61         //if(!oElm.id) oElm.id = 'autoEditButton_'+Math.floor(Math.random() * 100000);
    61         //if(!oElm.id) oElm.id = 'autoEditButton_'+Math.floor(Math.random() * 100000);
    98   taContent = taContent.replace(unescape('%0A'), '%0A');
    98   taContent = taContent.replace(unescape('%0A'), '%0A');
    99   taContent = taContent.replace('+', '%2B');
    99   taContent = taContent.replace('+', '%2B');
   100   blockSave_current = { 0 : id, 1 : oElm };
   100   blockSave_current = { 0 : id, 1 : oElm };
   101   ajaxPost(makeUrlNS('Special', 'EditSidebar', 'noheaders&action=save&id='+id), 'content='+taContent, function()
   101   ajaxPost(makeUrlNS('Special', 'EditSidebar', 'noheaders&action=save&id='+id), 'content='+taContent, function()
   102     {
   102     {
   103       if(ajax.readyState == 4)
   103       if ( ajax.readyState == 4 && ajax.status == 200 )
   104       {
   104       {
   105         id   = blockSave_current[0];
   105         id   = blockSave_current[0];
   106         oElm = blockSave_current[1];
   106         oElm = blockSave_current[1];
   107         eval(ajax.responseText);
   107         eval(ajax.responseText);
   108         if(status == 'GOOD')
   108         if(status == 'GOOD')
   170   img.src = scriptPath + '/images/loading.gif';
   170   img.src = scriptPath + '/images/loading.gif';
   171   parent.appendChild(img);
   171   parent.appendChild(img);
   172   newname = ajaxEscape(newname);
   172   newname = ajaxEscape(newname);
   173   ajaxPost(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), 'newname=' +newname, function()
   173   ajaxPost(makeUrlNS('Special', 'EditSidebar', 'ajax&noheaders&action=rename&id='+id), 'newname=' +newname, function()
   174     {
   174     {
   175       if ( ajax.readyState == 4 )
   175       if ( ajax.readyState == 4 && ajax.status == 200 )
   176       {
   176       {
   177         parent.removeChild(img);
   177         parent.removeChild(img);
   178         if ( ajax.responseText != 'GOOD' )
   178         if ( ajax.responseText != 'GOOD' )
   179           new messagebox(MB_OK|MB_ICONSTOP, 'Error renaming block', ajax.responseText);
   179           new messagebox(MB_OK|MB_ICONSTOP, 'Error renaming block', ajax.responseText);
   180       }
   180       }