[FEATURE] Improve element "insert record"
authorGeorg Ringer <mail@ringerge.org>
Sat, 3 Mar 2012 15:04:19 +0000 (16:04 +0100)
committerIngo Renner <ingo@typo3.org>
Mon, 16 Apr 2012 08:52:01 +0000 (10:52 +0200)
The content element "Insert record" can be improved
by adding it to the content element wizard and by
showing the related content elements instead of nothing

Change-Id: Ib3a46f1bb290e43a4b7356ee64e14059440260c0
Resolves: #34486
Releases: 6.0
Reviewed-on: http://review.typo3.org/9342
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Ingo Renner
Tested-by: Ingo Renner
typo3/sysext/cms/ext_localconf.php
typo3/sysext/cms/layout/class.tx_cms_layout.php
typo3/sysext/cms/layout/locallang_db_new_content_el.xlf
typo3/sysext/t3skin/icons/gfx/c_wiz/shortcut.gif [new file with mode: 0644]

index 9cc257e..3bbfd4c 100644 (file)
@@ -109,9 +109,17 @@ mod.wizards.newContentElement.wizardItems {
                                CType = div
                        }
                }
+               shortcut {
+                       icon = gfx/c_wiz/shortcut.gif
+                       title = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_shortcut_title
+                       description = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:special_shortcut_description
+                       tt_content_defValues {
+                               CType = shortcut
+                       }
+               }
 
        }
-       special.show = uploads,media,menu,html,div
+       special.show = uploads,media,menu,html,div,shortcut
 
        forms.header = LLL:EXT:cms/layout/locallang_db_new_content_el.xml:forms
        forms.elements {
@@ -192,4 +200,4 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['livesearch']['content'] = 'tt_content';
        //register hook to show preview info
 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_previewInfo']['cms'] = 'EXT:cms/tslib/hooks/class.tx_cms_fehooks.php:tx_cms_fehooks->hook_previewInfo';
 
-?>
\ No newline at end of file
+?>
index 9b034d6..dafee66 100755 (executable)
@@ -1426,8 +1426,26 @@ class tx_cms_layout extends recordList {
                                        }
                                        break;
                                case 'shortcut':
-                                       if ($row['records']) {
-                                               $out .= $this->linkEditContent($row['shortcut'], $row) . '<br />';
+                                       if (!empty($row['records'])) {
+                                               $shortcutContent = array();
+
+                                               $recordList = explode(',', $row['records']);
+                                               foreach ($recordList as $recordIdentifier) {
+                                                       $split = t3lib_BEfunc::splitTable_Uid($recordIdentifier);
+                                                       $tableName = empty($split[0]) ? 'tt_content' : $split[0];
+
+                                                       $shortcutRecord = t3lib_BEfunc::getRecord($tableName, $split[1]);
+
+                                                       if (is_array($shortcutRecord)) {
+                                                               $icon = t3lib_iconWorks::getSpriteIconForRecord($tableName, $shortcutRecord);
+                                                               $onClick = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon(
+                                                                       $icon, $tableName, $shortcutRecord['uid'], 1, '', '+copy,info,edit,view', TRUE);
+
+                                                               $shortcutContent[] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $icon . '</a>' .
+                                                                                               htmlspecialchars(t3lib_BEfunc::getRecordTitle($tableName, $shortcutRecord));
+                                                       }
+                                               }
+                                               $out .= implode('<br />', $shortcutContent) . '<br />';
                                        }
                                        break;
                                case 'list':
index 3acb22e..83e9e30 100644 (file)
                        <trans-unit id="special_divider_description" xml:space="preserve">
                                <source>This element inserts a visual divider, which is by default a horizontal line.</source>
                        </trans-unit>
+                       <trans-unit id="special_shortcut_title" xml:space="preserve">
+                               <source>Insert records</source>
+                       </trans-unit>
+                       <trans-unit id="special_shortcut_description" xml:space="preserve">
+                               <source>With this element you can embed other content elements.</source>
+                       </trans-unit>
                        <trans-unit id="forms" xml:space="preserve">
                                <source>Form elements</source>
                        </trans-unit>
diff --git a/typo3/sysext/t3skin/icons/gfx/c_wiz/shortcut.gif b/typo3/sysext/t3skin/icons/gfx/c_wiz/shortcut.gif
new file mode 100644 (file)
index 0000000..4785407
Binary files /dev/null and b/typo3/sysext/t3skin/icons/gfx/c_wiz/shortcut.gif differ