Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--settings/ajax/changegroupname.php24
-rw-r--r--settings/css/settings.css7
-rw-r--r--settings/js/users.js33
-rw-r--r--settings/routes.php2
-rw-r--r--settings/templates/users.php4
5 files changed, 68 insertions, 2 deletions
diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php
new file mode 100644
index 00000000000..cbf1e3e5e86
--- /dev/null
+++ b/settings/ajax/changegroupname.php
@@ -0,0 +1,24 @@
+<?php
+// Check if we are a user
+
+OCP\JSON::callCheck();
+OC_JSON::checkLoggedIn();
+
+$l=OC_L10N::get('core');
+
+$groupname = $_POST["groupname"];
+
+// Return Success story
+// TODO : make changes to the API to allow this.
+// setGroupname doesnt exist yet.
+if(OC_Group::setGroupname($groupname)) {
+ OC_JSON::success(
+ array("data" => array(
+ "message" => $l->t('Group name has been changed.'),
+ "groupname" => $groupname,
+ )
+ )
+ );
+} else {
+ OC_JSON::error(array("data" => array( "message" => $l->t("Unable to change group name"))));
+} \ No newline at end of file
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 696fe01a91e..b96c0806b99 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -52,11 +52,16 @@ table.nostyle td { padding: 0.2em 0; }
/* USERS */
.usercount { float: left; margin: 5px; }
+span.utils .delete, span.utils .rename {
+ float: left; position: relative; display: none;
+ margin: 3px; top: 4px;
+}
+#app-navigation ul li:hover > span.utils .delete,
+#app-navigation ul li:hover > span.utils .rename { display: block; }
span.utils .delete {
float: left; position: relative; display: none;
margin: 3px; top: 4px;
}
-#app-navigation ul li:hover > span.utils .delete { display: block; }
#usersearchform { position: absolute; top: 4px; right: 10px; }
#usersearchform label { font-weight: 700; }
form { display:inline; }
diff --git a/settings/js/users.js b/settings/js/users.js
index 5d4fbed2a2b..f31367472a8 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -632,6 +632,39 @@ $(document).ready(function () {
}
});
});
+
+ // Implements Groupname editing.
+ $('#app-navigation').on('click', 'span.utils>img.rename', function (event) {
+ event.stopPropagation();
+ var img = $(this);
+ var gid = img.parent().parent().attr('data-gid');
+ var groupname = escapeHTML(img.parent().parent().attr('data-gid'));
+ var input = $('<input type="text" value="' + groupname + '">');
+ img.css('display', 'none');
+ img.parent().parent().children('a').replaceWith(input);
+ input.focus();
+ input.keypress(function (event) {
+ if (event.keyCode === 13) {
+ if ($(this).val().length > 0) {
+ $.post(
+ OC.filePath('settings', 'ajax', 'changegroupname.php'),
+ { groupname: gid,
+ groupname: $(this).val()
+ }
+ );
+ input.blur();
+ } else {
+ input.blur();
+ }
+ }
+ });
+ input.blur(function () {
+ var input = $(this), groupname = input.val();
+ input.closest('li').attr('data-gid', groupname);
+ input.replaceWith('<a href="#">' + escapeHTML(groupname) + '</a>');
+ img.css('display', '');
+ });
+ });
// Handle undo notifications
OC.Notification.hide();
diff --git a/settings/routes.php b/settings/routes.php
index 0e0f293b9be..1352fac8383 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -44,6 +44,8 @@ $this->create('settings_users_changepassword', '/settings/users/changepassword')
->action('OC\Settings\ChangePassword\Controller', 'changeUserPassword');
$this->create('settings_ajax_changedisplayname', '/settings/ajax/changedisplayname.php')
->actionInclude('settings/ajax/changedisplayname.php');
+$this->create('settings_ajax_changegorupname', '/settings/ajax/changegroupname.php')
+ ->actionInclude('settings/ajax/changegroupname.php');
// personal
$this->create('settings_personal_changepassword', '/settings/personal/changepassword')
->post()
diff --git a/settings/templates/users.php b/settings/templates/users.php
index 8c624ff655c..129f01282a5 100644
--- a/settings/templates/users.php
+++ b/settings/templates/users.php
@@ -45,6 +45,8 @@ $_['subadmingroups'] = array_flip($items);
<a href="#"><?php p($group['name']); ?></a>
<span class="utils">
<span class="usercount"><?php p(count($group['useringroup'])); ?></span>
+ <img class="svg action rename" src="<?php p(image_path('core', 'actions/rename.svg'))?>"
+ alt="<?php p($l->t("change group name"))?>" title="<?php p($l->t("change group name"))?>" />
<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">
<img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" class="svg" />
</a>
@@ -137,7 +139,7 @@ $_['subadmingroups'] = array_flip($items);
<?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
<th id="headerSubAdmins"><?php p($l->t('Group Admin')); ?></th>
<?php endif;?>
- <th id="headerQuota"><?php p($l->t('Storage')); ?></th>
+ <th id="headerQuota"><?php p($l->t('Quota')); ?></th>
<th id="headerStorageLocation"><?php p($l->t('Storage Location')); ?></th>
<th id="headerRemove">&nbsp;</th>
</tr>