Fixed default value for html bbcode
authorAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 11:31:10 +0000 (13:31 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 15 Aug 2017 11:31:10 +0000 (13:31 +0200)
wcfsetup/install/files/acp/templates/userGroupAdd.tpl
wcfsetup/install/files/acp/templates/userGroupOption.tpl
wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php

index d697a2bd11cb6227615a3c50e350cce0898b5f25..055bc8d8baf1589db1358cda178049eb2f290d3d 100644 (file)
                        new WCF.ACP.User.Group.Copy({@$groupID});
                {/if}
                
-               {if $action == 'edit' && ($groupIsEveryone || $groupIsGuest || $groupIsUsers)}
+               {if $action === 'add' && $isBlankForm}
+                       elBySelAll('.jsBbcodeSelectOptionHtml input[type="checkbox"]', undefined, function (checkbox) {
+                               checkbox.checked = true;
+                       });
+               {elseif $action == 'edit' && ($groupIsEveryone || $groupIsGuest || $groupIsUsers)}
                        elBySelAll('.jsBbcodeSelectOptionHtml', undefined, function (bbcodeHtml) {
                                elBySel('input[type="checkbox"]', bbcodeHtml).checked = true;
                                
index f5e716841f73f9b25ea423936ad120885dc86239..b5dcea1d07b8447a3b7f415ced26524738da0755 100644 (file)
                else {
                        parent.appendChild(fragment);
                }
+               
+               [{@$everyoneGroupID}, {@$guestGroupID}, {@$userGroupID}].forEach(function(groupID) {
+                       elBySelAll('dl[data-group-id="' + groupID + '"] .jsBbcodeSelectOptionHtml', undefined, function (bbcodeHtml) {
+                               elBySel('input[type="checkbox"]', bbcodeHtml).checked = true;
+                               
+                               elHide(bbcodeHtml);
+                       });
+               });
        })();
 </script>
 
@@ -77,7 +85,7 @@
                </header>
                
                {foreach from=$groups item=group}
-                       <dl>
+                       <dl data-group-id="{@$group->groupID}">
                                <dt>{if VISITOR_USE_TINY_BUILD && $guestGroupID == $group->groupID && $userGroupOption->excludedInTinyBuild}<span class="icon icon16 fa-bolt red jsTooltip" title="{lang}wcf.acp.group.excludedInTinyBuild{/lang}"></span> {/if}<label for="userGroupOption{@$group->groupID}">{lang}{$group->groupName}{/lang}</label></dt>
                                <dd>
                                        {@$formElements[$group->groupID]}
index 89fc056463a422bcd58a0d1dd3952f3ab3699629..635e06b21d9d2efaef42820a3ffce6147a0e4b4e 100755 (executable)
@@ -217,7 +217,8 @@ class UserGroupAddForm extends AbstractOptionListForm {
                        'priority' => $this->priority,
                        'userOnlineMarking' => $this->userOnlineMarking,
                        'showOnTeamPage' => $this->showOnTeamPage,
-                       'groupIsGuest' => false
+                       'groupIsGuest' => false,
+                       'isBlankForm' => empty($_POST)
                ]);
        }
        
index 2311d978619b2a7788cd8f3923ba831c3af5b74b..489c3523cad6468b27d4d33ed9bedc794c3dc6ee 100644 (file)
@@ -246,11 +246,16 @@ class UserGroupOptionForm extends AbstractForm {
        public function assignVariables() {
                parent::assignVariables();
                
-               $guestGroupID = 0;
+               $everyoneGroupID = $guestGroupID = $userGroupID = 0;
                foreach ($this->groups as $group) {
-                       if ($group->groupType == UserGroup::GUESTS) {
+                       if ($group->groupType == UserGroup::EVERYONE) {
+                               $everyoneGroupID = $group->groupID;
+                       }
+                       else if ($group->groupType == UserGroup::GUESTS) {
                                $guestGroupID = $group->groupID;
-                               break;
+                       }
+                       else if ($group->groupType == UserGroup::USERS) {
+                               $userGroupID = $group->groupID;
                        }
                }
                
@@ -260,7 +265,9 @@ class UserGroupOptionForm extends AbstractForm {
                        'parentCategories' => $this->parentCategories,
                        'userGroupOption' => $this->userGroupOption,
                        'values' => $this->values,
-                       'guestGroupID' => $guestGroupID
+                       'everyoneGroupID' => $everyoneGroupID,
+                       'guestGroupID' => $guestGroupID,
+                       'userGroupID' => $userGroupID
                ]);
        }