Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
ENH: Refs #223. two minor changes.
Browse files Browse the repository at this point in the history
1) use variables to store dom objects to improve running performance.
2) set qtip's position to target on mouse
  • Loading branch information
yuzhengZ committed Nov 14, 2011
1 parent a4f6985 commit c40fe40
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
2 changes: 1 addition & 1 deletion core/public/css/community/community.manage.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ span.userDataTitle{
.ui-draggable { cursor: pointer; }

div.userPersonalData{
opacity: .85;
opacity: .90;
}
2 changes: 1 addition & 1 deletion core/public/css/user/user.manage.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ span.communityTitle{
.draggable { cursor: pointer; }

div.communityList{
opacity: .85;
opacity: .90;
}

div.communityList span.communityShortDescription{
Expand Down
47 changes: 26 additions & 21 deletions core/public/js/community/community.manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ $(document).ready(function() {
"sEmptyTable": "No users in this group"
}
});
if($(this).attr('groupid')!=undefined)
var groupid=$(this).attr('groupid');
if(groupid!=undefined)
{
datatable[$(this).attr('groupid')]=obj;
datatable[groupid]=obj;
}
});

Expand Down Expand Up @@ -194,6 +195,8 @@ function init()
{
groupUsersSelected=new Array();
memberSelected=new Array();
var mainDialogContentDiv = $('div.MainDialogContent');
var createGroupFromDiv = $('div#createGroupFrom');
$('a.groupLink').each(function(){
var id=$(this).attr('groupid');
$(this).parent('li').find('span').html(' ('+($('div#groupList_'+id+' td.tdUser').size())+')');
Expand All @@ -203,24 +206,22 @@ function init()
{
$('div.groupUsersSelection').hide();
$('td.tdUser input').removeAttr('checked');
$('div.MainDialogContent').html('');
$('div.MainDialogContent').html('');
$('div#createGroupFrom').find('input[name=groupId]').val('0');
$('div#createGroupFrom').find('input[name=name]').val('');
showDialogWithContent(json.community.message.createGroup,$('div#createGroupFrom').html(),false);
$('div.MainDialogContent form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
mainDialogContentDiv.html('');
createGroupFromDiv.find('input[name=groupId]').val('0');
createGroupFromDiv.find('input[name=name]').val('');
showDialogWithContent(json.community.message.createGroup,createGroupFromDiv.html(),false);
mainDialogContentDiv.find('form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
});

$('a.editGroupLink').click(function()
{
$('div.MainDialogContent').html('');
mainDialogContentDiv.html('');
var id=$(this).attr('groupid');
$('div.MainDialogContent').html('');
$('div#createGroupFrom').find('input[name=groupId]').val(id);
createGroupFromDiv.find('input[name=groupId]').val(id);
var groupName=$(this).parent('li').find('a:first').html();
showDialogWithContent(json.community.message.editGroup,$('div#createGroupFrom').html(),false);
showDialogWithContent(json.community.message.editGroup,createGroupFromDiv.html(),false);
$('form.editGroupForm input#name').val(groupName);
$('div.MainDialogContent form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
mainDialogContentDiv.find('form.editGroupForm').ajaxForm( {beforeSubmit: validateGroupChange, success: successGroupChange} );
});

$('a.groupLink').click(function()
Expand Down Expand Up @@ -498,19 +499,23 @@ function successInfoChange(responseText, statusText, xhr, form)

function initCommunityPrivacy()
{
if($('input[name=privacy]:checked').val()== 1) //private
var inputCanJoin = $('input[name=canJoin]');
var inputPrivacy = $('input[name=privacy]');
var canJoinDiv = $('div#canJoinDiv');

if(inputPrivacy.filter(':checked').val()== 1) //private
{
$('input[name=canJoin]').attr('disabled','disabled');
$('input[name=canJoin]').removeAttr('checked');
$('input[name=canJoin][value=0]').attr('checked', true); //invitation
$('div#canJoinDiv').hide();
inputCanJoin.attr('disabled','disabled');
inputCanJoin.removeAttr('checked');
inputCanJoin.filter('[value=0]').attr('checked', true); //invitation
canJoinDiv.hide();
}
else
{
$('input[name=canJoin]').removeAttr('disabled');
$('div#canJoinDiv').show();
inputCanJoin.removeAttr('disabled');
canJoinDiv.show();
}
$('input[name=privacy]').change(function(){
inputPrivacy.change(function(){
initCommunityPrivacy();
});
}
Expand Down
10 changes: 5 additions & 5 deletions core/public/js/user/user.manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ function initDragAndDrop()
}
var destination_obj=this;

// do nothing if drop item(s) to its current folder
// do nothing if drop item(s) to its current folder, otherwise move item(s)
if ($(this).attr('id') != $(from_obj).attr('id')){
$.post(json.global.webroot+'/browse/movecopy', {moveElement: true, elements: elements , destination:$(this).attr('element'),from:$(from_obj).attr('element'),ajax:true},
$.post(json.global.webroot+'/browse/movecopy', {moveElement: true, elements: elements , destination:$(destination_obj).attr('element'),from:$(from_obj).attr('element'),ajax:true},
function(data) {

jsonResponse = jQuery.parseJSON(data);
Expand All @@ -114,7 +114,7 @@ function initDragAndDrop()
if(jsonResponse[0])
{
createNotive(jsonResponse[1],1500);
$($(ui.draggable).parents("tr")).appendBranchTo(destination_obj);
$($(ui.draggable).parents("tr")[0]).appendBranchTo(destination_obj);
$(from_obj).reload();
$(destination_obj).reload();
}
Expand Down Expand Up @@ -147,11 +147,11 @@ function initDragAndDrop()
});

$(this).parents("tr:[policy=0]").qtip({
content: 'You do not have write permission on this folder and cannot drop items to it !',
content: 'You do not have write permission on this folder and cannot drop item(s) to it !',
show: 'mouseover',
hide: 'mouseout',
position: {
at: 'center',
target: 'mouse',
my: 'bottom left',
viewport: $(window), // Keep the qtip on-screen at all times
effect: true // Disable positioning animation
Expand Down

0 comments on commit c40fe40

Please sign in to comment.