|
/**
|
|
* Function imported from class.tslib_content.php
|
|
* unescape replaced by decodeURIComponent
|
|
*
|
|
* Returns a JavaScript <script> section with some function calls to JavaScript functions from "t3lib/jsfunc.updateform.js" (which is also included by setting a reference in $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'])
|
|
* The JavaScript codes simply transfers content into form fields of a form which is probably used for editing information by frontend users. Used by fe_adminLib.inc.
|
|
*
|
|
* @param array Data array which values to load into the form fields from $formName (only field names found in $fieldList)
|
|
* @param string The form name
|
|
* @param string A prefix for the data array
|
|
* @param string The list of fields which are loaded
|
|
* @return string
|
|
* @access private
|
|
* @see user_feAdmin::displayCreateScreen()
|
|
*/
|
|
function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) {
|
|
$JSPart='';
|
|
$updateValues=t3lib_div::trimExplode(',',$fieldList);
|
|
while(list(,$fKey)=each($updateValues)) {
|
|
$value = $dataArray[$fKey];
|
|
if (is_array($value)) {
|
|
reset($value);
|
|
while(list(,$Nvalue)=each($value)) {
|
|
$JSPart.="
|
|
if (window.decodeURIComponent) { unesc = decodeURIComponent('".rawurlencode($Nvalue)."') } else { unesc = unescape('".rawurlencode($Nvalue)."') };
|
|
updateForm('".$formName."','".$arrPrefix."[".$fKey."]',unesc);";
|
|
}
|
|
|
|
} else {
|
|
$JSPart.="
|
|
if (window.decodeURIComponent) { unesc = decodeURIComponent('".rawurlencode($value)."') } else { unesc = unescape('".rawurlencode($value)."') };
|
|
updateForm('".$formName."','".$arrPrefix."[".$fKey."]',unesc);";
|
|
}
|
|
}
|
|
$JSPart='<script type="text/javascript">
|
|
/*<![CDATA[*/ '.$JSPart.'
|
|
/*]]>*/
|
|
</script>
|
|
';
|
|
$GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate']='<script type="text/javascript" src="'.$GLOBALS['TSFE']->absRefPrefix.'t3lib/jsfunc.updateform.js"></script>';
|
|
return $JSPart;
|
|
}
|