Fixed mass processing form
authorAlexander Ebert <ebert@woltlab.com>
Thu, 26 Jan 2012 16:16:39 +0000 (17:16 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 26 Jan 2012 16:16:39 +0000 (17:16 +0100)
wcfsetup/install/files/acp/templates/usersMassProcessing.tpl
wcfsetup/install/files/lib/acp/form/UsersMassProcessingForm.class.php

index 80f4666304964ecc392a2ac822ea1b03a5d9f6c2..d6c90d1e002844b8baf223766d9671e5bfc36fb8 100644 (file)
@@ -1,67 +1,62 @@
 {include file='header'}
 
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/Suggestion.class.js"></script>
-<script type="text/javascript" src="{@RELATIVE_WCF_DIR}js/TabMenu.class.js"></script>
 <script type="text/javascript">
        //<![CDATA[
-       // disable
-       function disableAll() {
-               {foreach from=$availableActions item=availableAction}
-               disable{@$availableAction|ucfirst}();
-               {/foreach}
-       }
-       
-       function disableSendMail() {
-               hideOptions('sendMailDiv');
-       }
-       
-       function disableExportMailAddress() {
-               hideOptions('exportMailAddressDiv');
-       }
-       
-       function disableAssignToGroup() {
-               hideOptions('assignToGroupDiv');
-       }
-       
-       function disableDelete() { }
-       
-       // enable
-       function enableSendMail() {
-               disableAll();
-               showOptions('sendMailDiv');
-       }
-       
-       function enableExportMailAddress() {
-               disableAll();
-               showOptions('exportMailAddressDiv');
-       }
-       
-       function enableAssignToGroup() {
-               disableAll();
-               showOptions('assignToGroupDiv');
-       }
-       
-       function enableDelete() {
-               disableAll();
-       }
-       
-       var tabMenu = new TabMenu();
-       onloadEvents.push(function() {
-               tabMenu.showSubTabMenu('profile')
-               {if $action != ''}enable{@$action|ucfirst}();{else}disableAll();{/if}
-       });
-       
-       function setFileType(newType) {
-               switch (newType) {
-                       case 'csv':
-                               showOptions('separatorDiv', 'textSeparatorDiv');
-                               break;
-                       case 'xml':
-                               hideOptions('separatorDiv', 'textSeparatorDiv');
-                               break;
+       $(function() {
+               function toggleContainer(value) {
+                       for (var $name in $targetContainers) {
+                               if ($name === value) {
+                                       $targetContainers[$name].show();
+                               }
+                               else {
+                                       $targetContainers[$name].hide();
+                               }
+                       }
+               }
+               
+               var $targetContainers = { };
+               $('input[name=action]').each(function(index, input) {
+                       var $input = $(input);
+                       var $value = $input.prop('value');
+                       
+                       if (!$targetContainers[$value]) {
+                               var $container = $('#' + $.wcfEscapeID($value + 'Div'));
+                               if ($container.length) {
+                                       $targetContainers[$value] = $container;
+                               }
+                       }
+                       
+                       $input.change(function(event) {
+                               toggleContainer($(event.currentTarget).prop('value'));
+                       });
+               });
+               
+               function setFileType(newType) {
+                       if (newType === 'csv') {
+                               $('#separatorDiv').show().next().show();
+                       }
+                       else {
+                               $('#separatorDiv').hide().next().hide();
+                       }
                }
-       }
-       onloadEvents.push(function() { setFileType('{@$fileType}'); });
+               
+               $('input[name=fileType]').each(function(index, input) {
+                       var $input = $(input);
+                       
+                       $input.change(function(event) {
+                               setFileType($input.prop('value'));
+                       });
+               });
+               
+               toggleContainer('{@$action}');
+               setFileType('{@$fileType}');
+               
+               new WCF.Search.User($('#username'), function(data) {
+                       $('#username').val(data.label);
+                       return false;
+               }, false);
+               WCF.TabMenu.init();
+       });
        //]]>
 </script>
 
                                <dt><label for="username">{lang}wcf.user.username{/lang}</label></dt>
                                <dd>
                                        <input type="text" id="username" name="username" value="{$username}" class="medium" />
-                                       <script type="text/javascript">
-                                               //<![CDATA[
-                                               suggestion.enableMultiple(false);
-                                               suggestion.init('username');
-                                               //]]>
-                                       </script>
                                </dd>
                        </dl>
                        
                {event name='fieldsets'}
                
                {hascontent}
-                       <nav class="tabMenu"><!-- ToDo: Fix that TabMenu! -->
-                               <ul>
-                                       {content}
-                                               {if $options|count}
-                                                       <li id="profile"><a onclick="tabMenu.showSubTabMenu('profile');"><span>{lang}wcf.acp.user.search.conditions.profile{/lang}</span></a></li>
-                                               {/if}
-
-                                               {event name='tabMenuTabs'}
-                                       {/content}
-                               </ul>
-                       </nav>
-
-                       <nav class="menu">
-                               <div class="containerHead"><div> </div></div>
-                       </nav>
-
-                       {if $options|count}
-                               <div id="profile-content" class="border tabMenuContent hidden">
-                                       <hgroup class="subHeading">
-                                               <h1>{lang}wcf.acp.user.search.conditions.profile{/lang}</h1>
-                                       </hgroup>
-
-                                       {include file='optionFieldList' langPrefix='wcf.user.option.'}
-                               </div>
-                       {/if}
-
-                       {event name='tabMenuContent'}
+                       <div class="tabMenuContainer">
+                               <nav class="tabMenu">
+                                       <ul>
+                                               {content}
+                                                       {if $options|count}
+                                                               <li><a href="#profile">{lang}wcf.acp.user.search.conditions.profile{/lang}</a></li>
+                                                       {/if}
+       
+                                                       {event name='tabMenuTabs'}
+                                               {/content}
+                                       </ul>
+                               </nav>
+                               
+                               {if $options|count}
+                                       <div id="profile" class="border tabMenuContent hidden">
+                                               <hgroup class="subHeading">
+                                                       <h1>{lang}wcf.acp.user.search.conditions.profile{/lang}</h1>
+                                               </hgroup>
+                                               
+                                               {include file='optionFieldList' langPrefix='wcf.user.option.'}
+                                       </div>
+                               {/if}
+                               
+                               {event name='tabMenuContent'}
+                       </div>
                {/hascontent}
        </div>
        
                                        <dl>
                                                <dd>
                                                        {if $__wcf->session->getPermission('admin.user.canMailUser')}
-                                                               <label><input type="radio" onclick="if (IS_SAFARI) enableSendMail()" onfocus="enableSendMail()" name="action" value="sendMail" {if $action == 'sendMail'}checked="checked" {/if}/> {lang}wcf.acp.user.sendMail{/lang}</label>
-                                                               <label><input type="radio" onclick="if (IS_SAFARI) enableExportMailAddress()" onfocus="enableExportMailAddress()" name="action" value="exportMailAddress" {if $action == 'exportMailAddress'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress{/lang}</label>
+                                                               <label><input type="radio" name="action" value="sendMail" {if $action == 'sendMail'}checked="checked" {/if}/> {lang}wcf.acp.user.sendMail{/lang}</label>
+                                                               <label><input type="radio" name="action" value="exportMailAddress" {if $action == 'exportMailAddress'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress{/lang}</label>
                                                        {/if}
                                                        {if $__wcf->session->getPermission('admin.user.canEditUser')}
-                                                               <label><input type="radio" onclick="if (IS_SAFARI) enableAssignToGroup()" onfocus="enableAssignToGroup()" name="action" value="assignToGroup" {if $action == 'assignToGroup'}checked="checked" {/if}/> {lang}wcf.acp.user.assignToGroup{/lang}</label>
+                                                               <label><input type="radio" name="action" value="assignToGroup" {if $action == 'assignToGroup'}checked="checked" {/if}/> {lang}wcf.acp.user.assignToGroup{/lang}</label>
                                                        {/if}
                                                        {if $__wcf->session->getPermission('admin.user.canDeleteUser')}
-                                                               <label><input type="radio" onclick="if (IS_SAFARI) enableDelete()" onfocus="enableDelete()" name="action" value="delete" {if $action == 'delete'}checked="checked" {/if}/> {lang}wcf.acp.user.delete{/lang}</label>
+                                                               <label><input type="radio" name="action" value="delete" {if $action == 'delete'}checked="checked" {/if}/> {lang}wcf.acp.user.delete{/lang}</label>
                                                        {/if}
                                                        
-                                                       {if $additionalActions|isset}{@$additionalActions}{/if}
+                                                       {event name='additionalActions'}
                                                        
                                                        {if $errorField == 'action'}
                                                                <small class="innerError">
                                                        <legend>{lang}wcf.acp.user.exportEmailAddress.fileType{/lang}</legend>
                                                        
                                                        <dl>
-                                                               <dd><label><input type="radio" onclick="if (IS_SAFARI) setFileType('csv')" onfocus="setFileType('csv')" name="fileType" value="csv" {if $fileType == 'csv'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress.fileType.csv{/lang}</label></dd>
-                                                               <dd><label><input type="radio" onclick="if (IS_SAFARI) setFileType('xml')" onfocus="setFileType('xml')" name="fileType" value="xml" {if $fileType == 'xml'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress.fileType.xml{/lang}</label></dd>
+                                                               <dd><label><input type="radio" name="fileType" value="csv" {if $fileType == 'csv'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress.fileType.csv{/lang}</label></dd>
+                                                               <dd><label><input type="radio" name="fileType" value="xml" {if $fileType == 'xml'}checked="checked" {/if}/> {lang}wcf.acp.user.exportEmailAddress.fileType.xml{/lang}</label></dd>
                                                        </dl>
                                                </fieldset>
                                        </dd>
index eedbb91bd3337c6ad74a23f4577398e09e1cfff3..0ad28dd7fefd57c4562ca648ffe1c11b5f6a3418 100644 (file)
@@ -345,7 +345,7 @@ class UsersMassProcessingForm extends UserOptionListForm {
                        }
                }
                
-               $this->options = $this->getCategoryOptions('profile');
+               $this->options = $this->optionHandler->getCategoryOptions('profile');
        }
        
        /**
@@ -388,9 +388,6 @@ class UsersMassProcessingForm extends UserOptionListForm {
                // check master password
                WCFACP::checkMasterPassword();
                
-               // get user options and categories from cache
-               $this->readCache();
-               
                // show form
                parent::show();
        }
@@ -398,14 +395,16 @@ class UsersMassProcessingForm extends UserOptionListForm {
        /**
         * @see wcf\system\option\ISearchableOptionType::getSearchFormElement()
         */
+       /*
        protected function getFormElement($type, &$optionData) {
                return $this->getTypeObject($type)->getSearchFormElement($optionData);
-       }
+       }*/
        
        /**
         * @see wcf\acp\form\AbstractOptionListForm::checkOption()
         */
+       /*
        protected static function checkOption(Option $option) {
                return ($option->searchable == 1 && !$option->disabled && ($option->visible == 3 || $option->visible < 2));
-       }
+       }*/
 }