Skip to content

Commit

Permalink
Item14343: Merge updates to Group templates and topics
Browse files Browse the repository at this point in the history
Changes to reduce topics shipped in Main web, make them easier to update
         - Move GroupTemplate to System web.
         - Change code to search for Main.GroupTemplate,
           System.GroupTemplate to
           allow override.
         - Move GroupViewTemplate to System web.
         - Split active components of WikiGroups topic into
           System.WikiGroupsComponents
         - Change any INCLUDE of moved topics to list Main.<topic>,
           System.<topic>, so easy override is possible.
  • Loading branch information
gac410 committed Jun 6, 2017
2 parents 90e01a9 + c035a5f commit d717ab5
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 97 deletions.
8 changes: 0 additions & 8 deletions TopicUserMappingContrib/data/Main/GroupTemplate.txt

This file was deleted.

13 changes: 13 additions & 0 deletions TopicUserMappingContrib/data/System/GroupTemplate.txt
@@ -0,0 +1,13 @@
%META:TOPICINFO{author="ProjectContributor" date="1489712653" format="1.1" version="1"}%
%META:TOPICPARENT{name="WikiGroups"}%
%STARTSECTION{type="templateonly"}%
To modify this template, first copy it to %USERSWEB%.%TOPIC% web, and edit that
copy. If %USERSWEB%.%TOPIC% exists, it will automatically be used when
creating new groups.
%ENDSECTION{type="templateonly"}%

%MAKETEXT{"Edit this topic to add a description to the [_1]" args="!%URLPARAM{"topic"}%"}%

%META:PREFERENCE{name="GROUP" title="GROUP" value=""}%
%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" value="GroupView"}%
%META:PREFERENCE{name="ALLOWTOPICCHANGE" title="ALLOWTOPICCHANGE" type="Set" value="%URLPARAM{"topic"}%"}%
Expand Up @@ -3,7 +3,6 @@
data/System/TopicUserMappingContrib.txt 0644 Documentation
lib/Foswiki/Contrib/TopicUserMappingContrib.pm 0444
lib/Foswiki/Users/TopicUserMapping.pm 0444
data/Main/GroupTemplate.txt 0644
data/Main/NobodyGroup.txt 0644
data/Main/RegistrationAgent.txt 0644
data/Main/UserHomepageHeader.txt 0644
Expand All @@ -19,6 +18,7 @@ data/System/ChangeEmailAddress.txt 0644
data/System/ChangePassword.txt 0644
data/System/DefaultUserRegistration.txt 0644
data/System/FAQRebuildingWikiUsersTopic.txt 0644
data/System/GroupTemplate.txt 0644
data/System/ManagingUsers.txt 0644
data/System/NewUserTemplate.txt 0644
data/System/ResetPassword.txt 0644
Expand Down
13 changes: 11 additions & 2 deletions TopicUserMappingContrib/lib/Foswiki/Users/TopicUserMapping.pm
Expand Up @@ -946,8 +946,17 @@ sub addUserToGroup {
)
);

$groupTopicObject =
Foswiki::Meta->load( $this->{session}, $groupWeb, 'GroupTemplate' );
if ( Foswiki::Func::topicExists( $groupWeb, 'GroupTemplate' ) ) {
$groupTopicObject =
Foswiki::Meta->load( $this->{session}, $groupWeb,
'GroupTemplate' );
}
else {
$groupTopicObject =
Foswiki::Meta->load( $this->{session},
$Foswiki::cfg{SystemWebName},
'GroupTemplate' );
}

# expand the GroupTemplate as best we can.
$this->{session}->{request}
Expand Down
74 changes: 2 additions & 72 deletions core/data/Main/WikiGroups.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1489206078" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1489712653" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%
---+ Wiki groups dashboard
Showing all known groups that can be used to define [[%SYSTEMWEB%.AccessControl][access controls]] in <nop>%WIKITOOLNAME%.
Expand All @@ -13,74 +13,4 @@ page can be significantly improved by enabling the following Set statement.
With this enabled, adding and removing members and also topic upgrades for each group are omitted from this page. Maintenance can be done from the individual group topics.
-->

%TWISTY{
link="<img src='%ICONURLPATH{"persons"}%' /> %MAKETEXT{"Create a new group"}%"
mode="div"
%IF{"$expand='1'" then='start="show"'}%
}%

<sticky>
<form action='%SCRIPTURLPATH{"manage" topic="%WEB%.%TOPIC%"}%' method='post'>
<input type="hidden" name="action" value="addUserToGroup"/>
<input type="hidden" name="create" value="1"/>
<div class="foswikiFormSteps">
<div class="foswikiFormStep ">
<h3>%MAKETEXT{"Group name"}%</h3>
<input type="text" name="groupname" size="30" class="foswikiInputField" value="%URLPARAM{"groupname"}%" />
<div class="foswikiFormDescription">
*Note:*
A group name must be a [[%SYSTEMWEB%.WikiWord][WikiWord]] and *must* end in =...Group=.
New topics are based on [[GroupTemplate]]
</div>
</div>
<div class="foswikiFormStep">
<h3>%MAKETEXT{"Members"}%</h3>
<input type="text" name="username" value="%URLPARAM{"username"}%" size="60" class="foswikiInputField" />
<div class="foswikiFormDescription">Comma separated list. You will be added to the group automatically to allow you to continue to manage the new group.</div>
</div>
<div class="foswikiFormStep">
<input class="foswikiSubmit" type="submit" value="%MAKETEXT{"Create group"}%"/>
</div>
<div class="foswikiFormStep foswikiLast">
<div class="foswikiFormDescription foswikiHelp">
*IMPORTANT NOTE:* Think twice before restricting write access to a web or a topic, because an open system where everybody can contribute is the essence of [[%SYSTEMWEB%.WikiCulture][WikiCulture]]. Experience shows that unrestricted write access works very well because:
* There is enough peer pressure to post only appropriate content.
* Content does not get lost because topics are under revision control.
* A topic revision can be undone by a member of the [[%USERSWEB%.AdminGroup][AdminGroup]] if necesssary.

*Related topics:* [[%SYSTEMWEB%.AccessControl][AccessControl]], [[%WEBPREFSTOPIC%]], [[%WIKIUSERSTOPIC%]], [[%SYSTEMWEB%.WikiCulture][WikiCulture]]

<div class="foswikiHelp">%X% If a large number of groups are configured, the rendering performance of this page can be significantly improved by disabling group maintenance from this page. Edit this topic for more information.</div>
</div>
</div>
</div>
</form></sticky> %ENDTWISTY%

%GROUPINFO{
header="<table class='foswikiTable wikiGroupsTable'>
<tr>
<th>%MAKETEXT{"Group"}%</th>
<th>%MAKETEXT{"Members"}%</th>
<th>%MAKETEXT{"Actions"}%</th>
</tr>$n"
format="<tr>
<td> $percntIF{\"not istopic '%USERSWEB%.$name'\" then=\"<nop>$name\" else=\"[[%USERSWEB%.$name][$name]]\"}$percnt</td>
<td>
$percntINCLUDE{\"%USERSWEB%.GroupViewTemplate\"
section=\"rendergroup\"
groupname=\"$name\"
allowschange=\"$allowschange\"
}$percnt
</td>
<td class=\"wikiGroupsActions\">
$percntINCLUDE{\"%USERSWEB%.GroupViewTemplate\"
section=\"groupactions\"
groupname=\"$name\"
allowschange=\"$allowschange\"
}$percnt
</td>
</tr>"
footer="</table>"
separator="$n"
}%

%INCLUDE{"%BASEWEB%.WikiGroupsComponents, %SYSTEMWEB%.WikiGroupsComponents"}%
6 changes: 3 additions & 3 deletions core/data/System/AdminToggle.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1426913092" format="1.1" reprev="2" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1495729065" format="1.1" version="1"}%
---+ Group Member Toggle

This topic implements a button that will turn Admin status on or off for the
Expand All @@ -25,10 +25,10 @@ user making the change instead of the anonymous !AdminUser.
_If you (<nop>%WIKINAME%) has permission to change the %USERSWEB%.AdminGroup topic, a button to add or remove yourself from the !AdminGroup will appear below:_
Be sure that you have explicit CHANGE authority on the !AdminGroup or removing yourself from the group will be permanent.

%STARTINCLUDE%%INCLUDE{"%USERSWEB%.GroupViewTemplate" section="manageself" groupname="AdminGroup"}%%STOPINCLUDE%
%STARTINCLUDE%%INCLUDE{"%USERSWEB%.GroupViewTemplate,%SYSTEMWEB%.GroupViewTemplate" section="manageself" groupname="AdminGroup"}%%STOPINCLUDE%

---+++ More enhancements

You can add this button to your custom sidebar for any group, by using the following include macro:
<verbatim>
%INCLUDE{"%USERSWEB%.GroupViewTemplate" section="manageself" groupname="AdminGroup"}%</verbatim>
%INCLUDE{"%USERSWEB%.GroupViewTemplate,%SYSTEMWEB%.GroupViewTemplate" section="manageself" groupname="AdminGroup"}%</verbatim>
@@ -1,18 +1,21 @@
%META:TOPICINFO{author="ProjectContributor" date="1458094641" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1495729065" format="1.1" version="1"}%
%{ NOTE: THIS IS A SKIN TEMPLATE, NOT A TOPIC TEMPLATE }%
%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"content"}%<div class="foswikiTopicText">
%ADDTOZONE{"script" text="<script src='/pub/System/JavascriptFiles/strikeone.js'></script>"}%
---+!! %NOP%%TOPIC%
%IF{"'%USERSWEB%'='%WEB%'" else="<div class=\'foswikiAlert'>You are
viewing an inactive Group topic. See the [[%USERSWEB%.%TOPIC%]] for the live version of this group.</div>"}%

%IF{
"'%USERSWEB%.%TOPIC%' allows 'change'
AND '%TOPIC%' != 'BaseGroup'
AND '%TOPIC%' != 'NobodyGroup'
AND {AdminUserWikiName} != '%WIKINAME%'"
then="
$percntINCLUDE{
\"%USERSWEB%.GroupViewTemplate\"
\"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate\"
section=\"manageself\"
groupname=\"%TOPIC%\"
}$percnt
Expand All @@ -21,12 +24,12 @@
%TEXT%
---++ %MAKETEXT{"Members"}%
%INCLUDE{
"%USERSWEB%.GroupViewTemplate"
"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate"
section="rendergroup"
groupname="%TOPIC%"
twisty="on"
}%%INCLUDE{
"%USERSWEB%.GroupViewTemplate"
"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate"
section="groupactions"
groupname="%TOPIC%"
twisty="on"
Expand Down Expand Up @@ -180,8 +183,8 @@ then='
parameters: groupname
-->
%STARTSECTION{"group_upgrade"}%
<div id='manageGroup' title="%MAKETEXT{"Upgrade"}% %URLPARAM{"groupname"}%" class="jqUIDialog { modal:true, resizable:false, draggable:false, width:400, autoCenter:true, cache:false}">
<form action="%SCRIPTURLPATH{"manage"}%/%WEB%/%TOPIC%" method="post">
<div id='manageGroup' title='%MAKETEXT{"Upgrade"}% <noautolink>%URLPARAM{"groupname"}%</noautolink>' class="jqUIDialog { modal:true, resizable:false, draggable:false, width:400, autoCenter:true, cache:false}">
<form action="%SCRIPTURLPATH{"manage"}%/%USERSWEB%/%BASETOPIC%" method="post">
<input type="hidden" name="groupname" value="%URLPARAM{"groupname"}%"/>
<input type="hidden" name="action" value="addUserToGroup"/>
<input type="hidden" name="create" value="1"/>
Expand All @@ -202,7 +205,7 @@ then='
-->
%STARTSECTION{"group_add"}%<!-- --><sticky>
<div id='manageGroup' title='%MAKETEXT{"Add Members to [_1]" args="<noautolink>%URLPARAM{"groupname"}%</noautolink>"}%' class='jqUIDialog { modal:true, resizable:false, draggable:false, width:400, autoCenter:true, cache:false}'>
<form id='addUser' action='%SCRIPTURLPATH{"manage"}%/%WEB%/%TOPIC%' method='post'>
<form id='addUser' action='%SCRIPTURLPATH{"manage"}%/%USERSWEB%/%BASETOPIC%' method='post'>
<input type='hidden' name='groupname' value='%URLPARAM{"groupname" default="%groupname%"}%'/>
<input type='hidden' name='action' value='addUserToGroup'/>
<div class='foswikiFormSteps'>
Expand All @@ -227,7 +230,7 @@ then='
%GROUPINFO{
"%URLPARAM{"groupname"}%"
expand="0"
header="<form action=\"%SCRIPTURLPATH{"manage"}%/%WEB%/%TOPIC%\" method=\"post\" >
header="<form action=\"%SCRIPTURLPATH{"manage"}%/%USERSWEB%/%BASETOPIC%\" method=\"post\" >
<input type=\"hidden\" name=\"groupname\" value=\"%URLPARAM{"groupname"}%\" />
<input type=\"hidden\" name=\"action\" value=\"removeUserFromGroup\" />
<div class=\"foswikiFormSteps\">
Expand Down Expand Up @@ -274,8 +277,8 @@ then='
%STARTSECTION{"manageself"}%
%IF{
"'%GROUPINFO{"%groupname%" expand="0"}%'=~'\b%USERNAME%\b'"
then="%INCLUDE{"%USERSWEB%.GroupViewTemplate" section="delme" groupname="%groupname%"}%"
else="%INCLUDE{"%USERSWEB%.GroupViewTemplate" section="addme" groupname="%groupname%"}%"
then="%INCLUDE{"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate" section="delme" groupname="%groupname%"}%"
else="%INCLUDE{"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate" section="addme" groupname="%groupname%"}%"
}%
%ENDSECTION{"manageself"}%

Expand Down
82 changes: 82 additions & 0 deletions core/data/System/WikiGroupsComponents.txt
@@ -0,0 +1,82 @@
%META:TOPICINFO{author="ProjectContributor" date="1489712653" format="1.1" version="1"}%
%META:TOPICPARENT{name="WebHome"}%
---+ Wiki groups components.
Contains the active components used by %USERSWEB%.WikiGroups. To modify this
topic, copy it to %USERSWEB%.WikiGroupsComponents and edit the copy. It will
automatically be used.

<verbatim class="tml">
%STARTINCLUDE%
%TWISTY{
link="<img src='%ICONURLPATH{"persons"}%' /> %MAKETEXT{"Create a new group"}%"
mode="div"
%IF{"$expand='1'" then='start="show"'}%
}%

<sticky>
<form action='%SCRIPTURLPATH{"manage" topic="%USERSWEB%.WikiGroups"}%' method='post'>
<input type="hidden" name="action" value="addUserToGroup"/>
<input type="hidden" name="create" value="1"/>
<div class="foswikiFormSteps">
<div class="foswikiFormStep ">
<h3>%MAKETEXT{"Group name"}%</h3>
<input type="text" name="groupname" size="30" class="foswikiInputField" value="%URLPARAM{"groupname"}%" />
<div class="foswikiFormDescription">
*Note:*
A group name must be a [[%SYSTEMWEB%.WikiWord][WikiWord]] and *must* end in =...Group=.
New topics are based on %IF{"istopic %USERSWEB%.GroupTemplate" then="[[%USERSWEB%.GroupTemplate]]" else="[[%SYSTEMWEB%.GroupTemplate]]"}%
</div>
</div>
<div class="foswikiFormStep">
<h3>%MAKETEXT{"Members"}%</h3>
<input type="text" name="username" value="%URLPARAM{"username"}%" size="60" class="foswikiInputField" />
<div class="foswikiFormDescription">Comma separated list. You will be added to the group automatically to allow you to continue to manage the new group.</div>
</div>
<div class="foswikiFormStep">
<input class="foswikiSubmit" type="submit" value="%MAKETEXT{"Create group"}%"/>
</div>
<div class="foswikiFormStep foswikiLast">
<div class="foswikiFormDescription foswikiHelp">
*IMPORTANT NOTE:* Think twice before restricting write access to a web or a topic, because an open system where everybody can contribute is the essence of [[%SYSTEMWEB%.WikiCulture][WikiCulture]]. Experience shows that unrestricted write access works very well because:
* There is enough peer pressure to post only appropriate content.
* Content does not get lost because topics are under revision control.
* A topic revision can be undone by a member of the [[%USERSWEB%.AdminGroup][AdminGroup]] if necesssary.

*Related topics:* [[%SYSTEMWEB%.AccessControl][AccessControl]], [[%WEBPREFSTOPIC%]], [[%WIKIUSERSTOPIC%]], [[%SYSTEMWEB%.WikiCulture][WikiCulture]]

<div class="foswikiHelp">%X% If a large number of groups are configured, the rendering performance of this page can be significantly improved by disabling group maintenance from this page. Edit this topic for more information.</div>
</div>
</div>
</div>
</form></sticky> %ENDTWISTY%

%GROUPINFO{
header="<table class='foswikiTable wikiGroupsTable'>
<tr>
<th>%MAKETEXT{"Group"}%</th>
<th>%MAKETEXT{"Members"}%</th>
<th>%MAKETEXT{"Actions"}%</th>
</tr>$n"
format="<tr>
<td> $percntIF{\"not istopic '%USERSWEB%.$name'\" then=\"<nop>$name\" else=\"[[%USERSWEB%.$name][$name]]\"}$percnt</td>
<td>
$percntINCLUDE{\"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate\"
section=\"rendergroup\"
groupname=\"$name\"
allowschange=\"$allowschange\"
}$percnt
</td>
<td class=\"wikiGroupsActions\">
$percntINCLUDE{\"%SYSTEMWEB%.GroupViewTemplate, %USERSWEB%.GroupViewTemplate\"
section=\"groupactions\"
groupname=\"$name\"
allowschange=\"$allowschange\"
}$percnt
</td>
</tr>"
footer="</table>"
separator="$n"
}%

%STOPINCLUDE%
</verbatim>
3 changes: 2 additions & 1 deletion core/lib/Foswiki/Contrib/core/MANIFEST
Expand Up @@ -35,7 +35,6 @@ bin/viewfileauth 0555
data/Main/AdminGroup.txt 0644
data/Main/AdminUser.txt 0644
data/Main/AdminUserLeftBar.txt 0644
data/Main/GroupViewTemplate.txt 0644
data/Main/ProjectContributor.txt 0644
data/Main/SitePreferences.txt 0644
data/Main/UnknownUser.txt 0644
Expand Down Expand Up @@ -112,6 +111,7 @@ data/System/FrequentlyAskedQuestions.txt 0644
data/System/GlossaryOfTerms.txt 0644
data/System/GoBox.txt 0644
data/System/GoodStyle.txt 0644
data/System/GroupViewTemplate.txt 0644
data/System/HierarchicalNavigation.txt 0644
data/System/HierarchicalNavigationChildExample.txt 0644
data/System/IfStatements.txt 0644
Expand Down Expand Up @@ -317,6 +317,7 @@ data/System/WebTopicEditTemplate.txt 0644
data/System/WebTopicList.txt 0644
data/System/WelcomeGuest.txt 0644
data/System/WikiCulture.txt 0644
data/System/WikiGroupsComponents.txt 0644
data/System/WikiName.txt 0644
data/System/WikiSyntaxSummary.txt 0644
data/System/WikiWord.txt 0644
Expand Down

0 comments on commit d717ab5

Please sign in to comment.