From 5f584db9ec4d1a9502a6a2814af9e38b65fd2018 Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 27 Jan 2020 01:23:44 +0000 Subject: [PATCH] replace public --- public/.gitignore | 2 + public/.htaccess | 1 + public/db/.htaccess | 1 + public/{images => db}/index.html | 0 public/{index.php => index.html} | 186 +- public/jquery/index.html | 1 + public/jquery/jquery-1.4.4.min.js | 167 ++ public/jquery/jquery-ui-1.8.7.custom.min.js | 781 ++++++ public/jquery/jquery.autocomplete-1.1.js | 839 +++++++ public/lang/.htaccess | 1 + public/lang/index.html | 1 + public/mytinytodo.js | 2199 +++++++++++++++++ public/mytinytodo_ajax_storage.js | 197 ++ public/{ => themes/default}/images/COPYRIGHT | 0 .../{ => themes/default}/images/arrdown.gif | Bin .../{ => themes/default}/images/arrdown2.gif | Bin .../{ => themes/default}/images/buttons.png | Bin .../{ => themes/default}/images/calendar.png | Bin .../{ => themes/default}/images/closetag.gif | Bin .../default}/images/corner_left.gif | Bin .../default}/images/corner_right.gif | Bin public/{ => themes/default}/images/icons.gif | Bin public/themes/default/images/index.html | 1 + .../{ => themes/default}/images/loading1.gif | Bin .../default}/images/loading1_24.gif | Bin public/{ => themes/default}/images/mzl.png | Bin .../default}/images/page_white_text.png | Bin .../{ => themes/default}/images/tab_hover.gif | Bin public/{ => themes/default}/pda.css | 0 public/{ => themes/default}/print.css | 0 public/{ => themes/default}/style.css | 0 public/{ => themes/default}/style_rtl.css | 0 public/themes/index.html | 1 + public/tmp/.htaccess | 1 + public/tmp/index.html | 1 + 35 files changed, 4272 insertions(+), 108 deletions(-) create mode 100755 public/.gitignore create mode 100755 public/.htaccess create mode 100755 public/db/.htaccess rename public/{images => db}/index.html (100%) rename public/{index.php => index.html} (57%) create mode 100755 public/jquery/index.html create mode 100755 public/jquery/jquery-1.4.4.min.js create mode 100755 public/jquery/jquery-ui-1.8.7.custom.min.js create mode 100755 public/jquery/jquery.autocomplete-1.1.js create mode 100755 public/lang/.htaccess create mode 100755 public/lang/index.html create mode 100755 public/mytinytodo.js create mode 100755 public/mytinytodo_ajax_storage.js rename public/{ => themes/default}/images/COPYRIGHT (100%) rename public/{ => themes/default}/images/arrdown.gif (100%) rename public/{ => themes/default}/images/arrdown2.gif (100%) rename public/{ => themes/default}/images/buttons.png (100%) rename public/{ => themes/default}/images/calendar.png (100%) rename public/{ => themes/default}/images/closetag.gif (100%) rename public/{ => themes/default}/images/corner_left.gif (100%) rename public/{ => themes/default}/images/corner_right.gif (100%) rename public/{ => themes/default}/images/icons.gif (100%) create mode 100755 public/themes/default/images/index.html rename public/{ => themes/default}/images/loading1.gif (100%) rename public/{ => themes/default}/images/loading1_24.gif (100%) rename public/{ => themes/default}/images/mzl.png (100%) rename public/{ => themes/default}/images/page_white_text.png (100%) rename public/{ => themes/default}/images/tab_hover.gif (100%) rename public/{ => themes/default}/pda.css (100%) rename public/{ => themes/default}/print.css (100%) rename public/{ => themes/default}/style.css (100%) rename public/{ => themes/default}/style_rtl.css (100%) create mode 100755 public/themes/index.html create mode 100755 public/tmp/.htaccess create mode 100755 public/tmp/index.html diff --git a/public/.gitignore b/public/.gitignore new file mode 100755 index 0000000..f162bf2 --- /dev/null +++ b/public/.gitignore @@ -0,0 +1,2 @@ +.idea +tmp/sessions \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess new file mode 100755 index 0000000..c1e0189 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1 @@ +RedirectMatch 404 /\.git \ No newline at end of file diff --git a/public/db/.htaccess b/public/db/.htaccess new file mode 100755 index 0000000..3418e55 --- /dev/null +++ b/public/db/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/public/images/index.html b/public/db/index.html similarity index 100% rename from public/images/index.html rename to public/db/index.html diff --git a/public/index.php b/public/index.html similarity index 57% rename from public/index.php rename to public/index.html index bd60df7..2c8eeae 100755 --- a/public/index.php +++ b/public/index.html @@ -1,29 +1,20 @@ - - <?php mttinfo('title'); ?> - - - - - - - - - - - + todo breel + + + - - - - - - + + + + + + @@ -62,7 +42,7 @@
-

+

todo breel

@@ -72,13 +52,13 @@
- - - + + Login + Logout
@@ -89,14 +69,14 @@
-
+
@@ -126,21 +106,20 @@
-
+
- +
- +
@@ -148,12 +127,10 @@

- (0) - - / + Tasks (0) + Notes: Show / Hide - - + Tags

@@ -165,12 +142,11 @@ "+(i[0]>0&&D==i[1]-1?'
':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
', +o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&& +l)?" ":""));a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";if(d.browser.mozilla)k+='";else{k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
";return k},_adjustInstDate:function(a,b,c){var e= +a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a, +"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); +c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, +"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= +function(a){if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b)); +return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.7";window["DP_jQuery_"+y]=d})(jQuery); +;/* + * jQuery UI Progressbar 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.7"})})(jQuery); +;/* + * jQuery UI Effects 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.each(function(){f.queue(this,"fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l= +h.splice(h.length-1,1)[0];h.splice(1,0,l);f.dequeue(this)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c}, +b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.7",save:function(c,a){for(var b=0;b
").addClass("ui-effects-wrapper").css({fontSize:"100%", +background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c); +return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments); +else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c), +b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c, +a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c, +a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a== +e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","left"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],10)/100* +f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.7 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/public/jquery/jquery.autocomplete-1.1.js b/public/jquery/jquery.autocomplete-1.1.js new file mode 100755 index 0000000..a0daba2 --- /dev/null +++ b/public/jquery/jquery.autocomplete-1.1.js @@ -0,0 +1,839 @@ +/* + * jQuery Autocomplete plugin 1.1 + * + * Copyright (c) 2009 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ + */ + +/* + * Changes for myTinyTodo, www.mytinytodo.net + * Copyright (c) 2010 Max Pozdeev + * Dual licensed under the MIT and GPL licenses + */ + +;(function($) { + +$.fn.extend({ + autocomplete: function(urlOrData, options) { + var isUrl = typeof urlOrData == "string"; + var isFunc = typeof urlOrData == "function"; + options = $.extend({}, $.Autocompleter.defaults, { + url: isUrl ? urlOrData : null, + data: !isUrl && !isFunc ? urlOrData : null, + func: isFunc ? urlOrData : null, + delay: isUrl ? $.Autocompleter.defaults.delay : 10, + max: options && !options.scroll ? 10 : 150 + }, options); + + // if highlight is set to false, replace it with a do-nothing function + options.highlight = options.highlight || function(value) { return value; }; + + // if the formatMatch option is not specified, then use formatItem for backwards compatibility + options.formatMatch = options.formatMatch || options.formatItem; + + return this.each(function() { + new $.Autocompleter(this, options); + }); + }, + result: function(handler) { + return this.bind("result", handler); + }, + search: function(handler) { + return this.trigger("search", [handler]); + }, + flushCache: function() { + return this.trigger("flushCache"); + }, + setOptions: function(options){ + return this.trigger("setOptions", [options]); + }, + unautocomplete: function() { + return this.trigger("unautocomplete"); + } +}); + +$.Autocompleter = function(input, options) { + + var KEY = { + UP: 38, + DOWN: 40, + DEL: 46, + TAB: 9, + RETURN: 13, + ESC: 27, + COMMA: 188, + PAGEUP: 33, + PAGEDOWN: 34, + BACKSPACE: 8 + }; + + // Create $ object for input element + var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); + + var timeout; + var previousValue = ""; + var cache = $.Autocompleter.Cache(options); + var hasFocus = 0; + var lastKeyPressCode; + var config = { + mouseDownOnSelect: false + }; + var select = $.Autocompleter.Select(options, input, selectCurrent, config); + + var blockSubmit; + + // prevent form submit in opera when selecting with return key + $.browser.opera && $(input.form).bind("submit.autocomplete", function() { + if (blockSubmit) { + blockSubmit = false; + return false; + } + }); + + // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all + $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { + // a keypress means the input has focus + // avoids issue where input had focus before the autocomplete was applied + hasFocus = 1; + // track last key pressed + lastKeyPressCode = event.keyCode; + switch(event.keyCode) { + + case KEY.UP: + event.preventDefault(); + if ( select.visible() ) { + select.prev(); + } else { + onChange(0, true); + } + break; + + case KEY.DOWN: + event.preventDefault(); + if ( select.visible() ) { + select.next(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEUP: + event.preventDefault(); + if ( select.visible() ) { + select.pageUp(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEDOWN: + event.preventDefault(); + if ( select.visible() ) { + select.pageDown(); + } else { + onChange(0, true); + } + break; + + // matches also semicolon + case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: + case KEY.TAB: + case KEY.RETURN: + if( selectCurrent() ) { + // stop default to prevent a form submit, Opera needs special handling + event.preventDefault(); + blockSubmit = true; + return false; + } + break; + + case KEY.ESC: + select.hide(); + break; + + default: + clearTimeout(timeout); + timeout = setTimeout(onChange, options.delay); + break; + } + }).focus(function(){ + // track whether the field has focus, we shouldn't process any + // results if the field no longer has focus + hasFocus++; + }).blur(function() { + hasFocus = 0; + if (!config.mouseDownOnSelect) { + hideResults(); + } + }).click(function() { + // show select when clicking in a focused field + if ( hasFocus++ > 1 && !select.visible() ) { + onChange(0, true); + } + }).bind("search", function() { + // TODO why not just specifying both arguments? + var fn = (arguments.length > 1) ? arguments[1] : null; + function findValueCallback(q, data) { + var result; + if( data && data.length ) { + for (var i=0; i < data.length; i++) { + if( data[i].result.toLowerCase() == q.toLowerCase() ) { + result = data[i]; + break; + } + } + } + if( typeof fn == "function" ) fn(result); + else $input.trigger("result", result && [result.data, result.value]); + } + $.each(trimWords($input.val()), function(i, value) { + request(value, findValueCallback, findValueCallback); + }); + }).bind("flushCache", function() { + cache.flush(); + }).bind("setOptions", function() { + $.extend(options, arguments[1]); + // if we've updated the data, repopulate + if ( "data" in arguments[1] ) + cache.populate(); + }).bind("unautocomplete", function() { + select.unbind(); + $input.unbind(); + $(input.form).unbind(".autocomplete"); + }); + + + function selectCurrent() { + var selected = select.selected(); + if( !selected ) + return false; + + var v = selected.result; + previousValue = v; + + if ( options.multiple ) { + var words = trimWords($input.val()); + if ( words.length > 1 ) { + var seperator = options.multipleSeparator.length; + var cursorAt = $(input).selection().start; + var wordAt, progress = 0; + $.each(words, function(i, word) { + progress += word.length; + if (cursorAt <= progress) { + wordAt = i; + return false; + } + progress += seperator; + }); + words[wordAt] = v; + // TODO this should set the cursor to the right position, but it gets overriden somewhere + //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); + v = words.join( options.multipleSeparator ); + } + v += options.multipleSeparator; + } + + $input.val(v); + hideResultsNow(); + $input.trigger("result", [selected.data, selected.value]); + return true; + } + + function onChange(crap, skipPrevCheck) { + if( lastKeyPressCode == KEY.DEL ) { + select.hide(); + return; + } + + var currentValue = $input.val(); + + if ( !skipPrevCheck && currentValue == previousValue ) + return; + + previousValue = currentValue; + + currentValue = lastWord(currentValue); + if ( currentValue.length >= options.minChars) { + $input.addClass(options.loadingClass); + if (!options.matchCase) + currentValue = currentValue.toLowerCase(); + request(currentValue, receiveData, hideResultsNow); + } else { + stopLoading(); + select.hide(); + } + }; + + function trimWords(value) { + if (!value) + return [""]; + if (!options.multiple) + return [$.trim(value)]; + return $.map(value.split(options.multipleSeparator), function(word) { + return $.trim(value).length ? $.trim(word) : null; + }); + } + + function lastWord(value) { + if ( !options.multiple ) + return value; + var words = trimWords(value); + if (words.length == 1) + return words[0]; + var cursorAt = $(input).selection().start; + if (cursorAt == value.length) { + words = trimWords(value) + } else { + words = trimWords(value.replace(value.substring(cursorAt), "")); + } + return words[words.length - 1]; + } + + // fills in the input box w/the first match (assumed to be the best match) + // q: the term entered + // sValue: the first matching result + function autoFill(q, sValue){ + // autofill in the complete box w/the first match as long as the user hasn't entered in more data + // if the last user key pressed was backspace, don't autofill + if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { + // fill in the value (keep the case the user has typed) + $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); + // select the portion of the value not typed by the user (so the next character will erase) + $(input).selection(previousValue.length, previousValue.length + sValue.length); + } + }; + + function hideResults() { + clearTimeout(timeout); + timeout = setTimeout(hideResultsNow, 200); + }; + + function hideResultsNow() { + var wasVisible = select.visible(); + select.hide(); + clearTimeout(timeout); + stopLoading(); + if (options.mustMatch) { + // call search and run callback + $input.search( + function (result){ + // if no value found, clear the input box + if( !result ) { + if (options.multiple) { + var words = trimWords($input.val()).slice(0, -1); + $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); + } + else { + $input.val( "" ); + $input.trigger("result", null); + } + } + } + ); + } + }; + + function receiveData(q, data) { + if ( data && data.length && hasFocus ) { + stopLoading(); + select.display(data, q); + autoFill(q, data[0].value); + select.show(); + } else { + hideResultsNow(); + } + }; + + function request(term, success, failure) { + if (!options.matchCase) + term = term.toLowerCase(); + var data = cache.load(term); + // recieve the cached data + if (data && data.length) { + success(term, data); + } + // if function was supplied + else if(options.func) + { + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + options.func({ + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams)}, + function(data){ + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed) + success(term, parsed); + } + ); + } + // if an AJAX url has been supplied, try loading the data now + else if( (typeof options.url == "string") && (options.url.length > 0) ){ + + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + $.ajax({ + // try to leverage ajaxQueue plugin to abort previous requests + mode: "abort", + // limit abortion to this input + port: "autocomplete" + input.name, + dataType: options.dataType, + url: options.url, + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams), + success: function(data) { + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed); + success(term, parsed); + } + }); + } else { + // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match + select.emptyList(); + failure(term); + } + }; + + function parse(data) { + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: options.formatResult && options.formatResult(row, row[0]) || row[0] + }; + } + } + return parsed; + }; + + function stopLoading() { + $input.removeClass(options.loadingClass); + }; + +}; + +$.Autocompleter.defaults = { + inputClass: "ac_input", + resultsClass: "ac_results", + loadingClass: "ac_loading", + minChars: 1, + delay: 400, + matchCase: false, + matchSubset: true, + matchContains: false, + cacheLength: 10, + max: 100, + mustMatch: false, + extraParams: {}, + selectFirst: true, + formatItem: function(row) { return row[0]; }, + formatMatch: null, + autoFill: false, + width: 0, + multiple: false, + multipleSeparator: ", ", + highlight: function(value, term) { + return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); + }, + scroll: true, + scrollHeight: 180 +}; + +$.Autocompleter.Cache = function(options) { + + var data = {}; + var length = 0; + + function matchSubset(s, sub) { + if (!options.matchCase) + s = s.toLowerCase(); + var i = s.indexOf(sub); + if (options.matchContains == "word"){ + i = s.toLowerCase().search("\\b" + sub.toLowerCase()); + } + if (i == -1) return false; + return i == 0 || options.matchContains; + }; + + function add(q, value) { + if (length > options.cacheLength){ + flush(); + } + if (!data[q]){ + length++; + } + data[q] = value; + } + + function populate(){ + if( !options.data ) return false; + // track the matches + var stMatchSets = {}, + nullData = 0; + + // no url was specified, we need to adjust the cache length to make sure it fits the local data store + if( !options.url && !options.func ) options.cacheLength = 1; + + // track all options for minChars = 0 + stMatchSets[""] = []; + + // loop through the array and create a lookup structure + for ( var i = 0, ol = options.data.length; i < ol; i++ ) { + var rawValue = options.data[i]; + // if rawValue is a string, make an array otherwise just reference the array + rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; + + var value = options.formatMatch(rawValue, i+1, options.data.length); + if ( value === false ) + continue; + + var firstChar = value.charAt(0).toLowerCase(); + // if no lookup array for this character exists, look it up now + if( !stMatchSets[firstChar] ) + stMatchSets[firstChar] = []; + + // if the match is a string + var row = { + value: value, + data: rawValue, + result: options.formatResult && options.formatResult(rawValue) || value + }; + + // push the current match into the set list + stMatchSets[firstChar].push(row); + + // keep track of minChars zero items + if ( nullData++ < options.max ) { + stMatchSets[""].push(row); + } + }; + + // add the data items to the cache + $.each(stMatchSets, function(i, value) { + // increase the cache size + options.cacheLength++; + // add to the cache + add(i, value); + }); + } + + // populate any existing data + setTimeout(populate, 25); + + function flush(){ + data = {}; + length = 0; + } + + return { + flush: flush, + add: add, + populate: populate, + load: function(q) { + if (!options.cacheLength || !length) + return null; + /* + * if dealing w/local data and matchContains than we must make sure + * to loop through all the data collections looking for matches + */ + if( (!options.url && !options.func) && options.matchContains ){ + // track all matches + var csub = []; + // loop through all the data grids for matches + for( var k in data ){ + // don't search through the stMatchSets[""] (minChars: 0) cache + // this prevents duplicates + if( k.length > 0 ){ + var c = data[k]; + $.each(c, function(i, x) { + // if we've got a match, add it to the array + if (matchSubset(x.value, q)) { + csub.push(x); + } + }); + } + } + return csub; + } else + // if the exact item exists, use it + if (data[q]){ + return data[q]; + } else + if (options.matchSubset) { + for (var i = q.length - 1; i >= options.minChars; i--) { + var c = data[q.substr(0, i)]; + if (c) { + var csub = []; + $.each(c, function(i, x) { + if (matchSubset(x.value, q)) { + csub[csub.length] = x; + } + }); + return csub; + } + } + } + return null; + } + }; +}; + +$.Autocompleter.Select = function (options, input, select, config) { + var CLASSES = { + ACTIVE: "ac_over" + }; + + var listItems, + active = -1, + data, + term = "", + needsInit = true, + element, + list; + + // Create results + function init() { + if (!needsInit) + return; + element = $("
") + .hide() + .addClass(options.resultsClass) + .css("position", "absolute") + .appendTo(document.body); + + list = $("
    ").appendTo(element).mouseover( function(event) { + if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { + active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); + $(target(event)).addClass(CLASSES.ACTIVE); + } + }).click(function(event) { + $(target(event)).addClass(CLASSES.ACTIVE); + select(); + // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus + input.focus(); + return false; + }).mousedown(function() { + config.mouseDownOnSelect = true; + }).mouseup(function() { + config.mouseDownOnSelect = false; + }); + + if( options.width > 0 ) + element.css("width", options.width); + + needsInit = false; + } + + function target(event) { + var element = event.target; + while(element && element.tagName.toUpperCase() != "LI") + element = element.parentNode; + // more fun with IE, sometimes event.target is empty, just ignore it then + if(!element) + return []; + return element; + } + + function moveSelect(step) { + listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); + movePosition(step); + var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); + if(options.scroll) { + var offset = 0; + listItems.slice(0, active).each(function() { + offset += this.offsetHeight; + }); + if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { + list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); + } else if(offset < list.scrollTop()) { + list.scrollTop(offset); + } + } + }; + + function movePosition(step) { + active += step; + if (active < 0) { + active = listItems.size() - 1; + } else if (active >= listItems.size()) { + active = 0; + } + } + + function limitNumberOfItems(available) { + return options.max && options.max < available + ? options.max + : available; + } + + function fillList() { + list.empty(); + var max = limitNumberOfItems(data.length); + for (var i=0; i < max; i++) { + if (!data[i]) + continue; + var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); + if ( formatted === false ) + continue; + var li = $("
  • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; + $.data(li, "ac_data", data[i]); + } + listItems = list.find("li"); + if ( options.selectFirst ) { + listItems.slice(0, 1).addClass(CLASSES.ACTIVE); + active = 0; + } + // apply bgiframe if available + if ( $.fn.bgiframe ) + list.bgiframe(); + } + + return { + display: function(d, q) { + init(); + data = d; + term = q; + fillList(); + }, + next: function() { + moveSelect(1); + }, + prev: function() { + moveSelect(-1); + }, + pageUp: function() { + if (active != 0 && active - 8 < 0) { + moveSelect( -active ); + } else { + moveSelect(-8); + } + }, + pageDown: function() { + if (active != listItems.size() - 1 && active + 8 > listItems.size()) { + moveSelect( listItems.size() - 1 - active ); + } else { + moveSelect(8); + } + }, + hide: function() { + element && element.hide(); + listItems && listItems.removeClass(CLASSES.ACTIVE); + active = -1; + }, + visible : function() { + return element && element.is(":visible"); + }, + current: function() { + return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); + }, + show: function() { + var offset = $(input).offset(); + element.css({ + width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), + top: offset.top + input.offsetHeight, + left: offset.left + }).show(); + if(options.scroll) { + list.scrollTop(0); + list.css({ + maxHeight: options.scrollHeight, + overflow: 'auto' + }); + + if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { + var listHeight = 0; + listItems.each(function() { + listHeight += this.offsetHeight; + }); + var scrollbarsVisible = listHeight > options.scrollHeight; + list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); + if (!scrollbarsVisible) { + // IE doesn't recalculate width when scrollbar disappears + listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); + } + } + + } + }, + selected: function() { + var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); + return selected && selected.length && $.data(selected[0], "ac_data"); + }, + emptyList: function (){ + list && list.empty(); + }, + unbind: function() { + element && element.remove(); + } + }; +}; + +$.fn.selection = function(start, end) { + if (start !== undefined) { + return this.each(function() { + if( this.createTextRange ){ + var selRange = this.createTextRange(); + if (end === undefined || start == end) { + selRange.move("character", start); + selRange.select(); + } else { + selRange.collapse(true); + selRange.moveStart("character", start); + selRange.moveEnd("character", end); + selRange.select(); + } + } else if( this.setSelectionRange ){ + this.setSelectionRange(start, end); + } else if( this.selectionStart ){ + this.selectionStart = start; + this.selectionEnd = end; + } + }); + } + var field = this[0]; + if ( field.createTextRange ) { + var range = document.selection.createRange(), + orig = field.value, + teststring = "<->", + textLength = range.text.length; + range.text = teststring; + var caretAt = field.value.indexOf(teststring); + field.value = orig; + this.selection(caretAt, caretAt + textLength); + return { + start: caretAt, + end: caretAt + textLength + } + } else if( field.selectionStart !== undefined ){ + return { + start: field.selectionStart, + end: field.selectionEnd + } + } +}; + +})(jQuery); \ No newline at end of file diff --git a/public/lang/.htaccess b/public/lang/.htaccess new file mode 100755 index 0000000..3418e55 --- /dev/null +++ b/public/lang/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/public/lang/index.html b/public/lang/index.html new file mode 100755 index 0000000..31ed4cb --- /dev/null +++ b/public/lang/index.html @@ -0,0 +1 @@ +Direct access disallowed! \ No newline at end of file diff --git a/public/mytinytodo.js b/public/mytinytodo.js new file mode 100755 index 0000000..e5bc4e8 --- /dev/null +++ b/public/mytinytodo.js @@ -0,0 +1,2199 @@ +/* + This file is part of myTinyTodo. + (C) Copyright 2009-2010 Max Pozdeev + Licensed under the GNU GPL v2 license. See file COPYRIGHT for details. +*/ + +/** + * This function checks if the device accessing the page is a mobile device. + * + * @return {boolean} Returns true if the device is a mobile device and false otherwise. + */ +function isMobileDevice() { + return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)); +} + +/** + * This function takes a URL and the name of a GET parameter and returns the value of that + * parameter for the given URL. + * + * @param url The URL to get a get parameter value from. + * @param paramName The name of the parameter to retrieve the value for. + * @return {string | null} Returns the value of the parameter if it is present and null otherwise. + */ +function getGetParamValue(url, paramName) { + return new URL(url).searchParams.get(paramName); +} + +(function () { + + var taskList = [], taskOrder = []; + var filter = {compl: 0, search: '', due: ''}; + var sortOrder; //save task order before dragging + var searchTimer; + var objPrio = {}; + var selTask = 0; + var flag = { + needAuth: false, + isLogged: false, + tagsChanged: true, + readOnly: false, + editFormChanged: false + }; + var taskCnt = {total: 0, past: 0, today: 0, soon: 0}; + var tabLists = { + _lists: {}, + _length: 0, + _order: [], + _alltasks: {}, + clear: function () { + this._lists = {}; + this._length = 0; + this._order = []; + this._alltasks = {id: -1, showCompl: 0, sort: 3}; + }, + length: function () { + return this._length; + }, + exists: function (id) { + if (this._lists[id] || id == -1) return true; else return false; + }, + add: function (list) { + this._lists[list.id] = list; + this._length++; + this._order.push(list.id); + }, + replace: function (list) { + this._lists[list.id] = list; + }, + get: function (id) { + if (id == -1) return this._alltasks; else return this._lists[id]; + }, + getAll: function () { + var r = []; + for (var i in this._order) { + r.push(this._lists[this._order[i]]); + } + return r; + }, + reorder: function (order) { + this._order = order; + } + }; + var curList = 0; + var tagsList = []; + + var mytinytodo = window.mytinytodo = _mtt = { + + theme: { + newTaskFlashColor: '#ffffaa', + editTaskFlashColor: '#bbffaa', + msgFlashColor: '#ffffff' + }, + + actions: {}, + menus: {}, + mttUrl: '', + templateUrl: '', + options: { + openList: 0, + singletab: false, + autotag: false, + tagPreview: true, + tagPreviewDelay: 700, //milliseconds + saveShowNotes: false, + firstdayofweek: 1, + touchDevice: false + }, + + timers: { + previewtag: 0 + }, + + lang: { + __lang: null, + + daysMin: [], + daysLong: [], + monthsShort: [], + monthsLong: [], + + get: function (v) { + if (this.__lang[v]) return this.__lang[v]; + else return v; + }, + + init: function (lang) { + this.__lang = lang; + this.daysMin = this.__lang.daysMin; + this.daysLong = this.__lang.daysLong; + this.monthsShort = this.__lang.monthsMin; + this.monthsLong = this.__lang.monthsLong; + } + }, + + pages: { + current: {page: 'tasks', pageClass: ''}, + prev: [] + }, + + // procs + init: function (options) { + jQuery.extend(this.options, options); + + flag.needAuth = options.needAuth ? true : false; + flag.isLogged = options.isLogged ? true : false; + + if (this.options.showdate) $('#page_tasks').addClass('show-inline-date'); + if (this.options.singletab) $('#lists .mtt-tabs').addClass('mtt-tabs-only-one'); + + this.parseAnchor(); + + // handlers + $('.mtt-tabs-add-button').click(function () { + addList(); + }); + + $('.mtt-tabs-select-button').click(function (event) { + if (event.metaKey || event.ctrlKey) { + // toggle singetab interface + _mtt.applySingletab(!_mtt.options.singletab); + return false; + } + if (!_mtt.menus.selectlist) _mtt.menus.selectlist = new mttMenu('slmenucontainer', {onclick: slmenuSelect}); + _mtt.menus.selectlist.show(this); + }); + + + $('#newtask_form').submit(function () { + submitNewTask(this); + return false; + }); + + $('#newtask_submit').click(function () { + $('#newtask_form').submit(); + }); + + $('#newtask_adv').click(function () { + showEditForm(1); + return false; + }); + + $('#task').keydown(function (event) { + if (event.keyCode == 27) { + $(this).val(''); + } + }).focusin(function () { + $('#task_placeholder').removeClass('placeholding'); + $('#toolbar').addClass('mtt-intask'); + }).focusout(function () { + if ('' == $(this).val()) $('#task_placeholder').addClass('placeholding'); + $('#toolbar').removeClass('mtt-intask'); + }); + + + $('#search_form').submit(function () { + searchTasks(1); + return false; + }); + + $('#search_close').click(function () { + liveSearchToggle(0); + return false; + }); + + $('#search').keyup(function (event) { + if (event.keyCode == 27) return; + if ($(this).val() == '') $('#search_close').hide(); //actual value is only on keyup + else $('#search_close').show(); + clearTimeout(searchTimer); + searchTimer = setTimeout(function () { + searchTasks() + }, 400); + }) + .keydown(function (event) { + if (event.keyCode == 27) { // cancel on Esc (NB: no esc event on keypress in Chrome and on keyup in Opera) + if ($(this).val() != '') { + $(this).val(''); + $('#search_close').hide(); + searchTasks(); + } + else { + liveSearchToggle(0); + } + return false; //need to return false in firefox (for AJAX?) + } + }).focusin(function () { + $('#toolbar').addClass('mtt-insearch'); + $(this).focus(); + }).focusout(function () { + $('#toolbar').removeClass('mtt-insearch'); + }); + + + $('#taskview').click(function () { + if (!_mtt.menus.taskview) _mtt.menus.taskview = new mttMenu('taskviewcontainer'); + _mtt.menus.taskview.show(this); + }); + + $('#mtt_filters .tag-filter .mtt-filter-close').live('click', function () { + cancelTagFilter($(this).attr('tagid')); + }); + + $('#tagcloudbtn').click(function () { + if (!_mtt.menus.tagcloud) _mtt.menus.tagcloud = new mttMenu('tagcloud', { + beforeShow: function () { + if (flag.tagsChanged) { + $('#tagcloudcontent').html(''); + $('#tagcloudload').show(); + loadTags(curList.id, function () { + $('#tagcloudload').hide(); + }); + } + }, adjustWidth: true + }); + _mtt.menus.tagcloud.show(this); + }); + + $('#tagcloudcancel').click(function () { + if (_mtt.menus.tagcloud) _mtt.menus.tagcloud.close(); + }); + + $('#tagcloudcontent .tag').live('click', function () { + addFilterTag($(this).attr('tag'), $(this).attr('tagid')); + if (_mtt.menus.tagcloud) _mtt.menus.tagcloud.close(); + return false; + }); + + $('#mtt-notes-show').click(function () { + toggleAllNotes(1); + this.blur(); + return false; + }); + + $('#mtt-notes-hide').click(function () { + toggleAllNotes(0); + this.blur(); + return false; + }); + + $('#taskviewcontainer li').click(function () { + if (this.id == 'view_tasks') setTaskview(0); + else if (this.id == 'view_past') setTaskview('past'); + else if (this.id == 'view_today') setTaskview('today'); + else if (this.id == 'view_soon') setTaskview('soon'); + }); + + + // Tabs + $('#lists li.mtt-tab').live('click', function (event) { + if (event.metaKey || event.ctrlKey) { + // hide the tab + hideTab(this); + return false; + } + tabSelect(this); + return false; + }); + + $('#list_all').click(function (event) { + if (event.metaKey || event.ctrlKey) { + // hide the tab + hideTab(-1); + return false; + } + tabSelect(-1); + return false; + }); + + $('#lists li.mtt-tab .list-action').live('click', function () { + listMenu(this); + return false; //stop bubble to tab click + }); + + $('#list_all .list-action').click(function (event) { + listMenu(this); + return false; //stop bubble to tab click + }); + + //Priority popup + $('#priopopup .prio-neg-1').click(function () { + prioClick(-1, this); + }); + + $('#priopopup .prio-zero').click(function () { + prioClick(0, this); + }); + + $('#priopopup .prio-pos-1').click(function () { + prioClick(1, this); + }); + + $('#priopopup .prio-pos-2').click(function () { + prioClick(2, this); + }); + + $('#priopopup').mouseleave(function () { + $(this).hide() + } + ); + + + // edit form handlers + $('#alltags_show').click(function () { + toggleEditAllTags(1); + return false; + }); + + $('#alltags_hide').click(function () { + toggleEditAllTags(0); + return false; + }); + + $('#taskedit_form').submit(function () { + return saveTask(this); + }); + + $('#alltags .tag').live('click', function () { + addEditTag($(this).attr('tag')); + return false; + }); + + $("#duedate").datepicker({ + dateFormat: _mtt.duedatepickerformat(), + firstDay: _mtt.options.firstdayofweek, + showOn: 'button', + buttonImage: _mtt.templateUrl + 'images/calendar.png', + buttonImageOnly: true, + constrainInput: false, + duration: '', + dayNamesMin: _mtt.lang.daysMin, + dayNames: _mtt.lang.daysLong, + monthNamesShort: _mtt.lang.monthsLong + }); + + $("#edittags").autocomplete('ajax.php?suggestTags', { + scroll: false, + multiple: true, + selectFirst: false, + max: 8, + extraParams: { + list: function () { + var taskId = document.getElementById('taskedit_form').id.value; + return taskList[taskId].listId; + } + } + }); + + $('#taskedit_form').find('select,input,textarea').bind('change keypress', function () { + flag.editFormChanged = true; + }); + + // tasklist handlers + $("#tasklist").bind("click", tasklistClick); + + $('#tasklist li').live('dblclick', function () { + //clear selection + if (document.selection && document.selection.empty && document.selection.createRange().text) document.selection.empty(); + else if (window.getSelection) window.getSelection().removeAllRanges(); + + var li = findParentNode(this, 'LI'); + if (li && li.id) { + var id = li.id.split('_', 2)[1]; + if (id) editTask(parseInt(id)); + } + }); + + $('#tasklist .taskactionbtn').live('click', function () { + var id = parseInt(getLiTaskId(this)); + if (id) taskContextMenu(this, id); + return false; + }); + + $('#tasklist input[type=checkbox]').live('click', function () { + var id = parseInt(getLiTaskId(this)); + if (id) completeTask(id, this); + //return false; + }); + + $('#tasklist .task-toggle').live('click', function () { + var id = getLiTaskId(this); + if (id) $('#taskrow_' + id).toggleClass('task-expanded'); + return false; + }); + + $('#tasklist .tag').live('click', function (event) { + clearTimeout(_mtt.timers.previewtag); + $('#tasklist li').removeClass('not-in-tagpreview'); + addFilterTag($(this).attr('tag'), $(this).attr('tagid'), (event.metaKey || event.ctrlKey ? true : false)); + return false; + }); + + if (!this.options.touchDevice) { + $('#tasklist .task-prio').live('mouseover mouseout', function (event) { + var id = parseInt(getLiTaskId(this)); + if (!id) return; + if (event.type == 'mouseover') prioPopup(1, this, id); + else prioPopup(0, this); + }); + } + + $('#tasklist .mtt-action-note-cancel').live('click', function () { + var id = parseInt(getLiTaskId(this)); + if (id) cancelTaskNote(id); + return false; + }); + + $('#tasklist .mtt-action-note-save').live('click', function () { + var id = parseInt(getLiTaskId(this)); + if (id) saveTaskNote(id); + return false; + }); + + if (this.options.tagPreview) { + $('#tasklist .tag').live('mouseover mouseout', function (event) { + var cl = 'tag-id-' + $(this).attr('tagid'); + var sel = (event.metaKey || event.ctrlKey) ? 'li.' + cl : 'li:not(.' + cl + ')'; + if (event.type == 'mouseover') { + _mtt.timers.previewtag = setTimeout(function () { + $('#tasklist ' + sel).addClass('not-in-tagpreview'); + }, _mtt.options.tagPreviewDelay); + } + else { + clearTimeout(_mtt.timers.previewtag); + $('#tasklist li').removeClass('not-in-tagpreview'); + } + }); + } + + $("#tasklist").sortable({ + items: '> :not(.task-completed)', cancel: 'span,input,a,textarea', + delay: 150, start: sortStart, update: orderChanged, + placeholder: 'mtt-task-placeholder' + }); + + $("#lists ul").sortable({delay: 150, update: listOrderChanged}); + this.applySingletab(); + + + // AJAX Errors + $('#msg').ajaxSend(function (r, s) { + $("#msg").hide().removeClass('mtt-error mtt-info').find('.msg-details').hide(); + $("#loading").show(); + }); + + $('#msg').ajaxStop(function (r, s) { + $("#loading").fadeOut(); + }); + + $('#msg').ajaxError(function (event, request, settings) { + var errtxt; + if (request.status == 0) errtxt = 'Bad connection'; + else if (request.status != 200) errtxt = 'HTTP: ' + request.status + '/' + request.statusText; + else errtxt = request.responseText; + flashError(_mtt.lang.get('error'), errtxt); + }); + + + // Error Message details + $("#msg>.msg-text").click(function () { + $("#msg>.msg-details").toggle(); + }); + + + // Authorization + $('#bar_login').click(function () { + showAuth(this); + return false; + }); + + $('#bar_logout').click(function () { + logout(); + return false; + }); + + $('#login_form').submit(function () { + doAuth(this); + return false; + }); + + + // Settings + $("#settings").click(showSettings); + $("#settings_form").live('submit', function () { + saveSettings(this); + return false; + }); + + $(".mtt-back-button").live('click', function () { + _mtt.pageBack(); + this.blur(); + return false; + }); + + $(window).bind('beforeunload', function () { + if (_mtt.pages.current.page == 'taskedit' && flag.editFormChanged) { + return _mtt.lang.get('confirmLeave'); + } + }); + + + // tab menu + this.addAction('listSelected', tabmenuOnListSelected); + + // task context menu + this.addAction('listsLoaded', cmenuOnListsLoaded); + this.addAction('listRenamed', cmenuOnListRenamed); + this.addAction('listAdded', cmenuOnListAdded); + this.addAction('listSelected', cmenuOnListSelected); + this.addAction('listOrderChanged', cmenuOnListOrderChanged); + this.addAction('listHidden', cmenuOnListHidden); + + // select list menu + this.addAction('listsLoaded', slmenuOnListsLoaded); + this.addAction('listRenamed', slmenuOnListRenamed); + this.addAction('listAdded', slmenuOnListAdded); + this.addAction('listSelected', slmenuOnListSelected); + this.addAction('listHidden', slmenuOnListHidden); + + return this; + }, + + log: function (v) { + console.log.apply(this, arguments); + }, + + addAction: function (action, proc) { + if (!this.actions[action]) this.actions[action] = []; + this.actions[action].push(proc); + }, + + doAction: function (action, opts) { + if (!this.actions[action]) return; + for (var i in this.actions[action]) { + this.actions[action][i](opts); + } + }, + + setOptions: function (opts) { + jQuery.extend(this.options, opts); + }, + + loadLists: function (onInit) { + if (filter.search != '') { + filter.search = ''; + $('#searchbarkeyword').text(''); + $('#searchbar').hide(); + } + $('#page_tasks').hide(); + $('#tasklist').html(''); + + tabLists.clear(); + + this.db.loadLists(null, function (res) { + var ti = ''; + var openListId = 0; + if (res && res.total) { + // open required or first non-hidden list + for (var i = 0; i < res.list.length; i++) { + if (_mtt.options.openList) { + if (_mtt.options.openList == res.list[i].id) { + openListId = res.list[i].id; + break; + } + } + else if (!res.list[i].hidden) { + openListId = res.list[i].id; + break; + } + } + + // open all tasks tab + if (_mtt.options.openList == -1) openListId = -1; + + // or open first if all list are hidden + if (!openListId) openListId = res.list[0].id; + + $.each(res.list, function (i, item) { + tabLists.add(item); + ti += '
  • ' + + '' + item.name + '' + + '
  • '; + }); + } + + if (openListId) { + $('#mtt_body').removeClass('no-lists'); + $('.mtt-need-list').removeClass('mtt-item-disabled'); + } + else { + curList = 0; + $('#mtt_body').addClass('no-lists'); + $('.mtt-need-list').addClass('mtt-item-disabled'); + } + + _mtt.options.openList = 0; + $('#lists ul').html(ti); + $('#lists').show(); + _mtt.doAction('listsLoaded'); + tabSelect(openListId); + + $('#page_tasks').show(); + + }); + + if (onInit) updateAccessStatus(); + }, + + duedatepickerformat: function () { + if (!this.options.duedatepickerformat) return 'yy-mm-dd'; + + var s = this.options.duedatepickerformat.replace(/(.)/g, function (t, s) { + switch (t) { + case 'Y': + return 'yy'; + case 'y': + return 'y'; + case 'd': + return 'dd'; + case 'j': + return 'd'; + case 'm': + return 'mm'; + case 'n': + return 'm'; + case '/': + case '.': + case '-': + return t; + default: + return ''; + } + }); + + if (s == '') return 'yy-mm-dd'; + return s; + }, + + errorDenied: function () { + flashError(this.lang.get('denied')); + }, + + pageSet: function (page, pageClass) { + var prev = this.pages.current; + prev.lastScrollTop = $(window).scrollTop(); + this.pages.prev.push(this.pages.current); + this.pages.current = {page: page, pageClass: pageClass}; + showhide($('#page_' + this.pages.current.page).addClass('mtt-page-' + this.pages.current.pageClass), $('#page_' + prev.page)); + }, + + pageBack: function () { + if (this.pages.current.page == 'tasks') return false; + var prev = this.pages.current; + this.pages.current = this.pages.prev.pop(); + showhide($('#page_' + this.pages.current.page), $('#page_' + prev.page).removeClass('mtt-page-' + prev.page.pageClass)); + $(window).scrollTop(this.pages.current.lastScrollTop); + }, + + applySingletab: function (yesno) { + if (yesno == null) yesno = this.options.singletab; + else this.options.singletab = yesno; + + if (yesno) { + $('#lists .mtt-tabs').addClass('mtt-tabs-only-one'); + $("#lists ul").sortable('disable'); + } + else { + $('#lists .mtt-tabs').removeClass('mtt-tabs-only-one'); + $("#lists ul").sortable('enable'); + } + }, + + filter: { + _filters: [], + clear: function () { + this._filters = []; + $('#mtt_filters').html(''); + }, + addTag: function (tagId, tag, exclude) { + for (var i in this._filters) { + if (this._filters[i].tagId && this._filters[i].tagId == tagId) return false; + } + this._filters.push({tagId: tagId, tag: tag, exclude: exclude}); + $('#mtt_filters').append('' + + _mtt.lang.get('tagfilter') + '' + tag + ''); + return true; + }, + cancelTag: function (tagId) { + for (var i in this._filters) { + if (this._filters[i].tagId && this._filters[i].tagId == tagId) { + this._filters.splice(i, 1); + $('#mtt_filters .tag-filter.tag-id-' + tagId).remove(); + return true; + } + } + return false; + }, + getTags: function (withExcluded) { + var a = []; + for (var i in this._filters) { + if (this._filters[i].tagId) { + if (this._filters[i].exclude && withExcluded) a.push('^' + this._filters[i].tag); + else if (!this._filters[i].exclude) a.push(this._filters[i].tag) + } + } + return a.join(', '); + } + }, + + parseAnchor: function () { + if (location.hash == '') return false; + var h = location.hash.substr(1); + var a = h.split("/"); + var p = {}; + var s = ''; + + for (var i = 0; i < a.length; i++) { + s = a[i]; + switch (s) { + case "list": + if (a[++i].match(/^-?\d+$/)) { + p[s] = a[i]; + } + break; + case "alltasks": + p.list = '-1'; + break; + } + } + + if (p.list) this.options.openList = p.list; + + return p; + } + + }; + + function addList() { + var r = prompt(_mtt.lang.get('addList'), _mtt.lang.get('addListDefault')); + if (r == null) return; + + _mtt.db.request('addList', {name: r}, function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + var i = tabLists.length(); + tabLists.add(item); + if (i > 0) { + $('#lists ul').append('
  • ' + + '' + item.name + '' + + '
  • '); + mytinytodo.doAction('listAdded', item); + } + else _mtt.loadLists(); + }); + } + + function renameCurList() { + if (!curList) return; + var r = prompt(_mtt.lang.get('renameList'), dehtml(curList.name)); + if (r == null || r == '') return; + + _mtt.db.request('renameList', {list: curList.id, name: r}, function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + curList = item; + tabLists.replace(item); + $('#lists ul>.mtt-tabs-selected>a').attr('title', item.name).find('span').html(item.name); + mytinytodo.doAction('listRenamed', item); + }); + } + + function deleteCurList() { + if (!curList) return false; + var r = confirm(_mtt.lang.get('deleteList')); + if (!r) return; + + _mtt.db.request('deleteList', {list: curList.id}, function (json) { + if (!parseInt(json.total)) return; + _mtt.loadLists(); + }) + } + + function publishCurList() { + if (!curList) return false; + _mtt.db.request('publishList', { + list: curList.id, + publish: curList.published ? 0 : 1 + }, function (json) { + if (!parseInt(json.total)) return; + curList.published = curList.published ? 0 : 1; + if (curList.published) { + $('#btnPublish').addClass('mtt-item-checked'); + $('#btnRssFeed').removeClass('mtt-item-disabled'); + } + else { + $('#btnPublish').removeClass('mtt-item-checked'); + $('#btnRssFeed').addClass('mtt-item-disabled'); + } + }); + } + + function loadTasks(opts) { + if (!curList) return false; + setSort(curList.sort, 1); + opts = opts || {}; + if (opts.clearTasklist) { + $('#tasklist').html(''); + $('#total').html('0'); + } + + _mtt.db.request('loadTasks', { + list: curList.id, + compl: curList.showCompl, + sort: curList.sort, + search: filter.search, + tag: _mtt.filter.getTags(true), + setCompl: opts.setCompl + }, function (json) { + taskList.length = 0; + taskOrder.length = 0; + taskCnt.total = taskCnt.past = taskCnt.today = taskCnt.soon = 0; + var tasks = ''; + $.each(json.list, function (i, item) { + tasks += prepareTaskStr(item); + taskList[item.id] = item; + taskOrder.push(parseInt(item.id)); + changeTaskCnt(item, 1); + }); + if (opts.beforeShow && opts.beforeShow.call) { + opts.beforeShow(); + } + refreshTaskCnt(); + $('#tasklist').html(tasks); + }); + } + + function prepareTaskStr(item, noteExp) { + // — = — = — + var id = item.id; + var prio = item.prio; + return '
  • ' + + '
    ' + "\n" + + '
    ' + + '
    ' + "\n" + + '
    ' + prepareDuedate(item) + + '' + item.dateInline + '—' + + '' + item.dateCompletedInline + '
    ' + "\n" + + '
    ' + preparePrio(prio, id) + '' + prepareHtml(item.title) + ' ' + + (curList.id == -1 ? '' + tabLists.get(item.listId).name + '' : '') + "\n" + + prepareTagsStr(item) + '' + item.dateInlineTitle + '
    ' + + '
    ' + + '
    ' + prepareHtml(item.note) + '
    ' + + '' + + '
    ' + + "
  • \n"; + } + + function prepareHtml(s) { + // make URLs clickable + s = s.replace(/(^|\s|>)(www\.([\w\#$%&~\/.\-\+;:=,\?\[\]@]+?))(,|\.|:|)?(?=\s|"|<|>|\"|<|>|$)/gi, '$1$2$4'); + return s.replace(/(^|\s|>)((?:http|https|ftp):\/\/([\w\#$%&~\/.\-\+;:=,\?\[\]@]+?))(,|\.|:|)?(?=\s|"|<|>|\"|<|>|$)/ig, '$1$2$4'); + } + + function preparePrio(prio, id) { + var cl = ''; + var v = ''; + if (prio < 0) { + cl = 'prio-neg prio-neg-' + Math.abs(prio); + v = '−' + Math.abs(prio); + } // − = − = − + else if (prio > 0) { + cl = 'prio-pos prio-pos-' + prio; + v = '+' + prio; + } + else { + cl = 'prio-zero'; + v = '±0'; + } // ± = ± = ± + return '' + v + ''; + } + + function prepareTagsStr(item) { + if (!item.tags || item.tags == '') return ''; + var a = item.tags.split(','); + if (!a.length) return ''; + var b = item.tags_ids.split(','); + for (var i in a) { + a[i] = '' + a[i] + ''; + } + return '' + a.join(', ') + ''; + } + + function prepareTagsClass(ids) { + if (!ids || ids == '') return ''; + var a = ids.split(','); + if (!a.length) return ''; + for (var i in a) { + a[i] = 'tag-id-' + a[i]; + } + return ' ' + a.join(' '); + } + + function prepareDuedate(item) { + if (!item.duedate) return ''; + return ' ' + item.dueStr + ''; + } + + function submitNewTask(form) { + if (form.task.value == '') return false; + _mtt.db.request('newTask', { + list: curList.id, + title: form.task.value, + tag: _mtt.filter.getTags() + }, function (json) { + if (!json.total) return; + $('#total').text(parseInt($('#total').text()) + 1); + taskCnt.total++; + form.task.value = ''; + var item = json.list[0]; + taskList[item.id] = item; + taskOrder.push(parseInt(item.id)); + $('#tasklist').append(prepareTaskStr(item)); + changeTaskOrder(item.id); + $('#taskrow_' + item.id).effect("highlight", {color: _mtt.theme.newTaskFlashColor}, 2000); + refreshTaskCnt(); + }); + flag.tagsChanged = true; + return false; + } + + function changeTaskOrder(id) { + id = parseInt(id); + if (taskOrder.length < 2) return; + var oldOrder = taskOrder.slice(); + // sortByHand + if (curList.sort == 0) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + return taskList[a].ow - taskList[b].ow + }); + // sortByPrio + else if (curList.sort == 1) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].prio != taskList[b].prio) return taskList[b].prio - taskList[a].prio; + if (taskList[a].dueInt != taskList[b].dueInt) return taskList[a].dueInt - taskList[b].dueInt; + return taskList[a].ow - taskList[b].ow; + }); + // sortByPrio (reverse) + else if (curList.sort == 101) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].prio != taskList[b].prio) return taskList[a].prio - taskList[b].prio; + if (taskList[a].dueInt != taskList[b].dueInt) return taskList[b].dueInt - taskList[a].dueInt; + return taskList[b].ow - taskList[a].ow; + }); + // sortByDueDate + else if (curList.sort == 2) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dueInt != taskList[b].dueInt) return taskList[a].dueInt - taskList[b].dueInt; + if (taskList[a].prio != taskList[b].prio) return taskList[b].prio - taskList[a].prio; + return taskList[a].ow - taskList[b].ow; + }); + // sortByDueDate (reverse) + else if (curList.sort == 102) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dueInt != taskList[b].dueInt) return taskList[b].dueInt - taskList[a].dueInt; + if (taskList[a].prio != taskList[b].prio) return taskList[a].prio - taskList[b].prio; + return taskList[b].ow - taskList[a].ow; + }); + // sortByDateCreated + else if (curList.sort == 3) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dateInt != taskList[b].dateInt) return taskList[a].dateInt - taskList[b].dateInt; + if (taskList[a].prio != taskList[b].prio) return taskList[b].prio - taskList[a].prio; + return taskList[a].ow - taskList[b].ow; + }); + // sortByDateCreated (reverse) + else if (curList.sort == 103) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dateInt != taskList[b].dateInt) return taskList[b].dateInt - taskList[a].dateInt; + if (taskList[a].prio != taskList[b].prio) return taskList[a].prio - taskList[b].prio; + return taskList[b].ow - taskList[a].ow; + }); + // sortByDateModified + else if (curList.sort == 4) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dateEditedInt != taskList[b].dateEditedInt) return taskList[a].dateEditedInt - taskList[b].dateEditedInt; + if (taskList[a].prio != taskList[b].prio) return taskList[b].prio - taskList[a].prio; + return taskList[a].ow - taskList[b].ow; + }); + // sortByDateModified (reverse) + else if (curList.sort == 104) taskOrder.sort(function (a, b) { + if (taskList[a].compl != taskList[b].compl) return taskList[a].compl - taskList[b].compl; + if (taskList[a].dateEditedInt != taskList[b].dateEditedInt) return taskList[b].dateEditedInt - taskList[a].dateEditedInt; + if (taskList[a].prio != taskList[b].prio) return taskList[a].prio - taskList[b].prio; + return taskList[b].ow - taskList[a].ow; + }); + else return; + if (oldOrder.toString() == taskOrder.toString()) return; + if (id && taskList[id]) { + // optimization: determine where to insert task: top or after some task + var indx = $.inArray(id, taskOrder); + if (indx == 0) { + $('#tasklist').prepend($('#taskrow_' + id)) + } else { + var after = taskOrder[indx - 1]; + $('#taskrow_' + after).after($('#taskrow_' + id)); + } + } + else { + var o = $('#tasklist'); + for (var i in taskOrder) { + o.append($('#taskrow_' + taskOrder[i])); + } + } + } + + function prioPopup(act, el, id) { + if (act == 0) { + clearTimeout(objPrio.timer); + return; + } + var offset = $(el).offset(); + $('#priopopup').css({position: 'absolute', top: offset.top + 1, left: offset.left + 1}); + objPrio.taskId = id; + objPrio.el = el; + objPrio.timer = setTimeout("$('#priopopup').show()", 300); + } + + function prioClick(prio, el) { + el.blur(); + prio = parseInt(prio); + $('#priopopup').fadeOut('fast'); //.hide(); + setTaskPrio(objPrio.taskId, prio); + } + + function setTaskPrio(id, prio) { + _mtt.db.request('setPrio', {id: id, prio: prio}); + taskList[id].prio = prio; + var $t = $('#taskrow_' + id); + $t.find('.task-prio').replaceWith(preparePrio(prio, id)); + if (curList.sort != 0) changeTaskOrder(id); + $t.effect("highlight", {color: _mtt.theme.editTaskFlashColor}, 'normal'); + } + + function setSort(v, init) { + $('#listmenucontainer .sort-item').removeClass('mtt-item-checked').children('.mtt-sort-direction').text(''); + if (v == 0) $('#sortByHand').addClass('mtt-item-checked'); + else if (v == 1 || v == 101) $('#sortByPrio').addClass('mtt-item-checked').children('.mtt-sort-direction').text(v == 1 ? '↑' : '↓'); + else if (v == 2 || v == 102) $('#sortByDueDate').addClass('mtt-item-checked').children('.mtt-sort-direction').text(v == 2 ? '↑' : '↓'); + else if (v == 3 || v == 103) $('#sortByDateCreated').addClass('mtt-item-checked').children('.mtt-sort-direction').text(v == 3 ? '↓' : '↑'); + else if (v == 4 || v == 104) $('#sortByDateModified').addClass('mtt-item-checked').children('.mtt-sort-direction').text(v == 4 ? '↓' : '↑'); + else return; + + curList.sort = v; + if (v == 0 && !flag.readOnly) $("#tasklist").sortable('enable'); + else $("#tasklist").sortable('disable'); + + if (!init) { + changeTaskOrder(); + if (!flag.readOnly) _mtt.db.request('setSort', {list: curList.id, sort: curList.sort}); + } + } + + function changeTaskCnt(task, dir, old) { + if (dir > 0) dir = 1; + else if (dir < 0) dir = -1; + if (dir == 0 && old != null && task.dueClass != old.dueClass) //on saveTask + { + if (old.dueClass != '') taskCnt[old.dueClass]--; + if (task.dueClass != '') taskCnt[task.dueClass]++; + } + else if (dir == 0 && old == null) //on comleteTask + { + if (!curList.showCompl && task.compl) taskCnt.total--; + if (task.dueClass != '') taskCnt[task.dueClass] += task.compl ? -1 : 1; + } + if (dir != 0) { + if (task.dueClass != '' && !task.compl) taskCnt[task.dueClass] += dir; + taskCnt.total += dir; + } + } + + function refreshTaskCnt() { + $('#cnt_total').text(taskCnt.total); + $('#cnt_past').text(taskCnt.past); + $('#cnt_today').text(taskCnt.today); + $('#cnt_soon').text(taskCnt.soon); + if (filter.due == '') $('#total').text(taskCnt.total); + else if (taskCnt[filter.due] != null) $('#total').text(taskCnt[filter.due]); + } + + function setTaskview(v) { + if (v == 0) { + if (filter.due == '') return; + $('#taskview .btnstr').text(_mtt.lang.get('tasks')); + $('#tasklist').removeClass('filter-' + filter.due); + filter.due = ''; + $('#total').text(taskCnt.total); + } + else if (v == 'past' || v == 'today' || v == 'soon') { + if (filter.due == v) return; + else if (filter.due != '') { + $('#tasklist').removeClass('filter-' + filter.due); + } + $('#tasklist').addClass('filter-' + v); + $('#taskview .btnstr').text(_mtt.lang.get('f_' + v)); + $('#total').text(taskCnt[v]); + filter.due = v; + } + } + + function toggleAllNotes(show) { + for (var id in taskList) { + if (taskList[id].note == '') continue; + if (show) $('#taskrow_' + id).addClass('task-expanded'); + else $('#taskrow_' + id).removeClass('task-expanded'); + } + curList.showNotes = show; + if (_mtt.options.saveShowNotes) _mtt.db.request('setShowNotesInList', { + list: curList.id, + shownotes: show + }, function (json) { + }); + } + + function tabSelect(elementOrId) { + var id; + if (typeof elementOrId == 'number') id = elementOrId; + else if (typeof elementOrId == 'string') id = parseInt(elementOrId); + else { + id = $(elementOrId).attr('id'); + if (!id) return; + id = parseInt(id.split('_', 2)[1]); + } + if (!tabLists.exists(id)) return; + $('#lists .mtt-tabs-selected').removeClass('mtt-tabs-selected'); + $('#list_all').removeClass('mtt-tabs-selected'); + + if (id == -1) { + $('#list_all').addClass('mtt-tabs-selected').removeClass('mtt-tabs-hidden'); + $('#listmenucontainer .mtt-need-real-list').addClass('mtt-item-hidden'); + } + else { + $('#list_' + id).addClass('mtt-tabs-selected').removeClass('mtt-tabs-hidden'); + $('#listmenucontainer .mtt-need-real-list').removeClass('mtt-item-hidden'); + } + + if (curList.id != id) { + if (id == -1) $('#mtt_body').addClass('show-all-tasks'); + else $('#mtt_body').removeClass('show-all-tasks'); + if (filter.search != '') liveSearchToggle(0, 1); + mytinytodo.doAction('listSelected', tabLists.get(id)); + } + curList = tabLists.get(id); + if (curList.hidden) { + curList.hidden = false; + if (curList.id > 0) _mtt.db.request('setHideList', {list: curList.id, hide: 0}); + } + flag.tagsChanged = true; + cancelTagFilter(0, 1); + setTaskview(0); + loadTasks({clearTasklist: 1}); + } + + function listMenu(el) { + if (!mytinytodo.menus.listMenu) mytinytodo.menus.listMenu = new mttMenu('listmenucontainer', {onclick: listMenuClick}); + mytinytodo.menus.listMenu.show(el); + } + + function listMenuClick(el, menu) { + if (!el.id) return; + switch (el.id) { + case 'btnAddList': + addList(); + break; + case 'btnRenameList': + renameCurList(); + break; + case 'btnDeleteList': + deleteCurList(); + break; + case 'btnPublish': + publishCurList(); + break; + case 'btnExportCSV': + exportCurList('csv'); + break; + case 'btnExportICAL': + exportCurList('ical'); + break; + case 'btnRssFeed': + feedCurList(); + break; + case 'btnShowCompleted': + showCompletedToggle(); + break; + case 'btnClearCompleted': + clearCompleted(); + break; + case 'sortByHand': + setSort(0); + break; + case 'sortByPrio': + setSort(curList.sort == 1 ? 101 : 1); + break; + case 'sortByDueDate': + setSort(curList.sort == 2 ? 102 : 2); + break; + case 'sortByDateCreated': + setSort(curList.sort == 3 ? 103 : 3); + break; + case 'sortByDateModified': + setSort(curList.sort == 4 ? 104 : 4); + break; + } + } + + function deleteTask(id) { + if (!confirm(_mtt.lang.get('confirmDelete'))) { + return false; + } + _mtt.db.request('deleteTask', {id: id}, function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + taskOrder.splice($.inArray(id, taskOrder), 1); + $('#taskrow_' + id).fadeOut('normal', function () { + $(this).remove() + }); + changeTaskCnt(taskList[id], -1); + refreshTaskCnt(); + delete taskList[id]; + }); + flag.tagsChanged = true; + return false; + } + + function completeTask(id, ch) { + if (!taskList[id]) return; //click on already removed from the list while anim. effect + var compl = 0; + if (ch.checked) compl = 1; + _mtt.db.request('completeTask', {id: id, compl: compl, list: curList.id}, function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + if (item.compl) $('#taskrow_' + id).addClass('task-completed'); + else $('#taskrow_' + id).removeClass('task-completed'); + taskList[id] = item; + changeTaskCnt(taskList[id], 0); + if (item.compl && !curList.showCompl) { + delete taskList[id]; + taskOrder.splice($.inArray(id, taskOrder), 1); + $('#taskrow_' + id).fadeOut('normal', function () { + $(this).remove() + }); + } + else if (curList.showCompl) { + $('#taskrow_' + item.id).replaceWith(prepareTaskStr(taskList[id])); + $('#taskrow_' + id).fadeOut('fast', function () { + changeTaskOrder(id); + $(this).effect("highlight", {color: _mtt.theme.editTaskFlashColor}, 'normal', function () { + $(this).css('display', '') + }); + }); + } + refreshTaskCnt(); + }); + return false; + } + + function toggleTaskNote(id) { + var aArea = '#tasknotearea' + id; + if ($(aArea).css('display') == 'none') { + $('#notetext' + id).val(taskList[id].noteText); + $(aArea).show(); + $('#tasknote' + id).hide(); + $('#taskrow_' + id).addClass('task-expanded'); + $('#notetext' + id).focus(); + } else { + cancelTaskNote(id) + } + return false; + } + + function cancelTaskNote(id) { + if (taskList[id].note == '') $('#taskrow_' + id).removeClass('task-expanded'); + $('#tasknotearea' + id).hide(); + $('#tasknote' + id).show(); + return false; + } + + function saveTaskNote(id) { + _mtt.db.request('editNote', {id: id, note: $('#notetext' + id).val()}, function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + taskList[id].note = item.note; + taskList[id].noteText = item.noteText; + $('#tasknote' + id + '>span').html(prepareHtml(item.note)); + if (item.note == '') $('#taskrow_' + id).removeClass('task-has-note task-expanded'); + else $('#taskrow_' + id).addClass('task-has-note task-expanded'); + cancelTaskNote(id); + }); + return false; + } + + function editTask(id) { + var item = taskList[id]; + if (!item) return false; + // no need to clear form + var form = document.getElementById('taskedit_form'); + form.task.value = dehtml(item.title); + form.note.value = item.noteText; + form.id.value = item.id; + form.tags.value = item.tags.split(',').join(', '); + form.duedate.value = item.duedate; + form.prio.value = item.prio; + $('#taskedit-date .date-created>span').text(item.date); + if (item.compl) $('#taskedit-date .date-completed').show().find('span').text(item.dateCompleted); + else $('#taskedit-date .date-completed').hide(); + toggleEditAllTags(0); + showEditForm(); + return false; + } + + function clearEditForm() { + var form = document.getElementById('taskedit_form'); + form.task.value = ''; + form.note.value = ''; + form.tags.value = ''; + form.duedate.value = ''; + form.prio.value = '0'; + form.id.value = ''; + toggleEditAllTags(0); + } + + function showEditForm(isAdd) { + var form = document.getElementById('taskedit_form'); + if (isAdd) { + clearEditForm(); + $('#page_taskedit').removeClass('mtt-inedit').addClass('mtt-inadd'); + form.isadd.value = 1; + if (_mtt.options.autotag) form.tags.value = _mtt.filter.getTags(); + if ($('#task').val() != '') { + _mtt.db.request('parseTaskStr', { + list: curList.id, + title: $('#task').val(), + tag: _mtt.filter.getTags() + }, function (json) { + if (!json) return; + form.task.value = json.title; + form.tags.value = (form.tags.value != '') ? form.tags.value + ', ' + json.tags : json.tags; + form.prio.value = json.prio; + $('#task').val(''); + + }); + } + } + else { + $('#page_taskedit').removeClass('mtt-inadd').addClass('mtt-inedit'); + form.isadd.value = 0; + } + + flag.editFormChanged = false; + _mtt.pageSet('taskedit'); + } + + function saveTask(form) { + if (flag.readOnly) return false; + if (form.isadd.value != 0) + return submitFullTask(form); + + _mtt.db.request('editTask', { + id: form.id.value, title: form.task.value, note: form.note.value, + prio: form.prio.value, tags: form.tags.value, duedate: form.duedate.value + }, + function (json) { + if (!parseInt(json.total)) return; + var item = json.list[0]; + changeTaskCnt(item, 0, taskList[item.id]); + taskList[item.id] = item; + var noteExpanded = (item.note != '' && $('#taskrow_' + item.id).is('.task-expanded')) ? 1 : 0; + $('#taskrow_' + item.id).replaceWith(prepareTaskStr(item, noteExpanded)); + if (curList.sort != 0) changeTaskOrder(item.id); + _mtt.pageBack(); //back to list + refreshTaskCnt(); + $('#taskrow_' + item.id).effect("highlight", {color: _mtt.theme.editTaskFlashColor}, 'normal', function () { + $(this).css('display', '') + }); + }); + $("#edittags").flushCache(); + flag.tagsChanged = true; + return false; + } + + function toggleEditAllTags(show) { + if (show) { + if (curList.id == -1) { + var taskId = document.getElementById('taskedit_form').id.value; + loadTags(taskList[taskId].listId, fillEditAllTags); + } + else if (flag.tagsChanged) loadTags(curList.id, 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); + } + + function loadTags(listId, callback) { + _mtt.db.request('tagCloud', {list: listId}, function (json) { + 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 cancelTagFilter(tagId, dontLoadTasks) { + if (tagId) _mtt.filter.cancelTag(tagId); + else _mtt.filter.clear(); + if (dontLoadTasks == null || !dontLoadTasks) loadTasks(); + } + + function addFilterTag(tag, tagId, exclude) { + if (!_mtt.filter.addTag(tagId, tag, exclude)) return false; + loadTasks(); + } + + function liveSearchToggle(toSearch, dontLoad) { + if (toSearch) { + $('#search').focus(); + } + else { + if ($('#search').val() != '') { + filter.search = ''; + $('#search').val(''); + $('#searchbarkeyword').text(''); + $('#searchbar').hide(); + $('#search_close').hide(); + if (!dontLoad) loadTasks(); + } + + $('#search').blur(); + } + } + + function searchTasks(force) { + var newkeyword = $('#search').val(); + if (newkeyword == filter.search && !force) return false; + filter.search = newkeyword; + $('#searchbarkeyword').text(filter.search); + if (filter.search != '') $('#searchbar').fadeIn('fast'); + else $('#searchbar').fadeOut('fast'); + loadTasks(); + return false; + } + + function submitFullTask(form) { + if (flag.readOnly) return false; + + _mtt.db.request('fullNewTask', { + list: curList.id, + tag: _mtt.filter.getTags(), + title: form.task.value, + note: form.note.value, + prio: form.prio.value, + tags: form.tags.value, + duedate: form.duedate.value + }, function (json) { + if (!parseInt(json.total)) return; + form.task.value = ''; + var item = json.list[0]; + taskList[item.id] = item; + taskOrder.push(parseInt(item.id)); + $('#tasklist').append(prepareTaskStr(item)); + changeTaskOrder(item.id); + _mtt.pageBack(); + $('#taskrow_' + item.id).effect("highlight", {color: _mtt.theme.newTaskFlashColor}, 2000); + changeTaskCnt(item, 1); + refreshTaskCnt(); + }); + + $("#edittags").flushCache(); + flag.tagsChanged = true; + return false; + } + + function sortStart(event, ui) { + // remember initial order before sorting + sortOrder = $(this).sortable('toArray'); + } + + function orderChanged(event, ui) { + if (!ui.item[0]) return; + var itemId = ui.item[0].id; + var n = $(this).sortable('toArray'); + + // remove possible empty id's + for (var i = 0; i < sortOrder.length; i++) { + if (sortOrder[i] == '') { + sortOrder.splice(i, 1); + i--; + } + } + if (n.toString() == sortOrder.toString()) return; + + // make index: id=>position + var h0 = {}; //before + for (var j = 0; j < sortOrder.length; j++) { + h0[sortOrder[j]] = j; + } + var h1 = {}; //after + for (var j = 0; j < n.length; j++) { + h1[n[j]] = j; + taskOrder[j] = parseInt(n[j].split('_')[1]); + } + + // prepare param + var o = []; + var diff; + var replaceOW = taskList[sortOrder[h1[itemId]].split('_')[1]].ow; + for (var j in h0) { + diff = h1[j] - h0[j]; + if (diff != 0) { + var a = j.split('_'); + if (j == itemId) diff = replaceOW - taskList[a[1]].ow; + o.push({id: a[1], diff: diff}); + taskList[a[1]].ow += diff; + } + } + + _mtt.db.request('changeOrder', {order: o}); + } + + function mttMenu(container, options) { + var menu = this; + this.container = document.getElementById(container); + this.$container = $(this.container); + this.menuOpen = false; + this.options = options || {}; + this.submenu = []; + this.curSubmenu = null; + this.showTimer = null; + this.ts = (new Date).getTime(); + this.container.mttmenu = this.ts; + + this.$container.find('li').click(function () { + menu.onclick(this, menu); + return false; + }) + .each(function () { + + var submenu = 0; + if ($(this).is('.mtt-menu-indicator')) { + submenu = new mttMenu($(this).attr('submenu')); + submenu.$caller = $(this); + submenu.parent = menu; + if (menu.root) submenu.root = menu.root; //!! be careful with circular references + else submenu.root = menu; + menu.submenu.push(submenu); + submenu.ts = submenu.container.mttmenu = submenu.root.ts; + + submenu.$container.find('li').click(function () { + submenu.root.onclick(this, submenu); + return false; + }); + } + + $(this).hover( + function () { + if (!$(this).is('.mtt-menu-item-active')) menu.$container.find('li').removeClass('mtt-menu-item-active'); + clearTimeout(menu.showTimer); + if (menu.hideTimer && menu.parent) { + clearTimeout(menu.hideTimer); + menu.hideTimer = null; + menu.$caller.addClass('mtt-menu-item-active'); + clearTimeout(menu.parent.showTimer); + } + + if (menu.curSubmenu && menu.curSubmenu.menuOpen && menu.curSubmenu != submenu && !menu.curSubmenu.hideTimer) { + menu.$container.find('li').removeClass('mtt-menu-item-active'); + var curSubmenu = menu.curSubmenu; + curSubmenu.hideTimer = setTimeout(function () { + curSubmenu.hide(); + curSubmenu.hideTimer = null; + }, 300); + } + + if (!submenu || menu.curSubmenu == submenu && menu.curSubmenu.menuOpen) + return; + + menu.showTimer = setTimeout(function () { + menu.curSubmenu = submenu; + submenu.showSub(); + }, 400); + }, + function () { + } + ); + + }); + + this.onclick = function (item, fromMenu) { + if ($(item).is('.mtt-item-disabled,.mtt-menu-indicator,.mtt-item-hidden')) return; + menu.close(); + if (this.options.onclick) this.options.onclick(item, fromMenu); + }; + + this.hide = function () { + for (var i in this.submenu) this.submenu[i].hide(); + clearTimeout(this.showTimer); + this.$container.hide(); + this.$container.find('li').removeClass('mtt-menu-item-active'); + this.menuOpen = false; + }; + + this.close = function (event) { + if (!this.menuOpen) return; + if (event) { + // ignore if event (click) was on caller or container + var t = event.target; + if (t == this.caller || (t.mttmenu && t.mttmenu == this.ts)) return; + while (t.parentNode) { + if (t.parentNode == this.caller || (t.mttmenu && t.mttmenu == this.ts)) return; + t = t.parentNode; + } + } + this.hide(); + $(this.caller).removeClass('mtt-menu-button-active'); + $(document).unbind('mousedown.mttmenuclose'); + }; + + this.show = function (caller) { + if (this.menuOpen) { + this.close(); + if (this.caller && this.caller == caller) return; + } + $(document).triggerHandler('mousedown.mttmenuclose'); //close any other open menu + this.caller = caller; + var $caller = $(caller); + + // beforeShow trigger + if (this.options.beforeShow && this.options.beforeShow.call) + this.options.beforeShow(); + + // adjust width + if (this.options.adjustWidth && this.$container.outerWidth(true) > $(window).width()) + this.$container.width($(window).width() - (this.$container.outerWidth(true) - this.$container.width())); + + $caller.addClass('mtt-menu-button-active'); + var offset = $caller.offset(); + var x2 = $(window).width() + $(document).scrollLeft() - this.$container.outerWidth(true) - 1; + var x = offset.left < x2 ? offset.left : x2; + if (x < 0) x = 0; + var y = offset.top + caller.offsetHeight - 1; + if (y + this.$container.outerHeight(true) > $(window).height() + $(document).scrollTop()) y = offset.top - this.$container.outerHeight(); + if (y < 0) y = 0; + this.$container.css({ + position: 'absolute', + top: y, + left: x, + width: this.$container.width() /*, 'min-width': $caller.width()*/ + }).show(); + var menu = this; + $(document).bind('mousedown.mttmenuclose', function (e) { + menu.close(e) + }); + this.menuOpen = true; + }; + + this.showSub = function () { + this.$caller.addClass('mtt-menu-item-active'); + var offset = this.$caller.offset(); + var x = offset.left + this.$caller.outerWidth(); + if (x + this.$container.outerWidth(true) > $(window).width() + $(document).scrollLeft()) x = offset.left - this.$container.outerWidth() - 1; + if (x < 0) x = 0; + var y = offset.top + this.parent.$container.offset().top - this.parent.$container.find('li:first').offset().top; + if (y + this.$container.outerHeight(true) > $(window).height() + $(document).scrollTop()) y = $(window).height() + $(document).scrollTop() - this.$container.outerHeight(true) - 1; + if (y < 0) y = 0; + this.$container.css({ + position: 'absolute', + top: y, + left: x, + width: this.$container.width() /*, 'min-width': this.$caller.outerWidth()*/ + }).show(); + this.menuOpen = true; + }; + + this.destroy = function () { + for (var i in this.submenu) { + this.submenu[i].destroy(); + delete this.submenu[i]; + } + this.$container.find('li').unbind(); //'click mouseenter mouseleave' + }; + } + + function taskContextMenu(el, id) { + if (!_mtt.menus.cmenu) _mtt.menus.cmenu = new mttMenu('taskcontextcontainer', { + onclick: taskContextClick, + beforeShow: function () { + $('#cmenupriocontainer li').removeClass('mtt-item-checked'); + $('#cmenu_prio\\:' + taskList[_mtt.menus.cmenu.tag].prio).addClass('mtt-item-checked'); + } + }); + _mtt.menus.cmenu.tag = id; + _mtt.menus.cmenu.show(el); + } + + function taskContextClick(el, menu) { + if (!el.id) return; + var taskId = parseInt(_mtt.menus.cmenu.tag); + var id = el.id, value; + var a = id.split(':'); + if (a.length == 2) { + id = a[0]; + value = a[1]; + } + switch (id) { + case 'cmenu_edit': + editTask(taskId); + break; + case 'cmenu_note': + toggleTaskNote(taskId); + break; + case 'cmenu_delete': + deleteTask(taskId); + break; + case 'cmenu_prio': + setTaskPrio(taskId, parseInt(value)); + break; + case 'cmenu_list': + if (menu.$caller && menu.$caller.attr('id') == 'cmenu_move') moveTaskToList(taskId, value); + break; + } + } + + function moveTaskToList(taskId, listId) { + if (curList.id == listId) return; + _mtt.db.request('moveTask', {id: taskId, from: curList.id, to: listId}, function (json) { + if (!parseInt(json.total)) return; + if (curList.id == -1) { + // leave the task in current tab (all tasks tab) + var item = json.list[0]; + changeTaskCnt(item, 0, taskList[item.id]); + taskList[item.id] = item; + var noteExpanded = (item.note != '' && $('#taskrow_' + item.id).is('.task-expanded')) ? 1 : 0; + $('#taskrow_' + item.id).replaceWith(prepareTaskStr(item, noteExpanded)); + if (curList.sort != 0) changeTaskOrder(item.id); + refreshTaskCnt(); + $('#taskrow_' + item.id).effect("highlight", {color: _mtt.theme.editTaskFlashColor}, 'normal', function () { + $(this).css('display', '') + }); + } + else { + // remove the task from currrent tab + changeTaskCnt(taskList[taskId], -1); + delete taskList[taskId]; + taskOrder.splice($.inArray(taskId, taskOrder), 1); + $('#taskrow_' + taskId).fadeOut('normal', function () { + $(this).remove() + }); + refreshTaskCnt(); + } + }); + + $("#edittags").flushCache(); + flag.tagsChanged = true; + } + + function cmenuOnListsLoaded() { + if (_mtt.menus.cmenu) _mtt.menus.cmenu.destroy(); + _mtt.menus.cmenu = null; + var s = ''; + var all = tabLists.getAll(); + for (var i in all) { + s += '
  • ' + all[i].name + '
  • '; + } + $('#cmenulistscontainer ul').html(s); + } + + function cmenuOnListAdded(list) { + if (_mtt.menus.cmenu) _mtt.menus.cmenu.destroy(); + _mtt.menus.cmenu = null; + $('#cmenulistscontainer ul').append('
  • ' + list.name + '
  • '); + } + + function cmenuOnListRenamed(list) { + $('#cmenu_list\\:' + list.id).text(list.name); + } + + function cmenuOnListSelected(list) { + $('#cmenulistscontainer li').removeClass('mtt-item-disabled'); + $('#cmenu_list\\:' + list.id).addClass('mtt-item-disabled').removeClass('mtt-list-hidden'); + } + + function cmenuOnListOrderChanged() { + cmenuOnListsLoaded(); + $('#cmenu_list\\:' + curList.id).addClass('mtt-item-disabled'); + } + + function cmenuOnListHidden(list) { + $('#cmenu_list\\:' + list.id).addClass('mtt-list-hidden'); + } + + function tabmenuOnListSelected(list) { + if (list.published) { + $('#btnPublish').addClass('mtt-item-checked'); + $('#btnRssFeed').removeClass('mtt-item-disabled'); + } + else { + $('#btnPublish').removeClass('mtt-item-checked'); + $('#btnRssFeed').addClass('mtt-item-disabled'); + } + if (list.showCompl) $('#btnShowCompleted').addClass('mtt-item-checked'); + else $('#btnShowCompleted').removeClass('mtt-item-checked'); + } + + function listOrderChanged(event, ui) { + var a = $(this).sortable("toArray"); + var order = []; + for (var i in a) { + order.push(a[i].split('_')[1]); + } + tabLists.reorder(order); + _mtt.db.request('changeListOrder', {order: order}); + _mtt.doAction('listOrderChanged', {order: order}); + } + + function showCompletedToggle() { + var act = curList.showCompl ? 0 : 1; + curList.showCompl = tabLists.get(curList.id).showCompl = act; + if (act) $('#btnShowCompleted').addClass('mtt-item-checked'); + else $('#btnShowCompleted').removeClass('mtt-item-checked'); + loadTasks({setCompl: 1}); + } + + function clearCompleted() { + if (!curList) return false; + var r = confirm(_mtt.lang.get('clearCompleted')); + if (!r) return; + _mtt.db.request('clearCompletedInList', {list: curList.id}, function (json) { + if (!parseInt(json.total)) return; + flag.tagsChanged = true; + if (curList.showCompl) loadTasks(); + }); + } + + function tasklistClick(e) { + var node = e.target.nodeName.toUpperCase(); + if (node == 'SPAN' || node == 'LI' || node == 'DIV') { + var li = findParentNode(e.target, 'LI'); + if (li) { + if (selTask && li.id != selTask) $('#' + selTask).removeClass('clicked doubleclicked'); + selTask = li.id; + if ($(li).is('.clicked')) $(li).toggleClass('doubleclicked'); + else $(li).addClass('clicked'); + } + } + } + + function showhide(a, b) { + a.show(); + b.hide(); + } + + function findParentNode(el, node) { + // in html nodename is in uppercase, in xhtml nodename in in lowercase + if (el.nodeName.toUpperCase() == node) return el; + if (!el.parentNode) return null; + while (el.parentNode) { + el = el.parentNode; + if (el.nodeName.toUpperCase() == node) return el; + } + } + + function getLiTaskId(el) { + var li = findParentNode(el, 'LI'); + if (!li || !li.id) return 0; + return li.id.split('_', 2)[1]; + } + + function isParentId(el, id) { + if (el.id && $.inArray(el.id, id) != -1) return true; + if (!el.parentNode) return null; + return isParentId(el.parentNode, id); + } + + function dehtml(str) { + return str.replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'); + } + + function slmenuOnListsLoaded() { + if (_mtt.menus.selectlist) { + _mtt.menus.selectlist.destroy(); + _mtt.menus.selectlist = null; + } + + var s = ''; + var all = tabLists.getAll(); + for (var i in all) { + s += '
  • ' + all[i].name + '
  • '; + } + $('#slmenucontainer ul>.slmenu-lists-begin').nextAll().remove(); + $('#slmenucontainer ul>.slmenu-lists-begin').after(s); + } + + function slmenuOnListRenamed(list) { + $('#slmenucontainer li.list-id-' + list.id).find('a').html(list.name); + } + + function slmenuOnListAdded(list) { + if (_mtt.menus.selectlist) { + _mtt.menus.selectlist.destroy(); + _mtt.menus.selectlist = null; + } + $('#slmenucontainer ul').append('
  • ' + list.name + '
  • '); + } + + function slmenuOnListSelected(list) { + $('#slmenucontainer li').removeClass('mtt-item-checked'); + $('#slmenucontainer li.list-id-' + list.id).addClass('mtt-item-checked').removeClass('mtt-list-hidden'); + + } + + function slmenuOnListHidden(list) { + $('#slmenucontainer li.list-id-' + list.id).addClass('mtt-list-hidden'); + } + + function slmenuSelect(el, menu) { + if (!el.id) return; + var id = el.id, value; + var a = id.split(':'); + if (a.length == 2) { + id = a[0]; + value = a[1]; + } + if (id == 'slmenu_list') { + tabSelect(parseInt(value)); + } + return false; + } + + function exportCurList(format) { + if (!curList) return; + if (!format.match(/^[a-z0-9-]+$/i)) return; + window.location.href = _mtt.mttUrl + 'export.php?list=' + curList.id + '&format=' + format; + } + + function feedCurList() { + if (!curList) return; + window.location.href = _mtt.mttUrl + 'feed.php?list=' + curList.id; + } + + function hideTab(listId) { + if (typeof listId != 'number') { + var id = $(listId).attr('id'); + if (!id) return; + listId = parseInt(id.split('_', 2)[1]); + } + + if (!tabLists.get(listId)) return false; + + // if we hide current tab + var listIdToSelect = 0; + if (curList.id == listId) { + var all = tabLists.getAll(); + for (var i in all) { + if (all[i].id != curList.id && !all[i].hidden) { + listIdToSelect = all[i].id; + break; + } + } + // do not hide the tab if others are hidden + if (!listIdToSelect) return false; + } + + if (listId == -1) { + $('#list_all').addClass('mtt-tabs-hidden').removeClass('mtt-tabs-selected'); + } + else { + $('#list_' + listId).addClass('mtt-tabs-hidden').removeClass('mtt-tabs-selected'); + } + + tabLists.get(listId).hidden = true; + + if (listId > 0) { + _mtt.db.request('setHideList', {list: listId, hide: 1}); + _mtt.doAction('listHidden', tabLists.get(listId)); + } + + if (listIdToSelect) { + tabSelect(listIdToSelect); + } + } + + /* + Errors and Info messages + */ + + function flashError(str, details) { + $("#msg>.msg-text").text(str); + $("#msg>.msg-details").text(details); + $("#loading").hide(); + $("#msg").addClass('mtt-error').effect("highlight", {color: _mtt.theme.msgFlashColor}, 700); + } + + function flashInfo(str, details) { + $("#msg>.msg-text").text(str); + $("#msg>.msg-details").text(details); + $("#loading").hide(); + $("#msg").addClass('mtt-info').effect("highlight", {color: _mtt.theme.msgFlashColor}, 700); + } + + function toggleMsgDetails() { + var el = $("#msg>.msg-details"); + if (!el) return; + if (el.css('display') == 'none') el.show(); + else el.hide() + } + + + /* + Authorization + */ + function updateAccessStatus() { + // flag.needAuth is not changed after pageload + if (flag.needAuth) { + $('#bar_auth').show(); + if (flag.isLogged) { + showhide($("#bar_logout"), $("#bar_login")); + $('#bar .menu-owner').show(); + $('#bar .bar-delim').show(); + } + else { + showhide($("#bar_login"), $("#bar_logout")); + $('#bar .menu-owner').hide(); + $('#bar .bar-delim').hide(); + } + } + else { + $('#bar .menu-owner').show(); + } + if (flag.needAuth && !flag.isLogged) { + flag.readOnly = true; + $("#bar_public").show(); + $('#mtt_body').addClass('readonly'); + liveSearchToggle(1); + // remove some tab menu items + $('#btnRenameList,#btnDeleteList,#btnClearCompleted,#btnPublish').remove(); + } + else { + flag.readOnly = false; + $('#mtt_body').removeClass('readonly'); + $("#bar_public").hide(); + liveSearchToggle(0); + } + $('#page_ajax').hide(); + } + + function showAuth(el) { + var w = $('#authform'); + if (w.css('display') == 'none') { + var offset = $(el).offset(); + w.css({ + position: 'absolute', + top: offset.top + el.offsetHeight + 3, + left: offset.left + el.offsetWidth - w.outerWidth() + }).show(); + $('#password').focus(); + } + else { + w.hide(); + el.blur(); + } + } + + function doAuth(form) { + $.post(mytinytodo.mttUrl + 'ajax.php?login', { + login: 1, + password: form.password.value + }, function (json) { + form.password.value = ''; + if (json.logged) { + flag.isLogged = true; + window.location.reload(); + } + else { + flashError(_mtt.lang.get('invalidpass')); + $('#password').focus(); + } + }, 'json'); + $('#authform').hide(); + } + + function logout() { + $.post(mytinytodo.mttUrl + 'ajax.php?logout', {logout: 1}, function (json) { + flag.isLogged = false; + window.location.reload(); + }, 'json'); + return false; + } + + + /* + Settings + */ + + function showSettings() { + if (_mtt.pages.current.page == 'ajax' && _mtt.pages.current.pageClass == 'settings') return false; + $('#page_ajax').load(_mtt.mttUrl + 'settings.php?ajax=yes', null, function () { + //showhide($('#page_ajax').addClass('mtt-page-settings'), $('#page_tasks')); + _mtt.pageSet('ajax', 'settings'); + }); + return false; + } + + function saveSettings(frm) { + if (!frm) return false; + var params = {save: 'ajax'}; + $(frm).find("input:text,input:password,input:checked,select").filter(":enabled").each(function () { + params[this.name || '__'] = this.value; + }); + $(frm).find(":submit").attr('disabled', 'disabled').blur(); + $.post(_mtt.mttUrl + 'settings.php', params, function (json) { + if (json.saved) { + flashInfo(_mtt.lang.get('settingsSaved')); + setTimeout('window.location.reload();', 1000); + } + }, 'json'); + } + +})(); \ No newline at end of file diff --git a/public/mytinytodo_ajax_storage.js b/public/mytinytodo_ajax_storage.js new file mode 100755 index 0000000..f1badba --- /dev/null +++ b/public/mytinytodo_ajax_storage.js @@ -0,0 +1,197 @@ +/* + This file is a part of myTinyTodo. + (C) Copyright 2010 Max Pozdeev + Licensed under the GNU GPL v2 license. See file COPYRIGHT for details. +*/ + +// AJAX myTinyTodo Storage + +(function () { + + var mtt; + + function mytinytodoStorageAjax(amtt) { + this.mtt = mtt = amtt; + } + + window.mytinytodoStorageAjax = mytinytodoStorageAjax; + + mytinytodoStorageAjax.prototype = + { + /* required method */ + request: function (action, params, callback) { + if (!this[action]) throw "Unknown storage action: " + action; + + this[action](params, function (json) { + if (json.denied) mtt.errorDenied(); + if (callback) callback.call(mtt, json) + }); + }, + + + loadLists: function (params, callback) { + $.getJSON(this.mtt.mttUrl + 'ajax.php?loadLists' + '&rnd=' + Math.random(), callback); + }, + + + loadTasks: function (params, callback) { + var q = ''; + if (params.search && params.search != '') q += '&s=' + encodeURIComponent(params.search); + if (params.tag && params.tag != '') q += '&t=' + encodeURIComponent(params.tag); + if (params.setCompl && params.setCompl != 0) q += '&setCompl=1'; + q += '&rnd=' + Math.random(); + + /* $.getJSON(mtt.mttUrl+'ajax.php?loadTasks&list='+params.list+'&compl='+params.compl+'&sort='+params.sort+'&tz='+params.tz+q, function(json){ + callback.call(mtt, json); + }) + */ + + $.getJSON(this.mtt.mttUrl + 'ajax.php?loadTasks&list=' + params.list + '&compl=' + params.compl + '&sort=' + params.sort + q, callback); + }, + + + newTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?newTask', + {list: params.list, title: params.title, tag: params.tag}, callback, 'json'); + }, + + + fullNewTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?fullNewTask', + { + list: params.list, + title: params.title, + note: params.note, + prio: params.prio, + tags: params.tags, + duedate: params.duedate + }, + callback, 'json'); + }, + + + editTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?editTask=' + params.id, + { + id: params.id, + title: params.title, + note: params.note, + prio: params.prio, + tags: params.tags, + duedate: params.duedate + }, + callback, 'json'); + }, + + + editNote: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?editNote=' + params.id, { + id: params.id, + note: params.note + }, callback, 'json'); + }, + + + completeTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?completeTask=' + params.id, { + id: params.id, + compl: params.compl + }, callback, 'json'); + }, + + + deleteTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?deleteTask=' + params.id, {id: params.id}, callback, 'json'); + }, + + + setPrio: function (params, callback) { + $.getJSON(this.mtt.mttUrl + 'ajax.php?setPrio=' + params.id + '&prio=' + params.prio + '&rnd=' + Math.random(), callback); + }, + + + setSort: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?setSort', { + list: params.list, + sort: params.sort + }, callback, 'json'); + }, + + changeOrder: function (params, callback) { + var order = ''; + for (var i in params.order) { + order += params.order[i].id + '=' + params.order[i].diff + '&'; + } + $.post(this.mtt.mttUrl + 'ajax.php?changeOrder', {order: order}, callback, 'json'); + }, + + tagCloud: function (params, callback) { + $.getJSON(this.mtt.mttUrl + 'ajax.php?tagCloud&list=' + params.list + '&rnd=' + Math.random(), callback); + }, + + moveTask: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?moveTask', { + id: params.id, + from: params.from, + to: params.to + }, callback, 'json'); + }, + + parseTaskStr: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?parseTaskStr', { + list: params.list, + title: params.title, + tag: params.tag + }, callback, 'json'); + }, + + + // Lists + addList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?addList', {name: params.name}, callback, 'json'); + + }, + + renameList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?renameList', { + list: params.list, + name: params.name + }, callback, 'json'); + }, + + deleteList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?deleteList', {list: params.list}, callback, 'json'); + }, + + publishList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?publishList', { + list: params.list, + publish: params.publish + }, callback, 'json'); + }, + + setShowNotesInList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?setShowNotesInList', { + list: params.list, + shownotes: params.shownotes + }, callback, 'json'); + }, + + setHideList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?setHideList', { + list: params.list, + hide: params.hide + }, callback, 'json'); + }, + + changeListOrder: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?changeListOrder', {order: params.order}, callback, 'json'); + }, + + clearCompletedInList: function (params, callback) { + $.post(this.mtt.mttUrl + 'ajax.php?clearCompletedInList', {list: params.list}, callback, 'json'); + } + + }; + +})(); \ No newline at end of file diff --git a/public/images/COPYRIGHT b/public/themes/default/images/COPYRIGHT similarity index 100% rename from public/images/COPYRIGHT rename to public/themes/default/images/COPYRIGHT diff --git a/public/images/arrdown.gif b/public/themes/default/images/arrdown.gif similarity index 100% rename from public/images/arrdown.gif rename to public/themes/default/images/arrdown.gif diff --git a/public/images/arrdown2.gif b/public/themes/default/images/arrdown2.gif similarity index 100% rename from public/images/arrdown2.gif rename to public/themes/default/images/arrdown2.gif diff --git a/public/images/buttons.png b/public/themes/default/images/buttons.png similarity index 100% rename from public/images/buttons.png rename to public/themes/default/images/buttons.png diff --git a/public/images/calendar.png b/public/themes/default/images/calendar.png similarity index 100% rename from public/images/calendar.png rename to public/themes/default/images/calendar.png diff --git a/public/images/closetag.gif b/public/themes/default/images/closetag.gif similarity index 100% rename from public/images/closetag.gif rename to public/themes/default/images/closetag.gif diff --git a/public/images/corner_left.gif b/public/themes/default/images/corner_left.gif similarity index 100% rename from public/images/corner_left.gif rename to public/themes/default/images/corner_left.gif diff --git a/public/images/corner_right.gif b/public/themes/default/images/corner_right.gif similarity index 100% rename from public/images/corner_right.gif rename to public/themes/default/images/corner_right.gif diff --git a/public/images/icons.gif b/public/themes/default/images/icons.gif similarity index 100% rename from public/images/icons.gif rename to public/themes/default/images/icons.gif diff --git a/public/themes/default/images/index.html b/public/themes/default/images/index.html new file mode 100755 index 0000000..31ed4cb --- /dev/null +++ b/public/themes/default/images/index.html @@ -0,0 +1 @@ +Direct access disallowed! \ No newline at end of file diff --git a/public/images/loading1.gif b/public/themes/default/images/loading1.gif similarity index 100% rename from public/images/loading1.gif rename to public/themes/default/images/loading1.gif diff --git a/public/images/loading1_24.gif b/public/themes/default/images/loading1_24.gif similarity index 100% rename from public/images/loading1_24.gif rename to public/themes/default/images/loading1_24.gif diff --git a/public/images/mzl.png b/public/themes/default/images/mzl.png similarity index 100% rename from public/images/mzl.png rename to public/themes/default/images/mzl.png diff --git a/public/images/page_white_text.png b/public/themes/default/images/page_white_text.png similarity index 100% rename from public/images/page_white_text.png rename to public/themes/default/images/page_white_text.png diff --git a/public/images/tab_hover.gif b/public/themes/default/images/tab_hover.gif similarity index 100% rename from public/images/tab_hover.gif rename to public/themes/default/images/tab_hover.gif diff --git a/public/pda.css b/public/themes/default/pda.css similarity index 100% rename from public/pda.css rename to public/themes/default/pda.css diff --git a/public/print.css b/public/themes/default/print.css similarity index 100% rename from public/print.css rename to public/themes/default/print.css diff --git a/public/style.css b/public/themes/default/style.css similarity index 100% rename from public/style.css rename to public/themes/default/style.css diff --git a/public/style_rtl.css b/public/themes/default/style_rtl.css similarity index 100% rename from public/style_rtl.css rename to public/themes/default/style_rtl.css diff --git a/public/themes/index.html b/public/themes/index.html new file mode 100755 index 0000000..31ed4cb --- /dev/null +++ b/public/themes/index.html @@ -0,0 +1 @@ +Direct access disallowed! \ No newline at end of file diff --git a/public/tmp/.htaccess b/public/tmp/.htaccess new file mode 100755 index 0000000..3418e55 --- /dev/null +++ b/public/tmp/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/public/tmp/index.html b/public/tmp/index.html new file mode 100755 index 0000000..31ed4cb --- /dev/null +++ b/public/tmp/index.html @@ -0,0 +1 @@ +Direct access disallowed! \ No newline at end of file