'+prepareDuedate(item.duedate, item.dueClass, item.dueStr)+
@@ -299,7 +293,7 @@ function showEditForm(isAdd)
{
$('
').appendTo('body').css('opacity', 0.5).show();
//clear selection
- if(document.selection && document.selection.empty) document.selection.empty();
+ if(document.selection && document.selection.empty && document.selection.createRange().text) document.selection.empty();
else if(window.getSelection) window.getSelection().removeAllRanges();
if(isAdd) {
$('#page_taskedit').removeClass('mtt-inedit').addClass('mtt-inadd');
@@ -724,16 +718,6 @@ function tagCloudClose(e)
$('#tagcloud').hide();
}
-function preloadImg()
-{
- for(var i in img) {
- for(var ii in img[i]) {
- var o = new Image();
- o.src = img[i][ii];
- }
- }
-}
-
function changeTaskCnt(cl, dir)
{
if(!dir) dir = 1;
@@ -1129,3 +1113,128 @@ function publishCurList()
else $('#btnPublish').removeClass('mtt-item-checked');
}, 'json');
}
+
+function taskContextMenu(el, id)
+{
+ if(!cmenu) cmenu = new mttMenu('taskcontextcontainer', {onclick:taskContextClick});
+ cmenu.tag = id;
+ cmenu.show(el);
+ return false;
+}
+
+function taskContextClick(el)
+{
+ if(!el.id) return;
+ var taskId = cmenu.tag;
+ switch(el.id) {
+ case 'cmenu_edit': editTask(taskId); break;
+ case 'cmenu_note': toggleTaskNote(taskId); break;
+ case 'cmenu_delete': deleteTask(taskId); break;
+ }
+}
+
+function mttMenu(container, options)
+{
+ var menu = this;
+ this.container = $('#'+container);
+ this.menuOpen = false;
+ this.options = options || {};
+
+ //create submenus
+ this.container.find('li.mtt-menu-has-submenu').each(function()
+ {
+ var submenu = new mttMenu($(this).attr('submenu'));
+ submenu.$caller = $(this);
+ submenu.parent = menu;
+ menu.submenu = submenu;
+
+ var showTimer, hideTimer;
+ $(this).hover(
+ function(){
+ clearTimeout(hideTimer);
+ showTimer = setTimeout(function(){
+ submenu.showSub();
+ }, 300);
+ },
+ function(){
+ clearTimeout(showTimer);
+ hideTimer = setTimeout(function(){
+ submenu.hide();
+ }, 300);
+ }
+ );
+
+ submenu.container.find('li').each(function()
+ {
+ $(this).hover(
+ function(){
+ clearTimeout(hideTimer);
+ },
+ function(){
+ hideTimer = setTimeout(function(){
+ submenu.hide();
+ }, 300);
+ }
+ );
+ });
+ });
+
+ this.container.find('li').click(function(){
+ menu.onclick(this);
+ return false;
+ });
+
+ this.onclick = function(item)
+ {
+ if($(item).is('.mtt-disabled')) return;
+ menu.close();
+ if(this.options.onclick) this.options.onclick(item);
+ }
+
+ this.hide = function()
+ {
+ if(this.submenu) this.submenu.hide();
+ this.container.hide();
+ this.menuOpen = false;
+ }
+
+ this.close = function(event)
+ {
+ if(!this.menuOpen) return;
+ if(event)
+ {
+ var t = event.target;
+ if(t == this.caller) return;
+ while(t.parentNode) {
+ if(t.parentNode == this.caller) return;
+ t = t.parentNode;
+ }
+ }
+ this.hide();
+ $(document).unbind('click.mttmenuclose');
+ }
+
+ this.show = function(caller)
+ {
+ if(this.menuOpen)
+ {
+ this.close();
+ if(this.caller && this.caller == caller) return;
+ }
+ this.caller = caller;
+ $caller = $(caller);
+ var offset = $caller.offset();
+ this.container.css({ position: 'absolute', top: offset.top+caller.offsetHeight-1, left: offset.left , 'min-width': $caller.width() }).show();
+ var menu = this;
+ $(document).bind('click.mttmenuclose', function(e){ menu.close(e) });
+ this.menuOpen = true;
+ }
+
+ this.showSub = function()
+ {
+ var offset = this.$caller.offset();
+ var dy = this.parent.container.offset().top-this.parent.container.find('li:first').offset().top
+ this.container.css({ position: 'absolute', top: offset.top+dy, left: offset.left+this.$caller.outerWidth() /*, 'min-width': this.$caller.outerWidth()*/ }).show();
+ this.menuOpen = true;
+ }
+}
diff --git a/src/images/arrbtn.gif b/src/images/arrbtn.gif
new file mode 100644
index 0000000..2a886b4
Binary files /dev/null and b/src/images/arrbtn.gif differ
diff --git a/src/images/arrbtn_bw.gif b/src/images/arrbtn_bw.gif
new file mode 100644
index 0000000..06e9262
Binary files /dev/null and b/src/images/arrbtn_bw.gif differ
diff --git a/src/index.php b/src/index.php
index 9203093..1f72b94 100644
--- a/src/index.php
+++ b/src/index.php
@@ -65,7 +65,6 @@ $().ready(function(){
}
echo "\tloadLists(1, 1);\n";
?>
- preloadImg();
$("#duedate").datepicker({dateFormat: '', firstDay: ,
showOn: 'button', buttonImage: 'images/calendar.png', buttonImageOnly: true, changeMonth:true,
changeYear:true, constrainInput: false, duration:'', nextText:'>', prevText:'<', dayNamesMin:lang.daysMin,
@@ -214,6 +213,32 @@ $().ajaxStop( function(r,s) {$("#loading").fadeOut();} );
+
+
+
+
+
+