users.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. /**
  3. * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or later.
  5. * See the COPYING-README file.
  6. */
  7. $allGroups=array();
  8. foreach($_["groups"] as $group) {
  9. $allGroups[] = $group['name'];
  10. }
  11. $_['subadmingroups'] = $allGroups;
  12. $items = array_flip($_['subadmingroups']);
  13. unset($items['admin']);
  14. $_['subadmingroups'] = array_flip($items);
  15. ?>
  16. <script>
  17. var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
  18. </script>
  19. <div id="controls">
  20. <form id="newuser" autocomplete="off">
  21. <input id="newusername" type="text" placeholder="<?php echo $l->t('Name')?>" /> <input
  22. type="password" id="newuserpassword"
  23. placeholder="<?php echo $l->t('Password')?>" /> <select
  24. class="groupsselect"
  25. id="newusergroups" data-placeholder="groups"
  26. title="<?php echo $l->t('Groups')?>" multiple="multiple">
  27. <?php foreach($_["groups"] as $group): ?>
  28. <option value="<?php echo $group['name'];?>">
  29. <?php echo $group['name'];?>
  30. </option>
  31. <?php endforeach;?>
  32. </select> <input type="submit" value="<?php echo $l->t('Create')?>" />
  33. </form>
  34. <div class="quota">
  35. <span><?php echo $l->t('Default Quota');?>:</span>
  36. <div class="quota-select-wrapper">
  37. <?php if((bool) $_['isadmin']): ?>
  38. <select class='quota'>
  39. <?php foreach($_['quota_preset'] as $preset):?>
  40. <?php if($preset!='default'):?>
  41. <option
  42. <?php if($_['default_quota']==$preset) echo 'selected="selected"';?>
  43. value='<?php echo $preset;?>'>
  44. <?php echo $preset;?>
  45. </option>
  46. <?php endif;?>
  47. <?php endforeach;?>
  48. <?php if(array_search($_['default_quota'], $_['quota_preset'])===false):?>
  49. <option selected="selected"
  50. value='<?php echo $_['default_quota'];?>'>
  51. <?php echo $_['default_quota'];?>
  52. </option>
  53. <?php endif;?>
  54. <option value='other'>
  55. <?php echo $l->t('Other');?>
  56. ...
  57. </option>
  58. </select> <input class='quota-other'></input>
  59. <?php endif; ?>
  60. <?php if((bool) !$_['isadmin']): ?>
  61. <select class='quota' disabled="disabled">
  62. <option selected="selected">
  63. <?php echo $_['default_quota'];?>
  64. </option>
  65. </select>
  66. <?php endif; ?>
  67. </div>
  68. </div>
  69. </div>
  70. <div id='notification'></div>
  71. <table data-groups="<?php echo implode(', ', $allGroups);?>">
  72. <thead>
  73. <tr>
  74. <th id='headerName'><?php echo $l->t('Name')?></th>
  75. <th id="headerPassword"><?php echo $l->t( 'Password' ); ?></th>
  76. <th id="headerGroups"><?php echo $l->t( 'Groups' ); ?></th>
  77. <?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
  78. <th id="headerSubAdmins"><?php echo $l->t('Group Admin'); ?></th>
  79. <?php endif;?>
  80. <th id="headerQuota"><?php echo $l->t( 'Quota' ); ?></th>
  81. <th id="headerRemove">&nbsp;</th>
  82. </tr>
  83. </thead>
  84. <tbody>
  85. <?php foreach($_["users"] as $user): ?>
  86. <tr data-uid="<?php echo $user["name"] ?>">
  87. <td class="name"><?php echo $user["name"]; ?></td>
  88. <td class="password"><span>●●●●●●●</span> <img class="svg action"
  89. src="<?php echo image_path('core', 'actions/rename.svg')?>"
  90. alt="set new password" title="set new password"/>
  91. </td>
  92. <td class="groups"><select
  93. class="groupsselect"
  94. data-username="<?php echo $user['name'] ;?>"
  95. data-user-groups="<?php echo $user['groups'] ;?>"
  96. data-placeholder="groups" title="<?php echo $l->t('Groups')?>"
  97. multiple="multiple">
  98. <?php foreach($_["groups"] as $group): ?>
  99. <option value="<?php echo $group['name'];?>">
  100. <?php echo $group['name'];?>
  101. </option>
  102. <?php endforeach;?>
  103. </select>
  104. </td>
  105. <?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
  106. <td class="subadmins"><select
  107. class="subadminsselect"
  108. data-username="<?php echo $user['name'] ;?>"
  109. data-subadmin="<?php echo $user['subadmin'] ;?>"
  110. data-placeholder="subadmins" title="<?php echo $l->t('Group Admin')?>"
  111. multiple="multiple">
  112. <?php foreach($_["subadmingroups"] as $group): ?>
  113. <option value="<?php echo $group;?>">
  114. <?php echo $group;?>
  115. </option>
  116. <?php endforeach;?>
  117. </select>
  118. </td>
  119. <?php endif;?>
  120. <td class="quota">
  121. <div class="quota-select-wrapper">
  122. <select class='quota-user'>
  123. <?php foreach($_['quota_preset'] as $preset):?>
  124. <option
  125. <?php if($user['quota']==$preset) echo 'selected="selected"';?>
  126. value='<?php echo $preset;?>'>
  127. <?php echo $preset;?>
  128. </option>
  129. <?php endforeach;?>
  130. <?php if(array_search($user['quota'], $_['quota_preset'])===false):?>
  131. <option selected="selected" value='<?php echo $user['quota'];?>'>
  132. <?php echo $user['quota'];?>
  133. </option>
  134. <?php endif;?>
  135. <option value='other'>
  136. <?php echo $l->t('Other');?>
  137. ...
  138. </option>
  139. </select> <input class='quota-other'></input>
  140. </div>
  141. </td>
  142. <td class="remove">
  143. <?php if($user['name']!=OC_User::getUser()):?>
  144. <a href="#" class="action delete" original-title="<?php echo $l->t('Delete')?>">
  145. <img src="<?php echo image_path('core', 'actions/delete.svg') ?>" />
  146. </a>
  147. <?php endif;?>
  148. </td>
  149. </tr>
  150. <?php endforeach; ?>
  151. </tbody>
  152. </table>