camaleon_cms 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/admin/actions.js +14 -3
- data/app/assets/javascripts/admin/admin-manifest.js +1 -4
- data/app/assets/javascripts/admin/custom_fields.js +2 -2
- data/app/assets/javascripts/admin/data.js +68 -102
- data/app/assets/javascripts/admin/libraries.js +46 -87
- data/app/assets/javascripts/admin/modal.js +15 -3
- data/app/assets/javascripts/admin/post.js +2 -2
- data/app/assets/stylesheets/admin/admin-manifest.css +1 -2
- data/app/assets/stylesheets/admin/custom_admin.css.scss +3 -1
- data/app/controllers/admin/sessions_controller.rb +21 -14
- data/app/controllers/admin/users_controller.rb +7 -4
- data/app/controllers/api/api_controller.rb +28 -0
- data/app/controllers/api/v1/category_controller.rb +7 -0
- data/app/controllers/api/v1/page_controller.rb +8 -0
- data/app/controllers/api/v1/post_controller.rb +8 -0
- data/app/controllers/concerns/frontend_concern.rb +1 -17
- data/app/decorators/category_decorator.rb +1 -1
- data/app/helpers/camaleon_helper.rb +15 -0
- data/app/helpers/html_helper.rb +1 -0
- data/app/helpers/session_helper.rb +18 -3
- data/app/models/site.rb +17 -11
- data/app/views/admin/posts/_sidebar.html.erb +9 -7
- data/app/views/admin/posts/form.html.erb +4 -1
- data/app/views/admin/sessions/register.html.erb +8 -6
- data/app/views/admin/settings/custom_fields/_render.html.erb +3 -2
- data/app/views/admin/settings/custom_fields/fields/audio.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/checkbox.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/checkboxes.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/colorpicker.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/date.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/editor.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/email.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/field_attrs.html.erb +2 -2
- data/app/views/admin/settings/custom_fields/fields/file.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/image.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/numeric.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/phone.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/posts.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/radio.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/select.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/text_area.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/text_box.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/url.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/users.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/fields/video.html.erb +1 -1
- data/app/views/admin/settings/custom_fields/index.html.erb +54 -8
- data/app/views/admin/settings/site.html.erb +170 -151
- data/app/views/admin/users/form.html.erb +19 -23
- data/app/views/default_theme/sitemap.html.erb +19 -0
- data/app/views/default_theme/sitemap.xml.builder +48 -0
- data/app/views/layouts/admin.html.erb +3 -13
- data/app/views/layouts/admin/_footer.html.erb +10 -3
- data/app/views/layouts/admin/_header.html.erb +1 -1
- data/config/initializers/doorkeeper.rb +128 -0
- data/config/initializers/rufus_cron.rb +3 -3
- data/config/initializers/sass.rb +0 -62
- data/config/locales/admin/en.yml +3 -2
- data/config/locales/admin/es.yml +2 -0
- data/config/locales/admin/js.yml +9 -38
- data/config/locales/doorkeeper.en.yml +123 -0
- data/config/routes.rb +12 -0
- data/config/routes/admin.rb +0 -3
- data/db/migrate/20150930115030_doorkeeper_configuration.rb +45 -0
- data/lib/camaleon_cms/engine.rb +2 -0
- data/lib/camaleon_cms/version.rb +1 -1
- data/lib/generators/camaleon_cms/gem_plugin_template/app/models/plugins/my_plugin/my_plugin.rb +1 -6
- data/lib/generators/cplugin_template/app/apps/plugins/my_plugin/models/my_plugin.rb +0 -5
- data/lib/generators/ctheme_template/app/apps/themes/my_theme/assets/js/main.js +1 -1
- data/lib/plugin_routes.rb +12 -8
- metadata +38 -46
- data/app/assets/javascripts/admin/grid-editor.js +0 -532
- data/app/assets/javascripts/audio/alert.mp3 +0 -0
- data/app/assets/javascripts/audio/fail.mp3 +0 -0
- data/app/assets/javascripts/jquery-1.11.3.min.js +0 -5
- data/app/assets/stylesheets/admin/grid-editor.css.scss +0 -15
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/css/style.css +0 -84
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/editor_plugin.js +0 -1
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/editor_plugin_src.js +0 -90
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/img/youtube.png +0 -0
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/index.html +0 -86
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/js/scripts.js +0 -1
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/js/scripts_src.js +0 -81
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/en.js +0 -3
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/en_dlg.js +0 -12
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/es.js +0 -3
- data/app/assets/stylesheets/tinymce/plugins/youtubeIframe/langs/es_dlg.js +0 -12
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/bootstrap.css +0 -2228
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/content.css +0 -189
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/dialog.css +0 -295
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/butt2.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/button-bg.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/buttons.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/down_arrow.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/fade-butt.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/icons.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/items.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/menu-arrow.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/menu-check.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/progress.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/tabs.gif +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/img/toolbarbg.png +0 -0
- data/app/assets/stylesheets/tinymce/themes/advanced/skins/bootstrap/ui.css +0 -1163
- data/app/controllers/admin/grid_editor_controller.rb +0 -55
- data/app/views/admin/grid_editor/form.html.erb +0 -31
- data/app/views/admin/grid_editor/index.html.erb +0 -29
- data/config/sitemap.rb +0 -56
- data/lib/generators/camaleon_cms/gem_theme_template/app/controllers/plugins/my_plugin/admin_controller.rb +0 -8
- data/lib/generators/camaleon_cms/gem_theme_template/app/controllers/plugins/my_plugin/front_controller.rb +0 -8
- data/lib/generators/camaleon_cms/gem_theme_template/app/helpers/plugins/my_plugin/main_helper.rb +0 -22
- data/lib/generators/camaleon_cms/gem_theme_template/app/models/plugins/my_plugin/my_plugin.rb +0 -12
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/plugins/my_plugin/admin/index.html.erb +0 -2
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/plugins/my_plugin/front/index.html.erb +0 -2
- data/lib/generators/camaleon_cms/gem_theme_template/app/views/plugins/my_plugin/layouts/readme.txt +0 -2
- data/lib/generators/camaleon_cms/gem_theme_template/config/camaleon_plugin.json +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 289ef1eabd68fa970c95a6abdb5dfb37908fc788
|
|
4
|
+
data.tar.gz: 1e19ff8c9e625de6849d1e54616f49f42238ca48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a4ef462928c29569278fa1171e97de6c7573818aaaa09975f415948d7a90661de544adf87c697f58fc6c6d3ef70b84750c545e54e6e408d81364ef0c4d1e9ee
|
|
7
|
+
data.tar.gz: 25947d06a6e681ea99a988b65d385514dd6f333558658d0802e3a34d913823985356d44c795d91debfe976332397a5f2f748e100ddd4a2295ab92566e74afef8
|
|
@@ -2,14 +2,21 @@ jQuery(function($){
|
|
|
2
2
|
// initialize all validations for forms
|
|
3
3
|
init_form_validations();
|
|
4
4
|
setTimeout(page_actions, 1000);
|
|
5
|
-
setTimeout(init_intro, 500);
|
|
5
|
+
if(!$("body").attr("data-intro")) setTimeout(init_intro, 500);
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// show admin intro presentation
|
|
9
9
|
function init_intro(){
|
|
10
|
-
if($("body").attr("data-intro")) return;
|
|
11
10
|
var finish = function(){
|
|
12
11
|
$.get(root_url+"/admin/ajax", {mode: "save_intro"});
|
|
12
|
+
var layer = $(".introjs-overlay").clone();
|
|
13
|
+
var of = $(".introjs-tooltip").offset();
|
|
14
|
+
var c = $(".introjs-tooltip").clone().css($.extend({}, {"min-width": "0", position: "absolute", overflow: "hidden", "zIndex": 9999999}, of));
|
|
15
|
+
$("html, body").animate({scrollTop: $("body").height()}, 0);
|
|
16
|
+
setTimeout(function(){
|
|
17
|
+
$("body").append(layer, c);
|
|
18
|
+
c.animate($.extend({}, {width: 75, height: 20}, $("#link_see_intro").offset()), "slow", function(){ setTimeout(function(){ c.remove(); layer.remove(); }, 500); });
|
|
19
|
+
}, 5)
|
|
13
20
|
}
|
|
14
21
|
introJs().setOptions({exitOnEsc: false,
|
|
15
22
|
exitOnOverlayClick: false,
|
|
@@ -18,6 +25,10 @@ function init_intro(){
|
|
|
18
25
|
disableInteraction: true
|
|
19
26
|
}).oncomplete(finish).onexit(finish).onbeforechange(function(ele) {
|
|
20
27
|
if($(ele).hasClass("treeview") && !$(ele).hasClass("active")) $(ele).children("a").click();
|
|
28
|
+
if($(ele).is("li")){
|
|
29
|
+
var tree = $(ele).closest("ul");
|
|
30
|
+
if(!tree.hasClass("menu-open")) tree.prev("a").click();
|
|
31
|
+
}
|
|
21
32
|
}).start();
|
|
22
33
|
}
|
|
23
34
|
|
|
@@ -26,7 +37,7 @@ var page_actions = function(){
|
|
|
26
37
|
// button actions
|
|
27
38
|
$('#admin_content table').addClass('table').wrap('<div class="table-responsive"></div>');
|
|
28
39
|
$('#admin_content a[role="back"]').on('click',function(){ window.history.back(); return false; });
|
|
29
|
-
$('[data-toggle="tooltip"], a[title!=""]', "#admin_content").not(".skip_tooltip").tooltip();
|
|
40
|
+
$('a[data-toggle="tooltip"], button[data-toggle="tooltip"], a[title!=""]', "#admin_content").not(".skip_tooltip").tooltip();
|
|
30
41
|
|
|
31
42
|
/* PANELS */
|
|
32
43
|
$("#admin_content").on("click", ".panel .panel-collapse", function(){
|
|
@@ -30,15 +30,12 @@
|
|
|
30
30
|
|
|
31
31
|
//= require ./libraries
|
|
32
32
|
//= require ./actions
|
|
33
|
+
//= require ./introjs/intro.min
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
//= require ./modal
|
|
36
|
-
//= require ./grid-editor
|
|
37
37
|
|
|
38
38
|
//= require ./tageditor/jquery.caret.min
|
|
39
39
|
//= require ./tageditor/jquery.tag-editor
|
|
40
40
|
|
|
41
41
|
//= require ./lte/app
|
|
42
|
-
|
|
43
|
-
//= require ./introjs/intro.min
|
|
44
|
-
|
|
@@ -89,12 +89,12 @@ function custom_field_editor($field){
|
|
|
89
89
|
var inputs = textarea.data("translation_inputs");
|
|
90
90
|
if(inputs){ // multiples languages
|
|
91
91
|
for(var lang in inputs){
|
|
92
|
-
tinymce.init(
|
|
92
|
+
tinymce.init(cama_get_tinymce_settings({selector: '#' + inputs[lang].attr("id"), height: 120}));
|
|
93
93
|
}
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
tinymce.init(
|
|
97
|
+
tinymce.init(cama_get_tinymce_settings({selector: '#' + id, height: 120}));
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
function custom_field_field_attrs_val($field, value){
|
|
@@ -1,108 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
// generate default settings for tinymce editor
|
|
2
|
+
function cama_get_tinymce_settings(settings){
|
|
3
|
+
if(!settings) settings = {};
|
|
4
|
+
var def = {
|
|
5
|
+
selector: ".tinymce_textarea",
|
|
6
|
+
plugins: [
|
|
7
|
+
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
|
|
8
|
+
"searchreplace wordcount visualblocks visualchars code fullscreen",
|
|
9
|
+
"insertdatetime media nonbreaking save table contextmenu directionality",
|
|
10
|
+
"emoticons template paste textcolor colorpicker textpattern filemanager"
|
|
11
|
+
],
|
|
12
|
+
menubar: "edit insert view format table tools",
|
|
13
|
+
image_advtab: true,
|
|
14
|
+
statusbar: true,
|
|
15
|
+
paste: true,
|
|
16
|
+
toolbar_items_size: 'small',
|
|
17
|
+
content_css: tinymce_global_settings["custom_css"].join(","),
|
|
18
|
+
convert_urls: false,
|
|
19
|
+
//forced_root_block: '',
|
|
20
|
+
extended_valid_elements: 'i[*],div[*],p[*],li[*],a[*],ol[*],ul[*],span[*]',
|
|
21
|
+
toolbar: "bold italic | alignleft aligncenter alignright alignjustify | fontselect fontsizeselect | bullist numlist | outdent indent | undo redo | link unlink image media | forecolor backcolor | styleselect template "+tinymce_global_settings["custom_toolbar"].join(","),
|
|
22
|
+
language: CURRENT_LOCALE,
|
|
23
|
+
relative_urls: false,
|
|
24
|
+
remove_script_host: false,
|
|
25
|
+
browser_spellcheck : true,
|
|
26
|
+
language_url: tinymce_global_settings["language_url"],
|
|
27
|
+
file_browser_callback: function(field_name, url, type, win) {
|
|
28
|
+
$.fn.upload_elfinder({
|
|
29
|
+
selected: function(res){
|
|
30
|
+
var file = _.first(res)
|
|
31
|
+
if(type == 'media') type = 'video';
|
|
32
|
+
if(file.mime && (file.mime.indexOf(type) > -1 || type == "file")){
|
|
33
|
+
$('#'+field_name).val(file.url.to_url());
|
|
34
|
+
}else{
|
|
35
|
+
alert("You must upload a valid format: "+type)
|
|
36
36
|
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
setup: function (editor) {
|
|
41
|
+
editor.on('blur', function () {
|
|
42
|
+
tinymce.triggerSave();
|
|
43
|
+
$('textarea#'+editor.id).trigger('change');
|
|
44
|
+
});
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
editor.addMenuItem('append_line', {
|
|
47
|
+
text: 'New line at the end',
|
|
48
|
+
context: 'insert',
|
|
49
|
+
onclick: function () { editor.dom.add(editor.getBody(), 'p', {}, '-New line-'); }
|
|
50
|
+
});
|
|
51
|
+
editor.addMenuItem('add_line', {
|
|
52
|
+
text: 'New line',
|
|
53
|
+
context: 'insert',
|
|
54
|
+
onclick: function () { editor.insertContent('<p>-New line-</p>'); }
|
|
55
|
+
});
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
editor.on('postRender', function(e) {
|
|
59
|
-
editor.settings.onPostRender(editor);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
editor.on('init', function(e) {
|
|
63
|
-
// auto switch on grid editor detected
|
|
64
|
-
if($.fn.isGridEditorContent($(editor.targetElm).val()))
|
|
65
|
-
$(editor.targetElm).gridEditor(editor);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// grid editor button
|
|
69
|
-
editor.addButton('grid_editor', {
|
|
70
|
-
text: 'Grid Editor',
|
|
71
|
-
icon: false,
|
|
72
|
-
onclick: function(){
|
|
73
|
-
if(!confirm("Are you sure to change the editor?")) return false;
|
|
74
|
-
var area = $(editor.targetElm).gridEditor(editor);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
57
|
+
// eval all extra setups
|
|
58
|
+
for(var ff in tinymce_global_settings["setups"]) tinymce_global_settings["setups"][ff](editor);
|
|
77
59
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
tiny_mce3: {
|
|
86
|
-
advanced:{
|
|
87
|
-
// General options
|
|
88
|
-
mode : "textareas",
|
|
89
|
-
editor_selector : "tinymce_advanced",
|
|
90
|
-
theme : "advanced",
|
|
91
|
-
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
|
|
92
|
-
|
|
93
|
-
// Theme options
|
|
94
|
-
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
|
|
95
|
-
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
|
|
96
|
-
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
|
|
97
|
-
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
|
|
98
|
-
theme_advanced_toolbar_location : "top",
|
|
99
|
-
theme_advanced_toolbar_align : "left",
|
|
100
|
-
theme_advanced_statusbar_location : "bottom",
|
|
101
|
-
theme_advanced_resizing : true,
|
|
60
|
+
editor.on('postRender', function(e) {
|
|
61
|
+
editor.settings.onPostRender(editor);
|
|
62
|
+
// eval all extra setups
|
|
63
|
+
for(var ff in tinymce_global_settings["post_render"]) tinymce_global_settings["post_render"][ff](editor);
|
|
64
|
+
});
|
|
102
65
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
66
|
+
editor.on('init', function(e) {
|
|
67
|
+
for(var ff in tinymce_global_settings["init"]) tinymce_global_settings["init"][ff](editor);
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
onPostRender: function(editor){}
|
|
71
|
+
};
|
|
72
|
+
return $.extend({}, def, settings);
|
|
108
73
|
}
|
|
74
|
+
|
|
@@ -127,6 +127,49 @@ var init_form_validations = function(form){
|
|
|
127
127
|
// jquery custom validations and default values
|
|
128
128
|
(function($){
|
|
129
129
|
|
|
130
|
+
// file formats
|
|
131
|
+
$.file_formats = {
|
|
132
|
+
jpg: "image",
|
|
133
|
+
gif: "image",
|
|
134
|
+
png: "image",
|
|
135
|
+
bmp: "image",
|
|
136
|
+
jpeg: "image",
|
|
137
|
+
|
|
138
|
+
mp3: "audio",
|
|
139
|
+
ogg: "audio",
|
|
140
|
+
mid: "audio",
|
|
141
|
+
mod: "audio",
|
|
142
|
+
wav: "audio",
|
|
143
|
+
|
|
144
|
+
mp4: "video",
|
|
145
|
+
wmv: "video",
|
|
146
|
+
avi: "video",
|
|
147
|
+
swf: "video",
|
|
148
|
+
mov: "video",
|
|
149
|
+
mpeg: "video",
|
|
150
|
+
mjpg: "video"
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// verify the url for youtube, vimeo...
|
|
154
|
+
// return youtube | metcafe|dailymotion|vimeo
|
|
155
|
+
$.cama_check_video_url = function(url){
|
|
156
|
+
var regYoutube = new RegExp(/^.*((youtu.be\/)|(v\/)|(\/u\/w\/)|(embed\/)|(watch?))??v?=?([^#&?]*).*/);
|
|
157
|
+
var regVimeo = new RegExp(/^.*(vimeo.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/);
|
|
158
|
+
var regDailymotion = new RegExp(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
|
|
159
|
+
var regMetacafe = new RegExp(/^.*(metacafe.com)(\/watch\/)(d+)(.*)/i);
|
|
160
|
+
if(regYoutube.test(url)) {
|
|
161
|
+
return 'youtube';
|
|
162
|
+
}else if (regMetacafe.test(url)) {
|
|
163
|
+
return 'metacafe';
|
|
164
|
+
}else if(regDailymotion.test(url)){
|
|
165
|
+
return 'dailymotion';
|
|
166
|
+
}else if(regVimeo.test(url)) {
|
|
167
|
+
return 'vimeo';
|
|
168
|
+
}else{
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
130
173
|
// helper validate only letters latin
|
|
131
174
|
var regex = /^[a-z\sÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏàáâãäåæçèéêëìíîïÐÑÒÓÔÕÖØÙÚÛÜÝÞßðñòóôõöøùúûüýþÿ]+$/i;
|
|
132
175
|
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
|
@@ -158,48 +201,10 @@ var init_form_validations = function(form){
|
|
|
158
201
|
// validate file extension defined in data-formats
|
|
159
202
|
// data-formats: (default '') image | audio | video (support also external youtube metacafe, dailymotion, vimeo) | or file extension like: jpg|png
|
|
160
203
|
$.validator.addMethod("file_format", function(value, element) {
|
|
161
|
-
function check_url(url) {
|
|
162
|
-
var regYoutube = new RegExp(/^.*((youtu.be\/)|(v\/)|(\/u\/w\/)|(embed\/)|(watch?))??v?=?([^#&?]*).*/);
|
|
163
|
-
var regVimeo = new RegExp(/^.*(vimeo.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/);
|
|
164
|
-
var regDailymotion = new RegExp(/^.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/);
|
|
165
|
-
var regMetacafe = new RegExp(/^.*(metacafe.com)(\/watch\/)(d+)(.*)/i);
|
|
166
|
-
if(regYoutube.test(url)) {
|
|
167
|
-
return 'youtube';
|
|
168
|
-
}else if (regMetacafe.test(url)) {
|
|
169
|
-
return 'metacafe';
|
|
170
|
-
}else if(regDailymotion.test(url)){
|
|
171
|
-
return 'dailymotion';
|
|
172
|
-
}else if(regVimeo.test(url)) {
|
|
173
|
-
return 'vimeo';
|
|
174
|
-
}else{
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
var _formats = {
|
|
179
|
-
jpg: "image",
|
|
180
|
-
gif: "image",
|
|
181
|
-
png: "image",
|
|
182
|
-
bmp: "image",
|
|
183
|
-
jpeg: "image",
|
|
184
|
-
|
|
185
|
-
mp3: "audio",
|
|
186
|
-
ogg: "audio",
|
|
187
|
-
mid: "audio",
|
|
188
|
-
mod: "audio",
|
|
189
|
-
wav: "audio",
|
|
190
|
-
|
|
191
|
-
mp4: "video",
|
|
192
|
-
wmv: "video",
|
|
193
|
-
avi: "video",
|
|
194
|
-
swf: "video",
|
|
195
|
-
mov: "video",
|
|
196
|
-
mpeg: "video",
|
|
197
|
-
mjpg: "video"
|
|
198
|
-
}
|
|
199
204
|
var formats = $(element).attr("data-formats");
|
|
200
205
|
var ext = value.split(".").pop().toLowerCase();
|
|
201
206
|
if(formats)
|
|
202
|
-
return ($.inArray("video", formats.split(",")) >= 0 &&
|
|
207
|
+
return ($.inArray("video", formats.split(",")) >= 0 && $.cama_check_video_url(value)) || $.inArray($.file_formats[ext], formats.split(",")) >= 0 || $.inArray(ext, formats.split(",")) >= 0
|
|
203
208
|
|
|
204
209
|
return true;
|
|
205
210
|
}, "File format not accepted.");
|
|
@@ -208,54 +213,6 @@ var init_form_validations = function(form){
|
|
|
208
213
|
});
|
|
209
214
|
})(jQuery);
|
|
210
215
|
|
|
211
|
-
// Sortable
|
|
212
|
-
(function($){
|
|
213
|
-
$.fn.table_order = function (options){
|
|
214
|
-
var default_options = {url: "", table: ".table", on_success: false, on_change: false};
|
|
215
|
-
options = $.extend(default_options, options || {});
|
|
216
|
-
var th_data = false;
|
|
217
|
-
var $table = this ? $(this) : $(options.table);
|
|
218
|
-
$table.addClass('table_order')
|
|
219
|
-
var th_new = '<th class="center" data-sortable="0"></th>';
|
|
220
|
-
$table.find('thead tr').prepend(th_new);
|
|
221
|
-
$table.find('tbody tr').each(function(i, el) {
|
|
222
|
-
var id = $(this).attr('data-id');
|
|
223
|
-
var td_new = '<td>'
|
|
224
|
-
+'<div class="moved" style="cursor: all-scroll">'
|
|
225
|
-
+'<i class="fa fa-arrows"></i>'
|
|
226
|
-
+'<input type="hidden" name="values[]" value="'+id+'" />'
|
|
227
|
-
+'</div>'
|
|
228
|
-
'</td>';
|
|
229
|
-
$(this).prepend(td_new);
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
$table.find('tbody').sortable({
|
|
233
|
-
axis: "y",
|
|
234
|
-
placeholder: "ui-state-highlight",
|
|
235
|
-
handle: ".moved",
|
|
236
|
-
//items: "tr:not(.sortable)",
|
|
237
|
-
items: "tr",
|
|
238
|
-
start: function(event, ui) {
|
|
239
|
-
ui.item.startPos = ui.item.index();
|
|
240
|
-
},
|
|
241
|
-
stop: function( event, ui ) {
|
|
242
|
-
$.post(options.url, $table.find("input" ).serialize(), function(res){
|
|
243
|
-
if(ui.item.startPos != ui.item.index()){
|
|
244
|
-
if(options.on_success) options.on_success({res: res, item: ui.item})
|
|
245
|
-
}
|
|
246
|
-
}).fail(function() {
|
|
247
|
-
if(options.on_success) options.on_success({res: {error: 'Error Server'}, item: ui.item})
|
|
248
|
-
});
|
|
249
|
-
},
|
|
250
|
-
change: function(event, ui) {
|
|
251
|
-
if(options.on_change) options.on_change()
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
$table.find('tbody').disableSelection();
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
})(jQuery);
|
|
258
|
-
|
|
259
216
|
// convert string into hashcode
|
|
260
217
|
String.prototype.hashCode = function() {
|
|
261
218
|
var message = this;
|
|
@@ -279,5 +236,7 @@ String.prototype.hashCode = function() {
|
|
|
279
236
|
return ret;
|
|
280
237
|
};
|
|
281
238
|
|
|
239
|
+
// convert string path into full url
|
|
240
|
+
String.prototype.to_url = function () { return root_url.slice(0, root_url.length - 1) + this; };
|
|
282
241
|
// jquery browser supoer
|
|
283
242
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function(a){"use strict";function b(a){void 0===a&&(a=window.navigator.userAgent),a=a.toLowerCase();var b=/(edge)\/([\w.]+)/.exec(a)||/(opr)[\/]([\w.]+)/.exec(a)||/(chrome)[ \/]([\w.]+)/.exec(a)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[],c=/(ipad)/.exec(a)||/(ipod)/.exec(a)||/(iphone)/.exec(a)||/(kindle)/.exec(a)||/(silk)/.exec(a)||/(android)/.exec(a)||/(windows phone)/.exec(a)||/(win)/.exec(a)||/(mac)/.exec(a)||/(linux)/.exec(a)||/(cros)/.exec(a)||/(playbook)/.exec(a)||/(bb)/.exec(a)||/(blackberry)/.exec(a)||[],d={},e={browser:b[5]||b[3]||b[1]||"",version:b[2]||b[4]||"0",versionNumber:b[4]||b[2]||"0",platform:c[0]||""};if(e.browser&&(d[e.browser]=!0,d.version=e.version,d.versionNumber=parseInt(e.versionNumber,10)),e.platform&&(d[e.platform]=!0),(d.android||d.bb||d.blackberry||d.ipad||d.iphone||d.ipod||d.kindle||d.playbook||d.silk||d["windows phone"])&&(d.mobile=!0),(d.cros||d.mac||d.linux||d.win)&&(d.desktop=!0),(d.chrome||d.opr||d.safari)&&(d.webkit=!0),d.rv||d.edge){var f="msie";e.browser=f,d[f]=!0}if(d.safari&&d.blackberry){var g="blackberry";e.browser=g,d[g]=!0}if(d.safari&&d.playbook){var h="playbook";e.browser=h,d[h]=!0}if(d.bb){var i="blackberry";e.browser=i,d[i]=!0}if(d.opr){var j="opera";e.browser=j,d[j]=!0}if(d.safari&&d.android){var k="android";e.browser=k,d[k]=!0}if(d.safari&&d.kindle){var l="kindle";e.browser=l,d[l]=!0}if(d.safari&&d.silk){var m="silk";e.browser=m,d[m]=!0}return d.name=e.browser,d.platform=e.platform,d}return window.jQBrowser=b(window.navigator.userAgent),window.jQBrowser.uaMatch=b,a&&(a.browser=window.jQBrowser),window.jQBrowser});
|
|
@@ -83,7 +83,7 @@ jQuery(function(){
|
|
|
83
83
|
* return modal object
|
|
84
84
|
*/
|
|
85
85
|
function open_modal(settings){
|
|
86
|
-
var def = {title: "", content: null, url: null, show_footer: false, mode: "inline", ajax_params: {}, modal_size: "", type: '', modal_settings:{}, callback: function(){}}
|
|
86
|
+
var def = {title: "", content: null, url: null, show_footer: false, mode: "inline", ajax_params: {}, modal_size: "", type: '', modal_settings:{}, on_submit: null, callback: function(){}}
|
|
87
87
|
settings = $.extend({}, def, settings);
|
|
88
88
|
var modal = $('<div id="ow_inline_modal" class="modal fade modal-'+settings.type+'">'+
|
|
89
89
|
'<div class="modal-dialog '+settings.modal_size+'">'+
|
|
@@ -93,16 +93,28 @@ function open_modal(settings){
|
|
|
93
93
|
'<h4 class="modal-title">'+settings.title+'</h4>'+
|
|
94
94
|
'</div>'+
|
|
95
95
|
'<div class="modal-body"></div>'+
|
|
96
|
-
(settings.show_footer?'<div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">'+I18n("button.close")+'</button></div>':'')+
|
|
96
|
+
((settings.show_footer || settings.on_submit)?'<div class="modal-footer"> '+(settings.on_submit ? '<button type="button" class="btn btn-primary modal_submit" ><i class="fa fa-save"></i> '+I18n("button.save")+'</button>' : '')+' <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-arrow-circle-down"></i> '+I18n("button.close")+'</button></div>':'')+
|
|
97
97
|
'</div>'+
|
|
98
98
|
'</div>'+
|
|
99
99
|
'</div>');
|
|
100
100
|
|
|
101
|
-
|
|
101
|
+
// on modal hide
|
|
102
|
+
modal.on("hidden.bs.modal", function(e){
|
|
103
|
+
if(!$(e["currentTarget"]).attr("data-skip_destroy")) $(e["currentTarget"]).remove();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// submit button
|
|
107
|
+
if(settings.on_submit) modal.find(".modal-footer .modal_submit").click(function(){
|
|
108
|
+
settings.on_submit(modal);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// on modal show
|
|
102
112
|
modal.on("show.bs.modal", function(e){
|
|
103
113
|
if(!modal.find(".modal-title").text()) modal.find(".modal-header .close").css("margin-top", "-9px");
|
|
104
114
|
settings.callback(modal);
|
|
105
115
|
});
|
|
116
|
+
|
|
117
|
+
// show modal
|
|
106
118
|
if(settings.mode == "inline"){
|
|
107
119
|
modal.find(".modal-body").html(settings.content);
|
|
108
120
|
modal.modal(settings.modal_settings);
|