SyncCode I3 ajax.js

From MWWiki

Jump to: navigation, search

Back to WordPress Synchronizer

/**
 * Upon completion of querying the "remote" blog via XMLRPC, this method is invoked
 * for cleanup purposes, as well as to invoke the next method in the synchronization
 * process, which is querying the "local" blog via the same mechanism.
 */
function grabRemoteAjax(response) {
  var targetDiv = document.getElementById('datacontent');
 
  // post the message that indicates the NEXT step to occur (XMLRPC with "local")
  targetDiv.innerHTML += response;
  ajaxMain('grabLocal');
}
 
/**
 * Once the local blog has also been queried via XMLRPC, this method performs cleanup
 * as well as invokes the merge function, which will determine the list of entries
 * necessary to bridge the entry discrepancy between the two blogs.
 */
function grabLocalAjax(response) {
  var targetDiv = document.getElementById('datacontent');
 
  // post the messages that indicates the NEXT step to occur (entry merging)
  targetDiv.innerHTML += response + 'Collecting entries between ID values...<br />';
  ajaxMain('merge');
}
 
/**
 * This method is called once the merge is complete, and this simply resets the form
 * to its previous state, so pressing the "Start" button again will repeat the 
 * entire process that concludes here.
 */
function mergeAjax(response) {
  var targetDiv = document.getElementById('datacontent');
  targetDiv.innerHTML += response;
  var cleanup = document.getElementById('startbtn');
  cleanup.href = "javascript:ajaxMain('grabRemote');";
  cleanup.innerHTML = "<b>Begin</b>";
}