/******************************************************************************
 *
 *                   INDIGEN SOLUTIONS CODE PROPERTY
 *       The present javascript code is property of Indigen Solutions. This 
 *     code can only be used inside Internet/Intranet web sites located on 
 *  *web servers*, as the outcome of a licensed Indigen Solutions application 
 *  only. Any unauthorized use, reverse-engineering, alteration, transmission, 
 * transformation, facsimile, or copying of any means (electronic or not) is 
 *     strictly prohibited and will be prosecuted. Removal of the present 
 *              copyright notice is strictly prohibited
 *         Copyright (c) 2004 Indigen Solutions. All Rights Reserved.
 *
 * RCS Id                       $Id: admin.js,v 1.14 2005/05/04 15:33:06 jerome Exp $
 * RCS Revision                 $Revision: 1.14 $
 * RCS Check in date            $Date: 2005/05/04 15:33:06 $
 * 
 ******************************************************************************/

/**
 * @todo
 *   rename myEditorButtons
 *   (OK) rename language
 */

/* Globals. */

var myEditorButtons = new Array();

/* Classes. */

function AdminHandlerLogging(frameid) {
  this.frame = document.getElementById(frameid);
  this.buffer = "";
  this.frameLoaded = false;
  var thisRef = this;
  this.frame.attachEvent("onload", function() {
    thisRef.frameLoaded = true;
    thisRef.frame.contentWindow.document.body.innerHTML = thisRef.buffer;
  });
  this.put = function(str) {
    this.buffer += str;
    if ( this.frameLoaded ) {
      this.frame.contentWindow.document.body.innerHTML = this.buffer;
    }
  };
}

/* Functions. */

function getObjectContentLink(objid, language) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=objectcontent&i=" + objid;
}

function getObjectWorkflowLink(objid, language) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=objectworkflow&i=" + objid;
}

function getObjectPermissionsLink(objid) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=objectpermissions&i=" + objid;
}

function getObjectControlPermissionsLink(objid) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=objpermcontrol&i=" + objid;
}

function getObjectDeleteLink(objid) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=objectdelete&i=" + objid;
}

function getPopulationContentLink(name) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=population&name=" + name;
}

function getUserContentLink(login) {
  return "m=6&h=" + myHistoryThreadid + "&l=" + myLanguage + "&x=user&login=" + login;
}

function addEditorButton(name, action, handler, test) {
  var index = myEditorButtons.length;
  myEditorButtons[index] = {index:index, name:name, action:action, handler:handler, test:test};
}
