diff --git a/src/ajax.js b/src/ajax.js index e36bb2e..751568f 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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 += ''+item.tag+''; + }); + $('#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 += ''+item.tag+''; - }); - $('#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(''+tagsList[i].tag+''); + } + $('#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); +} diff --git a/src/index.php b/src/index.php index 7f0e30b..613ad00 100644 --- a/src/index.php +++ b/src/index.php @@ -77,7 +77,7 @@ $().ready(function(){ changeYear:true, constrainInput: false, duration:'', nextText:'>', prevText:'<', dayNamesMin:lang.daysMin, monthNamesShort:lang.monthsLong }); - $("#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)} }); @@ -151,9 +151,17 @@ $().ajaxStop( function(r,s) {$("#loading").fadeOut();} );
 
-

-

-

+
+
+
+ + + +
+ +
+
+
diff --git a/src/lang/class.default.php b/src/lang/class.default.php index f8a0b89..abf9423 100644 --- a/src/lang/class.default.php +++ b/src/lang/class.default.php @@ -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(); diff --git a/src/lang/en.php b/src/lang/en.php index dfa30c5..5b19ff6 100644 --- a/src/lang/en.php +++ b/src/lang/en.php @@ -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", ); } diff --git a/src/style.css b/src/style.css index 61d96ea..497cf71 100644 --- a/src/style.css +++ b/src/style.css @@ -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; }