annotate rhodecode/public/js/rhodecode.js @ 2189:3052f90c568a beta

fixed main comments, prevent from sending inline comments if text is empty
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 14 Apr 2012 22:40:47 +0200
parents b61e540122f2
children 5143b8df576c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 /**
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 RhodeCode JS Files
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 **/
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 if (typeof console == "undefined" || typeof console.log == "undefined"){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 console = { log: function() {} }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
10 var str_repeat = function(i, m) {
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 for (var o = []; m > 0; o[--m] = i);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 return o.join('');
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
13 };
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 /**
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 * INJECT .format function into String
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 * Usage: "My name is {0} {1}".format("Johny","Bravo")
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 * Return "My name is Johny Bravo"
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 * Inspired by https://gist.github.com/1049426
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 */
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 String.prototype.format = function() {
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 function format() {
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
24 var str = this;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 var len = arguments.length+1;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 var safe = undefined;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
27 var arg = undefined;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 // For each {0} {1} {n...} replace with the argument in that position. If
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 // the argument is an object or an array it will be stringified to JSON.
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31 for (var i=0; i < len; arg = arguments[i++]) {
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 safe = typeof arg === 'object' ? JSON.stringify(arg) : arg;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
33 str = str.replace(RegExp('\\{'+(i-1)+'\\}', 'g'), safe);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
34 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
35 return str;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
36 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
37
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
38 // Save a reference of what may already exist under the property native.
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
39 // Allows for doing something like: if("".format.native) { /* use native */ }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40 format.native = String.prototype.format;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 // Replace the prototype property
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43 return format;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
44
1458
9d9e491e2a21 added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents: 1426
diff changeset
45 }();
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46
1465
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
47
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
48 /**
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
49 * SmartColorGenerator
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
50 *
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
51 *usage::
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
52 * var CG = new ColorGenerator();
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
53 * var col = CG.getColor(key); //returns array of RGB
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
54 * 'rgb({0})'.format(col.join(',')
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
55 *
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
56 * @returns {ColorGenerator}
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
57 */
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
58 var ColorGenerator = function(){
1465
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
59 this.GOLDEN_RATIO = 0.618033988749895;
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
60 this.CURRENT_RATIO = 0.22717784590367374 // this can be random
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
61 this.HSV_1 = 0.75;//saturation
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
62 this.HSV_2 = 0.95;
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
63 this.color;
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
64 this.cacheColorMap = {};
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
65 };
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
66
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
67 ColorGenerator.prototype = {
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
68 getColor:function(key){
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
69 if(this.cacheColorMap[key] !== undefined){
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
70 return this.cacheColorMap[key];
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
71 }
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
72 else{
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
73 this.cacheColorMap[key] = this.generateColor();
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
74 return this.cacheColorMap[key];
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
75 }
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
76 },
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
77 _hsvToRgb:function(h,s,v){
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
78 if (s == 0.0)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
79 return [v, v, v];
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
80 i = parseInt(h * 6.0)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
81 f = (h * 6.0) - i
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
82 p = v * (1.0 - s)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
83 q = v * (1.0 - s * f)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
84 t = v * (1.0 - s * (1.0 - f))
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
85 i = i % 6
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
86 if (i == 0)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
87 return [v, t, p]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
88 if (i == 1)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
89 return [q, v, p]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
90 if (i == 2)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
91 return [p, v, t]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
92 if (i == 3)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
93 return [p, q, v]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
94 if (i == 4)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
95 return [t, p, v]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
96 if (i == 5)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
97 return [v, p, q]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
98 },
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
99 generateColor:function(){
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
100 this.CURRENT_RATIO = this.CURRENT_RATIO+this.GOLDEN_RATIO;
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
101 this.CURRENT_RATIO = this.CURRENT_RATIO %= 1;
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
102 HSV_tuple = [this.CURRENT_RATIO, this.HSV_1, this.HSV_2]
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
103 RGB_tuple = this._hsvToRgb(HSV_tuple[0],HSV_tuple[1],HSV_tuple[2]);
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
104 function toRgb(v){
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
105 return ""+parseInt(v*256)
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
106 }
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
107 return [toRgb(RGB_tuple[0]),toRgb(RGB_tuple[1]),toRgb(RGB_tuple[2])];
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
108
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
109 }
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
110 }
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
111
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
112
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
113
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
114
ef31d0c6bae9 Added smart color generator to rhodecode.js
Marcin Kuzminski <marcin@python-works.com>
parents: 1458
diff changeset
115
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116 /**
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
117 * GLOBAL YUI Shortcuts
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
118 */
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
119 var YUC = YAHOO.util.Connect;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
120 var YUD = YAHOO.util.Dom;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
121 var YUE = YAHOO.util.Event;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
122 var YUQ = YAHOO.util.Selector.query;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
123
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
124 // defines if push state is enabled for this browser ?
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
125 var push_state_enabled = Boolean(
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
126 window.history && window.history.pushState && window.history.replaceState
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
127 && !( /* disable for versions of iOS before version 4.3 (8F190) */
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
128 (/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent)
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
129 /* disable for the mercury iOS browser, or at least older versions of the webkit engine */
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
130 || (/AppleWebKit\/5([0-2]|3[0-2])/i).test(navigator.userAgent)
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
131 )
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
132 );
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
133
1717
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
134 var _run_callbacks = function(callbacks){
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
135 if (callbacks !== undefined){
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
136 var _l = callbacks.length;
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
137 for (var i=0;i<_l;i++){
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
138 var func = callbacks[i];
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
139 if(typeof(func)=='function'){
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
140 try{
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
141 func();
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
142 }catch (err){};
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
143 }
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
144 }
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
145 }
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
146 }
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
147
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
148 /**
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
149 * Partial Ajax Implementation
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
150 *
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
151 * @param url: defines url to make partial request
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152 * @param container: defines id of container to input partial result
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
153 * @param s_call: success callback function that takes o as arg
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
154 * o.tId
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
155 * o.status
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
156 * o.statusText
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
157 * o.getResponseHeader[ ]
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
158 * o.getAllResponseHeaders
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
159 * o.responseText
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
160 * o.responseXML
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
161 * o.argument
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
162 * @param f_call: failure callback
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
163 * @param args arguments
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
164 */
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
165 function ypjax(url,container,s_call,f_call,args){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
166 var method='GET';
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
167 if(args===undefined){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
168 args=null;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
169 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
170
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
171 // Set special header for partial ajax == HTTP_X_PARTIAL_XHR
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
172 YUC.initHeader('X-PARTIAL-XHR',true);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
173
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
174 // wrapper of passed callback
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
175 var s_wrapper = (function(o){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
176 return function(o){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
177 YUD.get(container).innerHTML=o.responseText;
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
178 YUD.setStyle(container,'opacity','1.0');
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
179 //execute the given original callback
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
180 if (s_call !== undefined){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
181 s_call(o);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
182 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
183 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
184 })()
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
185 YUD.setStyle(container,'opacity','0.3');
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
186 YUC.asyncRequest(method,url,{
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
187 success:s_wrapper,
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
188 failure:function(o){
1651
96ae22a4e963 Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents: 1638
diff changeset
189 console.log(o);
96ae22a4e963 Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents: 1638
diff changeset
190 YUD.get(container).innerHTML='ERROR';
96ae22a4e963 Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents: 1638
diff changeset
191 YUD.setStyle(container,'opacity','1.0');
96ae22a4e963 Display error on ypjax fail
Marcin Kuzminski <marcin@python-works.com>
parents: 1638
diff changeset
192 YUD.setStyle(container,'color','red');
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
193 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
194 },args);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
195
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
196 };
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
197
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
198 var ajaxPOST = function(url,postData,success) {
2189
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
199 // Set special header for ajax == HTTP_X_PARTIAL_XHR
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
200 YUC.initHeader('X-PARTIAL-XHR',true);
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
201
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
202 var toQueryString = function(o) {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
203 if(typeof o !== 'object') {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
204 return false;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
205 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
206 var _p, _qs = [];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
207 for(_p in o) {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
208 _qs.push(encodeURIComponent(_p) + '=' + encodeURIComponent(o[_p]));
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
209 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
210 return _qs.join('&');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
211 };
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
212
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
213 var sUrl = url;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
214 var callback = {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
215 success: success,
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
216 failure: function (o) {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
217 alert("error");
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
218 },
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
219 };
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
220 var postData = toQueryString(postData);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
221 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
222 return request;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
223 };
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
224
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
225
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
226 /**
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
227 * tooltip activate
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
228 */
1458
9d9e491e2a21 added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents: 1426
diff changeset
229 var tooltip_activate = function(){
1421
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
230 function toolTipsId(){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
231 var ids = [];
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
232 var tts = YUQ('.tooltip');
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
233 for (var i = 0; i < tts.length; i++) {
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
234 // if element doesn't not have and id
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
235 // autogenerate one for tooltip
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
236 if (!tts[i].id){
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
237 tts[i].id='tt'+((i*100)+tts.length);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
238 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
239 ids.push(tts[i].id);
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
240 }
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
241 return ids
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
242 };
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
243 var myToolTips = new YAHOO.widget.Tooltip("tooltip", {
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
244 context: [[toolTipsId()],"tl","bl",null,[0,5]],
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
245 monitorresize:false,
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
246 xyoffset :[0,0],
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
247 autodismissdelay:300000,
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
248 hidedelay:5,
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
249 showdelay:20,
c6b811f11c94 Javascripts rewrite: updated yui to latest 2.9, simplified ajax loading for multiple pages. Removed YUI dev package
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
250 });
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
251 };
1426
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
252
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
253 /**
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
254 * show more
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
255 */
1458
9d9e491e2a21 added author to main page tooltip
Marcin Kuzminski <marcin@python-works.com>
parents: 1426
diff changeset
256 var show_more_event = function(){
1426
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
257 YUE.on(YUD.getElementsByClassName('show_more'),'click',function(e){
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
258 var el = e.target;
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
259 YUD.setStyle(YUD.get(el.id.substring(1)),'display','');
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
260 YUD.setStyle(el.parentNode,'display','none');
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
261 });
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
262 };
1426
91708b96e991 Fixed show more links.
Marcin Kuzminski <marcin@python-works.com>
parents: 1421
diff changeset
263
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
264
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
265 /**
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
266 * Quick filter widget
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
267 *
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
268 * @param target: filter input target
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
269 * @param nodes: list of nodes in html we want to filter.
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
270 * @param display_element function that takes current node from nodes and
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
271 * does hide or show based on the node
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
272 *
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
273 */
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
274 var q_filter = function(target,nodes,display_element){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
275
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
276 var nodes = nodes;
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
277 var q_filter_field = YUD.get(target);
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
278 var F = YAHOO.namespace(target);
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
279
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
280 YUE.on(q_filter_field,'click',function(){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
281 q_filter_field.value = '';
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
282 });
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
283
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
284 YUE.on(q_filter_field,'keyup',function(e){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
285 clearTimeout(F.filterTimeout);
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
286 F.filterTimeout = setTimeout(F.updateFilter,600);
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
287 });
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
288
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
289 F.filterTimeout = null;
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
290
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
291 var show_node = function(node){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
292 YUD.setStyle(node,'display','')
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
293 }
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
294 var hide_node = function(node){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
295 YUD.setStyle(node,'display','none');
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
296 }
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
297
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
298 F.updateFilter = function() {
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
299 // Reset timeout
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
300 F.filterTimeout = null;
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
301
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
302 var obsolete = [];
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
303
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
304 var req = q_filter_field.value.toLowerCase();
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
305
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
306 var l = nodes.length;
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
307 var i;
1667
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
308 var showing = 0;
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
309
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
310 for (i=0;i<l;i++ ){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
311 var n = nodes[i];
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
312 var target_element = display_element(n)
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
313 if(req && n.innerHTML.toLowerCase().indexOf(req) == -1){
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
314 hide_node(target_element);
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
315 }
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
316 else{
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
317 show_node(target_element);
1667
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
318 showing+=1;
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
319 }
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
320 }
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
321
1667
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
322 // if repo_count is set update the number
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
323 var cnt = YUD.get('repo_count');
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
324 if(cnt){
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
325 YUD.get('repo_count').innerHTML = showing;
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
326 }
fab837f40cf7 fixed repo counter on main page
Marcin Kuzminski <marcin@python-works.com>
parents: 1653
diff changeset
327
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
328 }
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
329 };
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
330
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
331 var tableTr = function(cls,body){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
332 var tr = document.createElement('tr');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
333 YUD.addClass(tr, cls);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
334
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
335
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
336 var cont = new YAHOO.util.Element(body);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
337 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
338 tr.id = 'comment-tr-{0}'.format(comment_id);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
339 tr.innerHTML = '<td class="lineno-inline new-inline"></td>'+
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
340 '<td class="lineno-inline old-inline"></td>'+
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
341 '<td>{0}</td>'.format(body);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
342 return tr;
1674
6f0143e5efe5 #71 code review
Marcin Kuzminski <marcin@python-works.com>
parents: 1667
diff changeset
343 };
1653
b1e1dffd595c one generic qfilter function.
Marcin Kuzminski <marcin@python-works.com>
parents: 1651
diff changeset
344
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
345 /** comments **/
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
346 var removeInlineForm = function(form) {
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
347 form.parentNode.removeChild(form);
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
348 };
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
349
1682
1f2ba96de73e #71 code review
Marcin Kuzminski <marcin@python-works.com>
parents: 1679
diff changeset
350 var createInlineForm = function(parent_tr, f_path, line) {
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
351 var tmpl = YUD.get('comment-inline-form-template').innerHTML;
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
352 tmpl = tmpl.format(f_path, line);
1682
1f2ba96de73e #71 code review
Marcin Kuzminski <marcin@python-works.com>
parents: 1679
diff changeset
353 var form = tableTr('comment-form-inline',tmpl)
1f2ba96de73e #71 code review
Marcin Kuzminski <marcin@python-works.com>
parents: 1679
diff changeset
354
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
355 // create event for hide button
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
356 form = new YAHOO.util.Element(form);
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
357 var form_hide_button = new YAHOO.util.Element(form.getElementsByClassName('hide-inline-form')[0]);
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
358 form_hide_button.on('click', function(e) {
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
359 var newtr = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode;
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
360 if(YUD.hasClass(newtr.nextElementSibling,'inline-comments-button')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
361 YUD.setStyle(newtr.nextElementSibling,'display','');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
362 }
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
363 removeInlineForm(newtr);
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
364 YUD.removeClass(parent_tr, 'form-open');
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
365
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
366 });
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
367
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
368 return form
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
369 };
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
370
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
371 /**
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
372 * Inject inline comment for on given TR this tr should be always an .line
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
373 * tr containing the line. Code will detect comment, and always put the comment
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
374 * block at the very bottom
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
375 */
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
376 var injectInlineForm = function(tr){
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
377 if(!YUD.hasClass(tr, 'line')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
378 return
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
379 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
380 var submit_url = AJAX_COMMENT_URL;
1787
d4a7b6c82efe code garden for changeset ranges and comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1782
diff changeset
381 if(YUD.hasClass(tr,'form-open') || YUD.hasClass(tr,'context') || YUD.hasClass(tr,'no-comment')){
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
382 return
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
383 }
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
384 YUD.addClass(tr,'form-open');
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
385 var node = tr.parentNode.parentNode.parentNode.getElementsByClassName('full_f_path')[0];
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
386 var f_path = YUD.getAttribute(node,'path');
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
387 var lineno = getLineNo(tr);
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
388 var form = createInlineForm(tr, f_path, lineno, submit_url);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
389
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
390 var parent = tr;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
391 while (1){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
392 var n = parent.nextElementSibling;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
393 // next element are comments !
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
394 if(YUD.hasClass(n,'inline-comments')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
395 parent = n;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
396 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
397 else{
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
398 break;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
399 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
400 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
401 YUD.insertAfter(form,parent);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
402
1772
c83d3d42ab92 - diff.css merge to main style.css
Marcin Kuzminski <marcin@python-works.com>
parents: 1759
diff changeset
403 YUD.get('text_'+lineno).focus();
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
404 var f = YUD.get(form);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
405
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
406 var overlay = f.getElementsByClassName('overlay')[0];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
407 var _form = f.getElementsByClassName('inline-form')[0];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
408
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
409 form.on('submit',function(e){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
410 YUE.preventDefault(e);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
411
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
412 //ajax submit
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
413 var text = YUD.get('text_'+lineno).value;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
414 var postData = {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
415 'text':text,
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
416 'f_path':f_path,
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
417 'line':lineno
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
418 };
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
419
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
420 if(lineno === undefined){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
421 alert('missing line !');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
422 return
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
423 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
424 if(f_path === undefined){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
425 alert('missing file path !');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
426 return
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
427 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
428
2189
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
429 if(text == ""){
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
430 return
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
431 }
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
432
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
433 var success = function(o){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
434 YUD.removeClass(tr, 'form-open');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
435 removeInlineForm(f);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
436 var json_data = JSON.parse(o.responseText);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
437 renderInlineComment(json_data);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
438 };
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
439
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
440 if (YUD.hasClass(overlay,'overlay')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
441 var w = _form.offsetWidth;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
442 var h = _form.offsetHeight;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
443 YUD.setStyle(overlay,'width',w+'px');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
444 YUD.setStyle(overlay,'height',h+'px');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
445 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
446 YUD.addClass(overlay, 'submitting');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
447
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
448 ajaxPOST(submit_url, postData, success);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
449 });
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
450
1772
c83d3d42ab92 - diff.css merge to main style.css
Marcin Kuzminski <marcin@python-works.com>
parents: 1759
diff changeset
451 tooltip_activate();
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
452 };
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
453
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
454 var deleteComment = function(comment_id){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
455 var url = AJAX_COMMENT_DELETE_URL.replace('__COMMENT_ID__',comment_id);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
456 var postData = {'_method':'delete'};
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
457 var success = function(o){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
458 var n = YUD.get('comment-tr-'+comment_id);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
459 var root = n.previousElementSibling.previousElementSibling;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
460 n.parentNode.removeChild(n);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
461
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
462 // scann nodes, and attach add button to last one
2189
3052f90c568a fixed main comments, prevent from sending inline comments if text is empty
Marcin Kuzminski <marcin@python-works.com>
parents: 2187
diff changeset
463 placeAddButton(root);
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
464 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
465 ajaxPOST(url,postData,success);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
466 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
467
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
468
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
469 var createInlineAddButton = function(tr){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
470
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
471 var label = TRANSLATION_MAP['add another comment'];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
472
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
473 var html_el = document.createElement('div');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
474 YUD.addClass(html_el, 'add-comment');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
475 html_el.innerHTML = '<span class="ui-btn">{0}</span>'.format(label);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
476
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
477 var add = new YAHOO.util.Element(html_el);
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
478 add.on('click', function(e) {
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
479 injectInlineForm(tr);
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
480 });
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
481 return add;
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
482 };
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
483
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
484 var getLineNo = function(tr) {
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
485 var line;
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
486 var o = tr.children[0].id.split('_');
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
487 var n = tr.children[1].id.split('_');
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
488
1679
c3d9cd8c0cba fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 1677
diff changeset
489 if (n.length >= 2) {
c3d9cd8c0cba fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 1677
diff changeset
490 line = n[n.length-1];
c3d9cd8c0cba fixed inline comment file parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 1677
diff changeset
491 } else if (o.length >= 2) {
1685
2e583dbfcf22 fixed typo in linenumber calculation on inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1683
diff changeset
492 line = o[o.length-1];
1677
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
493 }
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
494
7276b170ce8b #71 code-review
Marcin Kuzminski <marcin@python-works.com>
parents: 1674
diff changeset
495 return line
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
496 };
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
497
2187
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
498 var placeAddButton = function(target_tr){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
499 if(!target_tr){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
500 return
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
501 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
502 var last_node = target_tr;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
503 //scann
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
504 while (1){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
505 var n = last_node.nextElementSibling;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
506 // next element are comments !
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
507 if(YUD.hasClass(n,'inline-comments')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
508 last_node = n;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
509 //also remove the comment button from previos
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
510 var comment_add_buttons = last_node.getElementsByClassName('add-comment');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
511 for(var i=0;i<comment_add_buttons.length;i++){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
512 var b = comment_add_buttons[i];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
513 b.parentNode.removeChild(b);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
514 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
515 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
516 else{
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
517 break;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
518 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
519 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
520
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
521 var add = createInlineAddButton(target_tr);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
522 // get the comment div
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
523 var comment_block = last_node.getElementsByClassName('comment')[0];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
524 // attach add button
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
525 YUD.insertAfter(add,comment_block);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
526 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
527
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
528 /**
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
529 * Places the inline comment into the changeset block in proper line position
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
530 */
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
531 var placeInline = function(target_container,lineno,html){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
532 var lineid = "{0}_{1}".format(target_container,lineno);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
533 var target_line = YUD.get(lineid);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
534 var comment = new YAHOO.util.Element(tableTr('inline-comments',html))
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
535
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
536 // check if there are comments already !
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
537 var parent = target_line.parentNode;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
538 var root_parent = parent;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
539 while (1){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
540 var n = parent.nextElementSibling;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
541 // next element are comments !
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
542 if(YUD.hasClass(n,'inline-comments')){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
543 parent = n;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
544 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
545 else{
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
546 break;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
547 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
548 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
549 // put in the comment at the bottom
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
550 YUD.insertAfter(comment,parent);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
551
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
552 // scann nodes, and attach add button to last one
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
553 placeAddButton(root_parent);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
554
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
555 return target_line;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
556 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
557
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
558 /**
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
559 * make a single inline comment and place it inside
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
560 */
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
561 var renderInlineComment = function(json_data){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
562 try{
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
563 var html = json_data['rendered_text'];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
564 var lineno = json_data['line_no'];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
565 var target_id = json_data['target_id'];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
566 placeInline(target_id, lineno, html);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
567
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
568 }catch(e){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
569 console.log(e);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
570 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
571 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
572
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
573 /**
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
574 * Iterates over all the inlines, and places them inside proper blocks of data
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
575 */
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
576 var renderInlineComments = function(file_comments){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
577 for (f in file_comments){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
578 // holding all comments for a FILE
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
579 var box = file_comments[f];
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
580
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
581 var target_id = YUD.getAttribute(box,'target_id');
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
582 // actually comments with line numbers
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
583 var comments = box.children;
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
584 for(var i=0; i<comments.length; i++){
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
585 var data = {
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
586 'rendered_text': comments[i].outerHTML,
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
587 'line_no': YUD.getAttribute(comments[i],'line'),
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
588 'target_id': target_id
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
589 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
590 renderInlineComment(data);
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
591 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
592 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
593 }
b61e540122f2 #415: Adding comment to changeset causes reload
Marcin Kuzminski <marcin@python-works.com>
parents: 2145
diff changeset
594
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
595
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
596 var fileBrowserListeners = function(current_url, node_list_url, url_base,
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
597 truncated_lbl, nomatch_lbl){
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
598 var current_url_branch = +"?branch=__BRANCH__";
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
599 var url = url_base;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
600 var node_url = node_list_url;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
601
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
602 YUE.on('stay_at_branch','click',function(e){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
603 if(e.target.checked){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
604 var uri = current_url_branch;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
605 uri = uri.replace('__BRANCH__',e.target.value);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
606 window.location = uri;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
607 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
608 else{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
609 window.location = current_url;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
610 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
611 })
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
612
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
613 var n_filter = YUD.get('node_filter');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
614 var F = YAHOO.namespace('node_filter');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
615
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
616 F.filterTimeout = null;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
617 var nodes = null;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
618
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
619 F.initFilter = function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
620 YUD.setStyle('node_filter_box_loading','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
621 YUD.setStyle('search_activate_id','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
622 YUD.setStyle('add_node_id','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
623 YUC.initHeader('X-PARTIAL-XHR',true);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
624 YUC.asyncRequest('GET',url,{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
625 success:function(o){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
626 nodes = JSON.parse(o.responseText);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
627 YUD.setStyle('node_filter_box_loading','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
628 YUD.setStyle('node_filter_box','display','');
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
629 n_filter.focus();
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
630 if(YUD.hasClass(n_filter,'init')){
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
631 n_filter.value = '';
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
632 YUD.removeClass(n_filter,'init');
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
633 }
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
634 },
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
635 failure:function(o){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
636 console.log('failed to load');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
637 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
638 },null);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
639 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
640
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
641 F.updateFilter = function(e) {
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
642
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
643 return function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
644 // Reset timeout
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
645 F.filterTimeout = null;
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
646 var query = e.target.value.toLowerCase();
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
647 var match = [];
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
648 var matches = 0;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
649 var matches_max = 20;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
650 if (query != ""){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
651 for(var i=0;i<nodes.length;i++){
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
652
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
653 var pos = nodes[i].name.toLowerCase().indexOf(query)
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
654 if(query && pos != -1){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
655
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
656 matches++
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
657 //show only certain amount to not kill browser
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
658 if (matches > matches_max){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
659 break;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
660 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
661
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
662 var n = nodes[i].name;
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
663 var t = nodes[i].type;
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
664 var n_hl = n.substring(0,pos)
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
665 +"<b>{0}</b>".format(n.substring(pos,pos+query.length))
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
666 +n.substring(pos+query.length)
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
667 match.push('<tr><td><a class="browser-{0}" href="{1}">{2}</a></td><td colspan="5"></td></tr>'.format(t,node_url.replace('__FPATH__',n),n_hl));
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
668 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
669 if(match.length >= matches_max){
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
670 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(truncated_lbl));
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
671 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
672
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
673 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
674 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
675 if(query != ""){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
676 YUD.setStyle('tbody','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
677 YUD.setStyle('tbody_filtered','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
678
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
679 if (match.length==0){
1705
5e4827a8e942 added reply comment button on top of inline comments
Marcin Kuzminski <marcin@python-works.com>
parents: 1699
diff changeset
680 match.push('<tr><td>{0}</td><td colspan="5"></td></tr>'.format(nomatch_lbl));
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
681 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
682
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
683 YUD.get('tbody_filtered').innerHTML = match.join("");
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
684 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
685 else{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
686 YUD.setStyle('tbody','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
687 YUD.setStyle('tbody_filtered','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
688 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
689
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
690 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
691 };
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
692
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
693 YUE.on(YUD.get('filter_activate'),'click',function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
694 F.initFilter();
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
695 })
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
696 YUE.on(n_filter,'click',function(){
1810
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
697 if(YUD.hasClass(n_filter,'init')){
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
698 n_filter.value = '';
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
699 YUD.removeClass(n_filter,'init');
203af05539e0 implements #330 api method for listing nodes at particular revision
Marcin Kuzminski <marcin@python-works.com>
parents: 1787
diff changeset
700 }
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
701 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
702 YUE.on(n_filter,'keyup',function(e){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
703 clearTimeout(F.filterTimeout);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
704 F.filterTimeout = setTimeout(F.updateFilter(e),600);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
705 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
706 };
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
707
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
708
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
709 var initCodeMirror = function(textAreadId,resetUrl){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
710 var myCodeMirror = CodeMirror.fromTextArea(YUD.get(textAreadId),{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
711 mode: "null",
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
712 lineNumbers:true
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
713 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
714 YUE.on('reset','click',function(e){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
715 window.location=resetUrl
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
716 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
717
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
718 YUE.on('file_enable','click',function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
719 YUD.setStyle('editor_container','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
720 YUD.setStyle('upload_file_container','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
721 YUD.setStyle('filename_container','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
722 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
723
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
724 YUE.on('upload_file_enable','click',function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
725 YUD.setStyle('editor_container','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
726 YUD.setStyle('upload_file_container','display','');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
727 YUD.setStyle('filename_container','display','none');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
728 });
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
729 };
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
730
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
731
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
732
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
733 var getIdentNode = function(n){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
734 //iterate thru nodes untill matched interesting node !
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
735
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
736 if (typeof n == 'undefined'){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
737 return -1
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
738 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
739
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
740 if(typeof n.id != "undefined" && n.id.match('L[0-9]+')){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
741 return n
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
742 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
743 else{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
744 return getIdentNode(n.parentNode);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
745 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
746 };
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
747
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
748 var getSelectionLink = function(selection_link_label) {
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
749 return function(){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
750 //get selection from start/to nodes
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
751 if (typeof window.getSelection != "undefined") {
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
752 s = window.getSelection();
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
753
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
754 from = getIdentNode(s.anchorNode);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
755 till = getIdentNode(s.focusNode);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
756
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
757 f_int = parseInt(from.id.replace('L',''));
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
758 t_int = parseInt(till.id.replace('L',''));
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
759
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
760 if (f_int > t_int){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
761 //highlight from bottom
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
762 offset = -35;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
763 ranges = [t_int,f_int];
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
764
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
765 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
766 else{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
767 //highligth from top
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
768 offset = 35;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
769 ranges = [f_int,t_int];
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
770 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
771
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
772 if (ranges[0] != ranges[1]){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
773 if(YUD.get('linktt') == null){
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
774 hl_div = document.createElement('div');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
775 hl_div.id = 'linktt';
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
776 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
777 anchor = '#L'+ranges[0]+'-'+ranges[1];
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
778 hl_div.innerHTML = '';
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
779 l = document.createElement('a');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
780 l.href = location.href.substring(0,location.href.indexOf('#'))+anchor;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
781 l.innerHTML = selection_link_label;
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
782 hl_div.appendChild(l);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
783
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
784 YUD.get('body').appendChild(hl_div);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
785
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
786 xy = YUD.getXY(till.id);
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
787
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
788 YUD.addClass('linktt','yui-tt');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
789 YUD.setStyle('linktt','top',xy[1]+offset+'px');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
790 YUD.setStyle('linktt','left',xy[0]+'px');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
791 YUD.setStyle('linktt','visibility','visible');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
792 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
793 else{
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
794 YUD.setStyle('linktt','visibility','hidden');
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
795 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
796 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
797 }
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 1685
diff changeset
798 };
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
799
1717
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
800 var deleteNotification = function(url, notification_id,callbacks){
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
801 var callback = {
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
802 success:function(o){
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
803 var obj = YUD.get(String("notification_"+notification_id));
1717
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
804 if(obj.parentNode !== undefined){
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
805 obj.parentNode.removeChild(obj);
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
806 }
7ff304d3028f Notification fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 1712
diff changeset
807 _run_callbacks(callbacks);
1712
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
808 },
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
809 failure:function(o){
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
810 alert("error");
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
811 },
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
812 };
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
813 var postData = '_method=delete';
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
814 var sUrl = url.replace('__NOTIFICATION_ID__',notification_id);
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
815 var request = YAHOO.util.Connect.asyncRequest('POST', sUrl,
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
816 callback, postData);
cac5109ac3b6 Notification system improvements
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
817 };
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
818
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
819
2142
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
820 /** MEMBERS AUTOCOMPLETE WIDGET **/
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
821
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
822 var MembersAutoComplete = function (users_list, groups_list, group_lbl, members_lbl) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
823 var myUsers = users_list;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
824 var myGroups = groups_list;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
825
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
826 // Define a custom search function for the DataSource of users
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
827 var matchUsers = function (sQuery) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
828 // Case insensitive matching
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
829 var query = sQuery.toLowerCase();
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
830 var i = 0;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
831 var l = myUsers.length;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
832 var matches = [];
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
833
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
834 // Match against each name of each contact
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
835 for (; i < l; i++) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
836 contact = myUsers[i];
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
837 if ((contact.fname.toLowerCase().indexOf(query) > -1) || (contact.lname.toLowerCase().indexOf(query) > -1) || (contact.nname && (contact.nname.toLowerCase().indexOf(query) > -1))) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
838 matches[matches.length] = contact;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
839 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
840 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
841 return matches;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
842 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
843
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
844 // Define a custom search function for the DataSource of usersGroups
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
845 var matchGroups = function (sQuery) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
846 // Case insensitive matching
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
847 var query = sQuery.toLowerCase();
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
848 var i = 0;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
849 var l = myGroups.length;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
850 var matches = [];
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
851
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
852 // Match against each name of each contact
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
853 for (; i < l; i++) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
854 matched_group = myGroups[i];
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
855 if (matched_group.grname.toLowerCase().indexOf(query) > -1) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
856 matches[matches.length] = matched_group;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
857 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
858 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
859 return matches;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
860 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
861
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
862 //match all
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
863 var matchAll = function (sQuery) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
864 u = matchUsers(sQuery);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
865 g = matchGroups(sQuery);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
866 return u.concat(g);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
867 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
868
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
869 // DataScheme for members
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
870 var memberDS = new YAHOO.util.FunctionDataSource(matchAll);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
871 memberDS.responseSchema = {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
872 fields: ["id", "fname", "lname", "nname", "grname", "grmembers", "gravatar_lnk"]
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
873 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
874
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
875 // DataScheme for owner
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
876 var ownerDS = new YAHOO.util.FunctionDataSource(matchUsers);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
877 ownerDS.responseSchema = {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
878 fields: ["id", "fname", "lname", "nname", "gravatar_lnk"]
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
879 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
880
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
881 // Instantiate AutoComplete for perms
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
882 var membersAC = new YAHOO.widget.AutoComplete("perm_new_member_name", "perm_container", memberDS);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
883 membersAC.useShadow = false;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
884 membersAC.resultTypeList = false;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
885
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
886 // Instantiate AutoComplete for owner
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
887 var ownerAC = new YAHOO.widget.AutoComplete("user", "owner_container", ownerDS);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
888 ownerAC.useShadow = false;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
889 ownerAC.resultTypeList = false;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
890
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
891
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
892 // Helper highlight function for the formatter
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
893 var highlightMatch = function (full, snippet, matchindex) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
894 return full.substring(0, matchindex)
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
895 + "<span class='match'>"
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
896 + full.substr(matchindex, snippet.length)
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
897 + "</span>" + full.substring(matchindex + snippet.length);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
898 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
899
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
900 // Custom formatter to highlight the matching letters
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
901 var custom_formatter = function (oResultData, sQuery, sResultMatch) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
902 var query = sQuery.toLowerCase();
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
903 var _gravatar = function(res, em, group){
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
904 if (group !== undefined){
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
905 em = '/images/icons/group.png'
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
906 }
2145
f8e66d942dcb autocomplete overflow fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2142
diff changeset
907 tmpl = '<div class="ac-container-wrap"><img class="perm-gravatar-ac" src="{0}"/>{1}</div>'
2142
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
908 return tmpl.format(em,res)
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
909 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
910 // group
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
911 if (oResultData.grname != undefined) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
912 var grname = oResultData.grname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
913 var grmembers = oResultData.grmembers;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
914 var grnameMatchIndex = grname.toLowerCase().indexOf(query);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
915 var grprefix = "{0}: ".format(group_lbl);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
916 var grsuffix = " (" + grmembers + " )";
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
917 var grsuffix = " ({0} {1})".format(grmembers, members_lbl);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
918
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
919 if (grnameMatchIndex > -1) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
920 return _gravatar(grprefix + highlightMatch(grname, query, grnameMatchIndex) + grsuffix,null,true);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
921 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
922 return _gravatar(grprefix + oResultData.grname + grsuffix, null,true);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
923 // Users
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
924 } else if (oResultData.fname != undefined) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
925 var fname = oResultData.fname,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
926 lname = oResultData.lname,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
927 nname = oResultData.nname || "",
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
928 // Guard against null value
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
929 fnameMatchIndex = fname.toLowerCase().indexOf(query),
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
930 lnameMatchIndex = lname.toLowerCase().indexOf(query),
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
931 nnameMatchIndex = nname.toLowerCase().indexOf(query),
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
932 displayfname, displaylname, displaynname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
933
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
934 if (fnameMatchIndex > -1) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
935 displayfname = highlightMatch(fname, query, fnameMatchIndex);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
936 } else {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
937 displayfname = fname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
938 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
939
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
940 if (lnameMatchIndex > -1) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
941 displaylname = highlightMatch(lname, query, lnameMatchIndex);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
942 } else {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
943 displaylname = lname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
944 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
945
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
946 if (nnameMatchIndex > -1) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
947 displaynname = "(" + highlightMatch(nname, query, nnameMatchIndex) + ")";
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
948 } else {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
949 displaynname = nname ? "(" + nname + ")" : "";
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
950 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
951
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
952 return _gravatar(displayfname + " " + displaylname + " " + displaynname, oResultData.gravatar_lnk);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
953 } else {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
954 return '';
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
955 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
956 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
957 membersAC.formatResult = custom_formatter;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
958 ownerAC.formatResult = custom_formatter;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
959
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
960 var myHandler = function (sType, aArgs) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
961
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
962 var myAC = aArgs[0]; // reference back to the AC instance
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
963 var elLI = aArgs[1]; // reference to the selected LI element
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
964 var oData = aArgs[2]; // object literal of selected item's result data
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
965 //fill the autocomplete with value
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
966 if (oData.nname != undefined) {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
967 //users
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
968 myAC.getInputEl().value = oData.nname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
969 YUD.get('perm_new_member_type').value = 'user';
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
970 } else {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
971 //groups
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
972 myAC.getInputEl().value = oData.grname;
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
973 YUD.get('perm_new_member_type').value = 'users_group';
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
974 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
975 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
976
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
977 membersAC.itemSelectEvent.subscribe(myHandler);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
978 if(ownerAC.itemSelectEvent){
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
979 ownerAC.itemSelectEvent.subscribe(myHandler);
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
980 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
981
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
982 return {
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
983 memberDS: memberDS,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
984 ownerDS: ownerDS,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
985 membersAC: membersAC,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
986 ownerAC: ownerAC,
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
987 };
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
988 }
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
989
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
990
a21eab6ff42f Added gravatars into permissions view and permissions autocomplete
Marcin Kuzminski <marcin@python-works.com>
parents: 2128
diff changeset
991
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
992 /**
1779
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
993 * QUICK REPO MENU
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
994 */
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
995 var quick_repo_menu = function(){
2088
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
996 YUE.on(YUQ('.quick_repo_menu'),'mouseenter',function(e){
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
997 var menu = e.currentTarget.firstElementChild.firstElementChild;
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
998 if(YUD.hasClass(menu,'hidden')){
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
999 YUD.replaceClass(e.currentTarget,'hidden', 'active');
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1000 YUD.replaceClass(menu, 'hidden', 'active');
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1001 }
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1002 })
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1003 YUE.on(YUQ('.quick_repo_menu'),'mouseleave',function(e){
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1004 var menu = e.currentTarget.firstElementChild.firstElementChild;
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1005 if(YUD.hasClass(menu,'active')){
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1006 YUD.replaceClass(e.currentTarget, 'active', 'hidden');
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1007 YUD.replaceClass(menu, 'active', 'hidden');
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1008 }
382df4e69dfc quick_repo_menu changed from mouseclick to popup
Marcin Kuzminski <marcin@python-works.com>
parents: 2087
diff changeset
1009 })
1779
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
1010 };
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
1011
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
1012
9edd6ac132f0 Added sorting into journal and admin pages
Marcin Kuzminski <marcin@python-works.com>
parents: 1778
diff changeset
1013 /**
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1014 * TABLE SORTING
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1015 */
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1016
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1017 // returns a node from given html;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1018 var fromHTML = function(html){
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1019 var _html = document.createElement('element');
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1020 _html.innerHTML = html;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1021 return _html;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1022 }
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1023 var get_rev = function(node){
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1024 var n = node.firstElementChild.firstElementChild;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1025
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1026 if (n===null){
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1027 return -1
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1028 }
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1029 else{
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1030 out = n.firstElementChild.innerHTML.split(':')[0].replace('r','');
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1031 return parseInt(out);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1032 }
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1033 }
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1034
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1035 var get_name = function(node){
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1036 var name = node.firstElementChild.children[2].innerHTML;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1037 return name
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1038 }
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1039 var get_group_name = function(node){
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1040 var name = node.firstElementChild.children[1].innerHTML;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1041 return name
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1042 }
1782
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1043 var get_date = function(node){
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1044 var date_ = node.firstElementChild.innerHTML;
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1045 return date_
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1046 }
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1047
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1048 var revisionSort = function(a, b, desc, field) {
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1049
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1050 var a_ = fromHTML(a.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1051 var b_ = fromHTML(b.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1052
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1053 // extract revisions from string nodes
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1054 a_ = get_rev(a_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1055 b_ = get_rev(b_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1056
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1057 var comp = YAHOO.util.Sort.compare;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1058 var compState = comp(a_, b_, desc);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1059 return compState;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1060 };
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1061 var ageSort = function(a, b, desc, field) {
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1062 var a_ = a.getData(field);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1063 var b_ = b.getData(field);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1064
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1065 var comp = YAHOO.util.Sort.compare;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1066 var compState = comp(a_, b_, desc);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1067 return compState;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1068 };
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1069
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1070 var nameSort = function(a, b, desc, field) {
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1071 var a_ = fromHTML(a.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1072 var b_ = fromHTML(b.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1073
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1074 // extract name from table
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1075 a_ = get_name(a_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1076 b_ = get_name(b_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1077
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1078 var comp = YAHOO.util.Sort.compare;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1079 var compState = comp(a_, b_, desc);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1080 return compState;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1081 };
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1082
2127
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1083 var permNameSort = function(a, b, desc, field) {
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1084 var a_ = fromHTML(a.getData(field));
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1085 var b_ = fromHTML(b.getData(field));
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1086 // extract name from table
2128
e29c688e6885 linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents: 2127
diff changeset
1087
e29c688e6885 linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents: 2127
diff changeset
1088 a_ = a_.children[0].innerHTML;
e29c688e6885 linkify perms and make global ones display better
Marcin Kuzminski <marcin@python-works.com>
parents: 2127
diff changeset
1089 b_ = b_.children[0].innerHTML;
2127
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1090
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1091 var comp = YAHOO.util.Sort.compare;
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1092 var compState = comp(a_, b_, desc);
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1093 return compState;
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1094 };
b745d5d2563c implemented #377 Users view own permissions
Marcin Kuzminski <marcin@python-works.com>
parents: 2088
diff changeset
1095
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1096 var groupNameSort = function(a, b, desc, field) {
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1097 var a_ = fromHTML(a.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1098 var b_ = fromHTML(b.getData(field));
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1099
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1100 // extract name from table
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1101 a_ = get_group_name(a_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1102 b_ = get_group_name(b_)
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1103
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1104 var comp = YAHOO.util.Sort.compare;
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1105 var compState = comp(a_, b_, desc);
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1106 return compState;
1782
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1107 };
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1108 var dateSort = function(a, b, desc, field) {
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1109 var a_ = fromHTML(a.getData(field));
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1110 var b_ = fromHTML(b.getData(field));
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1111
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1112 // extract name from table
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1113 a_ = get_date(a_)
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1114 b_ = get_date(b_)
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1115
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1116 var comp = YAHOO.util.Sort.compare;
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1117 var compState = comp(a_, b_, desc);
eaf09acf6872 added sorting to bookmarks tags and branches
Marcin Kuzminski <marcin@python-works.com>
parents: 1779
diff changeset
1118 return compState;
1778
defcf245f3e9 fixes #229 repo sorting is not working.
Marcin Kuzminski <marcin@python-works.com>
parents: 1772
diff changeset
1119 };