Added max length permission for about me
authorMarcel Werk <burntime@woltlab.com>
Fri, 23 May 2014 14:18:49 +0000 (16:18 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 23 May 2014 14:18:49 +0000 (16:18 +0200)
com.woltlab.wcf/userGroupOption.xml
com.woltlab.wcf/userOption.xml
wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php
wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index ac5ac5cc0f89390eb983de089e6e30c31e46bfec..3579938f2d3887659bb7db1d48c6d8a7249843fe 100644 (file)
@@ -508,6 +508,14 @@ pdf]]></defaultvalue>
                                <defaultvalue>0</defaultvalue>
                                <admindefaultvalue>1</admindefaultvalue>
                        </option>
+                       <option name="user.profile.aboutMeMaxLength">
+                               <categoryname>user.profile</categoryname>
+                               <optiontype>integer</optiontype>
+                               <defaultvalue>1000</defaultvalue>
+                               <admindefaultvalue>10000</admindefaultvalue>
+                               <minvalue>100</minvalue>
+                               <maxvalue>65535</maxvalue>
+                       </option>
                        
                        <option name="user.profile.avatar.canSeeAvatars">
                                <categoryname>user.profile.avatar</categoryname>
index 331acd191ef95947e7ee2d77a2f9c03b0556a4eb..1edad995a02122a580786ab2de91b83e10b4e729 100644 (file)
                        <!-- profile -->
                        <option name="aboutMe">
                                <categoryname>profile.aboutMe</categoryname>
-                               <optiontype>message</optiontype>
+                               <optiontype>aboutMe</optiontype>
                                <outputclass>wcf\system\option\user\MessageUserOptionOutput</outputclass>
                                <visible>15</visible>
                                <editable>3</editable>
-                               <maxlength>1000</maxlength>
                        </option>
                        <option name="birthday">
                                <categoryname>profile.personal</categoryname>
index d1823c14b7fbaa6d08e09583937ccbd993f86791..153d737358b08b473fe389133e8aa02ef564b9ae 100644 (file)
@@ -124,7 +124,7 @@ class UserOptionAddForm extends AbstractForm {
         * available option types
         * @var array<string>
         */
-       public static $availableOptionTypes = array('birthday', 'boolean', 'date', 'integer', 'float', 'password', 'multiSelect', 'radioButton', 'select', 'text', 'textarea', 'message', 'URL');
+       public static $availableOptionTypes = array('aboutMe', 'birthday', 'boolean', 'date', 'integer', 'float', 'password', 'multiSelect', 'radioButton', 'select', 'text', 'textarea', 'message', 'URL');
        
        /**
         * list of option type that require select options
diff --git a/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php b/wcfsetup/install/files/lib/system/option/AboutMeOptionType.class.php
new file mode 100644 (file)
index 0000000..34e74a4
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+namespace wcf\system\option;
+use wcf\data\option\Option;
+use wcf\system\exception\UserInputException;
+use wcf\system\WCF;
+
+/**
+ * Option type implementation for the 'about me' text field.
+ *
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.option
+ * @category   Community Framework
+ */
+class AboutMeOptionType extends MessageOptionType {
+       /**
+        * @see \wcf\system\option\IOptionType::validate()
+        */
+       public function validate(Option $option, $newValue) {
+               parent::validate($option, $newValue);
+       
+               if (WCF::getSession()->getPermission('user.profile.aboutMeMaxLength') < mb_strlen($newValue)) {
+                       throw new UserInputException($option->optionName, 'tooLong');
+               }
+       }
+}
index 5e2b6d8ad982c46752384984b8e6b611f002e7ec..4ce0f8686f87bf43bbfd5baa27c5815781695b22 100644 (file)
                <item name="wcf.acp.group.assignment.list"><![CDATA[Automatische Benutzergruppen-Zuordnungen]]></item>
                <item name="wcf.acp.group.assignment.userGroup"><![CDATA[Benutzergruppe]]></item>
                <item name="wcf.acp.group.assignment.isDisabled"><![CDATA[Automatische Zuordnung deaktivieren]]></item>
+               <item name="wcf.acp.group.option.user.profile.aboutMeMaxLength"><![CDATA[Maximallänge „Über mich“]]></item>
        </category>
        
        <category name="wcf.acp.index">
index eb778f0ca5eefc1c8e54e47e5f82a8b2b7514685..4fa346547a846a8a599d88fecfe45274a647d1f6 100644 (file)
@@ -385,6 +385,7 @@ Examples for medium ID detection:
                <item name="wcf.acp.group.assignment.list"><![CDATA[Automatic User Group Assignments]]></item>
                <item name="wcf.acp.group.assignment.userGroup"><![CDATA[User Group]]></item>
                <item name="wcf.acp.group.assignment.isDisabled"><![CDATA[Disable Automatic Assignment]]></item>
+               <item name="wcf.acp.group.option.user.profile.aboutMeMaxLength"><![CDATA[TODO: Maximallänge „Über mich“]]></item>
        </category>
        
        <category name="wcf.acp.index">