/** * Main function, returning the HTML content of the module * * @return string HTML */ function main() { require_once(t3lib_extMgm::extPath(STATIC_INFO_TABLES_EXTkey).'class.tx_staticinfotables_encoding.php'); $tableArray = array ('static_countries', 'static_country_zones', 'static_languages', 'static_currencies'); $content = ''; $content.= '<br />Convert character encoding of the static info tables.'; $content.= '<br />The default encoding is UTF-8.'; $destEncoding = htmlspecialchars(t3lib_div::_GP('dest_encoding')); if(t3lib_div::_GP('convert') AND ($destEncoding != '')) { foreach ($tableArray as $table) { $content .= '<p>'.htmlspecialchars($table.' > '.$destEncoding).'</p>'; tx_staticinfotables_encoding::convertEncodingTable($table, 'utf-8', $destEncoding); } $content .= '<p>You must enter the charset \''.$destEncoding.'\' now manually in the EM for static_info_tables!</p>'; $content .= '<p>Done</p>'; } else { $content .= '<form name="static_info_tables_form" action="'.htmlspecialchars(t3lib_div::linkThisScript()).'" method="post">'; $linkScript = t3lib_div::slashJS(t3lib_div::linkThisScript()); $content .= '<br /><br />'; $content .= 'This conversion works only once. When you converted the tables and you want to do it again to another encoding you have to reinstall the tables with the Extension Manager or select \'UPDATE!\'.'; $content .= '<br /><br />'; $content .= 'Destination character encoding:'; $content .= '<br />'.tx_staticinfotables_encoding::getEncodingSelect('dest_encoding', '', '', $TYPO3_CONF_VARS['EXTCONF'][STATIC_INFO_TABLES_EXTkey]['charset']); $content .= '<br /><br />'; $content .= '<input type="submit" name="convert" value="Convert" onclick="this.form.action=\''.$linkScript.'\';submit();" />'; $content .= '</form>'; } return $content; }
/** * wraps the record titles in the tree with links or not depending on if they are in the TCEforms_nonSelectableItemsArray. * * @param string $title: the title * @param array $v: an array with uid and title of the current item. * @return string the wrapped title */ function wrapTitle($title, $v) { if ($v['uid'] > 0) { if (in_array($v['uid'], $this->TCEforms_nonSelectableItemsArray)) { return '<a href="#" title="' . $v['description'] . '"><span style="color:#999;cursor:default;">' . $title . '</span></a>'; } else { $hrefTitle = $v['description']; $aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\',' . $v['uid'] . ',\'' . t3lib_div::slashJS($title) . '\' ); return false;'; return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . htmlentities($v['description']) . '">' . $title . '</a>'; } } else { return $GLOBALS['LANG']->sL('LLL:EXT:ab_linklist/locallang_db.php:tx_ablinklist_categories', 1); } }
/** * wraps the record titles in the tree with links or not depending on if they are in the TCEforms_nonSelectableItemsArray. * * @param string $title: the title * @param array $v: an array with uid and title of the current item. * @return string the wrapped title */ function wrapTitle($title, $v) { if ($v['uid'] > 0) { $hrefTitle = htmlentities('[id=' . $v['uid'] . '] ' . $v['description']); if (in_array($v['uid'], $this->TCEforms_nonSelectableItemsArray) || $this->disableAll) { $style = $this->getTitleStyles($v, $hrefTitle); return '<a href="#" title="' . $hrefTitle . '"><span style="color:#999;cursor:default;' . $style . '">' . $title . '</span></a>'; } else { $aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\',' . $v['uid'] . ',\'' . t3lib_div::slashJS($title) . '\'); return false;'; $style = $this->getTitleStyles($v, $hrefTitle); return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $hrefTitle . '"><span style="' . $style . '">' . $title . '</span></a>'; } } else { if ($this->useStoragePid || isset($v['doktype'])) { $pid = $this->storagePid ? $this->storagePid : $v['pid']; $pidLbl = sprintf($GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang_tca.xml:tt_news.treeSelect.pageTitleSuffix'), $pid); } else { $pidLbl = $GLOBALS['LANG']->sL('LLL:EXT:tt_news/locallang_tca.xml:tt_news.treeSelect.pageTitleSuffixNoGrsp'); } $pidLbl = ' <span class="typo3-dimmed"><em>' . $pidLbl . '</em></span>'; return $title . $pidLbl; } }
/** * Renders an ajax-enabled text field. Also adds required JS * * @param string $fieldname The fieldname in the form * @param string $table The table we render this selector for * @param string $field The field we render this selector for * @param array $row The row which is currently edited * @param array $config The TSconfig of the field * @return string The HTML code for the selector */ public function renderSuggestSelector($fieldname, $table, $field, array $row, array $config) { $this->suggestCount++; $containerCssClass = $this->cssClass . ' ' . $this->cssClass . '-position-right'; $suggestId = 'suggest-' . $table . '-' . $field . '-' . $row['uid']; $selector = ' <div class="' . $containerCssClass . '" id="' . $suggestId . '"> <input type="text" id="' . $fieldname . 'Suggest" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord') . '" class="' . $this->cssClass . '-search" /> <div class="' . $this->cssClass . '-indicator" style="display: none;" id="' . $fieldname . 'SuggestIndicator"> <img src="' . $GLOBALS['BACK_PATH'] . 'gfx/spinner.gif" alt="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:alttext.suggestSearching') . '" /> </div> <div class="' . $this->cssClass . '-choices" style="display: none;" id="' . $fieldname . 'SuggestChoices"></div> </div>'; // get minimumCharacters from TCA if (isset($config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters'])) { $minChars = intval($config['fieldConf']['config']['wizards']['suggest']['default']['minimumCharacters']); } // overwrite it with minimumCharacters from TSConfig (TCEFORM) if given if (isset($config['fieldTSConfig']['suggest.']['default.']['minimumCharacters'])) { $minChars = intval($config['fieldTSConfig']['suggest.']['default.']['minimumCharacters']); } $minChars = $minChars > 0 ? $minChars : 2; // replace "-" with ucwords for the JS object name $jsObj = str_replace(' ', '', ucwords(str_replace('-', ' ', t3lib_div::strtolower($suggestId)))); $this->TCEformsObj->additionalJS_post[] = ' var ' . $jsObj . ' = new TCEForms.Suggest("' . $fieldname . '", "' . $table . '", "' . $field . '", "' . $row['uid'] . '", ' . $row['pid'] . ', ' . $minChars . '); ' . $jsObj . '.defaultValue = "' . t3lib_div::slashJS($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.findRecord')) . '"; '; return $selector; }
/** * This functions returns the HTML-code that creates the editor-layout of the module. * * @param [type] $theConstants: ... * @param [type] $category: ... * @return [type] ... */ function ext_printFields($theConstants, $category) { reset($theConstants); $output = '<script type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/constantEditor.js"></script> '; $subcat = ''; if (is_array($this->categories[$category])) { $help = $this->helpConfig; $this->rArr = explode(',', $this->setup['resources'] . ',' . implode($this->dirResources, ',')); if (!$this->doNotSortCategoriesBeforeMakingForm) { asort($this->categories[$category]); } foreach ($this->categories[$category] as $name => $type) { $params = $theConstants[$name]; if (is_array($params)) { if ($subcat != $params['subcat_name']) { $subcat = $params['subcat_name']; $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : 'Others'; $output .= '<h2 class="typo3-tstemplate-ceditor-subcat">' . $subcat_name . '</h2>'; } $label = $GLOBALS['LANG']->sL($params['label']); $label_parts = explode(':', $label, 2); if (count($label_parts) == 2) { $head = trim($label_parts[0]); $body = trim($label_parts[1]); } else { $head = trim($label_parts[0]); $body = ''; } if (strlen($head) > 35) { if (!$body) { $body = $head; } $head = t3lib_div::fixed_lgd_cs($head, 35); } $typeDat = $this->ext_getTypeData($params['type']); $checked = ''; $p_field = ''; $raname = substr(md5($params['name']), 0, 10); $aname = '\'' . $raname . '\''; list($fN, $fV, $params) = $this->ext_fNandV($params); switch ($typeDat['type']) { case 'int': case 'int+': $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . ' onChange="uFormUrl(' . $aname . ')" />'; if ($typeDat['paramstr']) { $p_field .= ' Range: ' . $typeDat['paramstr']; } elseif ($typeDat['type'] == 'int+') { $p_field .= ' Range: 0 - '; } else { $p_field .= ' (Integer)'; } break; case 'color': $colorNames = explode(',', ',' . $this->HTMLcolorList); $p_field = ''; foreach ($colorNames as $val) { $sel = ''; if ($val == strtolower($params['value'])) { $sel = ' selected'; } $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . '</option>'; } $p_field = '<select id="select-' . $fN . '" rel="' . $fN . '" name="C' . $fN . '" class="typo3-tstemplate-ceditor-color-select" onChange="uFormUrl(' . $aname . ');">' . $p_field . '</select>'; $p_field .= '<input type="text" id="input-' . $fN . '" rel="' . $fN . '" name="' . $fN . '" class="typo3-tstemplate-ceditor-color-input" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(7) . ' onChange="uFormUrl(' . $aname . ')" />'; break; case 'wrap': $wArr = explode('|', $fV); $p_field = '<input type="text" id="' . $fN . '" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(29) . ' onChange="uFormUrl(' . $aname . ')" />'; $p_field .= ' | '; $p_field .= '<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(15) . ' onChange="uFormUrl(' . $aname . ')" />'; break; case 'offset': $wArr = explode(',', $fV); $labels = t3lib_div::trimExplode(',', $typeDat['paramstr']); $p_field = ($labels[0] ? $labels[0] : 'x') . ':<input type="text" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />'; $p_field .= ' , '; $p_field .= ($labels[1] ? $labels[1] : 'y') . ':<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />'; for ($aa = 2; $aa < count($labels); $aa++) { if ($labels[$aa]) { $p_field .= ' , ' . $labels[$aa] . ':<input type="text" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />'; } else { $p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />'; } } break; case 'options': if (is_array($typeDat['params'])) { $p_field = ''; foreach ($typeDat['params'] as $val) { $vParts = explode('=', $val, 2); $label = $vParts[0]; $val = isset($vParts[1]) ? $vParts[1] : $vParts[0]; // option tag: $sel = ''; if ($val == $params['value']) { $sel = ' selected'; } $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $GLOBALS['LANG']->sL($label) . '</option>'; } $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>'; } break; case 'boolean': $p_field = '<input type="hidden" name="' . $fN . '" value="0" />'; $sel = ''; if ($fV) { $sel = ' checked'; } $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ? $typeDat['paramstr'] : 1) . '"' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'; break; case 'comment': $p_field = '<input type="hidden" name="' . $fN . '" value="#" />'; $sel = ''; if (!$fV) { $sel = ' checked'; } $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value=""' . $sel . ' onClick="uFormUrl(' . $aname . ')" />'; break; case 'file': $p_field = '<option value=""></option>'; $theImage = ''; $selectThisFile = $this->extractFromResources($this->setup['resources'], $params['value']); if ($params['value'] && !$selectThisFile) { if (in_array($params['value'], $this->dirResources)) { $selectThisFile = $params['value']; } } // extensionlist $extList = $typeDat['paramstr']; $p_field = '<option value="">(' . $extList . ')</option>'; if ($extList == 'IMAGE_EXT') { $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']; } reset($this->rArr); $onlineResourceFlag = $this->ext_defaultOnlineResourceFlag; foreach ($this->rArr as $c => $val) { $val = trim($val); $fI = t3lib_div::split_fileref($val); if ($val && (!$extList || t3lib_div::inList($extList, $fI['fileext']))) { if ($onlineResourceFlag <= 0 && strstr($fI['path'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'])) { if ($onlineResourceFlag < 0) { $p_field .= '<option value=""></option>'; } $p_field .= '<option value="">__' . $fI['path'] . '__:</option>'; $onlineResourceFlag = 1; } $dims = $this->resourceDimensions[$val]; $sel = ''; // Check if $params['value'] is in the list of resources. if ($selectThisFile && $selectThisFile == $val) { $sel = ' selected'; if ($onlineResourceFlag <= 0) { $theImage = t3lib_BEfunc::thumbCode(array('resources' => $selectThisFile), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], ''); } else { $theImage = t3lib_BEfunc::thumbCode(array('resources' => $fI['file']), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '', $fI['path']); } } if ($onlineResourceFlag <= 0) { $onlineResourceFlag--; // Value is set with a * $val = $this->ext_setStar($val); $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . $dims . '</option>'; } else { $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $fI['file'] . $dims . '</option>'; } } } if (trim($params['value']) && !$selectThisFile) { $val = $params['value']; $p_field .= '<option value=""></option>'; $p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>'; } $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>'; $p_field .= $theImage; if (!$this->ext_noCEUploadAndCopying) { // Copy a resource $copyFile = $this->extractFromResources($this->setup['resources'], $params['value']); if (!$copyFile) { if ($params['value']) { $copyFile = PATH_site . $this->ext_detectAndFixExtensionPrefix($params['value']); } } else { $copyFile = ''; } if ($copyFile && @is_file($copyFile)) { $p_field .= '<img src="clear.gif" width="20" ' . 'height="1" alt="" />' . t3lib_iconWorks::getSpriteIcon('actions-edit-copy') . '<input type="checkbox" ' . 'name="_copyResource[' . $params['name'] . ']" value="' . htmlspecialchars($copyFile) . '" onclick="uFormUrl(' . $aname . ');if (this.checked && !confirm(\'' . t3lib_div::slashJS(htmlspecialchars(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsparser.xml:tsparser_ext.make_copy'), $params['value']))) . '\')) this.checked=false;" />'; } // Upload? $p_field .= '<br />'; $p_field .= '<input id="' . $fN . '" type="file" name="upload_' . $fN . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . ' onChange="uFormUrl(' . $aname . ')" size="50" />'; } break; case 'user': $userFunction = $typeDat['paramstr']; $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV); $p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, ''); break; case 'small': default: $fwidth = $typeDat['type'] == 'small' ? 10 : 46; $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth($fwidth) . ' onChange="uFormUrl(' . $aname . ')" />'; break; } // Define default names and IDs $userTyposcriptID = 'userTS-' . $params['name']; $defaultTyposcriptID = 'defaultTS-' . $params['name']; $checkboxName = 'check[' . $params['name'] . ']'; $checkboxID = $checkboxName; // Handle type=color specially if ($typeDat['type'] == 'color' && substr($params['value'], 0, 2) != '{$') { $color = '<div id="colorbox-' . $fN . '" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' . $params['value'] . ';"> </div>'; } else { $color = ''; } if (!$this->ext_dontCheckIssetValues) { /* Set the default styling options */ if (isset($this->objReg[$params['name']])) { $checkboxValue = 'checked'; $userTyposcriptStyle = ''; $defaultTyposcriptStyle = 'style="display:none;"'; } else { $checkboxValue = ''; $userTyposcriptStyle = 'style="display:none;"'; $defaultTyposcriptStyle = ''; } $deleteIconHTML = t3lib_iconWorks::getSpriteIcon('actions-edit-undo', array('class' => "typo3-tstemplate-ceditor-control undoIcon", 'alt' => "Revert to default Constant", 'title' => "Revert to default Constant", 'rel' => $params['name'])); $editIconHTML = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('class' => "typo3-tstemplate-ceditor-control editIcon", 'alt' => "Edit this Constant", 'title' => "Edit this Constant", 'rel' => $params['name'])); $constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>'; // If there's no default value for the field, use a static label. if (!$params['default_value']) { $params['default_value'] = '[Empty]'; } $constantDefaultRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>' . $editIconHTML . htmlspecialchars($params['default_value']) . $color . '</div>'; } $constantEditRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>' . $deleteIconHTML . $p_field . $color . '</div>'; $constantLabel = '<dt class="typo3-tstemplate-ceditor-label">' . htmlspecialchars($head) . '</dt>'; $constantName = '<dt class="typo3-dimmed">[' . $params['name'] . ']</dt>'; $constantDescription = $body ? '<dd>' . htmlspecialchars($body) . '</dd>' : ''; $constantData = '<dd>' . $constantCheckbox . $constantEditRow . $constantDefaultRow . '</dd>'; $output .= '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']]; $output .= '<dl class="typo3-tstemplate-ceditor-constant">' . $constantLabel . $constantName . $constantDescription . $constantData . '</dl>'; } else { debug('Error. Constant did not exist. Should not happen.'); } } } return $output; }
/** * This prints out a TYPO3 error message. * * @param string Header string * @param string Message string * @param boolean If set, then this will produce a alert() line for inclusion in JavaScript. * @param string URL for the <base> tag (if you want it) * @return string */ public function debug_typo3PrintError($header, $text, $js, $baseUrl = '') { if ($js) { $errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\\n' . $text) . '\');'; } else { $errorMessage = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd"> <?xml version="1.0" encoding="utf-8"?> <html> <head> ' . ($baseUrl ? '<base href="' . htmlspecialchars($baseUrl) . '" />' : '') . ' <title>Error!</title> <style type="text/css"><!--/*--><![CDATA[/*><!--*/ body { font-family:Verdana,Arial,Helvetica,sans-serif; font-size: 90%; text-align: center; background-color: #ffffff; } h1 { font-size: 1.2em; margin: 0 0 1em 0; } p { margin: 0; text-align: left; } img { border: 0; margin: 10px 0; } div.center div { margin: 0 auto; } .errorBox { width: 400px; padding: 0.5em; border: 1px solid black; background-color: #F4F0E8; } /*]]>*/--></style> </head> <body> <div class="center"> <img src="' . TYPO3_mainDir . 'gfx/typo3logo.gif" width="123" height="34" alt="" /> <div class="errorBox"> <h1>' . $header . '</h1> <p>' . $text . '</p> </div> </div> </body> </html>'; } // Hook to modify error message if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'])) { $params = array('header' => $header, 'text' => $text, 'js' => $js, 'baseUrl' => $baseUrl, 'errorMessage' => &$errorMessage); $null = null; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'] as $hookMethod) { t3lib_div::callUserFunction($hookMethod, $params, $null); } } echo $errorMessage; }
/** * Print error message with header, text etc. * Usage: 19 * * @param string Header string * @param string Content string * @param boolean Will return an alert() with the content of header and text. * @param boolean Print header. * @return void * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - use RuntimeException from now on */ public static function typo3PrintError($header, $text, $js = '', $head = 1) { // This prints out a TYPO3 error message. // If $js is set the message will be output in JavaScript if ($js) { echo "alert('" . t3lib_div::slashJS($header . '\\n' . $text) . "');"; } else { t3lib_div::logDeprecatedFunction(); $messageObj = t3lib_div::makeInstance('t3lib_message_ErrorPageMessage', $text, $header); $messageObj->output(); } }
function wrapTitle($title, $row, $bank) { if ($row['uid'] > 0) { if (in_array($row['uid'], $this->TCEforms_nonSelectableItemsArray)) { $style = $this->getTitleStyles($row); return '<a href="#" title="' . $title . ' [uid: ' . $row['uid'] . ']"><span style="color: #999; cursor:default; ' . $style . '">' . $title . '</span></a>'; } else { $aOnClick = 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\', ' . $row['uid'] . ', \'' . t3lib_div::slashJS($title) . '\'); return false;'; $style = $this->getTitleStyles($row); return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '" title="' . $title . ' [uid: ' . $row['uid'] . ']"><span style="' . $style . '">' . $title . '</span></a>'; } } else { $pidLbl = ' <span class="typo3-dimmed"><em>' . $GLOBALS['LANG']->sL('LLL:EXT:cps_tcatree/locallang_tca.xml:cps_tcatree.treeview.allPages') . '</em></span>'; return $title . $pidLbl; } }
/** * Prints the selector box form-field for the db/file/select elements (multiple) * * @param string Form element name * @param string Mode "db", "file" (internal_type for the "group" type) OR blank (then for the "select" type). Seperated with '|' a user defined mode can be set to be passed as param to the EB. * @param string Commalist of "allowed" * @param array The array of items. For "select" and "group"/"file" this is just a set of value. For "db" its an array of arrays with table/uid pairs. * @param string Alternative selector box. * @param array An array of additional parameters, eg: "size", "info", "headers" (array with "selector" and "items"), "noBrowser", "thumbnails" * @param string On focus attribute string * @param string $user_el_param Additional parameter for the EB * @return string The form fields for the selection. */ function dbFileIcons($fName, $mode, $allowed, $itemArray, $selector = '', $params = array(), $onFocus = '', $userEBParam = '') { list($mode, $modeEB) = explode('|', $mode); $modeEB = $modeEB ? $modeEB : $mode; $disabled = ''; if ($this->tceforms->renderReadonly || $params['readOnly']) { $disabled = ' disabled="disabled"'; } // Sets a flag which means some JavaScript is included on the page to support this element. $this->tceforms->printNeededJS['dbFileIcons'] = 1; // INIT $uidList = array(); $opt = array(); $itemArrayC = 0; // Creating <option> elements: if (is_array($itemArray)) { $itemArrayC = count($itemArray); reset($itemArray); switch ($mode) { case 'db': while (list(, $pp) = each($itemArray)) { if ($pp['title']) { $pTitle = $pp['title']; } else { if (function_exists('t3lib_BEfunc::getRecordWSOL')) { $pRec = t3lib_BEfunc::getRecordWSOL($pp['table'], $pp['id']); } else { $pRec = t3lib_BEfunc::getRecord($pp['table'], $pp['id']); } $pTitle = is_array($pRec) ? $pRec[$GLOBALS['TCA'][$pp['table']]['ctrl']['label']] : NULL; } if ($pTitle) { $pTitle = $pTitle ? t3lib_div::fixed_lgd_cs($pTitle, $this->tceforms->titleLen) : t3lib_BEfunc::getNoRecordTitle(); $pUid = $pp['table'] . '_' . $pp['id']; $uidList[] = $pUid; $opt[] = '<option value="' . htmlspecialchars($pUid) . '">' . htmlspecialchars($pTitle) . '</option>'; } } break; case 'folder': case 'file': while (list(, $pp) = each($itemArray)) { $pParts = explode('|', $pp); $uidList[] = $pUid = $pTitle = $pParts[0]; $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pParts[0])) . '">' . htmlspecialchars(rawurldecode($pParts[0])) . '</option>'; } break; default: while (list(, $pp) = each($itemArray)) { $pParts = explode('|', $pp, 2); $uidList[] = $pUid = $pParts[0]; $pTitle = $pParts[1] ? $pParts[1] : $pParts[0]; $opt[] = '<option value="' . htmlspecialchars(rawurldecode($pUid)) . '">' . htmlspecialchars(rawurldecode($pTitle)) . '</option>'; } break; } } // Create selector box of the options $sSize = $params['autoSizeMax'] ? t3lib_div::intInRange($itemArrayC + 1, t3lib_div::intInRange($params['size'], 1), $params['autoSizeMax']) : $params['size']; if (!$selector) { $selector = '<select size="' . $sSize . '"' . $this->tceforms->insertDefStyle('group') . ' multiple="multiple" name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>'; } $icons = array('L' => array(), 'R' => array()); if (!$params['readOnly']) { if (!$params['noBrowser']) { $aOnClick = 'setFormValueOpenBrowser(\'' . $modeEB . '\',\'' . ($fName . '|||' . $allowed . '|' . $userEBParam . '|') . '\'); return false;'; $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert3.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_browse_' . ($mode === 'file' ? 'file' : 'db'))) . ' />' . '</a>'; } if (!$params['dontShowMoveIcons']) { if ($sSize >= 5) { $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Top\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_totop.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_top')) . ' />' . '</a>'; } $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Up\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/up.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_up')) . ' />' . '</a>'; $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Down\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/down.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_down')) . ' />' . '</a>'; if ($sSize >= 5) { $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Bottom\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_tobottom.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_move_to_bottom')) . ' />' . '</a>'; } } // todo Clipboard $clipElements = $this->tceforms->getClipboardElements($allowed, $mode); if (count($clipElements)) { $aOnClick = ''; # $counter = 0; foreach ($clipElements as $elValue) { if ($mode === 'file' or $mode === 'folder') { $itemTitle = 'unescape(\'' . rawurlencode(tx_dam::file_basename($elValue)) . '\')'; } else { // 'db' mode assumed list($itemTable, $itemUid) = explode('|', $elValue); if (function_exists('t3lib_BEfunc::getRecordWSOL')) { $rec = t3lib_BEfunc::getRecordWSOL($itemTable, $itemUid); } else { $rec = t3lib_BEfunc::getRecord($itemTable, $itemUid); } $itemTitle = $GLOBALS['LANG']->JScharCode(t3lib_BEfunc::getRecordTitle($itemTable, $rec)); $elValue = $itemTable . '_' . $itemUid; } $aOnClick .= 'setFormValueFromBrowseWin(\'' . $fName . '\',\'' . t3lib_div::slashJS(t3lib_div::rawUrlEncodeJS($elValue)) . '\',' . t3lib_div::slashJS($itemTitle) . ');'; #$aOnClick .= 'setFormValueFromBrowseWin(\''.$fName.'\',unescape(\''.rawurlencode(str_replace('%20', ' ', $elValue)).'\'),'.$itemTitle.');'; # $counter++; # if ($params['maxitems'] && $counter >= $params['maxitems']) { break; } // Makes sure that no more than the max items are inserted... for convenience. } $aOnClick .= 'return false;'; $icons['R'][] = '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/insert5.png', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib(sprintf($this->tceforms->getLL('l_clipInsert_' . ($mode === 'file' ? 'file' : 'db')), count($clipElements))) . ' />' . '</a>'; } $icons['L'][] = '<a href="#" onclick="setFormValueManipulate(\'' . $fName . '\',\'Remove\'); return false;">' . '<img' . t3lib_iconWorks::skinImg($this->tceforms->backPath, 'gfx/group_clear.gif', 'width="14" height="14"') . ' border="0" ' . t3lib_BEfunc::titleAltAttrib($this->tceforms->getLL('l_remove_selected')) . ' />' . '</a>'; } $str = '<table border="0" cellpadding="0" cellspacing="0" width="1"> ' . ($params['headers'] ? ' <tr> <td>' . $this->tceforms->wrapLabels($params['headers']['selector']) . '</td> <td></td> <td></td> <td></td> <td>' . ($params['thumbnails'] ? $this->tceforms->wrapLabels($params['headers']['items']) : '') . '</td> </tr>' : '') . ' <tr> <td valign="top">' . $selector . '<br />' . $this->tceforms->wrapLabels($params['info']) . '</td> <td valign="top">' . implode('<br />', $icons['L']) . '</td> <td valign="top">' . implode('<br />', $icons['R']) . '</td> <td style="height:5px;"><span></span></td> <td valign="top">' . $this->tceforms->wrapLabels($params['thumbnails']) . '</td> </tr> </table>'; // Creating the hidden field which contains the actual value as a comma list. $str .= '<input type="hidden" name="' . $fName . '" value="' . htmlspecialchars(implode(',', $uidList)) . '" />'; return $str; }
/** * Enter description here... * * @param unknown_type $array * @param unknown_type $lines * @param unknown_type $level * @return unknown */ public static function arrayToCode($array, $level = 0) { $lines = 'array(' . LF; $level++; foreach ($array as $k => $v) { if (strlen($k) && is_array($v)) { $lines .= str_repeat(TAB, $level) . "'" . $k . "' => " . self::arrayToCode($v, $level); } elseif (strlen($k)) { $lines .= str_repeat(TAB, $level) . "'" . $k . "' => " . (t3lib_div::testInt($v) ? intval($v) : "'" . t3lib_div::slashJS(trim($v), 1) . "'") . ',' . LF; } } $lines .= str_repeat(TAB, $level - 1) . ')' . ($level - 1 == 0 ? '' : ',' . LF); return $lines; }
/** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website */ public function main($content, $conf) { $this->content = $content; $this->conf = $conf; $this->pi_setPiVarDefaults(); $this->pi_loadLL(); // get the config from EXT $this->confArr = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['jfmulticontent']); $this->pagerenderer = t3lib_div::makeInstance('tx_jfmulticontent_pagerenderer'); $this->pagerenderer->setConf($this->conf); // Plugin or template? if ($this->cObj->data['list_type'] == $this->extKey . '_pi1') { // It's a content, all data from flexform $this->lConf['style'] = $this->getFlexformData('general', 'style'); if ($this->lConf['style'] != 'typoscript') { $this->lConf['columnOrder'] = $this->getFlexformData('general', 'columnOrder', in_array($this->lConf['style'], array('2column', '3column', '4column', '5column'))); $this->lConf['column1'] = $this->getFlexformData('general', 'column1', in_array($this->lConf['style'], array('2column', '3column', '4column', '5column'))); $this->lConf['column2'] = $this->getFlexformData('general', 'column2', in_array($this->lConf['style'], array('2column', '3column', '4column', '5column'))); $this->lConf['column3'] = $this->getFlexformData('general', 'column3', in_array($this->lConf['style'], array('3column', '4column', '5column'))); $this->lConf['column4'] = $this->getFlexformData('general', 'column4', in_array($this->lConf['style'], array('4column', '5column'))); $this->lConf['column5'] = $this->getFlexformData('general', 'column5', in_array($this->lConf['style'], array('5column'))); $this->lConf['equalize'] = $this->getFlexformData('general', 'equalize', in_array($this->lConf['style'], array('1column', '2column', '3column', '4column', '5column'))); $debuglog = $this->lConf['style'] == 'tab'; $this->lConf['tabCollapsible'] = $this->getFlexformData('general', 'tabCollapsible', $debuglog); $this->lConf['tabOpen'] = $this->getFlexformData('general', 'tabOpen', $debuglog); $this->lConf['tabRandomContent'] = $this->getFlexformData('general', 'tabRandomContent', $debuglog); $this->lConf['tabEvent'] = $this->getFlexformData('general', 'tabEvent', $debuglog); $this->lConf['tabHeightStyle'] = $this->getFlexformData('general', 'tabHeightStyle', $debuglog); $this->lConf['tabCookieExpires'] = $this->getFlexformData('general', 'tabCookieExpires', $debuglog); $this->lConf['tabCookieRoot'] = $this->getFlexformData('general', 'tabCookieRoot', $debuglog); $this->lConf['tabHideEffect'] = $this->getFlexformData('general', 'tabHideEffect', $debuglog); $this->lConf['tabHideTransition'] = $this->getFlexformData('general', 'tabHideTransition', $debuglog); $this->lConf['tabHideTransitiondir'] = $this->getFlexformData('general', 'tabHideTransitiondir', $debuglog); $this->lConf['tabHideTransitionduration'] = $this->getFlexformData('general', 'tabHideTransitionduration', $debuglog); $this->lConf['tabShowEffect'] = $this->getFlexformData('general', 'tabShowEffect', $debuglog); $this->lConf['tabShowTransition'] = $this->getFlexformData('general', 'tabShowTransition', $debuglog); $this->lConf['tabShowTransitiondir'] = $this->getFlexformData('general', 'tabShowTransitiondir', $debuglog); $this->lConf['tabShowTransitionduration'] = $this->getFlexformData('general', 'tabShowTransitionduration', $debuglog); $debuglog = $this->lConf['style'] == 'accordion'; $this->lConf['accordionCollapsible'] = $this->getFlexformData('general', 'accordionCollapsible', $debuglog); $this->lConf['accordionClosed'] = $this->getFlexformData('general', 'accordionClosed', $debuglog); $this->lConf['accordionOpen'] = $this->getFlexformData('general', 'accordionOpen', $debuglog); $this->lConf['accordionRandomContent'] = $this->getFlexformData('general', 'accordionRandomContent', $debuglog); $this->lConf['accordionEvent'] = $this->getFlexformData('general', 'accordionEvent', $debuglog); $this->lConf['accordionHeightStyle'] = $this->getFlexformData('general', 'accordionHeightStyle', $debuglog); $this->lConf['accordionAnimate'] = $this->getFlexformData('general', 'accordionAnimate', $debuglog); $this->lConf['accordionTransition'] = $this->getFlexformData('general', 'accordionTransition', $debuglog); $this->lConf['accordionTransitiondir'] = $this->getFlexformData('general', 'accordionTransitiondir', $debuglog); $this->lConf['accordionTransitionduration'] = $this->getFlexformData('general', 'accordionTransitionduration', $debuglog); $debuglog = $this->lConf['style'] == 'slider'; $this->lConf['sliderWidth'] = $this->getFlexformData('general', 'sliderWidth', $debuglog); $this->lConf['sliderHeight'] = $this->getFlexformData('general', 'sliderHeight', $debuglog); $this->lConf['sliderResizeContents'] = $this->getFlexformData('general', 'sliderResizeContents', $debuglog); $this->lConf['sliderTheme'] = $this->getFlexformData('general', 'sliderTheme', $debuglog); $this->lConf['sliderMode'] = $this->getFlexformData('general', 'sliderMode', $debuglog); $this->lConf['sliderOpen'] = $this->getFlexformData('general', 'sliderOpen', $debuglog); $this->lConf['sliderRandomContent'] = $this->getFlexformData('general', 'sliderRandomContent', $debuglog); $this->lConf['sliderHashTags'] = $this->getFlexformData('general', 'sliderHashTags', $debuglog); $this->lConf['sliderBuildArrows'] = $this->getFlexformData('general', 'sliderBuildArrows', $debuglog); $this->lConf['sliderToggleArrows'] = $this->getFlexformData('general', 'sliderToggleArrows', $debuglog); $this->lConf['sliderNavigation'] = $this->getFlexformData('general', 'sliderNavigation', $debuglog); $this->lConf['sliderStartStop'] = $this->getFlexformData('general', 'sliderStartStop', $debuglog); $this->lConf['sliderPanelFromHeader'] = $this->getFlexformData('general', 'sliderPanelFromHeader', $debuglog); $this->lConf['sliderToggleControls'] = $this->getFlexformData('general', 'sliderToggleControls', $debuglog); $this->lConf['sliderAutoStart'] = $this->getFlexformData('general', 'sliderAutoStart', $debuglog); $this->lConf['sliderPauseOnHover'] = $this->getFlexformData('general', 'sliderPauseOnHover', $debuglog); $this->lConf['sliderAllowRapidChange'] = $this->getFlexformData('general', 'sliderAllowRapidChange', $debuglog); $this->lConf['sliderResumeOnVideoEnd'] = $this->getFlexformData('general', 'sliderResumeOnVideoEnd', $debuglog); $this->lConf['sliderStopAtEnd'] = $this->getFlexformData('general', 'sliderStopAtEnd', $debuglog); $this->lConf['sliderPlayRtl'] = $this->getFlexformData('general', 'sliderPlayRtl', $debuglog); $this->lConf['sliderTransition'] = $this->getFlexformData('general', 'sliderTransition', $debuglog); $this->lConf['sliderTransitiondir'] = $this->getFlexformData('general', 'sliderTransitiondir', $debuglog); $this->lConf['sliderTransitionduration'] = $this->getFlexformData('general', 'sliderTransitionduration', $debuglog); $this->lConf['sliderAutoplay'] = $this->getFlexformData('general', 'sliderAutoplay', $debuglog); $debuglog = $this->lConf['style'] == 'slidedeck'; $this->lConf['slidedeckHeight'] = $this->getFlexformData('general', 'slidedeckHeight', $debuglog); $this->lConf['slidedeckTransition'] = $this->getFlexformData('general', 'slidedeckTransition', $debuglog); $this->lConf['slidedeckTransitiondir'] = $this->getFlexformData('general', 'slidedeckTransitiondir', $debuglog); $this->lConf['slidedeckTransitionduration'] = $this->getFlexformData('general', 'slidedeckTransitionduration', $debuglog); $this->lConf['slidedeckStart'] = $this->getFlexformData('general', 'slidedeckStart', $debuglog); $this->lConf['slidedeckActivecorner'] = $this->getFlexformData('general', 'slidedeckActivecorner', $debuglog); $this->lConf['slidedeckIndex'] = $this->getFlexformData('general', 'slidedeckIndex', $debuglog); $this->lConf['slidedeckScroll'] = $this->getFlexformData('general', 'slidedeckScroll', $debuglog); $this->lConf['slidedeckKeys'] = $this->getFlexformData('general', 'slidedeckKeys', $debuglog); $this->lConf['slidedeckHidespines'] = $this->getFlexformData('general', 'slidedeckHidespines', $debuglog); $debuglog = $this->lConf['style'] == 'easyaccordion'; $this->lConf['easyaccordionSkin'] = $this->getFlexformData('general', 'easyaccordionSkin', $debuglog); $this->lConf['easyaccordionOpen'] = $this->getFlexformData('general', 'easyaccordionOpen', $debuglog); $this->lConf['easyaccordionWidth'] = $this->getFlexformData('general', 'easyaccordionWidth', $debuglog); $this->lConf['easyaccordionSlideNum'] = $this->getFlexformData('general', 'easyaccordionSlideNum', $debuglog); $debuglog = $this->lConf['style'] == 'booklet'; $this->lConf['bookletWidth'] = $this->getFlexformData('general', 'bookletWidth', $debuglog); $this->lConf['bookletHeight'] = $this->getFlexformData('general', 'bookletHeight', $debuglog); $this->lConf['bookletSpeed'] = $this->getFlexformData('general', 'bookletSpeed', $debuglog); $this->lConf['bookletStartingPage'] = $this->getFlexformData('general', 'bookletStartingPage', $debuglog); $this->lConf['bookletRTL'] = $this->getFlexformData('general', 'bookletRTL', $debuglog); $this->lConf['bookletTransition'] = $this->getFlexformData('general', 'bookletTransition', $debuglog); $this->lConf['bookletTransitiondir'] = $this->getFlexformData('general', 'bookletTransitiondir', $debuglog); $this->lConf['bookletPagePadding'] = $this->getFlexformData('general', 'bookletPagePadding', $debuglog); $this->lConf['bookletPageNumbers'] = $this->getFlexformData('general', 'bookletPageNumbers', $debuglog); $this->lConf['bookletManual'] = $this->getFlexformData('general', 'bookletManual', $debuglog); $this->lConf['bookletShadows'] = $this->getFlexformData('general', 'bookletShadows', $debuglog); $this->lConf['bookletClosed'] = $this->getFlexformData('general', 'bookletClosed', $debuglog); $this->lConf['bookletCovers'] = $this->getFlexformData('general', 'bookletCovers', $debuglog); $this->lConf['bookletAutoCenter'] = $this->getFlexformData('general', 'bookletAutoCenter', $debuglog); $this->lConf['bookletHash'] = $this->getFlexformData('general', 'bookletHash', $debuglog); $this->lConf['bookletKeyboard'] = $this->getFlexformData('general', 'bookletKeyboard', $debuglog); $this->lConf['bookletAuto'] = $this->getFlexformData('general', 'bookletAuto', $debuglog); $this->lConf['bookletDelay'] = $this->getFlexformData('general', 'bookletDelay', $debuglog); $this->lConf['bookletOverlays'] = $this->getFlexformData('general', 'bookletOverlays', $debuglog); $this->lConf['bookletArrows'] = $this->getFlexformData('general', 'bookletArrows', $debuglog); $this->lConf['bookletArrowsHide'] = $this->getFlexformData('general', 'bookletArrows', $debuglog); $this->lConf['bookletHovers'] = $this->getFlexformData('general', 'bookletHovers', $debuglog); $this->lConf['delayDuration'] = $this->getFlexformData('general', 'delayDuration', in_array($this->lConf['style'], array('slider', 'slidedeck', 'easyaccordion'))); $this->lConf['autoplayCycle'] = $this->getFlexformData('general', 'autoplayCycle', $this->lConf['style'] == 'slidedeck'); // columns $this->conf['config.']['column1'] = $this->lConf['column1']; $this->conf['config.']['column2'] = $this->lConf['column2']; $this->conf['config.']['column3'] = $this->lConf['column3']; $this->conf['config.']['column4'] = $this->lConf['column4']; $this->conf['config.']['column5'] = $this->lConf['column5']; $this->conf['config.']['columnOrder'] = $this->lConf['columnOrder']; if ($this->lConf['equalize'] < 2) { $this->conf['config.']['equalize'] = $this->lConf['equalize']; } // tab if ($this->lConf['tabCollapsible'] < 2) { $this->conf['config.']['tabCollapsible'] = $this->lConf['tabCollapsible']; } if ($this->lConf['tabOpen'] >= 0) { $this->conf['config.']['tabOpen'] = $this->lConf['tabOpen']; } if ($this->lConf['tabRandomContent'] < 2) { $this->conf['config.']['tabRandomContent'] = $this->lConf['tabRandomContent']; } if (strlen($this->lConf['tabCookieExpires']) > 0) { $this->conf['config.']['tabCookieExpires'] = $this->lConf['tabCookieExpires']; } if ($this->lConf['tabCookieRoot'] < 2) { $this->conf['config.']['tabCookieRoot'] = $this->lConf['tabCookieRoot']; } if ($this->lConf['tabHideEffect']) { $this->conf['config.']['tabHideEffect'] = $this->lConf['tabHideEffect']; } if ($this->lConf['tabHideTransition']) { $this->conf['config.']['tabHideTransition'] = $this->lConf['tabHideTransition']; } if ($this->lConf['tabHideTransitiondir']) { $this->conf['config.']['tabHideTransitiondir'] = $this->lConf['tabHideTransitiondir']; } if ($this->lConf['tabHideTransitionduration'] > 0) { $this->conf['config.']['tabHideTransitionduration'] = $this->lConf['tabHideTransitionduration']; } if ($this->lConf['tabShowEffect']) { $this->conf['config.']['tabShowEffect'] = $this->lConf['tabShowEffect']; } if ($this->lConf['tabShowTransition']) { $this->conf['config.']['tabShowTransition'] = $this->lConf['tabShowTransition']; } if ($this->lConf['tabShowTransitiondir']) { $this->conf['config.']['tabShowTransitiondir'] = $this->lConf['tabShowTransitiondir']; } if ($this->lConf['tabShowTransitionduration'] > 0) { $this->conf['config.']['tabShowTransitionduration'] = $this->lConf['tabShowTransitionduration']; } if (in_array($this->lConf['tabEvent'], array('click', 'mouseover'))) { $this->conf['config.']['tabEvent'] = $this->lConf['tabEvent']; } if (in_array($this->lConf['tabHeightStyle'], array('auto', 'fill', 'content'))) { $this->conf['config.']['tabHeightStyle'] = $this->lConf['tabHeightStyle']; } // accordion if ($this->lConf['accordionCollapsible'] < 2) { $this->conf['config.']['accordionCollapsible'] = $this->lConf['accordionCollapsible']; } if ($this->lConf['accordionClosed'] < 2) { $this->conf['config.']['accordionClosed'] = $this->lConf['accordionClosed']; } if ($this->lConf['accordionOpen'] > 0) { $this->conf['config.']['accordionOpen'] = $this->lConf['accordionOpen']; } if ($this->lConf['accordionRandomContent'] < 2) { $this->conf['config.']['accordionRandomContent'] = $this->lConf['accordionRandomContent']; } if ($this->lConf['accordionEvent']) { $this->conf['config.']['accordionEvent'] = $this->lConf['accordionEvent']; } if (in_array($this->lConf['accordionHeightStyle'], array('auto', 'fill', 'content'))) { $this->conf['config.']['accordionHeightStyle'] = $this->lConf['accordionHeightStyle']; } if ($this->lConf['accordionAnimate'] < 2) { $this->conf['config.']['accordionAnimate'] = $this->lConf['accordionAnimate']; } if ($this->lConf['accordionTransition']) { $this->conf['config.']['accordionTransition'] = $this->lConf['accordionTransition']; } if ($this->lConf['accordionTransitiondir']) { $this->conf['config.']['accordionTransitiondir'] = $this->lConf['accordionTransitiondir']; } if ($this->lConf['accordionTransitionduration'] > 0) { $this->conf['config.']['accordionTransitionduration'] = $this->lConf['accordionTransitionduration']; } // slider if ($this->lConf['sliderWidth']) { $this->conf['config.']['sliderWidth'] = $this->lConf['sliderWidth']; } if ($this->lConf['sliderHeight']) { $this->conf['config.']['sliderHeight'] = $this->lConf['sliderHeight']; } if ($this->lConf['sliderResizeContents'] < 2) { $this->conf['config.']['sliderResizeContents'] = $this->lConf['sliderResizeContents']; } if ($this->lConf['sliderTheme']) { $this->conf['config.']['sliderTheme'] = $this->lConf['sliderTheme']; } if ($this->lConf['sliderMode']) { $this->conf['config.']['sliderMode'] = $this->lConf['sliderMode']; } if ($this->lConf['sliderOpen'] > 0) { $this->conf['config.']['sliderOpen'] = $this->lConf['sliderOpen']; } if ($this->lConf['sliderRandomContent'] < 2) { $this->conf['config.']['sliderRandomContent'] = $this->lConf['sliderRandomContent']; } if ($this->lConf['sliderHashTags'] < 2) { $this->conf['config.']['sliderHashTags'] = $this->lConf['sliderHashTags']; } if ($this->lConf['sliderBuildArrows'] < 2) { $this->conf['config.']['sliderBuildArrows'] = $this->lConf['sliderBuildArrows']; } if ($this->lConf['sliderToggleArrows'] < 2) { $this->conf['config.']['sliderToggleArrows'] = $this->lConf['sliderToggleArrows']; } if ($this->lConf['sliderNavigation'] < 2) { $this->conf['config.']['sliderNavigation'] = $this->lConf['sliderNavigation']; } if ($this->lConf['sliderStartStop'] < 2) { $this->conf['config.']['sliderStartStop'] = $this->lConf['sliderStartStop']; } if ($this->lConf['sliderPanelFromHeader'] < 2) { $this->conf['config.']['sliderPanelFromHeader'] = $this->lConf['sliderPanelFromHeader']; } if ($this->lConf['sliderToggleControls'] < 2) { $this->conf['config.']['sliderToggleControls'] = $this->lConf['sliderToggleControls']; } if ($this->lConf['sliderAutoStart'] < 2) { $this->conf['config.']['sliderAutoStart'] = $this->lConf['sliderAutoStart']; } if ($this->lConf['sliderPauseOnHover'] < 2) { $this->conf['config.']['sliderPauseOnHover'] = $this->lConf['sliderPauseOnHover']; } if ($this->lConf['sliderAllowRapidChange'] < 2) { $this->conf['config.']['sliderAllowRapidChange'] = $this->lConf['sliderAllowRapidChange']; } if ($this->lConf['sliderResumeOnVideoEnd'] < 2) { $this->conf['config.']['sliderResumeOnVideoEnd'] = $this->lConf['sliderResumeOnVideoEnd']; } if ($this->lConf['sliderStopAtEnd'] < 2) { $this->conf['config.']['sliderStopAtEnd'] = $this->lConf['sliderStopAtEnd']; } if ($this->lConf['sliderPlayRtl'] < 2) { $this->conf['config.']['sliderPlayRtl'] = $this->lConf['sliderPlayRtl']; } if ($this->lConf['sliderTransition']) { $this->conf['config.']['sliderTransition'] = $this->lConf['sliderTransition']; } if ($this->lConf['sliderTransitiondir']) { $this->conf['config.']['sliderTransitiondir'] = $this->lConf['sliderTransitiondir']; } if ($this->lConf['sliderTransitionduration'] > 0) { $this->conf['config.']['sliderTransitionduration'] = $this->lConf['sliderTransitionduration']; } if ($this->lConf['sliderAutoplay'] < 2) { $this->conf['config.']['sliderAutoplay'] = $this->lConf['sliderAutoplay']; } // slidedeck if ($this->lConf['slidedeckHeight'] > 0) { $this->conf['config.']['slidedeckHeight'] = $this->lConf['slidedeckHeight']; } if ($this->lConf['slidedeckTransition']) { $this->conf['config.']['slidedeckTransition'] = $this->lConf['slidedeckTransition']; } if ($this->lConf['slidedeckTransitiondir']) { $this->conf['config.']['slidedeckTransitiondir'] = $this->lConf['slidedeckTransitiondir']; } if ($this->lConf['slidedeckTransitionduration'] > 0) { $this->conf['config.']['slidedeckTransitionduration'] = $this->lConf['slidedeckTransitionduration']; } if ($this->lConf['slidedeckStart'] > 0) { $this->conf['config.']['slidedeckStart'] = $this->lConf['slidedeckStart']; } if ($this->lConf['slidedeckActivecorner'] < 2) { $this->conf['config.']['slidedeckActivecorner'] = $this->lConf['slidedeckActivecorner']; } if ($this->lConf['slidedeckIndex'] < 2) { $this->conf['config.']['slidedeckIndex'] = $this->lConf['slidedeckIndex']; } if ($this->lConf['slidedeckScroll'] < 2) { $this->conf['config.']['slidedeckScroll'] = $this->lConf['slidedeckScroll']; } if ($this->lConf['slidedeckKeys'] < 2) { $this->conf['config.']['slidedeckKeys'] = $this->lConf['slidedeckKeys']; } if ($this->lConf['slidedeckHidespines'] < 2) { $this->conf['config.']['slidedeckHidespines'] = $this->lConf['slidedeckHidespines']; } // easyAccordion if ($this->lConf['easyaccordionSkin']) { $this->conf['config.']['easyaccordionSkin'] = $this->lConf['easyaccordionSkin']; } if ($this->lConf['easyaccordionOpen'] > 0) { $this->conf['config.']['easyaccordionOpen'] = $this->lConf['easyaccordionOpen']; } if ($this->lConf['easyaccordionWidth'] > 0) { $this->conf['config.']['easyaccordionWidth'] = $this->lConf['easyaccordionWidth']; } if ($this->lConf['easyaccordionSlideNum'] < 2) { $this->conf['config.']['easyaccordionSlideNum'] = $this->lConf['easyaccordionSlideNum']; } // booklet if ($this->lConf['bookletWidth'] > 0) { $this->conf['config.']['bookletWidth'] = $this->lConf['bookletWidth']; } if ($this->lConf['bookletHeight'] > 0) { $this->conf['config.']['bookletHeight'] = $this->lConf['bookletHeight']; } if ($this->lConf['bookletSpeed'] > 0) { $this->conf['config.']['bookletSpeed'] = $this->lConf['bookletSpeed']; } if ($this->lConf['bookletStartingPage'] > 0) { $this->conf['config.']['bookletStartingPage'] = $this->lConf['bookletStartingPage']; } if ($this->lConf['bookletRTL'] < 2) { $this->conf['config.']['bookletRTL'] = $this->lConf['bookletRTL']; } if ($this->lConf['bookletTransition']) { $this->conf['config.']['bookletTransition'] = $this->lConf['bookletTransition']; } if ($this->lConf['bookletTransitiondir']) { $this->conf['config.']['bookletTransitiondir'] = $this->lConf['bookletTransitiondir']; } if ($this->lConf['bookletPagePadding'] != '') { $this->conf['config.']['bookletPagePadding'] = $this->lConf['bookletPagePadding']; } if ($this->lConf['bookletPageNumbers'] < 2) { $this->conf['config.']['bookletPageNumbers'] = $this->lConf['bookletPageNumbers']; } if ($this->lConf['bookletManual'] < 2) { $this->conf['config.']['bookletManual'] = $this->lConf['bookletManual']; } if ($this->lConf['bookletShadows'] < 2) { $this->conf['config.']['bookletShadows'] = $this->lConf['bookletShadows']; } if ($this->lConf['bookletClosed'] < 2) { $this->conf['config.']['bookletClosed'] = $this->lConf['bookletClosed']; } if ($this->lConf['bookletCovers'] < 2) { $this->conf['config.']['bookletCovers'] = $this->lConf['bookletCovers']; } if ($this->lConf['bookletAutoCenter'] < 2) { $this->conf['config.']['bookletAutoCenter'] = $this->lConf['bookletAutoCenter']; } if ($this->lConf['bookletHash'] < 2) { $this->conf['config.']['bookletHash'] = $this->lConf['bookletHash']; } if ($this->lConf['bookletKeyboard'] < 2) { $this->conf['config.']['bookletKeyboard'] = $this->lConf['bookletKeyboard']; } if ($this->lConf['bookletAuto'] < 2) { $this->conf['config.']['bookletAuto'] = $this->lConf['bookletAuto']; } if ($this->lConf['bookletDelay'] < 2) { $this->conf['config.']['bookletDelay'] = $this->lConf['bookletDelay']; } if ($this->lConf['bookletOverlays'] < 2) { $this->conf['config.']['bookletOverlays'] = $this->lConf['bookletOverlays']; } if ($this->lConf['bookletArrows'] < 2) { $this->conf['config.']['bookletArrows'] = $this->lConf['bookletArrows']; } if ($this->lConf['bookletArrowsHide'] < 2) { $this->conf['config.']['bookletArrowsHide'] = $this->lConf['bookletArrowsHide']; } if ($this->lConf['bookletHovers'] < 2) { $this->conf['config.']['bookletHovers'] = $this->lConf['bookletHovers']; } // autoplay if ($this->lConf['delayDuration'] > 0) { $this->conf['config.']['delayDuration'] = $this->lConf['delayDuration']; } if ($this->lConf['autoplayCycle'] < 2) { $this->conf['config.']['autoplayCycle'] = $this->lConf['autoplayCycle']; } $this->conf['config.']['style'] = $this->lConf['style']; } $this->lConf['titles'] = $this->getFlexformData('title', 'titles'); $this->lConf['attributes'] = $this->getFlexformData('attribute', 'attributes'); $this->lConf['options'] = $this->getFlexformData('special', 'options'); $this->lConf['optionsOverride'] = $this->getFlexformData('special', 'optionsOverride'); if ($this->cObj->data['tx_jfmulticontent_view']) { $this->conf['config.']['view'] = $this->cObj->data['tx_jfmulticontent_view']; } else { $this->conf['config.']['view'] = 'content'; } // define the titles to overwrite if (trim($this->lConf['titles'])) { $this->titles = t3lib_div::trimExplode(chr(10), $this->lConf['titles']); } // define the attributes if (trim($this->lConf['attributes'])) { $this->attributes = t3lib_div::trimExplode(chr(10), $this->lConf['attributes']); } // options if ($this->lConf['optionsOverride'] || trim($this->lConf['options'])) { $this->conf['config.'][$this->lConf['style'] . 'Options'] = $this->lConf['options']; $this->conf['config.'][$this->lConf['style'] . 'OptionsOverride'] = $this->lConf['optionsOverride']; } $view = $this->conf['views.'][$this->conf['config.']['view'] . '.']; if ($this->conf['config.']['view'] == 'page') { // get the page ID's $page_ids = t3lib_div::trimExplode(",", $this->cObj->data['tx_jfmulticontent_pages']); // get the informations for every page for ($a = 0; $a < count($page_ids); $a++) { $GLOBALS['TSFE']->register['pid'] = $page_ids[$a]; if ($this->confArr['useOwnUserFuncForPages']) { // TemplaVoila will render the content with a userFunc $this->cElements[] = $this->cObj->cObjGetSingle($view['content'], $view['content.']); $this->rels[] = $this->cObj->cObjGetSingle($view['rel'], $view['rel.']); } else { $row = NULL; if ($GLOBALS['TSFE']->sys_language_content) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages_language_overlay', 'deleted=0 AND hidden=0 AND pid=' . intval($page_ids[$a]) . ' AND sys_language_uid=' . $GLOBALS['TSFE']->sys_language_content, '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); } if (!is_array($row)) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', 'deleted=0 AND hidden=0 AND uid=' . intval($page_ids[$a]), '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); } if (is_array($row)) { foreach ($row as $key => $val) { $GLOBALS['TSFE']->register['page_' . $key] = $val; } } $this->cElements[] = $this->cObj->cObjGetSingle($view['content'], $view['content.']); $this->rels[] = $this->cObj->cObjGetSingle($view['rel'], $view['rel.']); $this->content_id[$a] = $page_ids[$a]; } if ($this->titles[$a] == '' || !isset($this->titles[$a])) { $this->titles[$a] = $this->cObj->cObjGetSingle($view['title'], $view['title.']); } } } else { if ($this->conf['config.']['view'] == 'content') { // get the content ID's $content_ids = t3lib_div::trimExplode(",", $this->cObj->data['tx_jfmulticontent_contents']); // get the informations for every content for ($a = 0; $a < count($content_ids); $a++) { // Select the content $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'uid=' . intval($content_ids[$a]), '', '', 1); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); if ($GLOBALS['TSFE']->sys_language_content) { $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); } $GLOBALS['TSFE']->register['uid'] = $row['_LOCALIZED_UID'] ? $row['_LOCALIZED_UID'] : $row['uid']; $GLOBALS['TSFE']->register['title'] = strlen(trim($this->titles[$a])) > 0 ? $this->titles[$a] : $row['header']; if ($this->titles[$a] == '' || !isset($this->titles[$a])) { $this->titles[$a] = $this->cObj->cObjGetSingle($view['title'], $view['title.']); $GLOBALS['TSFE']->register['title'] = $this->titles[$a]; } $this->cElements[] = $this->cObj->cObjGetSingle($view['content'], $view['content.']); $this->rels[] = $this->cObj->cObjGetSingle($view['rel'], $view['rel.']); $this->content_id[$a] = $content_ids[$a]; } } else { if ($this->conf['config.']['view'] == 'irre') { // get the content ID's $elementUID = $this->cObj->data['_LOCALIZED_UID'] ? $this->cObj->data['_LOCALIZED_UID'] : $this->cObj->data['uid']; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'tx_jfmulticontent_irre_parentid=' . intval($elementUID) . ' AND deleted = 0 AND hidden = 0', '', 'sorting ASC'); $a = 0; while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($GLOBALS['TSFE']->sys_language_content) { $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tt_content', $row, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); } $GLOBALS['TSFE']->register['uid'] = $row['_LOCALIZED_UID'] ? $row['_LOCALIZED_UID'] : $row['uid']; $GLOBALS['TSFE']->register['title'] = strlen(trim($this->titles[$a])) > 0 ? $this->titles[$a] : $row['header']; if ($this->titles[$a] == '' || !isset($this->titles[$a])) { $this->titles[$a] = $this->cObj->cObjGetSingle($view['title'], $view['title.']); $GLOBALS['TSFE']->register['title'] = $this->titles[$a]; } $this->cElements[] = $this->cObj->cObjGetSingle($view['content'], $view['content.']); $this->rels[] = $this->cObj->cObjGetSingle($view['rel'], $view['rel.']); $this->content_id[$a] = $row['uid']; $a++; } } } } // HOOK for additional views if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jfmulticontent']['getViews'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['jfmulticontent']['getViews'] as $_classRef) { $_procObj =& t3lib_div::getUserObj($_classRef); if ($this->conf['config.']['view'] == $_procObj->getIdentifier()) { if (!method_exists($_procObj, 'isActive') || method_exists($_procObj, 'isActive') && $_procObj->isActive()) { // If the methode "isActive" not exists, this will be true... $_procObj->main($this->content, $this->conf, $this); $this->titles = $_procObj->getTitles(); $this->cElements = $_procObj->getElements(); $this->content_id = $_procObj->getIds(); if (method_exists($_procObj, 'getRels')) { $this->rels = $_procObj->getRels(); } } } } } // define the key of the element $this->setContentKey('jfmulticontent_c' . $this->cObj->data['uid']); } else { // TS config will be used // define the key of the element if ($this->conf['config.']['contentKey']) { $this->setContentKey($this->conf['config.']['contentKey']); } else { $this->setContentKey('jfmulticontent_ts1'); } // Render the contents if (count($this->conf['contents.']) > 0) { foreach ($this->conf['contents.'] as $key => $contents) { $title = trim($this->cObj->cObjGetSingle($contents['title'], $contents['title.'])); $content = trim($this->cObj->cObjGetSingle($contents['content'], $contents['content.'])); if ($content) { $this->titles[] = $title; $this->cElements[] = $content; $this->rels[] = $this->cObj->cObjGetSingle($contents['rel'], $contents['rel.']); $this->content_id[] = $this->cObj->stdWrap($contents['id'], $contents['id.']); } } } } $this->contentCount = count($this->cElements); // return FALSE, if there is no element if ($this->contentCount == 0) { return FALSE; } // The template if (!($this->templateFile = $this->cObj->fileResource($this->conf['templateFile']))) { $this->templateFile = $this->cObj->fileResource("EXT:jfmulticontent/res/tx_jfmulticontent_pi1.tmpl"); } // The template for JS if (!($this->templateFileJS = $this->cObj->fileResource($this->conf['templateFileJS']))) { $this->templateFileJS = $this->cObj->fileResource("EXT:jfmulticontent/res/tx_jfmulticontent_pi1.js"); } // define the jQuery mode and function if ($this->conf['jQueryNoConflict']) { $jQueryNoConflict = "jQuery.noConflict();"; } else { $jQueryNoConflict = ""; } // style switch ($this->conf['config.']['style']) { case "2column": $this->templatePart = "TEMPLATE_COLUMNS"; $this->contentCount = 2; $this->classes = array($this->conf['config.']["column1"], $this->conf['config.']["column2"]); $this->contentClass = t3lib_div::trimExplode("|*|", $this->conf['2columnClasses']); $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['columnWrap.']['wrap']); break; case "3column": $this->templatePart = "TEMPLATE_COLUMNS"; $this->contentCount = 3; $this->classes = array($this->conf['config.']["column1"], $this->conf['config.']["column2"], $this->conf['config.']["column3"]); $this->contentClass = t3lib_div::trimExplode("|*|", $this->conf['3columnClasses']); $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['columnWrap.']['wrap']); break; case "4column": $this->templatePart = "TEMPLATE_COLUMNS"; $this->contentCount = 4; $this->classes = array($this->conf['config.']["column1"], $this->conf['config.']["column2"], $this->conf['config.']["column3"], $this->conf['config.']["column4"]); $this->contentClass = t3lib_div::trimExplode("|*|", $this->conf['4columnClasses']); $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['columnWrap.']['wrap']); break; case "5column": $this->templatePart = "TEMPLATE_COLUMNS"; $this->contentCount = 5; $this->classes = array($this->conf['config.']["column1"], $this->conf['config.']["column2"], $this->conf['config.']["column3"], $this->conf['config.']["column4"], $this->conf['config.']["column5"]); $this->contentClass = t3lib_div::trimExplode("|*|", $this->conf['5columnClasses']); $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['columnWrap.']['wrap']); break; case "tab": // jQuery Tabs $this->templatePart = "TEMPLATE_TAB"; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['tabWrap.']['wrap']); // the id attribute is not permitted in tabs-style if (count($this->attributes) > 0) { foreach ($this->attributes as $key => $attribute) { if (preg_match("/id=[\"|\\'](.*?)[\"|\\']/i", $attribute, $preg)) { $this->attributes[$key] = trim(str_replace($preg[0], "", $attribute)); } } } $this->pagerenderer->addJS($jQueryNoConflict); $options = array(); if ($this->conf['config.']['tabCollapsible']) { $options['collapsible'] = "collapsible:true"; if (!$this->conf['config.']['tabOpen']) { $options['active'] = "active:false"; } } if ($this->conf['config.']['tabRandomContent']) { $options['active'] = "active:Math.floor(Math.random()*{$this->contentCount})"; } elseif (is_numeric($this->conf['config.']['tabOpen'])) { $options['active'] = "active:" . ($this->conf['config.']['tabOpen'] - 1); } if (in_array($this->conf['config.']['tabEvent'], array('click', 'mouseover'))) { $options['event'] = "event:'{$this->conf['config.']['tabEvent']}'"; } if (in_array($this->conf['config.']['tabHeightStyle'], array('auto', 'fill', 'content'))) { $options['heightStyle'] = "heightStyle:'{$this->conf['config.']['tabHeightStyle']}'"; } // Add Cookies script, if cookie is active if ($this->conf['config.']['tabCookieExpires'] > 0 && $this->conf['config.']['tabOpen'] != -1) { if (T3JQUERY !== TRUE) { $this->pagerenderer->addJsFile($this->conf['jQueryCookies']); } unset($options['active']); $cookie_path = t3lib_div::getIndpEnv('REQUEST_URI'); if ($this->lConf['tabCookieRoot'] || preg_match("/^\\/index.php/i", $cookie_path)) { $cookie_path = "/"; } $options['activate'] = "activate:function(e,ui) { jQuery.cookie('{$this->getContentKey()}', ui.newTab.index(), { expires: " . $this->conf['config.']['tabCookieExpires'] . ", path:'{$cookie_path}' }); }"; $options['active'] = "active:jQuery.cookie('{$this->getContentKey()}')"; } if ($this->conf['config.']['tabHideEffect'] == 'none') { $options['hide'] = "hide:false"; } elseif ($this->conf['config.']['tabHideEffect']) { $fx = array(); $fx[] = "effect:'{$this->conf['config.']['tabHideEffect']}'"; if (is_numeric($this->conf['config.']['tabHideTransitionduration'])) { $fx[] = "duration:'{$this->conf['config.']['tabHideTransitionduration']}'"; } if ($this->conf['config.']['tabHideTransition']) { $fx[] = "easing:'" . (in_array($this->conf['config.']['tabHideTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['tabHideTransitiondir']}") . "{$this->conf['config.']['tabHideTransition']}'"; } $options['hide'] = "hide:{" . implode(',', $fx) . "}"; } if ($this->conf['config.']['tabShowEffect'] == 'none') { $options['show'] = "show:false"; } elseif ($this->conf['config.']['tabShowEffect']) { $fx = array(); $fx[] = "effect:'{$this->conf['config.']['tabShowEffect']}'"; if (is_numeric($this->conf['config.']['tabShowTransitionduration'])) { $fx[] = "duration:'{$this->conf['config.']['tabShowTransitionduration']}'"; } if ($this->conf['config.']['tabShowTransition']) { $fx[] = "easing:'" . (in_array($this->conf['config.']['tabShowTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['tabShowTransitiondir']}") . "{$this->conf['config.']['tabShowTransition']}'"; } $options['show'] = "show:{" . implode(',', $fx) . "}"; } // overwrite all options if set if ($this->conf['config.']['tabOptionsOverride']) { $options = array($this->conf['config.']['tabOptions']); } else { if ($this->conf['config.']['tabOptions']) { $options['options'] = $this->conf['config.']['tabOptions']; } } // get the Template of the Javascript $markerArray = array(); // get the template if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_TAB_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_TAB_JS is missing", TRUE); } // open tab by hash if ($this->confArr['tabSelectByHash']) { $tabSelector = trim($this->cObj->getSubpart($templateCode, "###TAB_SELECT_BY_HASH###")); } else { $tabSelector = NULL; } $templateCode = trim($this->cObj->substituteSubpart($templateCode, '###TAB_SELECT_BY_HASH###', $tabSelector, 0)); // app the open-link-template if ($this->confArr['openExternalLink']) { $openExtLink = trim($this->cObj->getSubpart($templateCode, "###OPEN_EXTERNAL_LINK###")); } else { $openExtLink = NULL; } $templateCode = trim($this->cObj->substituteSubpart($templateCode, '###OPEN_EXTERNAL_LINK###', $openExtLink, 0)); // Replace default values $markerArray["KEY"] = $this->getContentKey(); $markerArray["PREG_QUOTE_KEY"] = preg_quote($this->getContentKey(), "/"); $markerArray["OPTIONS"] = implode(", ", $options); $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); $this->pagerenderer->addJsFile($this->conf['jQueryEasing']); $this->pagerenderer->addJsFile($this->conf['jQueryUI']); } $this->pagerenderer->addCssFile($this->conf['jQueryUIstyle']); $this->pagerenderer->addJS($templateCode); break; case "accordion": // jQuery Accordion $this->templatePart = "TEMPLATE_ACCORDION"; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['accordionWrap.']['wrap']); $this->pagerenderer->addJS($jQueryNoConflict); $options = array(); if ($this->conf['config.']['accordionCollapsible']) { $options['collapsible'] = "collapsible:true"; } if ($this->conf['config.']['accordionClosed']) { $options['active'] = "active:false"; $options['collapsible'] = "collapsible:true"; } elseif ($this->conf['config.']['accordionRandomContent']) { $options['active'] = "active:Math.floor(Math.random()*{$this->contentCount})"; } elseif ($this->conf['config.']['accordionOpen'] > 0) { $options['active'] = "active:" . ($this->conf['config.']['accordionOpen'] - 1); } if (in_array($this->conf['config.']['accordionEvent'], array('click', 'mouseover'))) { $options['event'] = "event:'{$this->conf['config.']['accordionEvent']}'"; } if (in_array($this->conf['config.']['accordionHeightStyle'], array('auto', 'fill', 'content'))) { $options['heightStyle'] = "heightStyle:'{$this->conf['config.']['accordionHeightStyle']}'"; } // get the Template of the Javascript $markerArray = array(); $markerArray["KEY"] = $this->getContentKey(); $markerArray["CONTENT_COUNT"] = $this->contentCount; $markerArray["EASING"] = in_array($this->conf['config.']['accordionTransition'], array("swing", "linear")) ? "" : "ease" . $this->conf['config.']['accordionTransitiondir'] . $this->conf['config.']['accordionTransition']; $markerArray["TRANS_DURATION"] = is_numeric($this->conf['config.']['accordionTransitionduration']) ? $this->conf['config.']['accordionTransitionduration'] : 1000; // get the template for the Javascript if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_ACCORDION_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_ACCORDION_JS is missing", TRUE); } $easingAnimation = NULL; if (!$this->conf['config.']['accordionAnimate']) { $options['animate'] = "animate:false"; } else { $fx = array(); if (is_numeric($this->conf['config.']['accordionTransitionduration'])) { $fx[] = "duration:'{$this->conf['config.']['accordionTransitionduration']}'"; } if ($this->conf['config.']['accordionTransition']) { $fx[] = "easing:'" . (in_array($this->conf['config.']['accordionTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['accordionTransitiondir']}") . "{$this->conf['config.']['accordionTransition']}'"; } $options['animate'] = "animate:{" . implode(',', $fx) . "}"; } // app the open-link-template if ($this->confArr['openExternalLink']) { $openExtLink = trim($this->cObj->getSubpart($templateCode, "###OPEN_EXTERNAL_LINK###")); } else { $openExtLink = NULL; } $templateCode = trim($this->cObj->substituteSubpart($templateCode, '###OPEN_EXTERNAL_LINK###', $openExtLink, 0)); // open tab by hash if ($this->confArr['tabSelectByHash']) { $tabSelector = trim($this->cObj->getSubpart($templateCode, "###TAB_SELECT_BY_HASH###")); } else { $tabSelector = NULL; } $templateCode = trim($this->cObj->substituteSubpart($templateCode, '###TAB_SELECT_BY_HASH###', $tabSelector, 0)); // overwrite all options if set if ($this->conf['config.']['accordionOptionsOverride']) { $options = array($this->conf['config.']['accordionOptions']); } else { if ($this->conf['config.']['accordionOptions']) { $options['options'] = $this->conf['config.']['accordionOptions']; } } // Replace default values $markerArray["OPTIONS"] = implode(", ", $options); // Replace all markers $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); $this->pagerenderer->addJsFile($this->conf['jQueryEasing']); $this->pagerenderer->addJsFile($this->conf['jQueryUI']); } $this->pagerenderer->addCssFile($this->conf['jQueryUIstyle']); $this->pagerenderer->addJS(trim($templateCode)); break; case "slider": // anythingslider $this->templatePart = "TEMPLATE_SLIDER"; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['sliderWrap.']['wrap']); $this->pagerenderer->addJS($jQueryNoConflict); // if ($this->conf['config.']['sliderTransition']) { $options[] = "easing: '" . (in_array($this->conf['config.']['sliderTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['sliderTransitiondir']}") . "{$this->conf['config.']['sliderTransition']}'"; } if ($this->conf['config.']['sliderTransitionduration'] > 0) { $options[] = "animationTime: {$this->conf['config.']['sliderTransitionduration']}"; } if ($this->conf['config.']['sliderAutoplay']) { $options[] = "autoPlay: true"; } else { $options[] = "autoPlay: false"; } if ($this->conf['config.']['delayDuration'] > 0) { $options[] = "delay: {$this->conf['config.']['delayDuration']}"; $options[] = "startStopped: " . ($this->conf['config.']['sliderAutoStart'] ? 'false' : 'true'); $options[] = "stopAtEnd: " . ($this->conf['config.']['sliderStopAtEnd'] ? 'true' : 'false'); } else { // Toggle only if not autoplay $options[] = "toggleArrows: " . ($this->conf['config.']['sliderToggleArrows'] ? 'true' : 'false'); $options[] = "toggleControls: " . ($this->conf['config.']['sliderToggleControls'] ? 'true' : 'false'); } $sliderWidth = trim($this->conf['config.']['sliderWidth']); $sliderHeight = trim($this->conf['config.']['sliderHeight']); if ($sliderWidth || $sliderHeight) { if (is_numeric($sliderWidth)) { $sliderWidth .= 'px'; } if (is_numeric($sliderHeight)) { $sliderHeight .= 'px'; } $this->pagerenderer->addCSS("#{$this->getContentKey()} {\n" . ($sliderWidth ? "\twidth: {$sliderWidth};\n" : "") . ($sliderHeight ? "\theight: {$sliderHeight};\n" : "") . "}"); } if ($this->conf['config.']['sliderResizeContents']) { $options[] = "resizeContents: true"; } $this->pagerenderer->addCssFile($this->conf['sliderCSS']); $this->pagerenderer->addCssFileInc($this->conf['sliderCSSie7'], 'lte IE 7'); if ($this->conf['config.']['sliderTheme']) { $options[] = "theme: '" . t3lib_div::slashJS($this->conf['config.']['sliderTheme']) . "'"; if (substr($this->confArr['anythingSliderThemeFolder'], 0, 4) === 'EXT:') { list($extKey, $local) = explode('/', substr($this->confArr['anythingSliderThemeFolder'], 4), 2); $anythingSliderThemeFolder = t3lib_extMgm::siteRelPath($extKey) . $local; } else { $anythingSliderThemeFolder = $this->confArr['anythingSliderThemeFolder']; } $this->pagerenderer->addCssFile(t3lib_div::slashJS($anythingSliderThemeFolder) . $this->conf['config.']['sliderTheme'] . '/style.css'); } if ($this->conf['config.']['sliderMode']) { $options[] = "mode: '" . $this->conf['config.']['sliderMode'] . "'"; } $options[] = "buildArrows: " . ($this->conf['config.']['sliderBuildArrows'] ? 'true' : 'false'); $options[] = "allowRapidChange: " . ($this->conf['config.']['sliderAllowRapidChange'] ? 'true' : 'false'); $options[] = "resumeOnVideoEnd: " . ($this->conf['config.']['sliderResumeOnVideoEnd'] ? 'true' : 'false'); $options[] = "playRtl: " . ($this->conf['config.']['sliderPlayRtl'] ? 'true' : 'false'); $options[] = "hashTags: " . ($this->conf['config.']['sliderHashTags'] ? 'true' : 'false'); $options[] = "pauseOnHover: " . ($this->conf['config.']['sliderPauseOnHover'] ? 'true' : 'false'); $options[] = "buildNavigation: " . ($this->conf['config.']['sliderNavigation'] ? 'true' : 'false'); $options[] = "buildStartStop: " . ($this->conf['config.']['sliderStartStop'] ? 'true' : 'false'); $options[] = "startText: '" . t3lib_div::slashJS($this->pi_getLL('slider_start')) . "'"; $options[] = "stopText: '" . t3lib_div::slashJS($this->pi_getLL('slider_stop')) . "'"; if ($this->pi_getLL('slider_forward')) { $options[] = "forwardText: '" . t3lib_div::slashJS($this->pi_getLL('slider_forward')) . "'"; } if ($this->pi_getLL('slider_back')) { $options[] = "backText: '" . t3lib_div::slashJS($this->pi_getLL('slider_back')) . "'"; } // define the paneltext if ($this->conf['config.']['sliderPanelFromHeader']) { $tab = array(); for ($a = 0; $a < $this->contentCount; $a++) { $tab[] = "if(i==" . ($a + 1) . ") return " . t3lib_div::quoteJSvalue($this->titles[$a]) . ";"; } $options[] = "navigationFormatter: function(i,p){\n\t\t\t" . implode("\n\t\t\t", $tab) . "\n\t\t}"; } elseif (trim($this->pi_getLL('slider_panel'))) { $options[] = "navigationFormatter: function(i,p){ var str = '" . t3lib_div::slashJS($this->pi_getLL('slider_panel')) . "'; return str.replace('%i%',i); }"; } if ($this->conf['config.']['sliderRandomContent']) { $options[] = "startPanel: Math.floor(Math.random()*" . ($this->contentCount + 1) . ")"; } elseif ($this->conf['config.']['sliderOpen'] > 1) { $options[] = "startPanel: " . ($this->conf['config.']['sliderOpen'] < $this->contentCount ? $this->conf['config.']['sliderOpen'] : $this->contentCount); } // overwrite all options if set if ($this->conf['config.']['sliderOptionsOverride']) { $options = array($this->conf['config.']['sliderOptions']); } else { if ($this->conf['config.']['sliderOptions']) { $options[] = $this->conf['config.']['sliderOptions']; } } // get the Template of the Javascript $markerArray = array(); // get the template if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_SLIDER_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_SLIDER_JS is missing", TRUE); } // Replace default values $markerArray["KEY"] = $this->getContentKey(); $markerArray["OPTIONS"] = implode(", ", $options); $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); $this->pagerenderer->addJsFile($this->conf['jQueryEasing']); } $this->pagerenderer->addJsFile($this->conf['sliderJS']); if ($this->conf['config.']['sliderResumeOnVideoEnd']) { $this->pagerenderer->addJsFile($this->conf['sliderJSvideo']); } $this->pagerenderer->addJS($templateCode); break; case "slidedeck": // SlideDeck $this->templatePart = "TEMPLATE_SLIDEDECK"; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['slidedeckWrap.']['wrap']); $this->pagerenderer->addJS($jQueryNoConflict); $options = array(); if ($this->conf['config.']['slidedeckTransitionduration']) { $options['speed'] = "speed: {$this->conf['config.']['slidedeckTransitionduration']}"; } if ($this->conf['config.']['slidedeckTransition']) { $options['transition'] = "transition: '" . (in_array($this->conf['config.']['slidedeckTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['slidedeckTransitiondir']}") . "{$this->conf['config.']['slidedeckTransition']}'"; } if ($this->conf['config.']['slidedeckStart']) { $options['start'] = "start: {$this->conf['config.']['slidedeckStart']}"; } $options['activeCorner'] = "activeCorner: " . ($this->conf['config.']['slidedeckActivecorner'] ? 'true' : 'false'); $options['index'] = "index: " . ($this->conf['config.']['slidedeckIndex'] ? 'true' : 'false'); $options['scroll'] = "scroll: " . ($this->conf['config.']['slidedeckScroll'] ? 'true' : 'false'); $options['keys'] = "keys: " . ($this->conf['config.']['slidedeckKeys'] ? 'true' : 'false'); $options['hideSpines'] = "hideSpines: " . ($this->conf['config.']['slidedeckHidespines'] ? 'true' : 'false'); if ($this->conf['config.']['delayDuration'] > 0) { $options['autoPlay'] = "autoPlay: true"; $options['autoPlayInterval'] = "autoPlayInterval: {$this->conf['config.']['delayDuration']}"; $options['cycle'] = "cycle: " . ($this->conf['config.']['autoplayCycle'] ? 'true' : 'false'); } // overwrite all options if set if ($this->conf['config.']['slidedeckOptionsOverride']) { $options = array($this->conf['config.']['slidedeckOptions']); } else { if ($this->conf['config.']['slidedeckOptions']) { $options['options'] = $this->conf['config.']['slidedeckOptions']; } } // get the template for the Javascript if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_SLIDEDECK_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_SLIDEDECK_JS is missing", TRUE); } // Replace default values $markerArray = array(); $markerArray["KEY"] = $this->getContentKey(); $markerArray["HEIGHT"] = $this->conf['config.']['slidedeckHeight'] > 0 ? $this->conf['config.']['slidedeckHeight'] : 300; $markerArray["OPTIONS"] = implode(", ", $options); // Replace all markers $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); $this->pagerenderer->addJsFile($this->conf['jQueryEasing']); } $this->pagerenderer->addJsFile($this->conf['slidedeckJS']); $this->pagerenderer->addCssFile($this->conf['slidedeckCSS']); if ($this->conf['config.']['slidedeckScroll']) { $this->pagerenderer->addJsFile($this->conf['jQueryMouseWheel']); } $this->pagerenderer->addJS(trim($templateCode)); break; case "easyaccordion": // easyaccordion $this->templatePart = "TEMPLATE_EASYACCORDION"; $this->additionalMarker["SKIN"] = $this->conf['config.']['easyaccordionSkin']; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['easyaccordionWrap.']['wrap']); $this->pagerenderer->addJS($jQueryNoConflict); $options = array(); if ($this->conf['config.']['delayDuration'] > 0) { $options['autoStart'] = "autoStart: true"; $options['slideInterval'] = "slideInterval: {$this->conf['config.']['delayDuration']}"; } $options['slideNum'] = "slideNum: " . ($this->conf['config.']['easyaccordionSlideNum'] ? 'true' : 'false'); // overwrite all options if set if ($this->conf['config.']['optionsOverride']) { $options = array($this->conf['config.']['slideOptions']); } else { if ($this->conf['config.']['slideOptions']) { $options['options'] = $this->conf['config.']['slideOptions']; } } // get the template for the Javascript if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_EASYACCORDION_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_EASYACCORDION_JS is missing", TRUE); } // Replace default values $markerArray = array(); $markerArray["KEY"] = $this->getContentKey(); $markerArray["WIDTH"] = $this->conf['config.']['easyaccordionWidth'] > 0 ? $this->conf['config.']['easyaccordionWidth'] : 600; $markerArray["OPTIONS"] = implode(", ", $options); // Replace all markers $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); } $this->pagerenderer->addJsFile($this->conf['easyaccordionJS']); $this->pagerenderer->addCssFile($this->conf['easyaccordionCSS']); $this->pagerenderer->addCssFile($this->confArr['easyAccordionSkinFolder'] . $this->conf['config.']['easyaccordionSkin'] . "/style.css"); $this->pagerenderer->addJS(trim($templateCode)); break; case "booklet": // easyaccordion $this->templatePart = "TEMPLATE_BOOKLET"; $this->contentWrap = t3lib_div::trimExplode("|*|", $this->conf['bookletWrap.']['wrap']); $this->pagerenderer->addJS($jQueryNoConflict); $options = array(); if (is_numeric($this->conf['config.']['bookletWidth'])) { $options['width'] = "width: " . $this->conf['config.']['bookletWidth']; } if (is_numeric($this->conf['config.']['bookletHeight'])) { $options['height'] = "height: " . $this->conf['config.']['bookletHeight']; } if (is_numeric($this->conf['config.']['bookletSpeed'])) { $options['speed'] = "speed: " . $this->conf['config.']['bookletSpeed']; } if (is_numeric($this->conf['config.']['bookletStartingPage'])) { $options['startingPage'] = "startingPage: " . $this->conf['config.']['bookletStartingPage']; } if ($this->conf['config.']['bookletRTL']) { $options['direction'] = "direction: 'RTL'"; } if ($this->conf['config.']['bookletTransition']) { $options['transition'] = "easing: '" . (in_array($this->conf['config.']['bookletTransition'], array("swing", "linear")) ? "" : "ease{$this->conf['config.']['bookletTransitiondir']}") . "{$this->conf['config.']['bookletTransition']}'"; } if (is_numeric($this->conf['config.']['bookletPagePadding'])) { $options['pagePadding'] = "pagePadding: " . $this->conf['config.']['bookletPagePadding']; } $options['pageNumbers'] = "pageNumbers: " . ($this->conf['config.']['bookletPageNumbers'] ? 'true' : 'false'); $options['manual'] = "manual: " . ($this->conf['config.']['bookletManual'] ? 'true' : 'false'); $options['shadows'] = "shadows: " . ($this->conf['config.']['bookletShadows'] ? 'true' : 'false'); $options['closed'] = "closed: " . ($this->conf['config.']['bookletClosed'] ? 'true' : 'false'); $options['covers'] = "covers: " . ($this->conf['config.']['bookletCovers'] ? 'true' : 'false'); $options['autoCenter'] = "autoCenter: " . ($this->conf['config.']['bookletAutoCenter'] ? 'true' : 'false'); $options['hash'] = "hash: " . ($this->conf['config.']['bookletHash'] ? 'true' : 'false'); $options['keyboard'] = "keyboard: " . ($this->conf['config.']['bookletKeyboard'] ? 'true' : 'false'); $options['overlays'] = "overlays: " . ($this->conf['config.']['bookletOverlays'] ? 'true' : 'false'); $options['arrows'] = "arrows: " . ($this->conf['config.']['bookletArrows'] ? 'true' : 'false'); $options['arrowsHide'] = "arrowsHide: " . ($this->conf['config.']['bookletArrowsHide'] ? 'true' : 'false'); $options['hovers'] = "hovers: " . ($this->conf['config.']['bookletHovers'] ? 'true' : 'false'); // overwrite all options if set if ($this->conf['config.']['bookletOptionsOverride']) { $options = array($this->conf['config.']['bookletOptions']); } else { if ($this->conf['config.']['bookletOptions']) { $options['options'] = $this->conf['config.']['bookletOptions']; } } // get the template for the Javascript if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_BOOKLET_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_BOOKLET_JS is missing", TRUE); } // Replace default values $markerArray = array(); $markerArray["KEY"] = $this->getContentKey(); $markerArray["OPTIONS"] = implode(",\n\t\t", $options); // Replace all markers $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); // Add all CSS and JS files if (T3JQUERY === TRUE) { tx_t3jquery::addJqJS(); } else { $this->pagerenderer->addJsFile($this->conf['jQueryLibrary'], TRUE); $this->pagerenderer->addJsFile($this->conf['jQueryEasing']); } $this->pagerenderer->addJsFile($this->conf['bookletJS']); $this->pagerenderer->addCssFile($this->conf['bookletCSS']); $this->pagerenderer->addJS(trim($templateCode)); break; default: return $this->outputError("NO VALID TEMPLATE SELECTED", FALSE); } // add the CSS file $this->pagerenderer->addCssFile($this->conf['cssFile']); // Add the ressources if (!$this->conf['disableJs']) { $this->pagerenderer->addResources(); } // Render the Template $content = $this->renderTemplate(); return $this->pi_wrapInBaseClass($content); }
/** * * @return void */ function pi_addJS() { $this->pagerenderer->addJS("\nvar feuser_friends = {\n\tdialogToAdd: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[addfriendrequest]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[addfriendrequest]='+uid+'&tx_feuserfriends_pi1[send]=1'+'&'+jQuery('textarea[name=\"tx_feuserfriends_pi1[invitation]\"]').serialize(),\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_add_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogToRemove: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[removefriend]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[removefriend]='+uid+'&tx_feuserfriends_pi1[send]=1',\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tjQuery('#friends_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_remove_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogToAccept: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[showfriendrequest]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('friends_request_accept')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[acceptfriend]='+uid,\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tjQuery('#friendsrequest_link_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('friends_request_reject')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[rejectfriend]='+uid,\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tjQuery('#friendsrequest_link_'+uid).hide('blind');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_request_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\tdialogSendMessage: function(uid) {\n\t\tjQuery('#dialog').remove();\n\t\tjQuery.ajax({\n\t\t\ttype: 'get',\n\t\t\turl: 'index.php',\n\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[sendmessage]='+uid,\n\t\t\tsuccess: function(html, status) {\n\t\t\t\tjQuery('body').append('<div id=\"dialog\">'+html+'</div>');\n\t\t\t\tjQuery('#dialog').dialog({\n\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('ok')) . "': function() {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\ttype: 'get',\n\t\t\t\t\t\t\t\turl: 'index.php',\n\t\t\t\t\t\t\t\tdata: 'type={$this->conf['ajaxTypeNum']}&tx_feuserfriends_pi1[sendmessage]='+uid+'&tx_feuserfriends_pi1[send]=1'+'&'+jQuery('textarea[name=\"tx_feuserfriends_pi1[message]\"]').serialize(),\n\t\t\t\t\t\t\t\tsuccess: function(html, status) {\n\t\t\t\t\t\t\t\t\tif ('{$this->conf['messageTagID']}' == '') {\n\t\t\t\t\t\t\t\t\t\talert(html);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tjQuery('#" . $this->conf['messageTagID'] . "').html(html);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'" . t3lib_div::slashJS($this->pi_getLL('cancel')) . "': function() {\n\t\t\t\t\t\t\tjQuery(this).dialog('close');\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\ttitle: '" . t3lib_div::slashJS($this->pi_getLL('friends_add_title')) . "'\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n};"); }
/** * This prints out a TYPO3 error message. * * @param string Header string * @param string Message string * @param boolean If set, then this will produce a alert() line for inclusion in JavaScript. * @param string URL for the <base> tag (if you want it) * @return string * @deprecated since TYPO3 4.5, will be removed in TYPO3 4.7 - use RuntimeException from now on */ public function debug_typo3PrintError($header, $text, $js, $baseUrl = '') { if ($js) { $errorMessage = 'alert(\'' . t3lib_div::slashJS($header . '\\n' . $text) . '\');'; } else { t3lib_div::logDeprecatedFunction(); $messageObj = t3lib_div::makeInstance('t3lib_message_ErrorPageMessage', $text, $header); $errorMessage = $messageObj->render(); } // Hook to modify error message if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'])) { $params = array('header' => $header, 'text' => $text, 'js' => $js, 'baseUrl' => $baseUrl, 'errorMessage' => &$errorMessage); $null = NULL; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_timetrack.php']['debug_typo3PrintError'] as $hookMethod) { t3lib_div::callUserFunction($hookMethod, $params, $null); } } echo $errorMessage; }
/** * Print error message with header, text etc. * Usage: 19 * * @param string Header string * @param string Content string * @param boolean Will return an alert() with the content of header and text. * @param boolean Print header. * @return void */ public static function typo3PrintError($header, $text, $js = '', $head = 1) { // This prints out a TYPO3 error message. // If $js is set the message will be output in JavaScript if ($js) { echo "alert('" . t3lib_div::slashJS($header . '\\n' . $text) . "');"; } else { echo $head ? '<html> <head> <title>Error!</title> </head> <body bgcolor="white" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">' : ''; echo '<div align="center"> <table border="0" cellspacing="0" cellpadding="0" width="333"> <tr> <td align="center">' . ($GLOBALS['TBE_STYLES']['logo_login'] ? '<img src="' . $GLOBALS['BACK_PATH'] . $GLOBALS['TBE_STYLES']['logo_login'] . '" alt="" />' : '<img src="' . $GLOBALS['BACK_PATH'] . 'gfx/typo3logo.gif" width="123" height="34" vspace="10" />') . '</td> </tr> <tr> <td bgcolor="black"> <table width="100%" border="0" cellspacing="1" cellpadding="10"> <tr> <td bgcolor="#F4F0E8"> <font face="verdana,arial,helvetica" size="2">'; echo '<strong><center><font size="+1">' . $header . '</font></center></strong><br />' . $text; echo ' </font> </td> </tr> </table> </td> </tr> </table> </div>'; echo $head ? ' </body> </html>' : ''; } }
public function getExtSlider($PA, &$fObj) { $checkboxCode = NULL; // Define the unique vars $id_slider = uniqid('tceforms-slider-'); $id_checkbox = uniqid('tceforms-check-'); $var = uniqid('slider_'); // The config from TCA-Field $conf = $PA['fieldConf']['config']; // Label $label = $conf['label']; // define the options if (is_numeric($conf['width'])) { $option[] = "width: {$conf['width']}"; } $lower = 0; if (is_numeric($conf['range']['lower'])) { $lower = $conf['range']['lower']; $option[] = "minValue: {$lower}"; } if (is_numeric($conf['range']['upper'])) { $option[] = "maxValue: {$conf['range']['upper']}"; } if (is_numeric($conf['decimalPrecision'])) { $option[] = "decimalPrecision: {$conf['decimalPrecision']}"; } // $default = is_numeric($conf['default']) ? $conf['default'] : $lower; $value = is_numeric($PA['itemFormElValue']) ? $PA['itemFormElValue'] : $default; $option[] = "value: " . $value; $emptyValue = $conf['emptyValue'] ? $conf['emptyValue'] : '0'; if (!is_numeric($PA['itemFormElValue']) && $emptyValue) { $disabled = TRUE; } else { $disabled = FALSE; } $option[] = "disabled: " . ($disabled ? 'true' : 'false'); $option[] = "renderTo: '{$id_slider}-outer'"; // Language vars $from_ts = $GLOBALS['LANG']->sL('LLL:EXT:jftcaforms/locallang_db.xml:tt_content.pi_flexform.from_ts'); if (!$from_ts) { $from_ts = 'From TS'; } // get the pagerenderer $pagerender = $GLOBALS['TBE_TEMPLATE']->getPageRenderer(); // Fix slider in hidden tabPanel $pagerender->addExtOnReadyCode("\n\t\tExt.override(Ext.Slider, {\n\t\t\tgetRatio: function() {\n\t\t\t\tvar w = this.innerEl.getComputedWidth();\n\t\t\t\tvar v = this.maxValue - this.minValue;\n\t\t\t\treturn (v == 0 ? w : (w/v));\n\t\t\t}\n\t\t});", TRUE); // Add the slider $pagerender->addExtOnReadyCode("\n\t\tvar {$var} = new Ext.Slider({\n\t\t\t" . implode(",\n\t", $option) . "\n\t\t});\n\t\t{$var}.on('change', function(slider, newValue) {\n\t\t\tExt.get('{$id_slider}').set({value: newValue});\n\t\t\tExt.get('{$id_slider}-num').update(newValue ? newValue : '0');\n\t\t});"); // The code for the checkbox will only be rendered, when emptyValue is set if ($emptyValue) { $pagerender->addExtOnReadyCode("\n\t\t\tExt.get('{$id_checkbox}').on('click', function(obj1, obj2) {\n\t\t\t\tif (obj2.checked) {\n\t\t\t\t\tExt.get('{$id_slider}').set({value: ''});\n\t\t\t\t\tExt.get('{$id_slider}-num').update('" . t3lib_div::slashJS($from_ts) . "');\n\t\t\t\t\t{$var}.disable();\n\t\t\t\t} else {\n\t\t\t\t\t{$var}.enable();\n\t\t\t\t\tvar newValue = {$var}.getValue();\n\t\t\t\t\tExt.get('{$id_slider}').set({value: newValue});\n\t\t\t\t\tExt.get('{$id_slider}-num').update(newValue ? newValue : '{$lower}');\n\t\t\t\t}\n\t\t\t});"); $checkboxCode = '<input type="checkbox" class="checkbox" id="' . $id_checkbox . '" name="' . $PA['itemFormElName'] . '_cb" style="float:left;"' . ($disabled ? ' checked="checked"' : '') . '>'; } return '' . '<input type="hidden" name="' . $PA['itemFormElName'] . '" value="' . ($disabled ? '' : $value) . '" id="' . $id_slider . '"/>' . $checkboxCode . '<div id="' . $id_slider . '-num">' . ($disabled ? $from_ts : $value) . '</div>' . '<div id="' . $id_slider . '-outer"></div>'; }
/** * Recursive rendering of flexforms * * @param array (part of) Data Structure for which to render. Keys on first level is flex-form fields * @param array (part of) Data array of flexform corresponding to the input DS. Keys on first level is flex-form field names * @param string Table name, eg. tt_content * @param string Field name, eg. tx_templavoila_flex * @param array The particular record from $table in which the field $field is found * @param array Array of standard information for rendering of a form field in TCEforms, see other rendering functions too * @param string Form field prefix, eg. "[data][sDEF][lDEF][...][...]" * @param integer Indicates nesting level for the function call * @param string Prefix for ID-values * @param boolean Defines whether the next flexform level is open or closed. Comes from _TOGGLE pseudo field in FlexForm xml. * @return string HTMl code for form. */ function getSingleField_typeFlex_draw($dataStruct, $editData, $table, $field, $row, &$PA, $formPrefix = '', $level = 0, $idPrefix = 'ID', $toggleClosed = FALSE) { $output = ''; $mayRestructureFlexforms = $GLOBALS['BE_USER']->checkLanguageAccess(0); // Data Structure array must be ... and array of course... if (is_array($dataStruct)) { foreach ($dataStruct as $key => $value) { // Traversing fields in structure: if (is_array($value)) { // The value of each entry must be an array. // ******************** // Making the row: // ******************** // Title of field: $theTitle = htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($value['tx_templavoila']['title']), 30)); // If it's a "section" or "container": if ($value['type'] == 'array') { // Creating IDs for form fields: // It's important that the IDs "cascade" - otherwise we can't dynamically expand the flex form because this relies on simple string substitution of the first parts of the id values. $thisId = t3lib_div::shortMd5(uniqid('id', TRUE)); // This is a suffix used for forms on this level $idTagPrefix = $idPrefix . '-' . $thisId; // $idPrefix is the prefix for elements on lower levels in the hierarchy and we combine this with the thisId value to form a new ID on this level. // If it's a "section" containing other elements: if ($value['section']) { // Load script.aculo.us if flexform sections can be moved by drag'n'drop: $GLOBALS['SOBE']->doc->getPageRenderer()->loadScriptaculous(); // Render header of section: $output .= '<div class="t3-form-field-label-flexsection"><strong>' . $theTitle . '</strong></div>'; // Render elements in data array for section: $tRows = array(); $cc = 0; if (is_array($editData[$key]['el'])) { foreach ($editData[$key]['el'] as $k3 => $v3) { $cc = $k3; if (is_array($v3)) { $theType = key($v3); $theDat = $v3[$theType]; $newSectionEl = $value['el'][$theType]; if (is_array($newSectionEl)) { $tRows[] = $this->getSingleField_typeFlex_draw(array($theType => $newSectionEl), array($theType => $theDat), $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el][' . $cc . ']', $level + 1, $idTagPrefix, $v3['_TOGGLE']); } } } } // Now, we generate "templates" for new elements that could be added to this section by traversing all possible types of content inside the section: // We have to handle the fact that requiredElements and such may be set during this rendering process and therefore we save and reset the state of some internal variables - little crude, but works... // Preserving internal variables we don't want to change: $TEMP_requiredElements = $this->requiredElements; // Traversing possible types of new content in the section: $newElementsLinks = array(); foreach ($value['el'] as $nnKey => $nCfg) { $additionalJS_post_saved = $this->additionalJS_post; $this->additionalJS_post = array(); $additionalJS_submit_saved = $this->additionalJS_submit; $this->additionalJS_submit = array(); $newElementTemplate = $this->getSingleField_typeFlex_draw(array($nnKey => $nCfg), array(), $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el][' . $idTagPrefix . '-form]', $level + 1, $idTagPrefix); // Makes a "Add new" link: $var = uniqid('idvar'); $replace = 'replace(/' . $idTagPrefix . '-/g,"' . $idTagPrefix . '-"+' . $var . '+"-")'; $onClickInsert = 'var ' . $var . ' = "' . 'idx"+(new Date()).getTime();'; // Do not replace $isTagPrefix in setActionStatus() because it needs section id! $onClickInsert .= 'new Insertion.Bottom($("' . $idTagPrefix . '"), unescape("' . rawurlencode($newElementTemplate) . '").' . $replace . '); setActionStatus("' . $idTagPrefix . '");'; $onClickInsert .= 'eval(unescape("' . rawurlencode(implode(';', $this->additionalJS_post)) . '").' . $replace . ');'; $onClickInsert .= 'TBE_EDITOR.addActionChecks("submit", unescape("' . rawurlencode(implode(';', $this->additionalJS_submit)) . '").' . $replace . ');'; $onClickInsert .= 'return false;'; // Kasper's comment (kept for history): Maybe there is a better way to do this than store the HTML for the new element in rawurlencoded format - maybe it even breaks with certain charsets? But for now this works... $this->additionalJS_post = $additionalJS_post_saved; $this->additionalJS_submit = $additionalJS_submit_saved; $new = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.new', 1); $newElementsLinks[] = '<a href="#" onclick="' . htmlspecialchars($onClickInsert) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-new') . htmlspecialchars(t3lib_div::fixed_lgd_cs($this->sL($nCfg['tx_templavoila']['title']), 30)) . '</a>'; } // Reverting internal variables we don't want to change: $this->requiredElements = $TEMP_requiredElements; // Adding the sections: $toggleAll = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.toggleall', 1); $output .= ' <div class="t3-form-field-toggle-flexsection"> <a href="#" onclick="' . htmlspecialchars('flexFormToggleSubs("' . $idTagPrefix . '"); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-move-right', array('title' => $toggleAll)) . $toggleAll . ' </a> </div> <div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsection">' . implode('', $tRows) . '</div>'; $output .= $mayRestructureFlexforms ? '<div class="t3-form-field-add-flexsection"><strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.addnew', 1) . ':</strong> ' . implode(' | ', $newElementsLinks) . '</div>' : ''; } else { // It is a container $toggleIcon_open = t3lib_iconWorks::getSpriteIcon('actions-move-down'); $toggleIcon_close = t3lib_iconWorks::getSpriteIcon('actions-move-right'); // Create on-click actions. //$onClickCopy = 'new Insertion.After($("'.$idTagPrefix.'"), getOuterHTML("'.$idTagPrefix.'").replace(/'.$idTagPrefix.'-/g,"'.$idTagPrefix.'-copy"+Math.floor(Math.random()*100000+1)+"-")); return false;'; // Copied elements doesn't work (well) in Safari while they do in Firefox and MSIE! UPDATE: It turned out that copying doesn't work for any browser, simply because the data from the copied form never gets submitted to the server for some reason! So I decided to simply disable copying for now. If it's requested by customers we can look to enable it again and fix the issue. There is one un-fixable problem though; Copying an element like this will violate integrity if files are attached inside that element because the file reference doesn't get an absolute path prefixed to it which would be required to have TCEmain generate a new copy of the file. $onClickRemove = 'if (confirm("Are you sure?")){/*###REMOVE###*/;$("' . $idTagPrefix . '").hide();setActionStatus("' . $idPrefix . '");} return false;'; $onClickToggle = 'flexFormToggle("' . $idTagPrefix . '"); return false;'; $onMove = 'flexFormSortable("' . $idPrefix . '")'; // Notice: Creating "new" elements after others seemed to be too difficult to do and since moving new elements created in the bottom is now so easy with drag'n'drop I didn't see the need. // Putting together header of a section. Sections can be removed, copied, opened/closed, moved up and down: // I didn't know how to make something right-aligned without a table, so I put it in a table. can be made into <div>'s if someone like to. // Notice: The fact that I make a "Sortable.create" right onmousedown is that if we initialize this when rendering the form in PHP new and copied elements will not be possible to move as a sortable. But this way a new sortable is initialized everytime someone tries to move and it will always work. $ctrlHeader = ' <table class="t3-form-field-header-flexsection" onmousedown="' . ($mayRestructureFlexforms ? htmlspecialchars($onMove) : '') . '"> <tr> <td> <a href="#" onclick="' . htmlspecialchars($onClickToggle) . '" id="' . $idTagPrefix . '-toggle"> ' . ($toggleClosed ? $toggleIcon_close : $toggleIcon_open) . ' </a> <strong>' . $theTitle . '</strong> <em><span id="' . $idTagPrefix . '-preview"></span></em> </td> <td align="right">' . ($mayRestructureFlexforms ? t3lib_iconWorks::getSpriteIcon('actions-move-move', array('title' => 'Drag to Move')) : '') . ($mayRestructureFlexforms ? '<a href="#" onclick="' . htmlspecialchars($onClickRemove) . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Delete')) : '') . '</td> </tr> </table>'; $s = t3lib_div::revExplode('[]', $formPrefix, 2); $actionFieldName = '_ACTION_FLEX_FORM' . $PA['itemFormElName'] . $s[0] . '][_ACTION][' . $s[1]; // Push the container to DynNestedStack as it may be toggled $this->pushToDynNestedStack('flex', $idTagPrefix); // Putting together the container: $this->additionalJS_delete = array(); $output .= ' <div id="' . $idTagPrefix . '" class="t3-form-field-container-flexsections"> <input id="' . $idTagPrefix . '-action" type="hidden" name="' . htmlspecialchars($actionFieldName) . '" value=""/> ' . $ctrlHeader . ' <div class="t3-form-field-record-flexsection" id="' . $idTagPrefix . '-content"' . ($toggleClosed ? ' style="display:none;"' : '') . '>' . $this->getSingleField_typeFlex_draw($value['el'], $editData[$key]['el'], $table, $field, $row, $PA, $formPrefix . '[' . $key . '][el]', $level + 1, $idTagPrefix) . ' </div> <input id="' . $idTagPrefix . '-toggleClosed" type="hidden" name="' . htmlspecialchars('data[' . $table . '][' . $row['uid'] . '][' . $field . ']' . $formPrefix . '[_TOGGLE]') . '" value="' . ($toggleClosed ? 1 : 0) . '" /> </div>'; $output = str_replace('/*###REMOVE###*/', t3lib_div::slashJS(htmlspecialchars(implode('', $this->additionalJS_delete))), $output); // NOTICE: We are saving the toggle-state directly in the flexForm XML and "unauthorized" according to the data structure. It means that flexform XML will report unclean and a cleaning operation will remove the recorded togglestates. This is not a fatal problem. Ideally we should save the toggle states in meta-data but it is much harder to do that. And this implementation was easy to make and with no really harmful impact. // Pop the container from DynNestedStack $this->popFromDynNestedStack('flex', $idTagPrefix); } // If it's a "single form element": } elseif (is_array($value['TCEforms']['config'])) { // Rendering a single form element: if (is_array($PA['_valLang'])) { $rotateLang = $PA['_valLang']; } else { $rotateLang = array($PA['_valLang']); } $conditionData = is_array($editData) ? $editData : array(); // add current $row to data processed by isDisplayCondition() $conditionData['parentRec'] = $row; $tRows = array(); foreach ($rotateLang as $vDEFkey) { $vDEFkey = 'v' . $vDEFkey; if (!$value['TCEforms']['displayCond'] || $this->isDisplayCondition($value['TCEforms']['displayCond'], $conditionData, $vDEFkey)) { $fakePA = array(); $fakePA['fieldConf'] = array('label' => $this->sL(trim($value['TCEforms']['label'])), 'config' => $value['TCEforms']['config'], 'defaultExtras' => $value['TCEforms']['defaultExtras'], 'onChange' => $value['TCEforms']['onChange']); if ($PA['_noEditDEF'] && $PA['_lang'] === 'lDEF') { $fakePA['fieldConf']['config'] = array('type' => 'none', 'rows' => 2); } if ($fakePA['fieldConf']['onChange'] == 'reload' || $GLOBALS['TCA'][$table]['ctrl']['type'] && !strcmp($key, $GLOBALS['TCA'][$table]['ctrl']['type']) || $GLOBALS['TCA'][$table]['ctrl']['requestUpdate'] && t3lib_div::inList($GLOBALS['TCA'][$table]['ctrl']['requestUpdate'], $key)) { if ($GLOBALS['BE_USER']->jsConfirmation(1)) { $alertMsgOnChange = 'if (confirm(TBE_EDITOR.labels.onChangeAlert) && TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm() };'; } else { $alertMsgOnChange = 'if(TBE_EDITOR.checkSubmit(-1)){ TBE_EDITOR.submitForm();}'; } } else { $alertMsgOnChange = ''; } $fakePA['fieldChangeFunc'] = $PA['fieldChangeFunc']; if (strlen($alertMsgOnChange)) { $fakePA['fieldChangeFunc']['alert'] = $alertMsgOnChange; } $fakePA['onFocus'] = $PA['onFocus']; $fakePA['label'] = $PA['label']; $fakePA['itemFormElName'] = $PA['itemFormElName'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']'; $fakePA['itemFormElName_file'] = $PA['itemFormElName_file'] . $formPrefix . '[' . $key . '][' . $vDEFkey . ']'; $fakePA['itemFormElID'] = $fakePA['itemFormElName']; if (isset($editData[$key][$vDEFkey])) { $fakePA['itemFormElValue'] = $editData[$key][$vDEFkey]; } else { $fakePA['itemFormElValue'] = $fakePA['fieldConf']['config']['default']; } $theFormEl = $this->getSingleField_SW($table, $field, $row, $fakePA); $theTitle = htmlspecialchars($fakePA['fieldConf']['label']); if (!in_array('DEF', $rotateLang)) { $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">' . $this->getLanguageIcon($table, $row, 0) . $this->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field) . ' </div>'; } else { $defInfo = ''; } if (!$PA['_noEditDEF']) { $prLang = $this->getAdditionalPreviewLanguages(); foreach ($prLang as $prL) { $defInfo .= '<div class="typo3-TCEforms-originalLanguageValue">' . $this->getLanguageIcon($table, $row, 'v' . $prL['ISOcode']) . $this->previewFieldValue($editData[$key]['v' . $prL['ISOcode']], $fakePA['fieldConf'], $field) . ' </div>'; } } $languageIcon = ''; if ($vDEFkey != 'vDEF') { $languageIcon = $this->getLanguageIcon($table, $row, $vDEFkey); } // Put row together // possible linebreaks in the label through xml: \n => <br/>, usage of nl2br() not possible, so it's done through str_replace $processedTitle = str_replace('\\n', '<br />', $theTitle); $tRows[] = '<div class="t3-form-field-container t3-form-field-container-flex">' . '<div class="t3-form-field-label t3-form-field-label-flex">' . $languageIcon . t3lib_BEfunc::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '</div> <div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '</div> </div>'; } } if (count($tRows)) { $output .= implode('', $tRows); } } } } } return $output; }
/** * */ function indexing_setMessage($msg) { echo ' <script type="text/javascript" language="javascript"> parent.setMessage("' . t3lib_div::slashJS($msg, false, '"') . '")</script>'; }
/** * Generates the module content * * @return void */ function moduleContent() { $this->jQueryConfig = array(); $this->jQueryConfig = $_POST; if (!is_array($this->jQueryConfig['files']) || !isset($this->jQueryConfig['files'])) { $this->jQueryConfig['files'] = array("jquery.js"); } switch ((string)$this->MOD_SETTINGS['function']) { case 1: { if (isset($_POST['compression'])) { if ($jsAlertData = $this->createJqFile()) { $content = ' <script type="text/javascript"> jQuery(document).ready(function() { alert("'.t3lib_div::slashJS($jsAlertData).'"); }); </script>'; } } $content .= $this->makeJqForm(); $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.header1'), $content ,0 ,1); break; } case 2: { $content = $this->makePackitoForm(); $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.header2'), $content, 0, 1); $file = $_FILES['js_local']['tmp_name'] ? $_FILES['js_local']['tmp_name'] : ($_POST['js_remote'] ? t3lib_div::getFileAbsFileName($_POST['js_remote']) : ''); // Form has been submitted if ($file) { $fileName = $_FILES['js_local']['name'] ? $_FILES['js_local']['name'] : ($_POST['js_remote'] ? $_POST['js_remote'] : $file ); $dep = $this->analyzeJS($file); // show the missing dependencies $content = $this->displayMissingLibrary(); if ($content) { $this->content .= $this->doc->section('', $content, 0, 1); } // show the dependencies $content = $this->displayDependencies($dep); if (count($dep) == 0) { $content .= '<p> </p><p>'.$this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.analyze.packed').'</p>'; } $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.analyze.dependencies').' "'.basename($fileName).'"', $content, 0, 1); } break; } case 3: { $content = $this->makeProcessForm(); $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.header3'), $content, 0, 1); // Form has been submitted $files = $_POST['ext']; if ($files) { $dep = Array(); foreach ($files as $file) { $dep = $this->processT3jqueryTxt(t3lib_div::getFileAbsFileName($file), $dep); } // show the missing dependencies $content = $this->displayMissingLibrary(); if ($content) { $this->content .= $this->doc->section('', $content, 0, 1); } // show the dependencies $content = $this->displayDependencies($dep); $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.extension.dependencies'), $content, 0, 1); } break; } case 4: { $content = $this->makeCompressForm($this->compressed); $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.header4'), $content, 0, 1); break; } case 5: { // Display APIdocs if (t3lib_extMgm::isLoaded('extdeveval')) { $content = NULL; try { $inst = t3lib_div::makeInstance('tx_extdeveval_apidisplay'); $content = '<hr />'.$inst->main(t3lib_div::getUrl('../ext_php_api.dat'),'tx_t3jquery'); } catch (Exception $e) { $content = $e->getMessage(); } $this->content .= $this->doc->section($this->LANG->sL('LLL:EXT:t3jquery/mod1/locallang.xml:jquery.header5'), $content, 0, 1); } break; } } }
/** * Wrapping $title in a-tags. * * @param string Title string * @param string Item record * @param integer Bank pointer (which mount point number) * @return string * @access private */ function tceformsSelect_wrapTitle($title, $row) { if ($this->parentField and in_array($row[$this->parentField], $this->TCEforms_nonSelectableItemsArray)) { $this->TCEforms_nonSelectableItemsArray[] = $row['uid']; $out = '<span class="titleWrap">' . $title . '</span>'; } elseif (in_array($row['uid'], $this->TCEforms_nonSelectableItemsArray)) { $out = '<span class="titleWrap">' . $title . '</span>'; } else { if ($row['uid']) { $selectTitle = $this->TCEFormsSelect_prefixTreeName ? $this->getTreeTitle() . ': ' . $title : $title; } else { $selectTitle = $this->getTreeTitle() . ' (Root)'; } $id = $this->TCEFormsSelect_prefixTreeName ? $this->treeName . ':' . $row['uid'] : $row['uid']; $aOnClick = $this->jsParent . 'setFormValueFromBrowseWin(\'' . $this->TCEforms_itemFormElName . '\',\'' . $id . '\',\'' . t3lib_div::slashJS($selectTitle) . '\'); return false;'; if (is_array($this->selectedIdArr) and in_array($row['uid'], $this->selectedIdArr)) { $title = '<span class="titleWrap">' . $title . '</span>'; } $out = '<a style="vertical-align:top;" href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>'; } return $out; }
/** * The main method of the PlugIn * * @param string $content: The PlugIn content * @param array $conf: The PlugIn configuration * @return The content that is displayed on the website (Menu) */ public function main($content, $conf) { $this->conf = $conf; // define the key of the element $this->contentKey = "jftabulatorsitemap_c" . $this->cObj->data['uid']; // Read the flexform if list_type is set if ($this->cObj->data['list_type'] == $this->extKey . '_pi1') { // It's a content, all data from flexform $this->lConf['tabCollapsible'] = $this->getFlexformData('general', 'tabCollapsible'); $this->lConf['tabOpen'] = $this->getFlexformData('general', 'tabOpen'); $this->lConf['tabRandomTab'] = $this->getFlexformData('general', 'tabRandomTab'); $this->lConf['tabFxHeight'] = $this->getFlexformData('general', 'tabFxHeight'); $this->lConf['tabFxOpacity'] = $this->getFlexformData('general', 'tabFxOpacity'); $this->lConf['tabFxDuration'] = $this->getFlexformData('general', 'tabFxDuration'); $this->lConf['tabCache'] = $this->getFlexformData('general', 'tabCache'); $this->lConf['tabPreload'] = $this->getFlexformData('general', 'tabPreload'); $this->lConf['tabTitles'] = $this->getFlexformData('general', 'tabTitles'); $this->lConf['tabShowSpinner'] = $this->getFlexformData('spinner', 'tabShowSpinner'); $this->lConf['spinnerPanel'] = $this->getFlexformData('spinner', 'spinnerPanel'); $this->lConf['spinnerPanelPosition'] = $this->getFlexformData('spinner', 'spinnerPanelPosition'); // tab if ($this->lConf['tabCollapsible'] < 2) { $this->conf['tabCollapsible'] = $this->lConf['tabCollapsible']; } if ($this->lConf['tabFxHeight'] < 2) { $this->conf['tabFxHeight'] = $this->lConf['tabFxHeight']; } if ($this->lConf['tabFxOpacity'] < 2) { $this->conf['tabFxOpacity'] = $this->lConf['tabFxOpacity']; } if ($this->lConf['tabFxDuration'] > 0) { $this->conf['tabFxDuration'] = $this->lConf['tabFxDuration']; } if ($this->lConf['tabOpen'] > 0) { $this->conf['tabOpen'] = $this->lConf['tabOpen']; } if ($this->lConf['tabRandomTab'] < 2) { $this->conf['tabRandomTab'] = $this->lConf['tabRandomTab']; } if ($this->lConf['tabCache'] < 2) { $this->conf['tabCache'] = $this->lConf['tabCache']; } if ($this->lConf['tabPreload'] < 2) { $this->conf['tabPreload'] = $this->lConf['tabPreload']; } if ($this->lConf['tabShowSpinner'] < 2) { $this->conf['tabShowSpinner'] = $this->lConf['tabShowSpinner']; } if ($this->lConf['spinnerPanel'] < 2) { $this->conf['spinnerPanel'] = $this->lConf['spinnerPanel']; } if ($this->lConf['spinnerPanelPosition']) { $this->conf['spinnerPanelPosition'] = $this->lConf['spinnerPanelPosition']; } if ($this->lConf['tabTitles']) { $this->conf['tabTitles'] = $this->lConf['tabTitles']; } } // The template for JS if (!($this->templateFileJS = $this->cObj->fileResource($this->conf['templateFileJS']))) { $this->templateFileJS = $this->cObj->fileResource("EXT:jftabulatorsitemap/res/tx_jftabulatorsitemap_pi1.js"); } $menuPids = t3lib_div::trimExplode(",", $this->cObj->data['pages'] ? $this->cObj->data['pages'] : intval($GLOBALS['TSFE']->id), 1); // define the select hidden / nav_hide $select = array(); if (!$this->conf['showNavHidePages']) { $select[] = 'AND nav_hide=0'; } $doktypes = t3lib_div::intExplode(',', $this->conf['showDoktypes'], TRUE); if (count($doktypes) > 0) { $select[] = 'AND doktype IN (' . implode(',', $doktypes) . ')'; } $items = null; $itemName = array(); $current = 0; if (count($menuPids) > 0) { foreach ($menuPids as $menuPid) { $menuItems_level1 = $GLOBALS['TSFE']->sys_page->getMenu($menuPid, '*', 'sorting', implode(" ", $select), 1); reset($menuItems_level1); while (list($uid, $pages_row) = each($menuItems_level1)) { $newId = $this->cleanTitel($pages_row['title'], $itemName, 0); $itemName[] = $newId; $GLOBALS['TSFE']->register['key'] = $this->contentKey; $GLOBALS['TSFE']->register['uid'] = $pages_row['uid']; $GLOBALS['TSFE']->register['target'] = $pages_row['target']; $GLOBALS['TSFE']->register['uniquetitle'] = $newId; $GLOBALS['TSFE']->register['titles'] = $this->conf['tabTitles']; $GLOBALS['TSFE']->register['SITE_NUM_CURRENT'] = $current; $item = trim($this->cObj->cObjGetSingle($this->conf['tabItem'], $this->conf['tabItem.'])); $items .= $this->cObj->stdWrap($item, $this->conf['tabWrap.']); $current++; } } } $content = $this->cObj->stdWrap($items, $this->conf['stdWrap.']); // define the jQuery mode and function if ($this->conf['jQueryNoConflict']) { $jQueryNoConflict = "jQuery.noConflict();"; } else { $jQueryNoConflict = ""; } // Set FX for tab $fx = array(); if ($this->conf['tabFxHeight']) { $fx[] = "height: 'toggle'"; } if ($this->conf['tabFxOpacity']) { $fx[] = "opacity: 'toggle'"; } if ($this->conf['tabFxDuration'] || is_numeric($this->conf['tabFxDuration'])) { $fx[] = "duration: " . (is_numeric($this->conf['tabFxDuration']) ? $this->conf['tabFxDuration'] : "'{$this->conf['tabFxDuration']}'"); } // Set options for tab $options = array(); if (count($fx) > 0) { $options[] = "fx: {" . implode(",", $fx) . "}"; } if ($this->conf['tabCollapsible']) { $options['collapsible'] = "collapsible: true"; } if ($this->conf['tabRandomTab']) { $options['selected'] = "selected: Math.floor(Math.random()*" . count($menuItems_level1) . ")"; } elseif (is_numeric($this->conf['tabOpen'])) { $options['selected'] = "selected: " . (($this->conf['tabOpen'] > count($menuItems_level1) ? count($menuItems_level1) : $this->conf['tabOpen']) - 1); } if ($this->conf['tabCache']) { $options['cache'] = "cache: true"; } $spinner = t3lib_div::slashJS(trim($this->cObj->cObjGetSingle($this->conf['tabSpinner'], $this->conf['tabSpinner.']))); if ($this->conf['tabShowSpinner']) { $options['spinner'] = "spinner: '" . $spinner . "'"; } else { $options['spinner'] = "spinner: ''"; } // get the Template of the Javascript $markerArray = array(); // get the template if (!($templateCode = trim($this->cObj->getSubpart($this->templateFileJS, "###TEMPLATE_TAB_JS###")))) { $templateCode = $this->outputError("Template TEMPLATE_TAB_JS is missing", TRUE); } // TAB_PRELOAD $tabPreload = null; if ($this->conf['tabPreload']) { $options['ajaxOptions'] = "ajaxOptions: {async: false}"; $tabPreload = trim($this->cObj->getSubpart($templateCode, "###TAB_PRELOAD###")); } $templateCode = $this->cObj->substituteSubpart($templateCode, '###TAB_PRELOAD###', $tabPreload, 0); // PANEL_SPINNER $spinnerPanel = null; if ($this->conf['spinnerPanel']) { $options['ajaxOptions'] = "ajaxOptions: {async: false}"; $options['spinnerPanel'] = "spinnerPanel: '" . $spinner . "'"; $spinnerPanel = trim($this->cObj->getSubpart($templateCode, "###PANEL_SPINNER###")); if ($this->conf['spinnerPanelPosition'] == 'html') { // cache is not permitted (results in empty panel) $options['cache'] = "cache: false"; } } $templateCode = $this->cObj->substituteSubpart($templateCode, '###PANEL_SPINNER###', $spinnerPanel, 0); // Replace default values $markerArray["KEY"] = $this->contentKey; $markerArray["OPTIONS"] = implode(", ", $options); $markerArray["SPINNER_PANEL_POSITION"] = $this->conf['spinnerPanelPosition'] ? $this->conf['spinnerPanelPosition'] : 'prepend'; $templateCode = $this->cObj->substituteMarkerArray($templateCode, $markerArray, '###|###', 0); $this->addCssFile($this->conf['jQueryUIstyle']); // If the request comes via AJAX, the JS will be added to the content if ($this->isAjax()) { $content .= t3lib_div::wrapJS($jQueryNoConflict . $templateCode); } else { $this->addJS($jQueryNoConflict . $templateCode); } // Add the ressources $this->addResources(); return $this->pi_wrapInBaseClass($content); }