it-logica-application-backbone 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/assets/javascripts/backbone_js/index.js +14 -0
- data/app/assets/javascripts/backbone_js/jquery-ui-timepicker-cs.js +20 -0
- data/app/assets/javascripts/backbone_js/jquery.cookie.js +96 -0
- data/app/assets/javascripts/backbone_js/jquery.fileupload.js +949 -0
- data/app/assets/javascripts/backbone_js/jquery.history.js +1 -0
- data/app/assets/javascripts/backbone_js/jquery.hotkeys.js +99 -0
- data/app/assets/javascripts/backbone_js/jquery.iframe-transport.js +171 -0
- data/app/assets/javascripts/backbone_js/jquery.jstree.js +4551 -0
- data/app/assets/javascripts/backbone_js/jquery.multiselect.min.js +20 -0
- data/app/assets/javascripts/backbone_js/jquery.ui.datepicker-cs.js +23 -0
- data/app/assets/javascripts/backbone_js/jquery.ui.widget.js +282 -0
- data/app/assets/javascripts/backbone_js/ladas_form_submitter.js +27 -0
- data/app/assets/javascripts/backbone_js/ladas_functions.js +13 -0
- data/app/assets/javascripts/backbone_js/ladas_initialize_history.js +42 -0
- data/app/assets/javascripts/backbone_js/ladas_jstree.js +314 -0
- data/app/assets/javascripts/backbone_js/ladas_live_search.js +156 -0
- data/app/assets/javascripts/backbone_js/ladas_loading.js +262 -0
- data/app/assets/javascripts/backbone_js/ladas_paginate.js +76 -0
- data/app/assets/javascripts/backbone_js/ladas_saving.js +93 -0
- data/app/assets/javascripts/backbone_js/ladas_table_for.js +13 -0
- data/app/assets/javascripts/backbone_js/ladas_tinymce.js +79 -0
- data/app/assets/javascripts/backbone_js/load-image.min.js +1 -0
- data/app/assets/javascripts/backbone_js/time_picker.js +1275 -0
- data/app/assets/javascripts/backbone_js/tmpl.min.js +1 -0
- data/it-logica-application-backbone.gemspec +26 -1
- data/lib/backbone_js/engine.rb +5 -0
- data/lib/it-logica-application-backbone.rb +3 -0
- metadata +37 -12
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery MultiSelect UI Widget 1.12
|
3
|
+
* Copyright (c) 2011 Eric Hynds
|
4
|
+
*
|
5
|
+
* http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
|
6
|
+
*
|
7
|
+
* Depends:
|
8
|
+
* - jQuery 1.4.2+
|
9
|
+
* - jQuery UI 1.8 widget factory
|
10
|
+
*
|
11
|
+
* Optional:
|
12
|
+
* - jQuery UI effects
|
13
|
+
* - jQuery UI position utility
|
14
|
+
*
|
15
|
+
* Dual licensed under the MIT and GPL licenses:
|
16
|
+
* http://www.opensource.org/licenses/mit-license.php
|
17
|
+
* http://www.gnu.org/licenses/gpl.html
|
18
|
+
*
|
19
|
+
*/
|
20
|
+
(function(d){var j=0;d.widget("ech.multiselect",{options:{header:!0,height:175,minWidth:225,classes:"",checkAllText:"Check all",uncheckAllText:"Uncheck all",noneSelectedText:"Select options",selectedText:"# selected",selectedList:0,show:"",hide:"",autoOpen:!1,multiple:!0,position:{}},_create:function(){var a=this.element.hide(),b=this.options;this.speed=d.fx.speeds._default;this._isOpen=!1;a=(this.button=d('<button type="button"><span class="ui-icon ui-icon-triangle-2-n-s"></span></button>')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({title:a.attr("title"), "aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=d("<span />")).html(b.noneSelectedText).appendTo(a);var a=(this.menu=d("<div />")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).appendTo(document.body),c=(this.header=d("<div />")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=d("<ul />")).addClass("ui-helper-reset").html(function(){return!0=== b.header?'<li><a class="ui-multiselect-all" href="#"><span class="ui-icon ui-icon-check"></span><span>'+b.checkAllText+'</span></a></li><li><a class="ui-multiselect-none" href="#"><span class="ui-icon ui-icon-closethick"></span><span>'+b.uncheckAllText+"</span></a></li>":"string"===typeof b.header?"<li>"+b.header+"</li>":""}).append('<li class="ui-multiselect-close"><a href="#" class="ui-multiselect-close"><span class="ui-icon ui-icon-circle-close"></span></a></li>').appendTo(c);(this.checkboxContainer= d("<ul />")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a);this._bindEvents();this.refresh(!0);b.multiple||a.addClass("ui-multiselect-single")},_init:function(){!1===this.options.header&&this.header.hide();this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide();this.options.autoOpen&&this.open();this.element.is(":disabled")&&this.disable()},refresh:function(a){var b=this.element,c=this.options,e=this.menu,h=this.checkboxContainer, g=[],f=[],i=b.attr("id")||j++;b.find("option").each(function(b){d(this);var a=this.parentNode,e=this.innerHTML,h=this.title,j=this.value,b=this.id||"ui-multiselect-"+i+"-option-"+b,k=this.disabled,m=this.selected,l=["ui-corner-all"];"optgroup"===a.tagName.toLowerCase()&&(a=a.getAttribute("label"),-1===d.inArray(a,g)&&(f.push('<li class="ui-multiselect-optgroup-label"><a href="#">'+a+"</a></li>"),g.push(a)));k&&l.push("ui-state-disabled");m&&!c.multiple&&l.push("ui-state-active");f.push('<li class="'+ (k?"ui-multiselect-disabled":"")+'">');f.push('<label for="'+b+'" title="'+h+'" class="'+l.join(" ")+'">');f.push('<input id="'+b+'" name="multiselect_'+i+'" type="'+(c.multiple?"checkbox":"radio")+'" value="'+j+'" title="'+e+'"');m&&(f.push(' checked="checked"'),f.push(' aria-selected="true"'));k&&(f.push(' disabled="disabled"'),f.push(' aria-disabled="true"'));f.push(" /><span>"+e+"</span></label></li>")});h.html(f.join(""));this.labels=e.find("label");this._setButtonWidth();this._setMenuWidth(); this.button[0].defaultValue=this.update();a||this._trigger("refresh")},update:function(){var a=this.options,b=this.labels.find("input"),c=b.filter("[checked]"),e=c.length,a=0===e?a.noneSelectedText:d.isFunction(a.selectedText)?a.selectedText.call(this,e,b.length,c.get()):/\d/.test(a.selectedList)&&0<a.selectedList&&e<=a.selectedList?c.map(function(){return d(this).next().text()}).get().join(", "):a.selectedText.replace("#",e).replace("#",b.length);this.buttonlabel.html(a);return a},_bindEvents:function(){function a(){b[b._isOpen? "close":"open"]();return!1}var b=this,c=this.button;c.find("span").bind("click.multiselect",a);c.bind({click:a,keypress:function(a){switch(a.which){case 27:case 38:case 37:b.close();break;case 39:case 40:b.open()}},mouseenter:function(){c.hasClass("ui-state-disabled")||d(this).addClass("ui-state-hover")},mouseleave:function(){d(this).removeClass("ui-state-hover")},focus:function(){c.hasClass("ui-state-disabled")||d(this).addClass("ui-state-focus")},blur:function(){d(this).removeClass("ui-state-focus")}}); this.header.delegate("a","click.multiselect",function(a){if(d(this).hasClass("ui-multiselect-close"))b.close();else b[d(this).hasClass("ui-multiselect-all")?"checkAll":"uncheckAll"]();a.preventDefault()});this.menu.delegate("li.ui-multiselect-optgroup-label a","click.multiselect",function(a){a.preventDefault();var c=d(this),g=c.parent().nextUntil("li.ui-multiselect-optgroup-label").find("input:visible:not(:disabled)"),f=g.get(),c=c.parent().text();!1!==b._trigger("beforeoptgrouptoggle",a,{inputs:f, label:c})&&(b._toggleChecked(g.filter("[checked]").length!==g.length,g),b._trigger("optgrouptoggle",a,{inputs:f,label:c,checked:f[0].checked}))}).delegate("label","mouseenter.multiselect",function(){d(this).hasClass("ui-state-disabled")||(b.labels.removeClass("ui-state-hover"),d(this).addClass("ui-state-hover").find("input").focus())}).delegate("label","keydown.multiselect",function(a){a.preventDefault();switch(a.which){case 9:case 27:b.close();break;case 38:case 40:case 37:case 39:b._traverse(a.which, this);break;case 13:d(this).find("input")[0].click()}}).delegate('input[type="checkbox"], input[type="radio"]',"click.multiselect",function(a){var c=d(this),g=this.value,f=this.checked,i=b.element.find("option");this.disabled||!1===b._trigger("click",a,{value:g,text:this.title,checked:f})?a.preventDefault():(c.focus(),c.attr("aria-selected",f),i.each(function(){if(this.value===g)this.selected=f;else if(!b.options.multiple)this.selected=!1}),b.options.multiple||(b.labels.removeClass("ui-state-active"), c.closest("label").toggleClass("ui-state-active",f),b.close()),b.element.trigger("change"),setTimeout(d.proxy(b.update,b),10))});d(document).bind("mousedown.multiselect",function(a){b._isOpen&&!d.contains(b.menu[0],a.target)&&!d.contains(b.button[0],a.target)&&a.target!==b.button[0]&&b.close()});d(this.element[0].form).bind("reset.multiselect",function(){setTimeout(d.proxy(b.refresh,b),10)})},_setButtonWidth:function(){var a=this.element.outerWidth(),b=this.options;if(/\d/.test(b.minWidth)&&a<b.minWidth)a= b.minWidth;this.button.width(a)},_setMenuWidth:function(){var a=this.menu,b=this.button.outerWidth()-parseInt(a.css("padding-left"),10)-parseInt(a.css("padding-right"),10)-parseInt(a.css("border-right-width"),10)-parseInt(a.css("border-left-width"),10);a.width(b||this.button.outerWidth())},_traverse:function(a,b){var c=d(b),e=38===a||37===a,c=c.parent()[e?"prevAll":"nextAll"]("li:not(.ui-multiselect-disabled, .ui-multiselect-optgroup-label)")[e?"last":"first"]();c.length?c.find("label").trigger("mouseover"): (c=this.menu.find("ul").last(),this.menu.find("label")[e?"last":"first"]().trigger("mouseover"),c.scrollTop(e?c.height():0))},_toggleState:function(a,b){return function(){this.disabled||(this[a]=b);b?this.setAttribute("aria-selected",!0):this.removeAttribute("aria-selected")}},_toggleChecked:function(a,b){var c=b&&b.length?b:this.labels.find("input"),e=this;c.each(this._toggleState("checked",a));c.eq(0).focus();this.update();var h=c.map(function(){return this.value}).get();this.element.find("option").each(function(){!this.disabled&& -1<d.inArray(this.value,h)&&e._toggleState("selected",a).call(this)});c.length&&this.element.trigger("change")},_toggleDisabled:function(a){this.button.attr({disabled:a,"aria-disabled":a})[a?"addClass":"removeClass"]("ui-state-disabled");this.menu.find("input").attr({disabled:a,"aria-disabled":a}).parent()[a?"addClass":"removeClass"]("ui-state-disabled");this.element.attr({disabled:a,"aria-disabled":a})},open:function(){var a=this.button,b=this.menu,c=this.speed,e=this.options;if(!(!1===this._trigger("beforeopen")|| a.hasClass("ui-state-disabled")||this._isOpen)){var h=b.find("ul").last(),g=e.show,f=a.offset();d.isArray(e.show)&&(g=e.show[0],c=e.show[1]||this.speed);h.scrollTop(0).height(e.height);d.ui.position&&!d.isEmptyObject(e.position)?(e.position.of=e.position.of||a,b.show().position(e.position).hide().show(g,c)):b.css({top:f.top+a.outerHeight(),left:f.left}).show(g,c);this.labels.eq(0).trigger("mouseover").trigger("mouseenter").find("input").trigger("focus");a.addClass("ui-state-active");this._isOpen= !0;this._trigger("open")}},close:function(){if(!1!==this._trigger("beforeclose")){var a=this.options,b=a.hide,c=this.speed;d.isArray(a.hide)&&(b=a.hide[0],c=a.hide[1]||this.speed);this.menu.hide(b,c);this.button.removeClass("ui-state-active").trigger("blur").trigger("mouseleave");this._isOpen=!1;this._trigger("close")}},enable:function(){this._toggleDisabled(!1)},disable:function(){this._toggleDisabled(!0)},checkAll:function(){this._toggleChecked(!0);this._trigger("checkAll")},uncheckAll:function(){this._toggleChecked(!1); this._trigger("uncheckAll")},getChecked:function(){return this.menu.find("input").filter("[checked]")},destroy:function(){d.Widget.prototype.destroy.call(this);this.button.remove();this.menu.remove();this.element.show();return this},isOpen:function(){return this._isOpen},widget:function(){return this.menu},_setOption:function(a,b){var c=this.menu;switch(a){case "header":c.find("div.ui-multiselect-header")[b?"show":"hide"]();break;case "checkAllText":c.find("a.ui-multiselect-all span").eq(-1).text(b); break;case "uncheckAllText":c.find("a.ui-multiselect-none span").eq(-1).text(b);break;case "height":c.find("ul").last().height(parseInt(b,10));break;case "minWidth":this.options[a]=parseInt(b,10);this._setButtonWidth();this._setMenuWidth();break;case "selectedText":case "selectedList":case "noneSelectedText":this.options[a]=b;this.update();break;case "classes":c.add(this.button).removeClass(this.options.classes).addClass(b)}d.Widget.prototype._setOption.apply(this,arguments)}})})(jQuery);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/* Czech initialisation for the jQuery UI date picker plugin. */
|
2
|
+
/* Written by Tomas Muller (tomas@tomas-muller.net). */
|
3
|
+
jQuery(function($){
|
4
|
+
$.datepicker.regional['cs'] = {
|
5
|
+
closeText: 'Zavřít',
|
6
|
+
prevText: '<Dříve',
|
7
|
+
nextText: 'Později>',
|
8
|
+
currentText: 'Nyní',
|
9
|
+
monthNames: ['leden','únor','březen','duben','květen','červen',
|
10
|
+
'červenec','srpen','září','říjen','listopad','prosinec'],
|
11
|
+
monthNamesShort: ['led','úno','bře','dub','kvě','čer',
|
12
|
+
'čvc','srp','zář','říj','lis','pro'],
|
13
|
+
dayNames: ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota'],
|
14
|
+
dayNamesShort: ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so'],
|
15
|
+
dayNamesMin: ['ne','po','út','st','čt','pá','so'],
|
16
|
+
weekHeader: 'Týd',
|
17
|
+
dateFormat: 'dd.mm.yy',
|
18
|
+
firstDay: 1,
|
19
|
+
isRTL: false,
|
20
|
+
showMonthAfterYear: false,
|
21
|
+
yearSuffix: ''};
|
22
|
+
$.datepicker.setDefaults($.datepicker.regional['cs']);
|
23
|
+
});
|
@@ -0,0 +1,282 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Widget 1.8.18+amd
|
3
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
+
*
|
5
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
6
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
7
|
+
* http://jquery.org/license
|
8
|
+
*
|
9
|
+
* http://docs.jquery.com/UI/Widget
|
10
|
+
*/
|
11
|
+
|
12
|
+
(function (factory) {
|
13
|
+
if (typeof define === "function" && define.amd) {
|
14
|
+
// Register as an anonymous AMD module:
|
15
|
+
define(["jquery"], factory);
|
16
|
+
} else {
|
17
|
+
// Browser globals:
|
18
|
+
factory(jQuery);
|
19
|
+
}
|
20
|
+
}(function( $, undefined ) {
|
21
|
+
|
22
|
+
// jQuery 1.4+
|
23
|
+
if ( $.cleanData ) {
|
24
|
+
var _cleanData = $.cleanData;
|
25
|
+
$.cleanData = function( elems ) {
|
26
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
27
|
+
try {
|
28
|
+
$( elem ).triggerHandler( "remove" );
|
29
|
+
// http://bugs.jquery.com/ticket/8235
|
30
|
+
} catch( e ) {}
|
31
|
+
}
|
32
|
+
_cleanData( elems );
|
33
|
+
};
|
34
|
+
} else {
|
35
|
+
var _remove = $.fn.remove;
|
36
|
+
$.fn.remove = function( selector, keepData ) {
|
37
|
+
return this.each(function() {
|
38
|
+
if ( !keepData ) {
|
39
|
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
40
|
+
$( "*", this ).add( [ this ] ).each(function() {
|
41
|
+
try {
|
42
|
+
$( this ).triggerHandler( "remove" );
|
43
|
+
// http://bugs.jquery.com/ticket/8235
|
44
|
+
} catch( e ) {}
|
45
|
+
});
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return _remove.call( $(this), selector, keepData );
|
49
|
+
});
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
53
|
+
$.widget = function( name, base, prototype ) {
|
54
|
+
var namespace = name.split( "." )[ 0 ],
|
55
|
+
fullName;
|
56
|
+
name = name.split( "." )[ 1 ];
|
57
|
+
fullName = namespace + "-" + name;
|
58
|
+
|
59
|
+
if ( !prototype ) {
|
60
|
+
prototype = base;
|
61
|
+
base = $.Widget;
|
62
|
+
}
|
63
|
+
|
64
|
+
// create selector for plugin
|
65
|
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
66
|
+
return !!$.data( elem, name );
|
67
|
+
};
|
68
|
+
|
69
|
+
$[ namespace ] = $[ namespace ] || {};
|
70
|
+
$[ namespace ][ name ] = function( options, element ) {
|
71
|
+
// allow instantiation without initializing for simple inheritance
|
72
|
+
if ( arguments.length ) {
|
73
|
+
this._createWidget( options, element );
|
74
|
+
}
|
75
|
+
};
|
76
|
+
|
77
|
+
var basePrototype = new base();
|
78
|
+
// we need to make the options hash a property directly on the new instance
|
79
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
80
|
+
// inheriting from
|
81
|
+
// $.each( basePrototype, function( key, val ) {
|
82
|
+
// if ( $.isPlainObject(val) ) {
|
83
|
+
// basePrototype[ key ] = $.extend( {}, val );
|
84
|
+
// }
|
85
|
+
// });
|
86
|
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
87
|
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
88
|
+
namespace: namespace,
|
89
|
+
widgetName: name,
|
90
|
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
91
|
+
widgetBaseClass: fullName
|
92
|
+
}, prototype );
|
93
|
+
|
94
|
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
95
|
+
};
|
96
|
+
|
97
|
+
$.widget.bridge = function( name, object ) {
|
98
|
+
$.fn[ name ] = function( options ) {
|
99
|
+
var isMethodCall = typeof options === "string",
|
100
|
+
args = Array.prototype.slice.call( arguments, 1 ),
|
101
|
+
returnValue = this;
|
102
|
+
|
103
|
+
// allow multiple hashes to be passed on init
|
104
|
+
options = !isMethodCall && args.length ?
|
105
|
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
106
|
+
options;
|
107
|
+
|
108
|
+
// prevent calls to internal methods
|
109
|
+
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
110
|
+
return returnValue;
|
111
|
+
}
|
112
|
+
|
113
|
+
if ( isMethodCall ) {
|
114
|
+
this.each(function() {
|
115
|
+
var instance = $.data( this, name ),
|
116
|
+
methodValue = instance && $.isFunction( instance[options] ) ?
|
117
|
+
instance[ options ].apply( instance, args ) :
|
118
|
+
instance;
|
119
|
+
// TODO: add this back in 1.9 and use $.error() (see #5972)
|
120
|
+
// if ( !instance ) {
|
121
|
+
// throw "cannot call methods on " + name + " prior to initialization; " +
|
122
|
+
// "attempted to call method '" + options + "'";
|
123
|
+
// }
|
124
|
+
// if ( !$.isFunction( instance[options] ) ) {
|
125
|
+
// throw "no such method '" + options + "' for " + name + " widget instance";
|
126
|
+
// }
|
127
|
+
// var methodValue = instance[ options ].apply( instance, args );
|
128
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
129
|
+
returnValue = methodValue;
|
130
|
+
return false;
|
131
|
+
}
|
132
|
+
});
|
133
|
+
} else {
|
134
|
+
this.each(function() {
|
135
|
+
var instance = $.data( this, name );
|
136
|
+
if ( instance ) {
|
137
|
+
instance.option( options || {} )._init();
|
138
|
+
} else {
|
139
|
+
$.data( this, name, new object( options, this ) );
|
140
|
+
}
|
141
|
+
});
|
142
|
+
}
|
143
|
+
|
144
|
+
return returnValue;
|
145
|
+
};
|
146
|
+
};
|
147
|
+
|
148
|
+
$.Widget = function( options, element ) {
|
149
|
+
// allow instantiation without initializing for simple inheritance
|
150
|
+
if ( arguments.length ) {
|
151
|
+
this._createWidget( options, element );
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
$.Widget.prototype = {
|
156
|
+
widgetName: "widget",
|
157
|
+
widgetEventPrefix: "",
|
158
|
+
options: {
|
159
|
+
disabled: false
|
160
|
+
},
|
161
|
+
_createWidget: function( options, element ) {
|
162
|
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
163
|
+
// so that it's stored even before the _create function runs
|
164
|
+
$.data( element, this.widgetName, this );
|
165
|
+
this.element = $( element );
|
166
|
+
this.options = $.extend( true, {},
|
167
|
+
this.options,
|
168
|
+
this._getCreateOptions(),
|
169
|
+
options );
|
170
|
+
|
171
|
+
var self = this;
|
172
|
+
this.element.bind( "remove." + this.widgetName, function() {
|
173
|
+
self.destroy();
|
174
|
+
});
|
175
|
+
|
176
|
+
this._create();
|
177
|
+
this._trigger( "create" );
|
178
|
+
this._init();
|
179
|
+
},
|
180
|
+
_getCreateOptions: function() {
|
181
|
+
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
182
|
+
},
|
183
|
+
_create: function() {},
|
184
|
+
_init: function() {},
|
185
|
+
|
186
|
+
destroy: function() {
|
187
|
+
this.element
|
188
|
+
.unbind( "." + this.widgetName )
|
189
|
+
.removeData( this.widgetName );
|
190
|
+
this.widget()
|
191
|
+
.unbind( "." + this.widgetName )
|
192
|
+
.removeAttr( "aria-disabled" )
|
193
|
+
.removeClass(
|
194
|
+
this.widgetBaseClass + "-disabled " +
|
195
|
+
"ui-state-disabled" );
|
196
|
+
},
|
197
|
+
|
198
|
+
widget: function() {
|
199
|
+
return this.element;
|
200
|
+
},
|
201
|
+
|
202
|
+
option: function( key, value ) {
|
203
|
+
var options = key;
|
204
|
+
|
205
|
+
if ( arguments.length === 0 ) {
|
206
|
+
// don't return a reference to the internal hash
|
207
|
+
return $.extend( {}, this.options );
|
208
|
+
}
|
209
|
+
|
210
|
+
if (typeof key === "string" ) {
|
211
|
+
if ( value === undefined ) {
|
212
|
+
return this.options[ key ];
|
213
|
+
}
|
214
|
+
options = {};
|
215
|
+
options[ key ] = value;
|
216
|
+
}
|
217
|
+
|
218
|
+
this._setOptions( options );
|
219
|
+
|
220
|
+
return this;
|
221
|
+
},
|
222
|
+
_setOptions: function( options ) {
|
223
|
+
var self = this;
|
224
|
+
$.each( options, function( key, value ) {
|
225
|
+
self._setOption( key, value );
|
226
|
+
});
|
227
|
+
|
228
|
+
return this;
|
229
|
+
},
|
230
|
+
_setOption: function( key, value ) {
|
231
|
+
this.options[ key ] = value;
|
232
|
+
|
233
|
+
if ( key === "disabled" ) {
|
234
|
+
this.widget()
|
235
|
+
[ value ? "addClass" : "removeClass"](
|
236
|
+
this.widgetBaseClass + "-disabled" + " " +
|
237
|
+
"ui-state-disabled" )
|
238
|
+
.attr( "aria-disabled", value );
|
239
|
+
}
|
240
|
+
|
241
|
+
return this;
|
242
|
+
},
|
243
|
+
|
244
|
+
enable: function() {
|
245
|
+
return this._setOption( "disabled", false );
|
246
|
+
},
|
247
|
+
disable: function() {
|
248
|
+
return this._setOption( "disabled", true );
|
249
|
+
},
|
250
|
+
|
251
|
+
_trigger: function( type, event, data ) {
|
252
|
+
var prop, orig,
|
253
|
+
callback = this.options[ type ];
|
254
|
+
|
255
|
+
data = data || {};
|
256
|
+
event = $.Event( event );
|
257
|
+
event.type = ( type === this.widgetEventPrefix ?
|
258
|
+
type :
|
259
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
260
|
+
// the original event may come from any element
|
261
|
+
// so we need to reset the target on the new event
|
262
|
+
event.target = this.element[ 0 ];
|
263
|
+
|
264
|
+
// copy original event properties over to the new event
|
265
|
+
orig = event.originalEvent;
|
266
|
+
if ( orig ) {
|
267
|
+
for ( prop in orig ) {
|
268
|
+
if ( !( prop in event ) ) {
|
269
|
+
event[ prop ] = orig[ prop ];
|
270
|
+
}
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
this.element.trigger( event, data );
|
275
|
+
|
276
|
+
return !( $.isFunction(callback) &&
|
277
|
+
callback.call( this.element[0], event, data ) === false ||
|
278
|
+
event.isDefaultPrevented() );
|
279
|
+
}
|
280
|
+
};
|
281
|
+
|
282
|
+
}));
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//(function($) {
|
2
|
+
// $.fn.AddOnChange = function(settings) {
|
3
|
+
// function add_onchange(all_obj) {
|
4
|
+
// $(all_obj).each(function () {
|
5
|
+
// $(this).change(function () {
|
6
|
+
// form_submit_watcher();
|
7
|
+
// });
|
8
|
+
// });
|
9
|
+
// }
|
10
|
+
//
|
11
|
+
//
|
12
|
+
var submit_timestamp = {};
|
13
|
+
function form_submit_watcher(watched_form_id) {
|
14
|
+
// console.log(watched_form_id);
|
15
|
+
// console.log(submit_timestamp)
|
16
|
+
//ladas_loading_show();
|
17
|
+
clearTimeout(submit_timestamp[watched_form_id]);
|
18
|
+
submit_timestamp[watched_form_id] = setTimeout(function() { form_submit(watched_form_id) }, 1000);
|
19
|
+
|
20
|
+
}
|
21
|
+
function form_submit(watched_form_id) {
|
22
|
+
// console.log("submiting")
|
23
|
+
// console.log(watched_form_id);
|
24
|
+
$("#"+watched_form_id).submit();
|
25
|
+
}
|
26
|
+
//
|
27
|
+
//})(jQuery);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
function is_hash(object) {
|
2
|
+
// console.log(Object.prototype.toString.call(object))
|
3
|
+
return (Object.prototype.toString.call(object) == '[object Object]');
|
4
|
+
}
|
5
|
+
|
6
|
+
function is_array(object) {
|
7
|
+
// console.log(Object.prototype.toString.call(object))
|
8
|
+
return (Object.prototype.toString.call(object) == '[object Array]');
|
9
|
+
}
|
10
|
+
|
11
|
+
function is_string(object) {
|
12
|
+
return (Object.prototype.toString.call(object) == '[object String]');
|
13
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
(function (window, undefined) {
|
2
|
+
|
3
|
+
//redirect for ajax navigation, must do this before our history.js
|
4
|
+
// if(window.location.hash.length > 0){
|
5
|
+
// window.location = "http://stealthwd.ca/" + window.location.hash.slice(1);
|
6
|
+
// }
|
7
|
+
|
8
|
+
|
9
|
+
// Prepare
|
10
|
+
var History = window.History; // Note: We are using a capital H instead of a lower h
|
11
|
+
if (!History.enabled) {
|
12
|
+
// History.js is disabled for this browser.
|
13
|
+
// This is because we can optionally choose to support HTML4 browsers or not.
|
14
|
+
return false;
|
15
|
+
}
|
16
|
+
// console.log('init');
|
17
|
+
// console.log(History);
|
18
|
+
historyBool = true; //true is our default
|
19
|
+
|
20
|
+
// Bind to StateChange Event
|
21
|
+
History.Adapter.bind(window, 'statechange', function () { // Note: We are using statechange instead of popstate
|
22
|
+
var State = History.getState(); // Note: We are using History.getState() instead of event.state
|
23
|
+
// console.log('state');
|
24
|
+
// console.log(window.location.href);
|
25
|
+
// console.log(State);
|
26
|
+
// History.log(State.data, State.title, State.url);
|
27
|
+
// console.log(window.location.hash)
|
28
|
+
|
29
|
+
// /don't run our function when we do a pushState
|
30
|
+
if (historyBool) {
|
31
|
+
// console.log("going back by browser")
|
32
|
+
historyBool = false;
|
33
|
+
// ToDo bude mozne zde volat funkci ulozenou ve state, pokud budu potrebovat vic nez jednu ajaxovou plochu
|
34
|
+
load_page({url:State.url, symlink_remote:true})
|
35
|
+
}
|
36
|
+
//set to our default of true
|
37
|
+
historyBool = true;
|
38
|
+
});
|
39
|
+
|
40
|
+
|
41
|
+
})(window);
|
42
|
+
|
@@ -0,0 +1,314 @@
|
|
1
|
+
(function($) {
|
2
|
+
$.fn.LadasTree = function(settings) {
|
3
|
+
function LadasJsTree(object, settings) {
|
4
|
+
var self = this;
|
5
|
+
self.settings = settings;
|
6
|
+
|
7
|
+
|
8
|
+
function contextmenu_create( obj, type, ee)
|
9
|
+
{
|
10
|
+
type = typeof type !== 'undefined' ? type : "default";
|
11
|
+
|
12
|
+
// console.log(ee);
|
13
|
+
// console.log(obj);
|
14
|
+
// console.log($("#demo"));
|
15
|
+
// console.log(object);
|
16
|
+
object.jstree("create", null, "last", { "attr":{ "rel": type } });
|
17
|
+
}
|
18
|
+
|
19
|
+
$(function () {
|
20
|
+
object
|
21
|
+
.bind("before.jstree", function (e, data) {
|
22
|
+
$("#alog").append(data.func + "<br />");
|
23
|
+
})
|
24
|
+
.jstree({
|
25
|
+
// "themes" : {
|
26
|
+
// "theme" : "default",
|
27
|
+
// "dots" : false,
|
28
|
+
// "icons" : false
|
29
|
+
// },
|
30
|
+
// List of active plugins
|
31
|
+
"plugins":[
|
32
|
+
"themes", "json_data", "ui", "crrm", "cookies", "dnd", "search", "types", "hotkeys", "contextmenu"
|
33
|
+
//"themes", "json_data", "ui", "crrm", "dnd", "search", "types", "hotkeys", "contextmenu"
|
34
|
+
],
|
35
|
+
contextmenu: {
|
36
|
+
select_node: true,
|
37
|
+
show_at_node: false,
|
38
|
+
items: {
|
39
|
+
"create" : {
|
40
|
+
label : self.settings['lang']['add_sub_page'] ,
|
41
|
+
action : function (obj) {
|
42
|
+
this.create(obj, "last", {data: {title : self.settings['lang']['new_sub_page']}, "attr" : {"rel" : "default"}});
|
43
|
+
}
|
44
|
+
},
|
45
|
+
rename: {label: self.settings['lang']['rename']},
|
46
|
+
remove: { label: self.settings['lang']["remove"]},
|
47
|
+
ccp :
|
48
|
+
{
|
49
|
+
label: self.settings['lang']['edit'],
|
50
|
+
submenu : {
|
51
|
+
cut : {label : self.settings['lang']['cut']},
|
52
|
+
copy : false,//{label : self.settings['lang']['copy']},
|
53
|
+
paste : {label : self.settings['lang']['paste']}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
},
|
58
|
+
|
59
|
+
// I usually configure the plugin that handles the data first
|
60
|
+
// This example uses JSON as it is most common
|
61
|
+
"json_data":{
|
62
|
+
// This tree is ajax enabled - as this is most common, and maybe a bit more complex
|
63
|
+
// All the options are almost the same as jQuery's AJAX (read the docs)
|
64
|
+
"ajax":{
|
65
|
+
// the URL to fetch the data
|
66
|
+
"url":self.settings['get_children_url'],
|
67
|
+
// the `data` function is executed in the instance's scope
|
68
|
+
// the parameter is the node being loaded
|
69
|
+
// (may be -1, 0, or undefined when loading the root nodes)
|
70
|
+
"data":function (n) {
|
71
|
+
// the result is fed to the AJAX request `data` option
|
72
|
+
return {
|
73
|
+
"operation":"get_children",
|
74
|
+
"id":n.attr ? n.attr("id").replace("node_", "") : 0
|
75
|
+
};
|
76
|
+
},
|
77
|
+
// "success" : function (data) {
|
78
|
+
// console.log(object);
|
79
|
+
// console.log(object.find("li a"));
|
80
|
+
// object.find("a").dblclick(function (){
|
81
|
+
// var selected_node = $(this).parent('li');
|
82
|
+
// console.log(selected_node);
|
83
|
+
// load_page(selected_node.data('settings'))
|
84
|
+
// });
|
85
|
+
"complete" : function (data) {
|
86
|
+
// console.log(object);
|
87
|
+
// console.log(object.find("li a"));
|
88
|
+
//
|
89
|
+
object.find("li a").each(function () {
|
90
|
+
|
91
|
+
|
92
|
+
$(this).attr("href", build_get_url($(this).parent().data('settings')));
|
93
|
+
})
|
94
|
+
}
|
95
|
+
}
|
96
|
+
},
|
97
|
+
// Configuring the search plugin
|
98
|
+
"search":{
|
99
|
+
// As this has been a common question - async search
|
100
|
+
// Same as above - the `ajax` config option is actually jQuery's AJAX object
|
101
|
+
"ajax":{
|
102
|
+
"url":self.settings['search_node_url'],
|
103
|
+
// You get the search string as a parameter
|
104
|
+
"data":function (str) {
|
105
|
+
return {
|
106
|
+
"operation":"search",
|
107
|
+
"search_str":str
|
108
|
+
};
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
// Using types - most of the time this is an overkill
|
113
|
+
// read the docs carefully to decide whether you need types
|
114
|
+
"types":{
|
115
|
+
// I set both options to -2, as I do not need depth and children count checking
|
116
|
+
// Those two checks may slow jstree a lot, so use only when needed
|
117
|
+
"max_depth":-2,
|
118
|
+
"max_children":-2,
|
119
|
+
// I want only `drive` nodes to be root nodes
|
120
|
+
// This will prevent moving or creating any other type as a root node
|
121
|
+
"valid_children":[ "default" ],
|
122
|
+
"types":{
|
123
|
+
// The default type
|
124
|
+
"default":{
|
125
|
+
// I want this type to have no children (so only leaf nodes)
|
126
|
+
// In my case - those are files
|
127
|
+
"valid_children":["default"],
|
128
|
+
// If we specify an icon for the default type it WILL OVERRIDE the theme icons
|
129
|
+
"icon":{
|
130
|
+
"image":"/icons/file.png"
|
131
|
+
}
|
132
|
+
},
|
133
|
+
// The `folder` type
|
134
|
+
"folder":{
|
135
|
+
// can have files and other folders inside of it, but NOT `drive` nodes
|
136
|
+
"valid_children":[ "default", "folder" ],
|
137
|
+
"icon":{
|
138
|
+
"image":"/icons/folder.png"
|
139
|
+
}
|
140
|
+
},
|
141
|
+
// The `drive` nodes
|
142
|
+
"drive":{
|
143
|
+
// can have files and folders inside, but NOT other `drive` nodes
|
144
|
+
"valid_children":[ "default", "folder" ],
|
145
|
+
"icon":{
|
146
|
+
"image":"/icons/root.png"
|
147
|
+
},
|
148
|
+
// those prevent the functions with the same name to be used on `drive` nodes
|
149
|
+
// internally the `before` event is used
|
150
|
+
"start_drag":false,
|
151
|
+
"move_node":false,
|
152
|
+
"delete_node":false,
|
153
|
+
"remove":false
|
154
|
+
}
|
155
|
+
}
|
156
|
+
},
|
157
|
+
// UI & core - the nodes to initially select and open will be overwritten by the cookie plugin
|
158
|
+
"ui":{
|
159
|
+
// this makes the node with ID node_4 selected onload
|
160
|
+
"select_limit": 1
|
161
|
+
}
|
162
|
+
// the UI plugin - it handles selecting/deselecting/hovering nodes
|
163
|
+
// "ui":{
|
164
|
+
// // this makes the node with ID node_4 selected onload
|
165
|
+
// "initially_select":[ "node_4" ]
|
166
|
+
// },
|
167
|
+
// // the core plugin - not many options here
|
168
|
+
// "core":{
|
169
|
+
// // just open those two nodes up
|
170
|
+
// // as this is an AJAX enabled tree, both will be downloaded from the server
|
171
|
+
// "initially_open":[ "node_2" , "node_3" ]
|
172
|
+
// }
|
173
|
+
})
|
174
|
+
.bind("create.jstree", function (e, data) {
|
175
|
+
$.post(
|
176
|
+
self.settings['create_node_url'],
|
177
|
+
{
|
178
|
+
"operation":"create_node",
|
179
|
+
"id": (data.rslt.parent == -1) ? 0 : data.rslt.parent.attr("id").replace("node_", ""),
|
180
|
+
"position":data.rslt.position,
|
181
|
+
"title":data.rslt.name,
|
182
|
+
"type":data.rslt.obj.attr("rel")
|
183
|
+
},
|
184
|
+
function (r) {
|
185
|
+
if (r.status) {
|
186
|
+
var node = data.rslt.obj;
|
187
|
+
node.attr("id", "node_" + r.id);
|
188
|
+
node.attr("data-settings", r['data-settings']);
|
189
|
+
}
|
190
|
+
else {
|
191
|
+
$.jstree.rollback(data.rlbk);
|
192
|
+
}
|
193
|
+
}
|
194
|
+
);
|
195
|
+
})
|
196
|
+
.bind("remove.jstree", function (e, data) {
|
197
|
+
data.rslt.obj.each(function () {
|
198
|
+
if (confirm(self.settings['lang']['do_you_want_to_delete_this_page']))
|
199
|
+
{
|
200
|
+
$.ajax({
|
201
|
+
async:false,
|
202
|
+
type:'POST',
|
203
|
+
url: self.settings['remove_node_url'],
|
204
|
+
data:{
|
205
|
+
"operation":"remove_node",
|
206
|
+
"id":this.id.replace("node_", "")
|
207
|
+
},
|
208
|
+
success:function (r) {
|
209
|
+
if (!r.status) {
|
210
|
+
data.inst.refresh();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
});
|
214
|
+
}
|
215
|
+
else
|
216
|
+
{
|
217
|
+
$.jstree.rollback(data.rlbk);
|
218
|
+
//data.inst.refresh();
|
219
|
+
}
|
220
|
+
});
|
221
|
+
})
|
222
|
+
.bind("rename.jstree", function (e, data) {
|
223
|
+
$.post(
|
224
|
+
self.settings['rename_node_url'],
|
225
|
+
{
|
226
|
+
"operation":"rename_node",
|
227
|
+
"id":data.rslt.obj.attr("id").replace("node_", ""),
|
228
|
+
"title":data.rslt.new_name
|
229
|
+
},
|
230
|
+
function (r) {
|
231
|
+
if (!r.status) {
|
232
|
+
$.jstree.rollback(data.rlbk);
|
233
|
+
}
|
234
|
+
}
|
235
|
+
);
|
236
|
+
})
|
237
|
+
.bind("move_node.jstree", function (e, data) {
|
238
|
+
data.rslt.o.each(function (i) {
|
239
|
+
$.ajax({
|
240
|
+
async:false,
|
241
|
+
type:'POST',
|
242
|
+
url:self.settings['move_node_url'],
|
243
|
+
data:{
|
244
|
+
"operation":"move_node",
|
245
|
+
"id":$(this).attr("id").replace("node_", ""),
|
246
|
+
"ref":data.rslt.cr === -1 ? 0 : data.rslt.np.attr("id").replace("node_", ""),
|
247
|
+
"position":data.rslt.cp + i,
|
248
|
+
"title":data.rslt.name,
|
249
|
+
"copy":data.rslt.cy ? 1 : 0
|
250
|
+
},
|
251
|
+
success:function (r) {
|
252
|
+
if (!r.status) {
|
253
|
+
$.jstree.rollback(data.rlbk);
|
254
|
+
}
|
255
|
+
else {
|
256
|
+
$(data.rslt.oc).attr("id", "node_" + r.id);
|
257
|
+
if (data.rslt.cy && $(data.rslt.oc).children("UL").length) {
|
258
|
+
data.inst.refresh(data.inst._get_parent(data.rslt.oc));
|
259
|
+
}
|
260
|
+
}
|
261
|
+
// $("#analyze").click();
|
262
|
+
}
|
263
|
+
});
|
264
|
+
});
|
265
|
+
})
|
266
|
+
.bind("select_node.jstree", function (NODE, REF_NODE) {
|
267
|
+
// console.log(NODE);
|
268
|
+
// console.log(REF_NODE);
|
269
|
+
// var selected_node = $.jstree._focused().get_selected();
|
270
|
+
// console.log(selected_node);
|
271
|
+
// load_page(selected_node.data('settings'));
|
272
|
+
|
273
|
+
});
|
274
|
+
});
|
275
|
+
|
276
|
+
object.delegate("a","click", function(e) {
|
277
|
+
var selected_node = $(this).parent('li');
|
278
|
+
load_page(selected_node.data('settings'));
|
279
|
+
return false;
|
280
|
+
});
|
281
|
+
|
282
|
+
// Code for the menu buttons
|
283
|
+
if (self.settings['menu_selector'])
|
284
|
+
{
|
285
|
+
$(function () {
|
286
|
+
var menu_selector = self.settings['menu_selector'] + " input";
|
287
|
+
$(menu_selector).click(function () {
|
288
|
+
switch (this.id) {
|
289
|
+
case "add_default":
|
290
|
+
// case "add_folder":
|
291
|
+
object.jstree("create",-1,"last",{ "data" : {"title" : self.settings['lang']['new_page']}, "attr":{ "rel":this.id.toString().replace("add_", "") } });
|
292
|
+
//object.jstree("create",-1,false,"Nová stránka",false,true);
|
293
|
+
//object.jstree("create", null, "last", { "attr":{ "rel":this.id.toString().replace("add_", "") } });
|
294
|
+
break;
|
295
|
+
case "search":
|
296
|
+
object.jstree("search", document.getElementById("text").value);
|
297
|
+
break;
|
298
|
+
case "text":
|
299
|
+
break;
|
300
|
+
case "edit_tree_node":
|
301
|
+
edit_tree_node($('#intranet_left_menu').jstree('get_selected').data('settings'));
|
302
|
+
break;
|
303
|
+
default:
|
304
|
+
object.jstree(this.id);
|
305
|
+
break;
|
306
|
+
}
|
307
|
+
});
|
308
|
+
});
|
309
|
+
}
|
310
|
+
}
|
311
|
+
new LadasJsTree($(this), settings);
|
312
|
+
}
|
313
|
+
|
314
|
+
})(jQuery);
|