/***********************************************************
Copyright (C) 2000-2002 PIRONET NDH AG, Germany
Author: Konstantin Breu, PIRONET NDH
$Id: qecustomfunctions.js,v 1.1.2.3 2002/09/26 10:11:44 kbreu Exp $
verändert durch: Heiko Oesterling 1=0 2=1

This is an example for integration of project fields into quickedit mode.
For using it, you have to assure that you are using quickedit mode via
the jspinclude/quickedit/quickedit.jsp implementation, and that 
you have modified the project fields you want to use (in the example below
PROJECT_TEXT_0 and PROJECT_TEXT1). This JScript file has to be included
into the templates which contain the quickedit integration, this can be
the navigation template and the content template - it depends on the structure
of your page layout and quickedit integration.

The functions here are called from functions implemented in
<WebServerRoot>/quickedit/quickeditcontrol.js and
<PBBS_Presentation>/meta/jspinclude/quickedit/quickedit.jsp

Please look to those files for getting more information about the tasks
of the functions.

This examples displays PROJECT_TEXT_0 and PROJECT_TEXT_1 as single line
text fields.
************************************************************/

function qeCustomizedCodeBuildHiddenForm() {
   return '<INPUT TYPE="HIDDEN" NAME="PROJECT_TEXT_0" VALUE="">'+
          '<INPUT TYPE="HIDDEN" NAME="PROJECT_TEXT_1" VALUE="">'+
          '<INPUT TYPE="HIDDEN" NAME="PROJECT_TEXT_2" VALUE="">';
}


function qeCustomizedMetaDataCopyFromVisibleFormToHiddenForm(contentWindow, spnMetaData) {
    contentWindow.SAVETOPBFORM.PROJECT_TEXT_0.value = spnMetaData.all["qePbPROJECT_TEXT_0"].value;
    contentWindow.SAVETOPBFORM.PROJECT_TEXT_1.value = spnMetaData.all["qePbPROJECT_TEXT_1"].value;
    contentWindow.SAVETOPBFORM.PROJECT_TEXT_2.value = spnMetaData.all["qePbPROJECT_TEXT_2"].value;
}


function qeCustomizedMetaDataCopyFromHiddenFormToVisibleForm(contentWindow, spnMetaData) {
    spnMetaData.all["qePbPROJECT_TEXT_0"].value = contentWindow.SAVETOPBFORM.PROJECT_TEXT_0.value;
    spnMetaData.all["qePbPROJECT_TEXT_1"].value = contentWindow.SAVETOPBFORM.PROJECT_TEXT_1.value;
    spnMetaData.all["qePbPROJECT_TEXT_2"].value = contentWindow.SAVETOPBFORM.PROJECT_TEXT_2.value;
}


function qeCustomizedMetaDataCreateVisibleForm() {
   return '<tr class="qeCustomClassMetaProjectText1"><td style="color: windowtext">' +qeContactPerson+ ' *</td><td valign="top" width="99%"><input type="text" id="qePbPROJECT_TEXT_0" name="qePbPROJECT_TEXT_0" value="" style="width: 100%;"></td></tr>'+
		  '<tr class="qeCustomClassMetaProjectText2"><td style="color: windowtext"><nobr>' +qeContactPersonEmail+ ' *</nobr></td><td valign="top" width="99%"><input type="text" id="qePbPROJECT_TEXT_1" name="qePbPROJECT_TEXT_1" value="" style="width: 100%;"></td></tr>'+
          '<tr class="qeCustomClassMetaProjectText3"><td style="color: windowtext">'+qeAuthor+ ' *</td><td valign="top" width="99%"><input type="text" id="qePbPROJECT_TEXT_2" name="qePbPROJECT_TEXT_2" value="" style="width: 100%;"></td></tr>'+
          '<tr class="qeCustomClassMetaProjectText3"><td style="color: windowtext">* = optional</td><td valign="top" width="99%">&nbsp;</td></tr>';
}

function qeCustomizedMetaDataGetObjectFromXMLData(qeUseOrigMetaData, root, id, languageid) {
  var obj = new Object();
  if(qeUseOrigMetaData) {
    try {
      obj["PROJECT_TEXT_0"] = root.getElementsByTagName("PROJECT_TEXT_0")[0].text;
    }
    catch(except) {
      obj["PROJECT_TEXT_0"] = "";
    }

    try {
      obj["PROJECT_TEXT_1"] = root.getElementsByTagName("PROJECT_TEXT_1")[0].text;
    }
    catch(except) {
      obj["PROJECT_TEXT_1"] = "";
    }
    
    try {
      obj["PROJECT_TEXT_2"] = root.getElementsByTagName("PROJECT_TEXT_2")[0].text;
    }
    catch(except) {
      obj["PROJECT_TEXT_2"] = "";
    }
  }
  else {
    obj["PROJECT_TEXT_0"] = "";
    obj["PROJECT_TEXT_1"] = "";
    obj["PROJECT_TEXT_2"] = "";
  }
  return obj;
}


function qeCustomizedMetaDataFillHiddenFormWithData(contentWindow, customFields) {
  contentWindow.SAVETOPBFORM.PROJECT_TEXT_0.value = customFields["PROJECT_TEXT_0"];
  contentWindow.SAVETOPBFORM.PROJECT_TEXT_1.value = customFields["PROJECT_TEXT_1"];
  contentWindow.SAVETOPBFORM.PROJECT_TEXT_2.value = customFields["PROJECT_TEXT_2"];
}

