Initial Commit : Changes Storage to Quota, Implements GroupName editing.

This commit is contained in:
raghunayyar 2014-02-18 21:59:45 +05:30 committed by Arthur Schiwon
parent dc28f58951
commit 970f899726
5 changed files with 68 additions and 2 deletions

View File

@ -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"))));
}

View 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; }

View 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();

View 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()

View 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>