General Actions:
Log-in
Register
Wiki:
games
▼
:
Document Index
»
Space:
XWiki
▼
:
Document Index
»
Page:
XWikiGroupSheet
Search
en
Page Actions:
Export
▼
:
Export as PDF
Export as RTF
Export as HTML
More actions
▼
:
Print preview
View Source
Wiki Home
»
XWiki Space
»
Groups
»
XWikiGroupSheet
Wiki source code of
XWikiGroupSheet
Last modified by
Administrator
on 2011/11/06 20:09
Content
·
Comments
(0)
·
Annotations
(0)
·
Attachments
(0)
·
History
·
Information
Hide line numbers
1: {{velocity output="false"}} 2: #set($mainwk = $xcontext.isMainWiki()) 3: $xwiki.jsfx.use('js/xwiki/usersandgroups/usersandgroups.js', true) 4: $xwiki.ssfx.use('js/xwiki/usersandgroups/usersandgroups.css') 5: $xwiki.jsfx.use('js/xwiki/table/livetable.js', true) 6: $xwiki.ssfx.use('js/xwiki/table/livetable.css', true) 7: #set($groupDoc = $doc) 8: #if($doc.fullName == 'Main.UserDirectory') 9: #set($groupDoc = $xwiki.getDocument('XWiki.XWikiAllGroup')) 10: #end 11: #macro(hasGroupRight $right $hasGroupRight) 12: #set($result = false) 13: #if($!xwiki.hasAccessLevel("$!right", $xcontext.user, $doc.fullName) && $doc.getObject('XWiki.XWikiGroups', false)) 14: #set($result = true) 15: #end 16: #set($hasGroupRight = $util.null) 17: #setVariable("$hasGroupRight" $result) 18: #end 19: #hasGroupRight('edit' $hasEditGroupRight) 20: #hasGroupRight('delete' $hasDeleteGroupRight) 21: ## 22: ## 23: {{/velocity}} 24: 25: {{velocity}} 26: ## Keep testing the inline action for backward compatibility with existing groups. 27: #if(($xcontext.action == 'edit' || $xcontext.action == 'inline') && $hasEditGroupRight) 28: {{html}} 29: <div id="addNewMember"> 30: <table> 31: <tr> 32: <td class="addlabel">$msg.get('xe.admin.groups.addUser') 33: #if(!$mainwk) 34: </td> 35: <td><select name="wiki" id="addUserScope"> 36: <option value="local" selected="selected">$msg.get('xe.admin.local')</option> 37: <option value="global">$msg.get('xe.admin.global')</option> 38: </select> 39: </td> 40: #else 41: <input type="hidden" name="wiki" value="local" /></td> 42: #end 43: <td> 44: <input id="userSuggest" type="text" size="30" name="newMember" autocomplete="off" /> 45: </td> 46: <td> 47: <input type="button" id="addNewUser" class="button" value="$msg.get('xe.admin.groups.addUser.submit')" /> 48: </td> 49: </tr> 50: <tr> 51: <td class="addlabel">$msg.get('xe.admin.groups.addGroup') 52: #if(!$mainwk) 53: </td> 54: <td><select name="wiki" id="addGroupScope"> 55: <option value="local" selected="selected">$msg.get('xe.admin.local')</option> 56: <option value="global">$msg.get('xe.admin.global')</option> 57: </select> 58: </td> 59: #else 60: <input type="hidden" name="wiki" value="local" /></td> 61: #end 62: <td> 63: <input id="groupSuggest" type="text" size="30" name="newMember" autocomplete="off" /> 64: </td> 65: <td> 66: <input type="button" id="addNewGroup" class="button" value="$msg.get('xe.admin.groups.addGroup.submit')" /> 67: </td> 68: </tr> 69: <tr><td colspan="3" id="errMsg"></td></tr> 70: </table> 71: </div> 72: ## 73: ## 74: <script type="text/javascript"> 75: // <![CDATA[ 76: if (typeof XWiki == "undefined") { 77: var XWiki = {}; 78: } 79: Object.extend(XWiki, { 80: groupmanager : { 81: /* 82: ** Initialize Group Manager javascript widgets (called on document load). 83: */ 84: userSuggest: null, 85: 86: groupSuggest: null, 87: 88: init: function() { 89: if (XWiki.contextaction != 'view') { 90: this.initSuggestWidget(); 91: this.initAddNewMemberWidget(); 92: } 93: }, 94: initSuggestWidget: function() { 95: if ($('userSuggest')) { 96: $('userSuggest').observe('focus', this.createSuggest.bind(this, $('userSuggest'), 'user', true)); 97: } 98: if ($('groupSuggest')) { 99: $('groupSuggest').observe('focus', this.createSuggest.bind(this, $('groupSuggest'), 'group', false)); 100: } 101: }, 102: initAddNewMemberWidget: function() { 103: if ($('addNewUser')) { 104: $('addNewUser').observe('click', this.addNewMember.bind(this, 'user', $('userSuggest'))); 105: } 106: if ($('addNewGroup')) { 107: $('addNewGroup').observe('click', this.addNewMember.bind(this, 'group', $('groupSuggest'))); 108: } 109: }, 110: createSuggest: function(input, uorg, suggestObj) { 111: // Clear the errors 112: $('errMsg').innerHTML = ""; 113: suggesturl = "${doc.getURL('view', 'xpage=uorgsuggest&classname=XWiki.XWikiUsers')}"; 114: 115: if (uorg == "user") { 116: suggesturl += "&uorg=user&wiki=" + ($('addUserScope') ? $('addUserScope').value : "local") + "&"; 117: icon = "$xwiki.getSkinFile('icons/silk/user.gif')"; 118: } else { 119: suggesturl += "&uorg=group&wiki=" + ($('addGroupScope') ? $('addGroupScope').value : "local") + "&"; 120: icon = "$xwiki.getSkinFile('icons/silk/group.gif')"; 121: } 122: return new XWiki.widgets.Suggest(input, { script: suggesturl, varname:'input', icon:icon }); 123: }, 124: addNewMember: function(uorg, input) { 125: if (input && input.value.strip() != '') { 126: var url = "${doc.getURL()}?xpage=adduorg&uorg=" + encodeURIComponent(uorg) + "&name=" + encodeURIComponent(input.value) + "&form_token=$!{escapetool.url($services.csrf.getToken())}"; 127: new Ajax.Request(url, { 128: method: 'get', 129: onSuccess: function(transport) { 130: $('userSuggest').value = ""; 131: $('groupSuggest').value = ""; 132: var nr = parseInt(transport.responseText); 133: if (nr == 0) { 134: if (uorg == "user") { 135: $('errMsg').innerHTML = "$msg.get('xe.admin.groups.addUser.duplicate')"; 136: } else { 137: $('errMsg').innerHTML = "$msg.get('xe.admin.groups.addGroup.duplicate')"; 138: } 139: } else { 140: var end = editgrouptable.limit; 141: var start = editgrouptable.lastOffset; 142: editgrouptable.clearCache(); 143: if (start < 1) { 144: start = 1; 145: } 146: editgrouptable.getRows(start, end, start, end); 147: } 148: } 149: }); 150: } 151: } 152: } 153: }); 154: XWiki.groupmanager.init(); 155: // ]]> 156: </script> 157: {{/html}}#end 158: #set($columnOptions = { 159: "member" : {'link': 'auto', 'type': 'text'}, 160: '_avatar' : { 'type' : 'none', 'link' : 'field', 'html' : 'true', 'sortable' : false }, 161: "_actions" : { 162: 'actions': ['delete'], 163: 'actionCallbacks': {'delete': 'table.deleteRow(i);'}, 164: 'ajaxActions': {'delete': true} 165: } 166: }) 167: ## Keep testing the inline action for backward compatibility with existing groups. 168: #if(($xcontext.action == 'edit' || $xcontext.action == 'inline') && $hasDeleteGroupRight) 169: #set($columns = ['_avatar', 'member', '_actions']) 170: #else 171: #set($columns = ['_avatar', 'member']) 172: #end 173: #livetable('groupusers', $columns, $columnOptions, {'url' : "${groupDoc.getURL('view', 'xpage=getgroupmembers')}", 'translationPrefix' : 'xe.admin.groups.', 'javascriptName' : 'editgrouptable'}) 174: {{/velocity}}