[FEATURE] Introduce read-only column for file mounts 96/31096/6
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Mon, 23 Jun 2014 13:41:17 +0000 (15:41 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 20 Sep 2014 22:40:06 +0000 (00:40 +0200)
File mount records get a new flag "read only".
This flag replaces the virtual flag introduced earlier,
so it can be defined natively in the record.

Resolves: #59830
Releases: 6.3
Change-Id: I11c738cb4740ea20b9088cc796ea0fb7ced1107a
Reviewed-on: http://review.typo3.org/31096
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Bernhard Kraft <kraftb@think-open.at>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php
typo3/sysext/core/Configuration/TCA/sys_filemounts.php
typo3/sysext/core/ext_tables.sql
typo3/sysext/extbase/Classes/Domain/Model/FileMount.php
typo3/sysext/lang/locallang_csh_sysfilem.xlf
typo3/sysext/lang/locallang_tca.xlf

index 2bfff31..b3c178d 100644 (file)
@@ -1627,9 +1627,7 @@ class BackendUserAuthentication extends \TYPO3\CMS\Core\Authentication\AbstractU
                                ? $this->db->stripOrderBy($GLOBALS['TCA']['sys_filemounts']['ctrl']['default_sortby'])
                                : 'sorting';
                        $fileMountRecords = $this->db->exec_SELECTgetRows(
-                               // Select read_only as (int)0, as there is no real database field for this.
-                               // Don't select as false as this is not supported by DBAL!
-                               '*,0 as read_only',
+                               '*',
                                'sys_filemounts',
                                'deleted=0 AND hidden=0 AND pid=0 AND uid IN (' . implode(',', $fileMounts) . ')',
                                '',
index 944abeb..b356df5 100644 (file)
@@ -52,10 +52,16 @@ return array(
                                'items' => array(),
                                'itemsProcFunc' => 'typo3/sysext/core/Classes/Resource/Service/UserFileMountService.php:TYPO3\CMS\Core\Resource\Service\UserFileMountService->renderTceformsSelectDropdown',
                        )
-               )
+               ),
+               'read_only' => array(
+                       'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_filemounts.read_only',
+                       'config' => array(
+                               'type' => 'check'
+                       ),
+               ),
        ),
        'types' => array(
-               '0' => array('showitem' => '--palette--;;mount, base, path')
+               '0' => array('showitem' => '--palette--;;mount, base, path, read_only')
        ),
        'palettes' => array(
                'mount' => array('showitem' => 'title,hidden', 'canNotCollapse' => 1)
index 0bf62f6..b894ebb 100644 (file)
@@ -245,6 +245,7 @@ CREATE TABLE sys_filemounts (
   hidden tinyint(3) unsigned DEFAULT '0' NOT NULL,
   deleted tinyint(1) unsigned DEFAULT '0' NOT NULL,
   sorting int(11) unsigned DEFAULT '0' NOT NULL,
+  read_only tinyint(1) unsigned DEFAULT '0' NOT NULL,
   PRIMARY KEY (uid),
   KEY parent (pid)
 );
index 3dfb4fe..a7bff7b 100644 (file)
@@ -48,6 +48,13 @@ class FileMount extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
        protected $isAbsolutePath = FALSE;
 
        /**
+        * Determines whether this file mount should be read only.
+        *
+        * @var bool
+        */
+       protected $readOnly = FALSE;
+
+       /**
         * Getter for the title of the file mount.
         *
         * @return string
@@ -105,11 +112,20 @@ class FileMount extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
        }
 
        /**
-        * Getter for the virtual field read_only
+        * Setter for the readOnly property of the file mount.
+        *
+        * @param bool $readOnly
+        */
+       public function setReadOnly($readOnly) {
+               $this->readOnly = $readOnly;
+       }
+
+       /**
+        * Getter for the readOnly property of the file mount.
         *
         * @return bool
         */
        public function isReadOnly() {
-               return FALSE;
+               return $this->readOnly;
        }
 }
index e30f513..2719405 100644 (file)
@@ -68,6 +68,12 @@ The directory structure of "fileadmin/" where you can see the "user_upload" fold
                                <source>sys_filemounts:path</source>
                                <note from="developer">This string contains an internal text, which must not be changed. Just copy the original text into the translation field. For more information have a look at the Tutorial.</note>
                        </trans-unit>
+                       <trans-unit id="read_only.description">
+                               <source>Display this file mount as read-only.</source>
+                       </trans-unit>
+                       <trans-unit id="read_only.details" xml:space="preserve">
+                               <source>Read-only file mounts are displayed in the File List and the Element Browser. They allow displaying of files and folders which are neither writable nor editable for the user.</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index c98b990..e462d73 100644 (file)
                        <trans-unit id="sys_filemounts.base" xml:space="preserve">
                                <source>Base:</source>
                        </trans-unit>
+                       <trans-unit id="sys_filemounts.read_only">
+                               <source>Read-only:</source>
+                       </trans-unit>
                        <trans-unit id="sys_filemounts.base_absolute" xml:space="preserve">
                                <source>absolute (root) / </source>
                        </trans-unit>