%META:TOPICINFO{author="ProjectContributor" date="1727167921" format="1.1" version="1"}%
%TMPL:INCLUDE{"view"}%

%TMPL:DEF{"content"}%<div class="foswikiTopicText">
%ADDTOZONE{"script" text="<script src='/pub/System/JavascriptFiles/strikeone.js'></script>"}%
---+!! %NOP%%TOPIC%
%IF{
  "'%USERSWEB%.%TOPIC%' allows 'change'
  AND '%TOPIC%' != 'BaseGroup'
  AND '%TOPIC%' != 'NobodyGroup'
  AND {AdminUserWikiName} != '%WIKINAME%'"
  then="
      $percntINCLUDE{
       \"%USERSWEB%.GroupViewTemplate\"
       section=\"manageself\"
       groupname=\"%TOPIC%\"
      }$percnt
  "
}%
%TEXT%
---++ %MAKETEXT{"Members"}%
%INCLUDE{
   "%USERSWEB%.GroupViewTemplate"
   section="rendergroup"
   groupname="%TOPIC%"
   twisty="on"
}%%INCLUDE{
   "%USERSWEB%.GroupViewTemplate"
   section="groupactions"
   groupname="%TOPIC%"
   twisty="on"
}%

*%MAKETEXT{"Related topics:"}%* [[%SYSTEMWEB%.AccessControl][AccessControl]], [[%USERSWEB%.WikiGroups][WikiGroups]]

#TopicEnd
</div>%TMPL:END%

%TMPL:DEF{"topicactionbuttons__"}%%TMPL:END%

%TMPL:DEF{Named_sections_for_INCLUDE}%
---++ Named INCLUDE sections for use in both Group topics and the WikiGroups list
<verbatim>
<!--
  parameters: groupname, twisty
-->
%STARTSECTION{"rendergroup"}%<!-- -->
%GROUPINFO{"%groupname%"
  expand="0"
  format="$percntIF{\"istopic '%USERSWEB%.$wikiname'\" then=\"[[%USERSWEB%.$wikiname][$wikiname]]\" else=\"<nop>$wikiname\"}$percnt"
  separator=", "
  zeroresults="%IF{"'%groupname%' != 'NobodyGroup'" then="%MAKETEXT{"No members"}%$n()"}%"
}%
<!-- -->%ENDSECTION{"rendergroup"}%
</verbatim>

<verbatim>
<!--
  parameters: groupname, twisty
-->
%STARTSECTION{"groupactions"}%%ADDTOZONE{
"head"
id="WIKIGROUP::CSS"
text="<style type='text/css' media='all'>
.wikiGroupsTable {
	width:100%;
}
.wikiGroupsTable td,
.wikiGroupsTable th {
	vertical-align:top;
}
.wikiGroupsTable td.wikiGroupsActions {
   width:150px;
}
div.wikiGroupsAction {
       width:150px;
}
.wikiGroupsTable .foswikiFormSteps {
	margin:5px 0 10px 0;
}
.wikiGroupsAction {
	margin:1em 0;
}
.wikiGroupsNoAction {
	color:#888;
}
</style><!-- /WIKIGROUP::CSS -->"
}%<!-- --><div class='wikiGroupsAction'>
%GROUPINFO{"%groupname%"
  expand="0"
  format="" 
  separator=""
  zeroresults="$percntINCLUDE{
    \"%WEB%.%TOPIC%\"
    section=\"%IF{
      "istopic '%USERSWEB%.%groupname%' AND
       $WIKINAME != 'WikiGuest' AND
       '%groupname%' != 'NobodyGroup' AND
       '%groupname%' != 'BaseGroup' AND
       '%maint%' != 'off' AND
       '%USERSWEB%.%groupname%' allows 'change'
      " 
      then="changegroup%IF{"'%twisty%' = 'off'" then="notwisty"}%" 
      else="nochange"
    }%\"
    groupname=\"%groupname%\"
    allowremove=\"0\"
    zeromembers=\"1\"
  }$percnt"
  footer="$percntINCLUDE{
    \"%WEB%.%TOPIC%\"
    section=\"%IF{
      "istopic '%USERSWEB%.%groupname%' AND 
       $WIKINAME != 'WikiGuest' AND
       '$wikiusername' != 'AdminUser' AND
       '%groupname%' != 'NobodyGroup' AND
       '%groupname%' != 'BaseGroup' AND
       '%maint%' != 'off' AND
       '%USERSWEB%.%groupname%' allows 'change'
      " 
      then="changegroup" 
      else="nochange"
    }%\"
    groupname=\"%groupname%\"
    allowremove=\"1\"
  }$percnt"
}%
</div><!-- /groupactions -->
%ENDSECTION{"groupactions"}%
</verbatim>

<verbatim>
<!--
  parameters: username, groupname
-->
%STARTSECTION{"nochange"}%%IF{
   "'%groupname%' = 'NobodyGroup'"
   then="<span class='wikiGroupsNoAction'>%MAKETEXT{"This group should not have members."}%$n()</span>"
   else="%IF{
      "'%groupname%' = 'BaseGroup'"
      then="<span class='wikiGroupsNoAction'>%MAKETEXT{"System user list."}%$n()</span>"
      else="%IF{
         "$WIKINAME = 'WikiGuest'"
         then="%MAKETEXT{"Log in to continue."}%$n()"
         else="%IF{
            "'%USERSWEB%.%groupname%' allows 'change'"
            else="<span class='wikiGroupsNoAction'>%MAKETEXT{"Only members or admins may update group."}%$n()</span>"
         }%"
      }%"
   }%"
}%%ENDSECTION{"nochange"}%
</verbatim>

<verbatim>
<!--
  parameters: groupname
-->
%STARTSECTION{"changegroup"}%%JQREQUIRE{"ui::dialog, textboxlist"}%
%IF{"'%BASEWEB%.%BASETOPIC%'='%USERSWEB%.%groupname%'"
then='
---++ %MAKETEXT{"Administration"}%
'}%
%ICON{"useradd" quote="\""}% <a href='%SCRIPTURL{view}%/%WEB%/%TOPIC%?skin=text;section=group_add;groupname=%groupname%' alt='%MAKETEXT{"Add members..."}%' title='%MAKETEXT{"Add members..."}%' class='jqUIDialogLink  {cache:false}'>%MAKETEXT{"Add members..."}%</a>
%IF{"$allowremove"
   then='%BR%%ICON{"userdelete" quote="\""}% <a href="%SCRIPTURL{view}%/%WEB%/%TOPIC%?skin=text;section=group_remove;groupname=%groupname%" alt="%MAKETEXT{"Remove members..."}%" title="%MAKETEXT{"Remove members..."}%" class="jqUIDialogLink {cache:false}">%MAKETEXT{"Remove members..."}%</a>'
}%
%IF{
   "$allowremove AND 
   istopic '%USERSWEB%.%groupname%' AND 
   not ( '%USERSWEB%.%groupname%'/preferences[name='VIEW_TEMPLATE'].value = 'GroupView' )
   "
   then='%BR%%ICON{"wrench" quote="\""}% <a href="%SCRIPTURL{view}%/%WEB%/%TOPIC%?skin=text;section=group_upgrade;groupname=%groupname%" alt="%MAKETEXT{"Upgrade group topic..."}%" title="%MAKETEXT{"Upgrade group topic..."}%" class="jqUIDialogLink {cache:false}">%MAKETEXT{"Upgrade group topic..."}%</a>'
}%
<!-- /changegroup -->%ENDSECTION{"changegroup"}%
</verbatim>

<verbatim>
<!--
  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">
<input type="hidden" name="groupname" value="%URLPARAM{"groupname"}%"/>
<input type="hidden" name="action" value="addUserToGroup"/>
<input type="hidden" name="create" value="1"/>
<div class="foswikiFormSteps">
<div class="foswikiFormStep">
<p>%MAKETEXT{"Add user management options to this topic."}%</p>
</div>
   <a class="jqUIDialogButton jqUIDialogSubmit jqUIDialogClose {icon:'ui-icon-circle-check'}" >%MAKETEXT{"Upgrade"}%</a>
   <a id='cancelLink' class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}">%MAKETEXT{"Cancel"}%</a>
</div>
</form></div>
<!-- /group_upgrade -->%ENDSECTION{"group_upgrade"}%
</verbatim>

<verbatim>
<!--
  parameters: groupname
-->
%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'> 
<input type='hidden' name='groupname' value='%URLPARAM{"groupname" default="%groupname%"}%'/> 
<input type='hidden' name='action' value='addUserToGroup'/>
<div class='foswikiFormSteps'>
  <div class='foswikiFormStep'>
     <h3>%MAKETEXT{"Enter users or groups to add to this group"}%</h3>
     <input type='text' name='username' value='' size='30' class='foswikiInputField jqTextboxList' autocomplete='%SCRIPTURL{"view"}%/%SYSTEMWEB%/JQueryAjaxHelper?section=user;skin=text;baseweb=%BASEWEB%;%IF{"defined EXCLUDE" then="exclude=%EXCLUDE%"}%' />
  </div>
   <a class="jqUIDialogButton jqUIDialogSubmit jqUIDialogClose {icon:'ui-icon-circle-check'}" >%MAKETEXT{"Add members"}%</a>
   <a id='cancelLink' class="jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}">%MAKETEXT{"Cancel"}%</a>
</div>
</form></div><!-- /group_add -->
</sticky>
%ENDSECTION{"group_add"}%
</verbatim>

<verbatim>
<!--
  parameters: groupname
-->
%STARTSECTION{"group_remove"}%<!-- -->
<div id='manageGroup' title='%MAKETEXT{"Remove Members from [_1]" args="<noautolink>%URLPARAM{"groupname"}%</noautolink>"}%' class='jqUIDialog { modal:true, resizable:false, draggable:false,  width:400, autoCenter:true,  cache:false }'>
%GROUPINFO{
   "%URLPARAM{"groupname"}%"
   expand="0"
   header="<form action=\"%SCRIPTURLPATH{"manage"}%/%WEB%/%TOPIC%\" method=\"post\" >
     <input type=\"hidden\" name=\"groupname\" value=\"%URLPARAM{"groupname"}%\" />
     <input type=\"hidden\" name=\"action\" value=\"removeUserFromGroup\" />
     <div class=\"foswikiFormSteps\">
     <div class=\"foswikiFormStep\">
     <h3>%MAKETEXT{"Select members to remove from this group:"}%</h3>"
   format="<label style=\"display:block\">
      <input type=\"checkbox\" name=\"username\" value=\"$username\" /> <nop>$wikiname
      </label>"
   footer="</div>
        <a class=\"jqUIDialogButton jqUIDialogSubmit jqUIDialogClose {icon:'ui-icon-circle-check'}\" >%MAKETEXT{"Remove selected members"}%</a>
       <a class=\"jqUIDialogButton jqUIDialogClose {icon:'ui-icon-cancel'}\">%MAKETEXT{"Cancel"}%</a>
        $percntCLEAR$percnt
      </div>
      </form>"
   separator="$n"
}%</div>
<!-- /group_remove -->%ENDSECTION{"group_remove"}%
</verbatim>

%STARTSECTION{"addme"}%
%IF{"'%USERSWEB%.%groupname%' allows 'CHANGE'" then="
  <form name='addme' action='%SCRIPTURLPATH{"manage"}%/%USERSWEB%/%groupname%' method='post'>
    <input type='hidden' name='groupname' value='%groupname%'/>
    <input type='hidden' name='action' value='addUserToGroup'/>
    <input type='hidden' name='redirectto' value='%BASEWEB%.%BASETOPIC%'/>
    <input type='hidden' name='username' value='%WIKINAME%' />
    %BUTTON{"%MAKETEXT{"Join [_1]" args="<nop>%groupname%"}%" icon="add" type="submit"}%
    %CLEAR%
  </form>
"}%
%ENDSECTION{"addme"}%

%STARTSECTION{"delme"}%
  <form name='delme' action='%SCRIPTURLPATH{"manage"}%/%USERSWEB%/%groupname%' method='post'>
    <input type='hidden' name='groupname' value='%groupname%'/>
    <input type='hidden' name='action' value='removeUserFromGroup'/>
    <input type='hidden' name='redirectto' value='%BASEWEB%.%BASETOPIC%'/>
    <input type='hidden' name='username' value='%WIKINAME%' />
    %BUTTON{"%MAKETEXT{"Leave [_1]" args="<nop>%groupname%"}%" icon="delete" class="red" type="submit"}%
    %CLEAR%
  </form>
%ENDSECTION{"delme"}%

%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%"}%"
}%
%ENDSECTION{"manageself"}%

%TMPL:END%

%META:PREFERENCE{name="VIEW_TEMPLATE" title="VIEW_TEMPLATE" type="Set" value="SkinTemplateView"}%
%META:PREFERENCE{name="ALLOWTOPICCHANGE" title="ALLOWTOPICCHANGE" type="Set" value="AdminUser"}%
%META:PREFERENCE{name="PERMSET_CHANGE" title="PERMSET_CHANGE" type="Local" value="nobody"}%
