+2008-01-11 Oliver Hader <oh@inpublica.de>
+
+ * (feature) Added feature #7124: Add some more functionality to new AJAX interface in the TYPO3 back-end
+
2008-01-10 Benjamin Mack <mack@xnos.org>
* (feature) Added #7096: Consistent interface for AJAX calls in the TYPO3 Backend
'compactFlexFormXML' => 0, // If set, the flexform XML will not contain indentation spaces making XML more compact
'elementVersioningOnly' => FALSE, // If true, only element versioning is allowed in the backend. This is recommended for new installations of TYPO3 4.2+ since "page" and "branch" versioning types are known for the drawbacks of loosing ids and "element" type versions supports moving now.
'AJAX' => array( // array of key-value pairs for a unified use of AJAX calls in the TYPO3 backend. Keys are the unique ajaxIDs where the value will be resolved to call a method in an object. See ajax.php and the classes/class.typo3ajax.php for more information.
- 'pagetree_ExpandCollapse' => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
- 'foldertree_ExpandCollapse' => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse',
+ 'SC_alt_db_navframe::expandCollapse' => 'typo3/alt_db_navframe.php:SC_alt_db_navframe->ajaxExpandCollapse',
+ 'SC_alt_file_navframe::expandCollapse' => 'typo3/alt_file_navframe.php:SC_alt_file_navframe->ajaxExpandCollapse',
),
),
'FE' => Array( // Configuration for the TypoScript frontend (FE). Nothing here relates to the administration backend!
* Makes the AJAX call to expand or collapse the pagetree.
* Called by typo3/ajax.php
*
- * @param array additional parameters (not used here)
- * @param object the TYPO3AJAX object of this request
+ * @param array $params: additional parameters (not used here)
+ * @param TYPO3AJAX &$ajaxObj: reference of the TYPO3AJAX object of this request
+ * @return void
*/
public function ajaxExpandCollapse($params, &$ajaxObj) {
global $LANG;
($this->currentSubScript?'top.currentSubScript=unescape("'.rawurlencode($this->currentSubScript).'");':'').'
// setting prefs for foldertree
- Tree.ajaxID = "foldertree_ExpandCollapse";
+ Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
// Function, loading the list frame from navigation tree:
function jumpTo(id, linkObj, highlightID, bank) {
* Makes the AJAX call to expand or collapse the foldertree.
* Called by typo3/ajax.php
*
- * @param array additional parameters (not used here)
- * @param object the TYPO3AJAX object of this request
+ * @param array $params: additional parameters (not used here)
+ * @param TYPO3AJAX &$ajaxObj: reference of the TYPO3AJAX object of this request
+ * @return void
*/
public function ajaxExpandCollapse($params, &$ajaxObj) {
global $LANG;
}
+ /**
+ * overwrites the existing content with the first parameter
+ *
+ * @param array the new content
+ * @return mixed the old content as array; if the new content was not an array, false is returned
+ */
+ public function setContent($content) {
+ $oldcontent = false;
+ if (is_array($content)) {
+ $oldcontent = $this->content;
+ $this->content = $content;
+ }
+ return $oldcontent;
+ }
+
+
/**
* adds new content
*
* @param string the new content key where the content should be added in the content array
* @param string the new content to add
- * @return string the old content
+ * @return mixed the old content; if the old content didn't exist before, false is returned
*/
public function addContent($key, $content) {
- $oldcontent = '';
+ $oldcontent = false;
if (array_key_exists($key, $this->content)) {
$oldcontent = $this->content[$key];
}
- if (!$content) {
+ if (!isset($content) || !strlen($content)) {
unset($this->content[$key]);
+ } elseif (!isset($key) || !strlen($key)) {
+ $this->content[] = $content;
} else {
$this->content[$key] = $content;
}
* @return void
*/
public function setContentFormat($format) {
- if (t3lib_div::inArray(array('plain', 'xml', 'json'), $format)) {
+ if (t3lib_div::inArray(array('plain', 'xml', 'json', 'jsonhead', 'jsonbody'), $format)) {
$this->contentFormat = $format;
}
}
var Tree = {
thisScript: 'ajax.php',
- ajaxID: 'pagetree_ExpandCollapse', // has to be either "pagetree_ExpandCollapse" or "foldertree_ExpandCollapse"
+ ajaxID: 'SC_alt_db_navframe::expandCollapse', // has to be either "SC_alt_db_navframe::expandCollapse" or "SC_alt_file_navframe::expandCollapse"
frameSetModule: null,
activateDragDrop: true,
highlightClass: 'active',