Adding and Removing Group Members

or Items in a Comma Seperated List in Variables

Simple way to remove Items

NewGroupTemplateTopic - this template for changes

NewGroupTopicDefaultCarryOverText - this template for new groups when a URLPARAM is not supplied

NeilTrialGroup - sample group for larking around with

Change Item List

New Item List:  

Create New Group

New Group:

New Item List:  

Hello!

-- NeilGood - 31 Mar 2009
 

What am I trying to do?

I am looking for a system to help less confident and non wiki users manager people in Groups. The immediate need was to enable people to be added to a current group which I think the code below achieves albiet in a clumsy way.

The more difficult thing would be to present the user with a current list of people and then when they un-tick the box, those people would be removed from the group.

The way I can see of doing it is as follows:
  • Read the current list of people into an array in JavaScript
  • Provide the formatted table so it displays as per below via JavaScript - for-next loop
  • As the user unticks the box, then the user would not be in the revised group - on.change to change the final strong in real time
  • When Submit is pressed, the new group is written - change the Group Variable definition in the Group topic.

I have hit two issues:
  • knowledge of JavaScript to:
    • do the for loop
    • provide the updated string as the user clicks the buttons
  • changing the topic text - I can add text as the example proves but change the current contents......hmmm.....
    • My solution would be to either:
      • Use a template and then in effect create a new revision of the topic using a template but this would ignore/lose any modifications by the user.
      • Use some sort of RegEx expression to capture the text of the current topic from the start to * Set GROUP and the text afterwards to the end.....this would form a new topic and enable any comments/additional info to be preserved......however, I cannot write RegEx expressions!

Any help gratefully received as ever!

 

How did I fix it?

In this example, Set CURRGROUPLIST =  Comma, Seperated, List, AbcAbc in the becomes:
<ul>
<li> Set CURRGROUPLIST =  Comma, Seperated, List, <span class="foswikiNewLink">AbcAbc<a href="/bin/edit/Sandbox/AbcAbc?topicparent=Sandbox.CommentFormTopic" rel="nofollow" title="Create this topic">?</a></span> 
</li>
</ul>
which causes the location parameter in the CommentPlugin to fail as it does not match the text in the topic.

The key to success was enclosing the %COMMENT% in the <noautolink> tag which stopped FosWiki converting it to a hyperlink with the create topic option at the end.

The Code in action

This extracts the Variable from the topic ready for processing:

<noautolink>
%COMMENT{type="ListAddItem" target="CommentPluginTest" location="%CURRGROUPLIST%"}%
</noautolink>

Item to Add:

An alternative form with the same aim:

NewGroupTopicDefaultCarryOverText - stuff for a new group

-- Main.NeilGood - 31 Mar 2009

NewGroupTopicDefaultCarryOverText - stuff for a new Group topic incase a previous topic is not supplied

-- Main.NeilGood - 31 Mar 2009

NewGroupTopicDefaultCarryOverText

-- Main.NeilGood - 31 Mar 2009

Sample format for Including/Excluding items on the list

Here is the user Interface but this is where I think JavaScript is needed to change the string as the User checks/unchecks the items.

Item Include?
Comma
Seperated
List
AbcAbc
NeilGood
SimonLatham

-- NeilGood - 26 Mar 2009

Topic revision: r3 - 31 Mar 2009, NeilGood
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads