forgeos_core 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/README.textile +1 -23
  2. data/app/assets/javascripts/forgeos/admin/customselects.js +2 -0
  3. data/app/assets/javascripts/forgeos/admin/functions/forgeos_core/overlay.js +22 -3
  4. data/app/assets/javascripts/forgeos/admin/functions/forgeos_core/tinyMCE.js +1 -1
  5. data/app/assets/javascripts/forgeos/admin/functions/forgeos_core/uploads.js +55 -0
  6. data/app/assets/javascripts/forgeos/admin/functions/forgeos_core/visual.js +3 -3
  7. data/app/assets/javascripts/forgeos/admin/inits/forgeos_core/overlays.js +4 -46
  8. data/app/assets/javascripts/forgeos/admin/inits/forgeos_core/visual.js +17 -57
  9. data/app/assets/stylesheets/forgeos/960.css.sass +1 -125
  10. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_attachments.css.sass +13 -4
  11. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_content.css.sass +7 -2
  12. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_customer.css.sass +18 -5
  13. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_dashboard.css.sass +38 -16
  14. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_datatable.css.sass +32 -13
  15. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_generals.css.sass +75 -39
  16. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_icons.css.sass +130 -16
  17. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_lightbox.css.sass +21 -18
  18. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_notifications.css.sass +0 -1
  19. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_payment.css.sass +1 -1
  20. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_rightSidebar.css.sass +14 -14
  21. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_roles.css.sass +1 -1
  22. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_search.css.sass +6 -5
  23. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_settings.css.sass +1 -3
  24. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_sidebar.css.sass +11 -3
  25. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_uploadify.css.sass +10 -8
  26. data/app/assets/stylesheets/forgeos/admin/forgeos_core/_visuals.css.sass +12 -12
  27. data/app/assets/stylesheets/forgeos/admin/login.css.sass +30 -14
  28. data/app/assets/stylesheets/forgeos/jquery-ui/themes/forgeos.css.sass +96 -733
  29. data/app/assets/stylesheets/forgeos/jstree/themes/categories/style.css.sass +12 -18
  30. data/app/controllers/admin/administrators_controller.rb +2 -2
  31. data/app/controllers/admin/attachments_controller.rb +3 -3
  32. data/app/controllers/admin/categories_controller.rb +1 -1
  33. data/app/controllers/admin/person_sessions_controller.rb +1 -1
  34. data/app/controllers/admin/rights_controller.rb +2 -2
  35. data/app/controllers/admin/roles_controller.rb +3 -3
  36. data/app/controllers/admin/users_controller.rb +2 -2
  37. data/app/controllers/forgeos/application_controller.rb +1 -1
  38. data/app/models/category.rb +7 -3
  39. data/app/models/right.rb +1 -1
  40. data/app/models/role.rb +1 -1
  41. data/app/models/user.rb +6 -3
  42. data/app/views/admin/administrators/index.json.erb +3 -1
  43. data/app/views/admin/attachments/_attachments_popup.html.haml +4 -4
  44. data/app/views/admin/attachments/_form.html.haml +1 -1
  45. data/app/views/admin/attachments/_tabs.html.haml +1 -1
  46. data/app/views/admin/attachments/index.json.erb +4 -2
  47. data/app/views/admin/attachments/show.html.haml +1 -1
  48. data/app/views/admin/cachings/index.html.haml +2 -2
  49. data/app/views/admin/categories/index.json.erb +3 -1
  50. data/app/views/admin/import/_tabs.html.haml +1 -0
  51. data/app/views/admin/import/index.html.haml +1 -1
  52. data/app/views/admin/rights/_tabs.html.haml +1 -0
  53. data/app/views/admin/rights/index.json.erb +7 -5
  54. data/app/views/admin/roles/_tabs.html.haml +1 -0
  55. data/app/views/admin/roles/index.json.erb +5 -3
  56. data/app/views/admin/sidebars/_attachments_popups.html.haml +7 -76
  57. data/app/views/admin/users/index.json.erb +3 -1
  58. data/app/views/admin/visual/_visual_popup.html.haml +18 -107
  59. data/app/views/admin/visual/_visuals_popup.html.haml +7 -47
  60. data/app/views/layouts/admin.html.haml +2 -2
  61. data/app/views/layouts/admin_login.html.haml +2 -2
  62. data/config/locales/common/en.yml +1 -0
  63. data/config/locales/common/fr.yml +1 -0
  64. data/config/routes.rb +12 -1
  65. data/lib/forgeos/urlified.rb +16 -0
  66. data/lib/tasks/install.rake +3 -3
  67. data/lib/technoweenie/attachment_fu/backends/ftp_backend.rb +8 -12
  68. data/recipes/db.rb +1 -1
  69. metadata +52 -57
  70. data/app/controllers/admin/base_controller.rbc +0 -1305
  71. data/app/controllers/admin/dashboard_controller.rbc +0 -361
  72. data/app/controllers/admin/person_sessions_controller.rbc +0 -1248
  73. data/app/controllers/forgeos/application_controller.rbc +0 -2027
  74. data/app/helpers/admin/attachment_helper.rbc +0 -2340
  75. data/app/helpers/admin/base_helper.rbc +0 -2522
  76. data/app/helpers/forgeos/application_helper.rbc +0 -3152
  77. data/app/models/administrator.rbc +0 -415
  78. data/app/models/person.rbc +0 -1498
  79. data/app/models/person_session.rbc +0 -142
  80. data/app/models/right.rbc +0 -432
  81. data/app/models/role.rbc +0 -469
  82. data/app/models/setting.rbc +0 -699
  83. data/config/initializers/load_settings.rbc +0 -330
  84. data/config/routes.rbc +0 -2203
  85. data/lib/extensions.rbc +0 -126
  86. data/lib/extensions/form_helper_extensions.rbc +0 -295
  87. data/lib/extensions/i18n_fallbacks_config.rbc +0 -246
  88. data/lib/forgeos.rbc +0 -1942
  89. data/lib/forgeos/core.rbc +0 -325
  90. data/lib/forgeos/core/engine.rbc +0 -316
  91. data/lib/forgeos_core.rbc +0 -53
  92. data/lib/map_fields.rbc +0 -4437
  93. data/lib/sortable_attachments.rbc +0 -1399
  94. data/lib/sphinx_globalize.rbc +0 -785
@@ -1,11 +1,11 @@
1
- #imageUploadDialogLeftSidebar.upload-lightbox-container.white
2
- #imageUploadLeftSidebar
1
+ #imageLeftSidebarUploadDialog.upload-lightbox-container.white
2
+ #imageLeftSidebarUpload
3
3
  %span= I18n.t('or')
4
- = link_to_function I18n.t('media.add_form_library'), "$('#imageSelectDialogLeftSidebar').dialog('open');"
4
+ = link_to_function I18n.t('media.add_from_library'), "$('#imageLeftSidebarSelectDialog').dialog('open');"
5
5
 
6
- #imageSelectDialogLeftSidebar.media-hoverlay
6
+ #imageLeftSidebarSelectDialog.media-hoverlay
7
7
  .media-hoverlay-header
8
- = link_to_function content_tag(:span, I18n.t('media.picture.upload.action').capitalize, :class=>'big-icons add-picture'), "$(\'#imageUploadDialogLeftSidebar\').dialog(\'open\'); $(\'#imageSelectDialogLeftSidebar\').dialog(\'close\')", :class=>'backgrounds button'
8
+ = link_to_function content_tag(:span, I18n.t('media.picture.upload.action').capitalize, :class=>'big-icons add-picture'), "$(\'#imageLeftSidebarUploadDialog\').dialog(\'open\'); $(\'#imageLeftSidebarSelectDialog\').dialog(\'close\')", :class=>'backgrounds button'
9
9
  .display-mode
10
10
  .heading-separator
11
11
  .display-thumbnails
@@ -27,75 +27,6 @@
27
27
  %tr
28
28
  %td
29
29
 
30
- = dataSlides_tag :url => forgeos_core.admin_attachments_path(:format => :json, :skin => 'thumbnail', :file_type => 'picture', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table', :autostart => false
30
+ = dataSlides_tag :url => forgeos_core.admin_pictures_path(:format => :json, :skin => 'thumbnail', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table', :autostart => false
31
31
 
32
- = dataTables_tag :id => 'image-table', :url => forgeos_core.admin_attachments_path(:format => :json, :file_type => 'picture',:mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{I18n.t('media.filename')}'}", "{ 'sTitle': '#{I18n.t('media.content_type')}'}", "{ 'sTitle': '#{I18n.t('media.updated_at')}'}", "{ 'sTitle': '#{I18n.t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
33
-
34
-
35
- -# TODO move to base.js
36
- :javascript
37
- function initImageUploadLeftSidebar(link){
38
- $('#imageUploadDialogLeftSidebar').dialog('open');
39
- $('#imageUploadDialogLeftSidebar').html('<div id="imageUploadLeftSidebar"></div><div class="library-add"><span>#{t(:or)}</span><a href="#" onclick="$(\'#imageUploadDialogLeftSidebar\').dialog(\'close\'); $(\'#imageSelectDialogLeftSidebar\').dialog(\'open\'); return false;">#{t('media.add_from_library')}</a></div>');
40
- var uploadify_datas = { "format": "json" };
41
- uploadify_datas[window._forgeos_js_vars.session_key] = window._forgeos_js_vars.session;
42
-
43
- $('#imageUploadLeftSidebar').uploadify({
44
- "uploader": "/assets/forgeos/uploadify/uploadify.swf",
45
- "cancelImg": "/assets/forgeos/admin/big-icons/delete-icon.png",
46
- "script": "#{forgeos_core.admin_attachments_path(:file_type => "picture")}",
47
- "buttonImg": "#{image_path("forgeos/uploadify/upload-picture_#{I18n.locale}.png")}",
48
- "width" :"154",
49
- "height" :"24",
50
- "scriptData": uploadify_datas,
51
- "ScriptAccess": "always",
52
- "multi": "true",
53
- "displayData": "speed",
54
- "onComplete": function(e,queueID,fileObj,response,data){
55
- if(typeof JSON=="object" && typeof JSON.parse=="function") {
56
- result = JSON.parse(response);
57
- } else {
58
- result = eval('(' + response + ')');
59
- }
60
- if (result.result == 'success'){
61
- $.ajax({
62
- "success": function(result){
63
- jQuery.tree.focused().refresh();
64
- },
65
- "error": function(){},
66
- "data": {
67
- 'category[attachment_ids]': [result.id],
68
- authenticity_token: window._forgeos_js_vars.token
69
- },
70
- "dataType": 'json',
71
- "type": 'put',
72
- "url": '/admin/categories/'+ link +'.json',
73
- });
74
- } else {
75
- display_notification_message('error',result.error)
76
- }
77
- },
78
- "onAllComplete": function(){
79
- $('#imageUploadDialogLeftSidebar').dialog('close');
80
- }
81
- });
82
- }
83
-
84
- function add_picture_to_category(){
85
- var image_id = get_rails_element_id($('.row_selected')[0]);
86
- var cat_id = get_rails_element_id($('.tree-li-selected-to-add-image'));
87
- $.ajax({
88
- "success": function(result){
89
- jQuery.tree.focused().refresh();
90
- jQuery('#imageSelectDialogLeftSidebar').dialog('close');
91
- },
92
- "error": function(){},
93
- "data": {
94
- 'category[attachment_ids]': [image_id],
95
- authenticity_token: window._forgeos_js_vars.token
96
- },
97
- "dataType": 'json',
98
- "type": 'put',
99
- "url": '/admin/categories/'+ cat_id +'.json',
100
- });
101
- }
32
+ = dataTables_tag :id => 'image-table', :url => forgeos_core.admin_pictures_path(:format => :json, :mode => 'selection'), :columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{I18n.t('media.filename')}'}", "{ 'sTitle': '#{I18n.t('media.content_type')}'}", "{ 'sTitle': '#{I18n.t('media.updated_at')}'}", "{ 'sTitle': '#{I18n.t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
@@ -1,6 +1,8 @@
1
1
  <%
2
2
  output = {
3
- :iTotalDisplayRecords => @users.total_entries || 0,
3
+ :sEcho => params[:sEcho],
4
+ :iTotalRecords => @users.total_entries || 0,
5
+ :iTotalDisplayRecords => @users.size,
4
6
  :aaData => @users.collect do |user|
5
7
  link_id = "user_#{user.id}"
6
8
  klass = user.active? ? 'see-on' : 'see-off'
@@ -1,12 +1,7 @@
1
1
  #imagepictureUploadDialog.upload-lightbox-container.white
2
2
  #imagepictureUpload
3
- /= form.file_field :uploaded_data
4
- /= hidden_field_tag :target, params[:target]
5
- /= hidden_field_tag :target_id, params[:target_id]
6
- /= form.submit t('save').capitalize
7
-
8
3
  %span= t('or')
9
- = link_to_function t('media.add_form_library'), "$('#imagepictureSelectDialog').dialog('open');"
4
+ = link_to_function t('media.add_from_library'), "$('#imagepictureSelectDialog').dialog('open');"
10
5
 
11
6
  #imagepictureSelectDialog.media-hoverlay.project
12
7
  .media-hoverlay-header
@@ -32,67 +27,10 @@
32
27
  %tr
33
28
  %td
34
29
 
35
- = dataSlides_tag :url => forgeos_core.admin_attachments_path(:format => :json, :skin => 'thumbnail', :file_type => 'picture', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-picture', :autostart => false
36
-
37
- = dataTables_tag :id => 'image-table-picture', :url => forgeos_core.admin_attachments_path(:format => :json, :file_type => 'picture',:mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{t('media.filename')}'}", "{ 'sTitle': '#{t('media.content_type')}'}", "{ 'sTitle': '#{t('media.updated_at')}'}", "{ 'sTitle': '#{t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
38
-
39
- -# TODO move to base.js
40
- - session_key = ActionController::Base.session_options[:key]
41
- - javascript_tag do
42
- function initpictureImageUpload(){
43
-
44
- $('#imagepictureUploadDialog').html('<div id="imagepictureUpload"></div><div class="library-add"><span>or</span><a href="#" onclick="$(\'#imagepictureUploadDialog\').dialog(\'close\'); $(\'#imagepictureSelectDialog\').dialog(\'open\'); return false;">add from library</a></div>');
45
-
46
- $('#imagepictureUpload').uploadify({
47
- uploader: '/assets/forgeos/uploadify/uploadify.swf',
48
- cancelImg: '/assets/forgeos/big-icons/delete-icon.png',
49
- = "script: '#{forgeos_core.admin_attachments_path(:file_type => 'picture')}',"
50
- = "buttonImg:'#{image_path("uploadify/choose-picture_#{I18n.locale}.png")}',"
51
- width: 154,
52
- height:24,
53
- scriptData: {
54
- format: 'json',
55
- = "'authenticity_token': encodeURIComponent('#{u form_authenticity_token}')," if protect_against_forgery?
56
- = "'#{session_key}': encodeURIComponent('#{cookies[session_key]}')"
57
- },
58
- ScriptAccess: 'always',
59
- multi: 'true',
60
- displayData: 'speed',
61
- onComplete: function(e,queueID,fileObj,response,data){
62
- if(typeof JSON=="object" && typeof JSON.parse=="function")
63
- {
64
- result = JSON.parse(response);
65
- }
66
- else{
67
- result = eval('(' + response + ')');
68
- }
69
- if (result.result == 'success'){
70
- add_picture_picture_to_element(result.path,result.id,fileObj.name);
71
- } else {
72
- display_notification_message('error',result.error)
73
- }
74
- },
75
- onAllComplete: function(){
76
- $('#imagepictureUploadDialog').dialog('close');
77
- }
78
- });
79
- }
80
-
81
- function add_picture_picture_to_element(path,id,name){
82
- = "object_name='#{form.object_name}';"
83
- $('#picture-picture ul.sortable').html('<li><img src="'+path+'" alt="'+name+'"/><a href="#" onclick="$(this).parents(\'li\').remove(); $(\'#picture\').val(\'null\'); return false;" class="big-icons delete"></a></li>');
84
- $("#picture").val(id);
85
- }
86
-
87
30
  #imageimageUploadDialog.upload-lightbox-container.white
88
31
  #imageimageUpload
89
- /= form.file_field :uploaded_data
90
- /= hidden_field_tag :target, params[:target]
91
- /= hidden_field_tag :target_id, params[:target_id]
92
- /= form.submit t('save').capitalize
93
-
94
32
  %span= t('or')
95
- = link_to_function t('media.add_form_library'), "$('#imageimageSelectDialog').dialog('open');"
33
+ = link_to_function t('media.add_from_library'), "$('#imageimageSelectDialog').dialog('open');"
96
34
 
97
35
  #imageimageSelectDialog.media-hoverlay.project
98
36
  .media-hoverlay-header
@@ -118,53 +56,26 @@
118
56
  %tr
119
57
  %td
120
58
 
121
- = dataSlides_tag :url => forgeos_core.admin_attachments_path(:format => :json, :skin => 'thumbnail', :file_type => 'picture', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-image'
122
- = dataTables_tag :id => 'image-table-image', :url => forgeos_core.admin_attachments_path(:format => :json, :file_type => 'picture',:mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{t('media.filename')}'}", "{ 'sTitle': '#{t('media.content_type')}'}", "{ 'sTitle': '#{t('media.updated_at')}'}", "{ 'sTitle': '#{t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}']
59
+ = dataSlides_tag :url => forgeos_core.admin_pictures_path(:format => :json, :skin => 'thumbnail', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-image'
123
60
 
124
- -# TODO move to base.js
125
- - session_key = ActionController::Base.session_options[:key]
126
- - javascript_tag do
127
- function initimageImageUpload(){
61
+ = dataTables_tag :id => 'image-table-image', :url => forgeos_core.admin_pictures_path(:format => :json, :mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{t('media.filename')}'}", "{ 'sTitle': '#{t('media.content_type')}'}", "{ 'sTitle': '#{t('media.updated_at')}'}", "{ 'sTitle': '#{t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}']
128
62
 
129
- $('#imageimageUploadDialog').html('<div id="imageimageUpload"></div><div class="library-add"><span>or</span><a href="#" onclick="$(\'#imageimageUploadDialog\').dialog(\'close\'); $(\'#imageimageSelectDialog\').dialog(\'open\'); return false;">add from library</a></div>');
63
+ = dataSlides_tag :url => forgeos_core.admin_pictures_path(:format => :json, :skin => 'thumbnail', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-picture', :autostart => false
130
64
 
131
- $('#imageimageUpload').uploadify({
132
- uploader: '/assets/forgeos/uploadify/uploadify.swf',
133
- cancelImg: '/assets/forgeos/admin/big-icons/delete-icon.png',
134
- = "script: '#{forgeos_core.admin_attachments_path(:file_type => 'picture')}',"
135
- = "buttonImg:'#{image_path("uploadify/choose-picture_#{I18n.locale}.png")}',"
136
- width: 154,
137
- height:24,
138
- scriptData: {
139
- format: 'json',
140
- = "'authenticity_token': encodeURIComponent('#{u form_authenticity_token}')," if protect_against_forgery?
141
- = "'#{session_key}': encodeURIComponent('#{cookies[session_key]}')"
142
- },
143
- ScriptAccess: 'always',
144
- multi: 'true',
145
- displayData: 'speed',
146
- onComplete: function(e,queueID,fileObj,response,data){
147
- if(typeof JSON=="object" && typeof JSON.parse=="function")
148
- {
149
- result = JSON.parse(response);
150
- }
151
- else{
152
- result = eval('(' + response + ')');
153
- }
154
- if (result.result == 'success'){
155
- add_image_picture_to_element(result.path,result.id,fileObj.name);
156
- } else {
157
- display_notification_message('error',result.error)
158
- }
159
- },
160
- onAllComplete: function(){
161
- $('#imageimageUploadDialog').dialog('close');
162
- }
163
- });
65
+ = dataTables_tag :id => 'image-table-picture', :url => forgeos_core.admin_pictures_path(:format => :json, :mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{t('media.filename')}'}", "{ 'sTitle': '#{t('media.content_type')}'}", "{ 'sTitle': '#{t('media.updated_at')}'}", "{ 'sTitle': '#{t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
66
+
67
+ :javascript
68
+ function add_image_to_element(path,id,name,object_name,input) {
69
+ jQuery(input + '-picture ul.sortable').html('<li><img src="'+path+'" alt="'+name+'"/><a href="#" onclick="$(this).parents(\'li\').remove(); $("'+input+'").val(\'null\'); return false;" class="big-icons delete"></a></li>');
70
+ jQuery(input).val(id);
164
71
  }
165
72
 
166
73
  function add_image_picture_to_element(path,id,name){
167
- = "object_name='#{form.object_name}';"
168
- $('#image-picture ul.sortable').html('<li><img src="'+path+'" alt="'+name+'"/><a href="#" onclick="$(this).parents(\'li\').remove(); $(\'#image\').val(\'null\'); return false;" class="big-icons delete"></a></li>');
169
- $("#image").val(id);
74
+ var object_name='#{form.object_name}';
75
+ add_image_to_element(path,id,name,object_name, '#image');
76
+ }
77
+
78
+ function add_picture_picture_to_element(path,id,name){
79
+ var object_name='#{form.object_name}';
80
+ add_image_to_element(path,id,name,object_name, '#picture');
170
81
  }
@@ -6,7 +6,7 @@
6
6
  /= form.submit I18n.t('save').capitalize
7
7
 
8
8
  %span= I18n.t('or')
9
- = link_to_function I18n.t('media.add_form_library'), "$('#imagevisualsSelectDialog').dialog('open');"
9
+ = link_to_function I18n.t('media.add_from_library'), "$('#imagevisualsSelectDialog').dialog('open');"
10
10
 
11
11
  #imagevisualsSelectDialog.media-hoverlay.project
12
12
  .media-hoverlay-header
@@ -32,52 +32,12 @@
32
32
  %tr
33
33
  %td
34
34
 
35
- = dataSlides_tag :url => forgeos_core.admin_attachments_path(:format => :json, :skin => 'thumbnail', :file_type => 'picture', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-visuals', :autostart => false
35
+ = dataSlides_tag :url => forgeos_core.admin_pictures_path(:format => :json, :skin => 'thumbnail', :mode => 'selection'), :columns => [ '{ "bSortable": true, "bSearchable": true, "sType": "string", "bUseRendered": true, "fnRender": null, "iDataSort": 0, "nTf": null, "nTh": function(){$(".thead").find(".th");}, "sWidth": "0px"}','{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}' ], :id => 'thumbnail-table-visuals', :autostart => false
36
36
 
37
- = dataTables_tag :id => 'image-table-visuals', :url => forgeos_core.admin_attachments_path(:format => :json, :file_type => 'picture',:mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{I18n.t('media.filename')}'}", "{ 'sTitle': '#{I18n.t('media.content_type')}'}", "{ 'sTitle': '#{I18n.t('media.updated_at')}'}", "{ 'sTitle': '#{I18n.t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
37
+ = dataTables_tag :id => 'image-table-visuals', :url => forgeos_core.admin_pictures_path(:format => :json, :mode => 'selection'),:columns => ["{'sClass':'th-checkbox-container', 'bSortable': false }", "{ 'sTitle': '#{I18n.t('media.filename')}'}", "{ 'sTitle': '#{I18n.t('media.content_type')}'}", "{ 'sTitle': '#{I18n.t('media.updated_at')}'}", "{ 'sTitle': '#{I18n.t('media.size')}'}", '{"bVisible": false}', '{ "bVisible": false }', '{ "bVisible": false}','{ "bVisible": false}', '{ "bVisible": false}'], :autostart => false
38
38
 
39
- -# TODO move to base.js
40
- - session_key = ActionController::Base.session_options[:key]
41
- - javascript_tag do
42
- function initvisualsImageUpload(){
43
-
44
- $('#imagevisualsUploadDialog').html('<div id="imagevisualsUpload"></div><div class="library-add"><span>or</span><a href="#" onclick="$(\'#imagevisualsUploadDialog\').dialog(\'close\'); $(\'#imagevisualsSelectDialog\').dialog(\'open\'); return false;">add from library</a></div>');
45
-
46
- $('#imagevisualsUpload').uploadify({
47
- uploader: '/assets/forgeos/uploadify/uploadify.swf',
48
- cancelImg: '/assets/forgeos/min/big-icons/delete-icon.png',
49
- = "script: '#{forgeos_core.admin_attachments_path(:file_type => 'picture')}',"
50
- = "buttonImg:'#{image_path("uploadify/choose-picture_#{I18n.locale}.png")}',"
51
- width: 154,
52
- height:24,
53
- scriptData: {
54
- format: 'json',
55
- = "authenticity_token: encodeURIComponent('#{u form_authenticity_token}')," if protect_against_forgery?
56
- = "#{session_key}: encodeURIComponent('#{cookies[session_key]}')"
57
- },
58
- ScriptAccess: 'always',
59
- multi: 'true',
60
- displayData: 'speed',
61
- onComplete: function(e,queueID,fileObj,response,data){
62
- if(typeof JSON=="object" && typeof JSON.parse=="function")
63
- {
64
- result = JSON.parse(response);
65
- }
66
- else{
67
- result = eval('(' + response + ')');
68
- }
69
- if (result.result == 'success'){
70
- add_picture_to_element(result.path,result.id,fileObj.name);
71
- } else {
72
- display_notification_message('error',result.error)
39
+ :javascript
40
+ function add_picture_to_visuals(path,id,name){
41
+ var object_name='#{form.object_name}';
42
+ jQuery('#visuals-picture ul.sortable').before('<li><a href="#" onclick="jQuery(this).parents(\'li\').remove(); return false;" class="big-icons trash"></a><input type="hidden" name="'+object_name+'[attachment_ids][]" value="'+id+'"/><img src="'+path+'" alt="'+name+'"/><div class="handler"><div class="inner"></div></div></li>');
73
43
  }
74
- },
75
- onAllComplete: function(){
76
- $('#imagevisualsUploadDialog').dialog('close');
77
- }
78
- });
79
- }
80
-
81
- function add_picture_to_element(path,id,name){
82
- = "object_name='#{form.object_name}';"
83
- $('#visuals-picture ul.sortable').before('<li><a href="#" onclick="$(this).parents(\'li\').remove(); return false;" class="big-icons trash"></a><input type="hidden" name="'+object_name+'[attachment_ids][]" value="'+id+'"/><img src="'+path+'" alt="'+name+'"/><div class="handler"><div class="inner"></div></div></li>'); }
@@ -1,5 +1,5 @@
1
- !!! xml utf-8
2
- !!! 1.1
1
+ !!! XML
2
+ !!! 5
3
3
  %html{ "xml:lang" => I18n.locale, :xmlns => "http://www.w3.org/1999/xhtml" }
4
4
  %head
5
5
  %meta{ :content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type" }
@@ -1,5 +1,5 @@
1
- !!! xml utf-8
2
- !!! 1.1
1
+ !!! XML
2
+ !!! 5
3
3
  %html{ 'xml:lang' => I18n.locale, :xmlns => 'http://www.w3.org/1999/xhtml' }
4
4
  %head
5
5
  %meta{ :content => 'text/html; charset=utf-8', 'http-equiv' => 'Content-Type' }
@@ -214,6 +214,7 @@ en:
214
214
  action: 'save order for site display'
215
215
  media:
216
216
  list: list of media
217
+ add_from_library: add from library
217
218
  one: media
218
219
  other: media
219
220
  none: no media
@@ -215,6 +215,7 @@ fr:
215
215
  action: "sauvegarder l'ordre pour le site"
216
216
  media:
217
217
  list: liste des médias
218
+ add_from_library: ajouter depuis la librairie
218
219
  one: média
219
220
  other: médias
220
221
  none: aucun média
data/config/routes.rb CHANGED
@@ -59,8 +59,19 @@ Forgeos::Core::Engine.routes.draw do
59
59
  end
60
60
 
61
61
  match '/library' => 'attachments#index', :as => :library, :file_type => 'picture'
62
+
63
+ resources :attachments, :except => [:new] do
64
+ collection do
65
+ get :manage
66
+ end
67
+ member do
68
+ get :download
69
+ end
70
+ end
71
+
72
+
62
73
  %w(media picture doc pdf audio video attachment).each do |attachment|
63
- resources attachment.pluralize.to_sym, :except => [:new] do
74
+ resources attachment.pluralize.to_sym, :controller => 'attachments', :file_type => attachment, :except => [:new] do
64
75
  collection do
65
76
  get :manage
66
77
  end
@@ -0,0 +1,16 @@
1
+ module Forgeos
2
+ module Urlified
3
+ def self.included(base)
4
+ base.before_validation :force_url_format, :generate_url
5
+ end
6
+
7
+ def force_url_format
8
+ self.url= Forgeos::url_generator(self.url)
9
+ end
10
+
11
+ def generate_url
12
+ return true if self.url.present?
13
+ self.url = self.name.parameterize if self.name.present?
14
+ end
15
+ end
16
+ end
@@ -1,9 +1,9 @@
1
1
  namespace :forgeos do
2
2
  namespace :core do
3
3
  desc "load fixtures and generate forgeos_core controllers ACLs"
4
- task :install => [ :environment, 'forgeos_core_engine:install:migrations', 'db:migrate' ] do
5
- system 'rake "forgeos:core:fixtures:load[forgeos_core,people geo_zones settings]"'
6
- system "rake 'forgeos:core:generate:acl[#{Gem.loaded_specs['forgeos_core'].full_gem_path}]'"
4
+ task :install do
5
+ Rake::Task['forgeos:core:fixtures:load'].invoke('forgeos_core','people geo_zones settings')
6
+ Rake::Task['forgeos:core:generate:acl'].invoke(Gem.loaded_specs['forgeos_core'].full_gem_path)
7
7
  end
8
8
  end
9
9
  end
@@ -152,18 +152,12 @@ module Technoweenie # :nodoc:
152
152
  end
153
153
 
154
154
  def current_data
155
- ftp = Net::FTP.new(ftp_config[:server])
156
- ftp.login(ftp_config[:login], ftp_config[:password])
157
- dest_path = File.join(ftp_config[:base_upload_path], full_filename)
158
- puts(dest_path.inspect)
159
- f = Tempfile.open('w')
160
- f.close
161
- ftp.getbinaryfile(dest_path, f.path)
162
- ftp.close
163
- f.open
164
- v = f.read()
165
- f.delete
166
- v
155
+ Net::FTP.open(ftp_config[:server]) do |ftp|
156
+ ftp.login(ftp_config[:login], ftp_config[:password])
157
+ ftp.getbinaryfile(File.join(ftp_config[:base_upload_path], full_filename)) do |data|
158
+ return data
159
+ end
160
+ end
167
161
  end
168
162
 
169
163
  # Partitions the given path into an array of path components.
@@ -201,6 +195,7 @@ module Technoweenie # :nodoc:
201
195
  protected
202
196
  # Called in the after_destroy callback
203
197
  def destroy_file
198
+ return true if ftp_config[:read_only]
204
199
  ftp = Net::FTP.new(ftp_config[:server])
205
200
  ftp.login(ftp_config[:login], ftp_config[:password])
206
201
  dest_path = File.join(ftp_config[:base_upload_path], full_filename)
@@ -208,6 +203,7 @@ module Technoweenie # :nodoc:
208
203
  end
209
204
 
210
205
  def rename_file
206
+ return true if ftp_config[:read_only]
211
207
  return unless @old_filename && @old_filename != filename
212
208
  old_full_filename = File.join(base_path, @old_filename)
213
209