+ can show all tags in task edit

This commit is contained in:
Max Pozdeev 2009-09-21 17:43:54 +04:00
parent 931ff6d64a
commit 2b29063bf1
5 changed files with 81 additions and 29 deletions

View file

@ -25,6 +25,7 @@ var tmp = {};
var oBtnMenu = {};
var tabLists;
var curList = 0;
var tagsList = [];
function loadTasks()
{
@ -310,6 +311,7 @@ function cancelEdit(e)
document.edittask.note.value = '';
document.edittask.tags.value = '';
document.edittask.duedate.value = '';
toggleEditAllTags(0);
return false;
}
@ -672,6 +674,23 @@ function changeTaskOrder(id)
}
}
function loadTags(callback)
{
setAjaxErrorTrigger();
$.getJSON('ajax.php?tagCloud&list='+curList.id+'&rnd='+Math.random(), function(json){
resetAjaxErrorTrigger();
if(!parseInt(json.total)) tagsList = [];
else tagsList = json.cloud;
var cloud = '';
$.each(tagsList, function(i,item){
cloud += '<a href="#" onClick=\'addFilterTag("'+item.tag+'");tagCloudClose();return false;\' class="tag w'+item.w+'" >'+item.tag+'</a>';
});
$('#tagcloudcontent').html(cloud)
flag.tagsChanged = false;
callback();
});
}
function showTagCloud(el)
{
w = $('#tagcloud');
@ -682,29 +701,12 @@ function showTagCloud(el)
$('#tagcloudcontent').html('');
$('#tagcloudload').show();
offset = $(el).offset();
l = Math.ceil(offset.left - w.outerWidth()/2 + $(el).outerWidth()/2);
if(l<0) l=0;
w.css({ position: 'absolute', top: offset.top+el.offsetHeight-1, left: l }).show();
setAjaxErrorTrigger();
nocache = '&rnd='+Math.random();
$.getJSON('ajax.php?tagCloud&list='+curList.id+nocache, function(json){
resetAjaxErrorTrigger();
$('#tagcloudload').hide();
if(!parseInt(json.total)) return;
var cloud = '';
$.each(json.cloud, function(i,item){
cloud += '<a href="#" onClick=\'addFilterTag("'+item.tag+'");tagCloudClose();return false;\' class="tag w'+item.w+'" >'+item.tag+'</a>';
});
$('#tagcloudcontent').html(cloud)
flag.tagsChanged = false;
});
w.css({ position: 'absolute', top: offset.top+el.offsetHeight-1, left: offset.left }).show();
loadTags(function(){$('#tagcloudload').hide();});
}
else {
offset = $(el).offset();
l = Math.ceil(offset.left - w.outerWidth()/2 + $(el).outerWidth()/2);
if(l<0) l=0;
w.css({ position: 'absolute', top: offset.top+el.offsetHeight-1, left: l }).show();
w.css({ position: 'absolute', top: offset.top+el.offsetHeight-1, left: offset.left }).show();
}
$(document).bind("click", tagCloudClose);
}
@ -828,7 +830,7 @@ function editFormResize(startstop, event)
else if(startstop == 2) {
//to avoid bug http://dev.jqueryui.com/ticket/3628
if(f.is('.ui-draggable')) {
f.css('left',tmp.editformpos[0]).css('top',tmp.editformpos[1]).css('position', 'fixed');
f.css( {left:tmp.editformpos[0], top:tmp.editformpos[1], height:''} ).css('position', 'fixed');
}
}
else $('#page_taskedit textarea').height(f.height() - tmp.editformdiff);
@ -906,12 +908,12 @@ function toggleNote(id)
o.toggleClass('hidden');
}
function toggleAllNotes(showhide)
function toggleAllNotes(show)
{
for(id in taskList)
{
if(taskList[id].note == '') continue;
if(showhide) {
if(show) {
$('#taskrow_'+id+'>div>.mtt-toggle').attr('src', img.toggle[1]);
$('#taskrow_'+id+'>div>div.task-note-block').removeClass('hidden');
}
@ -1021,3 +1023,38 @@ function addsearchToggle(toSearch)
$('#task').focus();
}
}
function toggleEditAllTags(show)
{
if(show)
{
if(flag.tagsChanged) loadTags(fillEditAllTags);
else fillEditAllTags();
showhide($('#alltags_hide'), $('#alltags_show'));
}
else {
$('#alltags').hide();
showhide($('#alltags_show'), $('#alltags_hide'))
}
}
function fillEditAllTags()
{
var a = [];
for(var i=tagsList.length-1; i>=0; i--) {
a.push('<a href="#" class="tag" onClick=\'addEditTag("'+tagsList[i].tag+'");return false\'>'+tagsList[i].tag+'</a>');
}
$('#alltags .tags-list').html(a.join(', '));
$('#alltags').show();
}
function addEditTag(tag)
{
var v = $('#edittags').val();
if(v == '') {
$('#edittags').val(tag);
return;
}
var r = v.search(new RegExp('(^|,)\\s*'+tag+'\\s*(,|$)'));
if(r < 0) $('#edittags').val(v+', '+tag);
}

View file

@ -77,7 +77,7 @@ $().ready(function(){
changeYear:true, constrainInput: false, duration:'', nextText:'&gt;', prevText:'&lt;', dayNamesMin:lang.daysMin,
monthNamesShort:lang.monthsLong });
<?php if(!isset($_GET['pda'])): ?>
$("#page_taskedit").draggable({ stop: function(e,ui){ flag.windowTaskEditMoved=true; tmp.editformpos=[$(this).css('left'),$(this).css('top')]; } });
$("#page_taskedit").draggable({ handle:'h3', stop: function(e,ui){ flag.windowTaskEditMoved=true; tmp.editformpos=[$(this).css('left'),$(this).css('top')]; } });
$("#page_taskedit").resizable({ minWidth:$("#page_taskedit").width(), minHeight:$("#page_taskedit").height(), start:function(ui,e){editFormResize(1)}, resize:function(ui,e){editFormResize(0,e)}, stop:function(ui,e){editFormResize(2,e)} });
<?php endif; ?>
@ -151,9 +151,17 @@ $().ajaxStop( function(r,s) {$("#loading").fadeOut();} );
<input type="hidden" name="id" value="">
<div class="form-row"><span class="h"><?php __('priority');?></span> <SELECT name="prio"><option value="2">+2</option><option value="1">+1</option><option value="0" selected>&plusmn;0</option><option value="-1">&minus;1</option></SELECT>
&nbsp; <span class="h"><?php __('due');?> </span> <input name="duedate" id="duedate" value="" class="in100" title="Y-M-D, M/D/Y, D.M.Y, M/D, D.M" autocomplete="off"></div>
<div class="form-row"><span class="h"><?php __('task');?></span><br> <input type="text" name="task" value="" class="in500" maxlength="250"></div>
<div class="form-row"><span class="h"><?php __('note');?></span><br> <textarea name="note" class="in500"></textarea></div>
<div class="form-row"><span class="h"><?php __('tags');?></span><br> <input type="text" name="tags" id="edittags" value="" class="in500" maxlength="250"></div>
<div class="form-row"><div class="h"><?php __('task');?></div> <input type="text" name="task" value="" class="in500" maxlength="250"></div>
<div class="form-row"><div class="h"><?php __('note');?></div> <textarea name="note" class="in500"></textarea></div>
<div class="form-row"><div class="h"><?php __('tags');?></div>
<table cellspacing="0" cellpadding="0" width="100%"><tr>
<td><input type="text" name="tags" id="edittags" value="" class="in500" maxlength="250"></td>
<td width="1" style="white-space:nowrap; padding-left:5px; text-align:right;">
<a href="#" id="alltags_show" onClick="toggleEditAllTags(1);return false;"><?php __('alltags_show');?></a>
<a href="#" id="alltags_hide" onClick="toggleEditAllTags(0);return false;" style="display:none"><?php __('alltags_hide');?></a></td>
</tr></table>
</div>
<div class="form-row" id="alltags" style="display:none;"><?php __('alltags');?> <span class="tags-list"></span></div>
<div class="form-row"><input type="submit" value="<?php __('save');?>" onClick="this.blur()"> <input type="button" value="<?php __('cancel');?>" onClick="cancelEdit();this.blur();return false"></div>
</form>

View file

@ -71,6 +71,9 @@ class DefaultLang
'list_new' => "New list",
'list_rename' => "Rename",
'list_delete' => "Delete",
'alltags' => "All tags:",
'alltags_show' => "Show all",
'alltags_hide' => "Hide all",
);
var $js = array();

View file

@ -66,6 +66,9 @@ class Lang extends DefaultLang
'list_new' => "New list",
'list_rename' => "Rename",
'list_delete' => "Delete",
'alltags' => "All tags:",
'alltags_show' => "Show all",
'alltags_hide' => "Hide all",
);
}

View file

@ -62,7 +62,6 @@ a { color:#0000ff; }
.task-left { float:left; }
.task-left .mtt-toggle { cursor:pointer; }
.task-middle { margin-left:40px; margin-right:65px; }
.nobr input { margin-left:0px; margin-right:4px; }
#tasklist { list-style-type: none; margin: 0; padding: 0;}
#tasklist li { padding:6px 2px 6px 6px; border-bottom:1px solid #DEDEDE; min-height:18px; margin-bottom:1px; background-color:#fff; }
#tasklist li:hover { background-color:#f6f6f6; }
@ -111,12 +110,14 @@ div.task-note-area textarea { color:#999999; width:100%; display:block; height:6
#authstr { display: none; color:#ff0000; }
.form-row { margin-top:4px; margin-bottom:4px; }
.form-row span.h { font-weight:bold; color:#333333; }
.form-row .h { font-weight:bold; color:#333333; }
#overlay { position:fixed; z-index:200; background-color:#111111; display:none; top:0px; left:0px; width:100%; height:100%; }
#page_taskedit { position:fixed; z-index:201; background-color:#fdfdfd; padding:8px; border:1px solid #cccccc; width:510px; }
#page_taskedit .form-row .in500 { width:99%; }
#page_taskedit .form-row textarea.in500 { height:130px; /*resize:none;*/ }
.ui-icon-gripsmall-diagonal-se { background-image:url(images/resizegrip.gif); }
#alltags .tag { font-weight:bold; color:#333333; }
#alltags .tag:hover { background-color:#999988; color:white; }
/* autocomplete */
.ac_results { padding: 0px; border: 1px solid #cccccc; background-color: #f0f0f0; overflow: hidden; z-index: 99999; }