]> source.dussan.org Git - nextcloud-server.git/commitdiff
Initial Commit : Changes Storage to Quota, Implements GroupName editing.
authorraghunayyar <me@iraghu.com>
Tue, 18 Feb 2014 16:29:45 +0000 (21:59 +0530)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 2 Jun 2014 10:52:53 +0000 (12:52 +0200)
settings/ajax/changegroupname.php [new file with mode: 0644]
settings/css/settings.css
settings/js/users.js
settings/routes.php
settings/templates/users.php

diff --git a/settings/ajax/changegroupname.php b/settings/ajax/changegroupname.php
new file mode 100644 (file)
index 0000000..cbf1e3e
--- /dev/null
@@ -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
index 696fe01a91e2a075ac8ab2e845b15632bce96128..b96c0806b9949031e8ef3d637c12a5dcc5bfeddb 100644 (file)
@@ -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; }
index 5d4fbed2a2b448c30014348841a5940c9a9309d1..f31367472a8f2d93adb8b22183b0040405bd90bf 100644 (file)
@@ -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();
index 0e0f293b9be32534f812de6ee4dfbdba79b7c300..1352fac83836ab657baee7b15dd8b978ba272a96 100644 (file)
@@ -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()
index 8c624ff655cb7f345dc20b861da2879ce8a10b8d..129f01282a5dda479950c2ac63abe78f989efc8a 100644 (file)
@@ -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>