* ADD Integrated DAM as a source of images
authorjocrau <jocrau@735d13b6-9817-0410-8766-e36946ffe9aa>
Sun, 9 Nov 2008 13:01:57 +0000 (13:01 +0000)
committerBastian Bringenberg <spam@bastian-bringenberg.de>
Thu, 4 Dec 2014 23:56:05 +0000 (00:56 +0100)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/contagged/trunk@13943 735d13b6-9817-0410-8766-e36946ffe9aa

ext_conf_template.txt
ext_tables.php
ext_tables.sql
pi1/class.tx_contagged_pi1.php
static/setup.txt
tca.php

index 384b1a1..6e7b777 100644 (file)
@@ -1,3 +1,6 @@
 
-       # cat=basic//10; type=int; label= Page-ID where the type definitions are stored (typically by adding a static template to the main template => root page pid).
+       # cat=basic//10; type=int; label=Setup storage PID: Page-ID where the type definitions are stored (typically by adding a static template to the main template => root page pid).
        mainConfigStoragePid = 
+
+       # cat=basic//20; type=boolean; label= DAM as image source: Take DAM (digital asset management) as image source.
+       getImagesFromDAM = 0
\ No newline at end of file
index 0e4d87b..53bb450 100644 (file)
@@ -39,7 +39,7 @@ $TCA["tx_contagged_terms"] = array (
                'iconfile'          => t3lib_extMgm::extRelPath($_EXTKEY).'icon_tx_contagged_terms.gif',
        ),
        "feInterface" => array (
-               "fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long, image, imagecaption, imagealt, imagetitle, related, link, exclude",
+               "fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long, image, dam_images, imagecaption, imagealt, imagetitle, related, link, exclude",
        )
 );
 
index 8fad735..5914712 100644 (file)
@@ -33,6 +33,7 @@ CREATE TABLE tx_contagged_terms (
        desc_short tinytext NOT NULL,
        desc_long text NOT NULL,
        image text NOT NULL,
+       dam_images int(11) DEFAULT '0' NOT NULL,
        imagecaption text NOT NULL,
        imagealt text NOT NULL,
        imagetitle text NOT NULL,
index 609b479..fb6cbf9 100644 (file)
@@ -261,23 +261,55 @@ class tx_contagged_pi1 extends tslib_pibase {
        }
        
        function getImages($termArray) {
-               if (!empty($termArray['image'])) {
-                       $imagesConf = $this->conf['images.']['single.'];
+               $images = array();
+               $imagesCaption = array();
+               $imagesAltText = array();
+               $imagesTitleText = array();
+               $imagesCode = '';
+               $imagesConf = $this->conf['images.']['single.'];
+               $extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
+               if ($extConfArray['getImagesFromDAM'] == 0) {
                        $images = t3lib_div::trimExplode(',', $termArray['image'], 1);
+                       foreach ($images as $image) {
+                               $imagesWithPath[] = 'uploads/pics/' . $image;
+                       }
+                       $images = $imagesWithPath;
                        $imagesCaption = t3lib_div::trimExplode(chr(10), $termArray['imagecaption']);
                        $imagesAltText = t3lib_div::trimExplode(chr(10), $termArray['imagealt']);
                        $imagesTitleText = t3lib_div::trimExplode(chr(10), $termArray['imagetitle']);
-                       $imagesCode = '';
+               } else {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
+                               'tx_dam.file_path, tx_dam.file_name, tx_dam.alt_text, tx_dam.caption, tx_dam.title',
+                               'tx_dam', 'tx_dam_mm_ref', 'tx_contagged_terms',
+                               'AND tx_dam_mm_ref.tablenames = "tx_contagged_terms" AND tx_dam_mm_ref.ident="dam_images" ' .
+                               'AND tx_dam_mm_ref.uid_foreign = "' . $termArray['uid'] . '"', '', 'tx_dam_mm_ref.sorting_foreign ASC'
+                               );
+                       while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+                               $images[] = $row['file_path'] . $row['file_name'];
+                               $imagesCaption[] = str_replace(array(chr(10),chr(13)), ' ', $row['caption'] . ' ');
+                               $imagesAltText[] = str_replace(array(chr(10),chr(13)), ' ', $row['alt_text'] . ' ');
+                               $imagesTitleText[] = str_replace(array(chr(10),chr(13)), ' ', $row['title'] . ' ');
+                       }
+               }
+               // debug($images, 'images');
+               // debug($imagesCaption, 'imagesCaption');
+               // debug($imagesAltText, 'imagesAltText');
+               // debug($imagesTitleText, 'imagesTitleText');
+               
+               if (!empty($images)) {
                        foreach ($images as $key => $image) {
+                               $imagesConf['image.']['file'] = $image;
                                $imagesConf['image.']['altText'] = $imagesAltText[$key];
                                $imagesConf['image.']['titleText'] = $imagesTitleText[$key];
-                               $imagesConf['image.']['file'] = 'uploads/pics/' . $image;
-                               $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']) . $this->local_cObj->stdWrap($imagesCaption[$key], $this->conf['images.']['caption.']['stdWrap.']);
+                               $caption = $imagesCaption[$key] != '' ? $this->local_cObj->stdWrap($imagesCaption[$key], $this->conf['images.']['caption.']['stdWrap.']) : '';
+                               $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']);
+                               $imagesCode .= $caption;
                        }
-                       return $this->local_cObj->stdWrap(trim($imagesCode), $this->conf['images.']['stdWrap.']);
+                       return $this->local_cObj->stdWrap(trim($imagesCode), $this->conf['images.']['stdWrap.']);                       
                } else {
                        return NULL;
                }
+               
        }
 
        function renderIndex(&$markerArray) {
index 3c74183..9390cef 100644 (file)
@@ -44,7 +44,7 @@ plugin.tx_contagged {
                single.image {
                        file.maxW = {$contagged.singleMaxW}
                        file.maxH = {$contagged.singleMaxH}
-                       wrap = 
+                       stdWrap.wrap = <div class="tx-contagged-singleimage">|</div>
                        imageLinkWrap = 1
                        imageLinkWrap {
                                enable = 1
diff --git a/tca.php b/tca.php
index d149d63..2542eac 100644 (file)
--- a/tca.php
+++ b/tca.php
@@ -5,7 +5,7 @@ if (!defined ('TYPO3_MODE'))    die ('Access denied.');
 $TCA["tx_contagged_terms"] = array (
        "ctrl" => $TCA["tx_contagged_terms"]["ctrl"],
        "interface" => array (
-               "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, image, imagecaption, imagealt, imagetitle, related, link, exclude"
+               "showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group term_main, term_alt, term_type, term_lang, replacement, desc_short, desc_long, image, dam_images,imagecaption, imagealt, imagetitle, related, link, exclude"
        ),
        "feInterface" => $TCA["tx_contagged_terms"]["feInterface"],
        "columns" => array (
@@ -182,53 +182,53 @@ $TCA["tx_contagged_terms"] = array (
                                        ),
                                )
                        ),
-                       'image' => Array (
-                               'exclude' => 1,
-                               'l10n_mode' => $l10n_mode_image,
-                               'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
-                               'config' => Array (
-                                       'type' => 'group',
-                                       'internal_type' => 'file',
-                                       'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
-                                       'max_size' => '10000',
-                                       'uploadfolder' => 'uploads/pics',
-                                       'show_thumbs' => '1',
-                                       'size' => 3,
-                                       'autoSizeMax' => 15,
-                                       'maxitems' => '99',
-                                       'minitems' => '0'
-                               )
-                       ),
-                       'imagecaption' => Array (
-                               'exclude' => 1,
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
-                               'l10n_mode' => $l10n_mode,
-                               'config' => Array (
-                                       'type' => 'text',
-                                       'cols' => '30',
-                                       'rows' => '3'
-                               )
-                       ),
-                       'imagealt' => Array (
-                               'exclude' => 1,
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
-                               'l10n_mode' => $l10n_mode,
-                               'config' => Array (
-                                       'type' => 'text',
-                                       'cols' => '30',
-                                       'rows' => '3'
-                               )
-                       ),
-                       'imagetitle' => Array (
-                               'exclude' => 1,
-                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
-                               'l10n_mode' => $l10n_mode,
-                               'config' => Array (
-                                       'type' => 'text',
-                                       'cols' => '30',
-                                       'rows' => '3'
-                               )
-                       ),
+                       // 'image' => Array (
+                       //      'exclude' => 1,
+                       //      'l10n_mode' => $l10n_mode_image,
+                       //      'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
+                       //      'config' => Array (
+                       //              'type' => 'group',
+                       //              'internal_type' => 'file',
+                       //              'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
+                       //              'max_size' => '10000',
+                       //              'uploadfolder' => 'uploads/pics',
+                       //              'show_thumbs' => '1',
+                       //              'size' => 3,
+                       //              'autoSizeMax' => 15,
+                       //              'maxitems' => '99',
+                       //              'minitems' => '0'
+                       //      )
+                       // ),
+                       // 'imagecaption' => Array (
+                       //      'exclude' => 1,
+                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
+                       //      'l10n_mode' => $l10n_mode,
+                       //      'config' => Array (
+                       //              'type' => 'text',
+                       //              'cols' => '30',
+                       //              'rows' => '3'
+                       //      )
+                       // ),
+                       // 'imagealt' => Array (
+                       //      'exclude' => 1,
+                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
+                       //      'l10n_mode' => $l10n_mode,
+                       //      'config' => Array (
+                       //              'type' => 'text',
+                       //              'cols' => '20',
+                       //              'rows' => '3'
+                       //      )
+                       // ),
+                       // 'imagetitle' => Array (
+                       //      'exclude' => 1,
+                       //      'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
+                       //      'l10n_mode' => $l10n_mode,
+                       //      'config' => Array (
+                       //              'type' => 'text',
+                       //              'cols' => '20',
+                       //              'rows' => '3'
+                       //      )
+                       // ),
                        'related' => Array (
                                'exclude' => 1,
                                'l10n_mode' => 'exclude',
@@ -275,12 +275,73 @@ $TCA["tx_contagged_terms"] = array (
                        ),
                ),
                "types" => array (
-                       "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], image, imagecaption, imagealt, imagetitle, related, link, exclude")
+                       "0" => array("showitem" => "sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, hidden;;1, term_main, term_alt, term_type, term_lang, term_replace, desc_short, desc_long;;;richtext[*]:rte_transform[mode=ts_css|imgpath=uploads/tx_contagged/rte/], image, dam_images, imagecaption, imagealt, imagetitle, related, link, exclude")
                ),
                "palettes" => array (
-                       "1" => array("showitem" => "starttime, endtime, fe_group")
+                       "1" => array("showitem" => "starttime, endtime, fe_group"),
+                       "2" => array("showitem" => "")
                )
        );
+       
+$extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
+if ( $extConfArray['getImagesFromDAM'] == 0 ) {
+       $TCA["tx_contagged_terms"]['columns'] = array_merge_recursive($TCA["tx_contagged_terms"]['columns'], array(
+                       'image' => Array (
+                               'exclude' => 1,
+                               'l10n_mode' => $l10n_mode_image,
+                               'label' => 'LLL:EXT:lang/locallang_general.php:LGL.images',
+                               'config' => Array (
+                                       'type' => 'group',
+                                       'internal_type' => 'file',
+                                       'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
+                                       'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'],
+                                       'uploadfolder' => 'uploads/pics',
+                                       'show_thumbs' => '1',
+                                       'size' => 3,
+                                       'autoSizeMax' => 15,
+                                       'maxitems' => '99',
+                                       'minitems' => '0'
+                               )
+                       ),
+                       'imagecaption' => Array (
+                               'exclude' => 1,
+                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagecaption',
+                               'l10n_mode' => $l10n_mode,
+                               'config' => Array (
+                                       'type' => 'text',
+                                       'cols' => '30',
+                                       'rows' => '3'
+                               )
+                       ),
+                       'imagealt' => Array (
+                               'exclude' => 1,
+                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagealt',
+                               'l10n_mode' => $l10n_mode,
+                               'config' => Array (
+                                       'type' => 'text',
+                                       'cols' => '20',
+                                       'rows' => '3'
+                               )
+                       ),
+                       'imagetitle' => Array (
+                               'exclude' => 1,
+                               'label' => 'LLL:EXT:contagged/locallang_db.xml:tx_contagged_terms.imagetitle',
+                               'l10n_mode' => $l10n_mode,
+                               'config' => Array (
+                                       'type' => 'text',
+                                       'cols' => '20',
+                                       'rows' => '3'
+                               )
+                       ),
+               )
+       );
+} else {
+       $TCA["tx_contagged_terms"]['columns'] = array_merge_recursive($TCA["tx_contagged_terms"]['columns'],array(
+               'dam_images' => txdam_getMediaTCA('image_field', 'dam_images')
+               )
+       );
+}
+
 require_once (PATH_t3lib.'class.t3lib_page.php');
 require_once (PATH_t3lib.'class.t3lib_tstemplate.php');
 require_once (PATH_t3lib.'class.t3lib_tsparser_ext.php');