[BUGFIX] Pootle: Multi-line labels are not rendered properly
[Packages/TYPO3.CMS.git] / typo3 / class.db_list_extra.inc
index 5e9999e..7436836 100644 (file)
  *
  * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-/**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- *   91: class localRecordList extends recordList
- *  123:     function writeTop($row)
- *  304:     function getTable($table,$id,$rowlist)
- *  559:     function renderListRow($table,$row,$cc,$titleCol,$thumbsCol,$indent=0)
- *  648:     function renderListHeader($table,$currentIdList)
- *
- *              SECTION: Rendering of various elements
- *  796:     function makeControl($table,$row)
- *  986:     function makeClip($table,$row)
- * 1057:     function makeRef($table,$uid)
- * 1086:     function makeLocalizationPanel($table,$row)
- * 1148:     function fieldSelectBox($table,$formFields=1)
- *
- *              SECTION: Helper functions
- * 1231:     function linkClipboardHeaderIcon($string,$table,$cmd,$warning='')
- * 1242:     function clipNumPane()
- * 1256:     function addSortLink($code,$field,$table)
- * 1281:     function recPath($pid)
- * 1294:     function showNewRecLink($table)
- * 1304:     function makeReturnUrl()
- *
- *              SECTION: CSV related functions
- * 1329:     function initCSV()
- * 1352:     function addToCSV($row,$table)
- * 1376:     function setCsvRow($csvRow)
- * 1387:     function outputCSV($prefix)
- *
- * TOTAL FUNCTIONS: 19
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
 
 
 
@@ -121,15 +85,6 @@ class localRecordList extends recordList {
        var $duplicateStack=array();                    // Used to track which elements has duplicates and how many
 
        /**
-        * references of the current record
-        *
-        * @var array
-        *
-        * @deprecated since 4.4: Use getReferenceCount instead
-        */
-       public $references;
-
-       /**
         * [$tablename][$uid] = number of references to this record
         *
         * @var array
@@ -297,8 +252,6 @@ class localRecordList extends recordList {
         * @return      string          HTML table with the listing for the record.
         */
        function getTable($table,$id,$rowlist)  {
-               global $TYPO3_CONF_VARS;
-
                        // Loading all TCA details for this table:
                t3lib_div::loadTCA($table);
 
@@ -308,7 +261,7 @@ class localRecordList extends recordList {
                $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
                $l10nEnabled = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']
                        && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'];
-               $tableCollapsed = (!$this->tablesCollapsed[$table]) ? false : TRUE;
+               $tableCollapsed = (!$this->tablesCollapsed[$table]) ? FALSE : TRUE;
 
                // prepare space icon
                $this->spaceIcon = t3lib_iconWorks::getSpriteIcon('empty-empty', array('style' => 'background-position: 0 10px;'));
@@ -402,8 +355,8 @@ class localRecordList extends recordList {
                 * @date                        2007-11-16
                 * @request             Malte Jansen  <mail@maltejansen.de>
                 */
-               if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
-                       foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
+               if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
                                $hookObject = t3lib_div::getUserObj($classData);
 
                                if(!($hookObject instanceof t3lib_localRecordListGetTableHook)) {
@@ -754,28 +707,6 @@ class localRecordList extends recordList {
        }
 
        /**
-        * Write sys_refindex entries for current record to $this->references
-        *
-        * @param       string          Table name
-        * @param       integer         Uid of current record
-        * @return      void
-        *
-        * @deprecated since 4.4, will be removed in TYPO3 4.6 - Use getReferenceCount instead
-        */
-       function setReferences($table, $uid) {
-               t3lib_div::logDeprecatedFunction();
-
-               $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
-                       'tablename, recuid, field',
-                       'sys_refindex',
-                       'ref_table='.$GLOBALS['TYPO3_DB']->fullQuoteStr($table,'sys_refindex').
-                               ' AND ref_uid='.intval($uid).
-                               ' AND deleted=0'
-               );
-               $this->references = $rows;
-       }
-
-       /**
         * Gets the number of records referencing the record with the UID $uid in
         * the table $tableName.
         *
@@ -815,8 +746,6 @@ class localRecordList extends recordList {
         * @see getTable()
         */
        function renderListHeader($table, $currentIdList)       {
-               global $TYPO3_CONF_VARS;
-
                        // Init:
                $theData = Array();
 
@@ -898,8 +827,8 @@ class localRecordList extends recordList {
                                         * @request             Bernhard Kraft  <krafbt@kraftb.at>
                                         * @usage               Above each listed table in Web>List a header row is shown. This hook allows to modify the icons responsible for the clipboard functions (shown above the clipboard checkboxes when a clipboard other than "Normal" is selected), or other "Action" functions which perform operations on the listed records.
                                         */
-                                       if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))        {
-                                               foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)       {
+                                       if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))     {
+                                               foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)    {
                                                        $hookObject = t3lib_div::getUserObj($classData);
                                                        if(!($hookObject instanceof localRecordList_actionsHook))       {
                                                                throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567850);
@@ -990,8 +919,8 @@ class localRecordList extends recordList {
                 * @request             Bernhard Kraft  <krafbt@kraftb.at>
                 * @usage               Above each listed table in Web>List a header row is shown. Containing the labels of all shown fields and additional icons to create new records for this table or perform special clipboard tasks like mark and copy all listed records to clipboard, etc.
                 */
-               if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))        {
-                       foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)       {
+               if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions']))     {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData)    {
                                $hookObject = t3lib_div::getUserObj($classData);
                                if(!($hookObject instanceof localRecordList_actionsHook))       {
                                        throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567855);
@@ -1150,8 +1079,6 @@ class localRecordList extends recordList {
         * @return      string          HTML table with the control panel (unless disabled)
         */
        function makeControl($table,$row)       {
-               global $SOBE, $TYPO3_CONF_VARS;
-
                if ($this->dontShowClipControlPanels)   return '';
 
                        // Initialize:
@@ -1202,7 +1129,7 @@ class localRecordList extends recordList {
                }
 
                        // If the extended control panel is enabled OR if we are seeing a single table:
-               if ($SOBE->MOD_SETTINGS['bigControlPanel'] || $this->table)     {
+               if ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] || $this->table)  {
 
                                // "Info": (All records)
                        $cells['viewBig'] = '<a href="#" onclick="' . htmlspecialchars(
@@ -1222,7 +1149,7 @@ class localRecordList extends recordList {
                                        '</a>';
 
                                        // Versioning:
-                               if (t3lib_extMgm::isLoaded('version') {
+                               if (t3lib_extMgm::isLoaded('version') && !t3lib_extMgm::isLoaded('workspaces')) {
                                        $vers = t3lib_BEfunc::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
                                        if (is_array($vers))    {       // If table can be versionized.
                                                $versionIcon = 'no-version';
@@ -1278,7 +1205,7 @@ class localRecordList extends recordList {
                                        if (isset($this->currentTable['prev'][$row['uid']]))    {       // Up
                                                $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prev'][$row['uid']];
                                                $cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars(
-                                                                       'return jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');'
+                                                                       'return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');'
                                                                ) .'" title="'.$GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' .
                                                                t3lib_iconWorks::getSpriteIcon('actions-move-up') .
                                                                '</a>';
@@ -1287,7 +1214,7 @@ class localRecordList extends recordList {
                                        }
                                        if ($this->currentTable['next'][$row['uid']])   {       // Down
                                                $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['next'][$row['uid']];
-                                               $cells['moveDown']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$SOBE->doc->issueCommand($params,-1).'\');').'" title="'.$GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' .
+                                               $cells['moveDown']='<a href="#" onclick="'.htmlspecialchars('return jumpToUrl(\''.$GLOBALS['SOBE']->doc->issueCommand($params,-1).'\');').'" title="'.$GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' .
                                                                        t3lib_iconWorks::getSpriteIcon('actions-move-down') .
                                                                '</a>';
                                        } else {
@@ -1303,12 +1230,12 @@ class localRecordList extends recordList {
                                if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
                                        if ($row[$hiddenField]) {
                                                $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=0';
-                                               $cells['hide']='<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');') . '" title="'.$GLOBALS['LANG']->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
+                                               $cells['hide']='<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="'.$GLOBALS['LANG']->getLL('unHide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
                                                                        t3lib_iconWorks::getSpriteIcon('actions-edit-unhide') .
                                                                '</a>';
                                        } else {
                                                $params='&data['.$table.']['.$row['uid'].']['.$hiddenField.']=1';
-                                               $cells['hide']='<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
+                                               $cells['hide']='<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('hide' . ($table == 'pages' ? 'Page' : ''), TRUE) . '">' .
                                                                        t3lib_iconWorks::getSpriteIcon('actions-edit-hide') .
                                                                '</a>';
                                        }
@@ -1331,7 +1258,7 @@ class localRecordList extends recordList {
                                                $this->getReferenceCount($table, $row['uid'])
                                        ) .
                                                t3lib_BEfunc::translationCount($table, $row['uid'], ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.translationsOfRecord'));
-                                       $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars('if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning') . ' "' .  $title . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');} return false;') . '" title="' . $GLOBALS['LANG']->getLL('delete', TRUE) . '">' .
+                                       $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars('if (confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('deleteWarning') . ' "' .  $title . '" ' . $refCountMsg) . ')) {jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;') . '" title="' . $GLOBALS['LANG']->getLL('delete', TRUE) . '">' .
                                                        t3lib_iconWorks::getSpriteIcon('actions-edit-delete') .
                                                        '</a>';
                                } elseif(!$this->table) {
@@ -1344,7 +1271,7 @@ class localRecordList extends recordList {
                                                // Up (Paste as the page right after the current parent page)
                                        if ($this->calcPerms&8) {
                                                $params='&cmd['.$table.']['.$row['uid'].'][move]='.-$this->id;
-                                               $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' .
+                                               $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' .
                                                                        t3lib_iconWorks::getSpriteIcon('actions-move-left') .
                                                                '</a>';
                                        }
@@ -1353,7 +1280,7 @@ class localRecordList extends recordList {
                                                $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(t3lib_BEfunc::getRecord('pages',$this->currentTable['prevUid'][$row['uid']]));
                                                if ($localCalcPerms&8)  {
                                                        $params='&cmd['.$table.']['.$row['uid'].'][move]='.$this->currentTable['prevUid'][$row['uid']];
-                                                       $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $SOBE->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' .
+                                                       $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' .
                                                                                t3lib_iconWorks::getSpriteIcon('actions-move-right') .
                                                                        '</a>';
                                                } else {
@@ -1375,10 +1302,10 @@ class localRecordList extends recordList {
                 * @date                        2007-09-22
                 * @request             Kasper Skårhøj  <kasper2007@typo3.com>
                 */
-               if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks']))     {
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks']))  {
                        $stat='';
                        $_params = array($table,$row['uid']);
-                       foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef)     {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef)  {
                                $stat.=t3lib_div::callUserFunction($_funcRef,$_params,$this);
                        }
                        $cells['stat'] = $stat;
@@ -1389,8 +1316,8 @@ class localRecordList extends recordList {
                 * @request             Bernhard Kraft  <krafbt@kraftb.at>
                 * @usage               This hook method gets passed the current $cells array as third parameter. This array contains values for the icons/actions generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
                 */
-               if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
-                       foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
+               if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                                $hookObject = t3lib_div::getUserObj($classData);
                                if(!($hookObject instanceof localRecordList_actionsHook))       {
                                        throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567840);
@@ -1413,8 +1340,6 @@ class localRecordList extends recordList {
         * @return      string          HTML table with the clipboard panel (unless disabled)
         */
        function makeClip($table,$row)  {
-               global $TYPO3_CONF_VARS;
-
                        // Return blank, if disabled:
                if ($this->dontShowClipControlPanels)   return '';
                $cells=array();
@@ -1480,8 +1405,8 @@ class localRecordList extends recordList {
                 * @request             Bernhard Kraft  <krafbt@kraftb.at>
                 * @usage               This hook method gets passed the current $cells array as third parameter. This array contains values for the clipboard icons generated for each record in Web>List. Each array entry is accessible by an index-key. The order of the icons is dependend on the order of those array entries.
                 */
-               if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
-                       foreach($TYPO3_CONF_VARS['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
+               if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
+                       foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
                                $hookObject = t3lib_div::getUserObj($classData);
                                if(!($hookObject instanceof localRecordList_actionsHook))       {
                                        throw new UnexpectedValueException('$hookObject must implement interface localRecordList_actionsHook', 1195567845);
@@ -1496,29 +1421,6 @@ class localRecordList extends recordList {
        }
 
        /**
-        * Make reference count
-        *
-        * @param       string          Table name
-        * @param       integer         UID of record
-        * @return      string          HTML-table
-        *
-        * @deprecated since 4.4, will be removed in TYPO3 4.6 - Use createReferenceHtml() instead
-        */
-       function makeRef($table,$uid)   {
-               t3lib_div::logDeprecatedFunction();
-
-                       // Compile information for title tag:
-               $infoData=array();
-               if (is_array($this->references)) {
-                       foreach ($this->references as $row) {
-                               $infoData[]=$row['tablename'].':'.$row['recuid'].':'.$row['field'];
-                       }
-               }
-
-               return count($infoData) ? '<a href="#" onclick="'.htmlspecialchars('top.launchView(\''.$table.'\', \''.$uid.'\'); return false;').'" title="'.htmlspecialchars(t3lib_div::fixed_lgd_cs(implode(' / ',$infoData),100)).'">'.count($infoData).'</a>' : '';
-       }
-
-       /**
         * Creates the HTML for a reference count for the record with the UID $uid
         * in the table $tableName.
         *
@@ -1602,7 +1504,7 @@ class localRecordList extends recordList {
                                        );
                                        $language = t3lib_BEfunc::getRecord('sys_language', $lUid_OnPage, 'title');
                                        if ($this->languageIconTitles[$lUid_OnPage]['flagIcon']) {
-                                               $lC = t3lib_iconWorks::getSpriteIcon($this->languageIconTitles[$lUid_OnPage]['flagIcon']);;
+                                               $lC = t3lib_iconWorks::getSpriteIcon($this->languageIconTitles[$lUid_OnPage]['flagIcon']);
                                        } else {
                                                $lC = $this->languageIconTitles[$lUid_OnPage]['title'];
                                        }
@@ -1641,7 +1543,7 @@ class localRecordList extends recordList {
                $setFields=is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
 
                        // Request fields from table:
-               $fields = $this->makeFieldList($table, false, TRUE);
+               $fields = $this->makeFieldList($table, FALSE, TRUE);
 
                        // Add pseudo "control" fields
                $fields[]='_PATH_';
@@ -1664,7 +1566,7 @@ class localRecordList extends recordList {
 
                        // Compile the options into a multiple selector box:
                $lMenu = '
-                                                                               <select size="'.t3lib_div::intInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
+                                                                               <select size="'.t3lib_utility_Math::forceIntegerInRange(count($fields)+1,3,20).'" multiple="multiple" name="displayFields['.$table.'][]">'.implode('',$opt).'
                                                                                </select>
                                ';
 
@@ -1784,7 +1686,7 @@ class localRecordList extends recordList {
                        return TRUE;
                        // If table is denied or allowed tables are set, but table is not part of:
                } else {
-                       return false;
+                       return FALSE;
                }
        }
 
@@ -1837,10 +1739,9 @@ class localRecordList extends recordList {
         * Adds selected columns of one table row as CSV line.
         *
         * @param       array           Record array, from which the values of fields found in $this->fieldArray will be listed in the CSV output.
-        * @param       string          Table name @deprecated since 4.4
         * @return      void
         */
-       protected function addToCSV(array $row = array(), $table = '') {
+       protected function addToCSV(array $row = array()) {
                $rowReducedByControlFields = self::removeControlFieldsFromFieldRow($row);
                $rowReducedToSelectedColumns = array_intersect_key($rowReducedByControlFields, array_flip($this->fieldArray));
                $this->setCsvRow($rowReducedToSelectedColumns);
@@ -1909,4 +1810,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.db_list_extra.inc']);
 }
 
-?>
\ No newline at end of file
+?>