diff --git a/app/controllers/gridfs_controller.rb b/app/controllers/gridfs_controller.rb index 4be7ec17..b7f926b1 100644 --- a/app/controllers/gridfs_controller.rb +++ b/app/controllers/gridfs_controller.rb @@ -3,7 +3,7 @@ require 'mongo' class GridfsController < ActionController::Metal def serve - gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "").force_encoding("UTF-8") + gridfs_path = (params[:path]+'.'+params[:format]).gsub("/gridfs/", "").force_encoding("UTF-8") begin gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r') self.response_body = gridfs_file.read diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index a6925aa4..77680e5b 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -15,7 +15,7 @@ class SessionsController < Devise::SessionsController if $nccu_ldap_connection.bind logger.info "=LDAP Binded password ok..." result =check_auth_with_ldap(login_uid,login_password) - if result #&& login_password!='' + if result && login_password!='' logger.info "==LDAP password passed..." nccu_id = get_nccu_id_from_mid_site(login_uid) resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id })) diff --git a/config/locales/en.yml b/config/locales/en.yml index fd08be49..054d1c23 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -289,4 +289,7 @@ en: modal: close: Close preview: Preview - + sys: + not_previewable: "Preview not support" + limit_of_upload_file_size: "Upload file must be less than: %{best_size}" + diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 0eb12ba1..930f5902 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -508,3 +508,6 @@ zh_tw: modal: close: "關閉" preview: "預覽" + sys: + not_previewable: "不支援預覽" + limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}" diff --git a/config/routes.rb b/config/routes.rb index 75fa6142..40e82749 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -140,7 +140,8 @@ Orbit::Application.routes.draw do } # routes for gridfs files - match "/gridfs/*path" => "gridfs#serve" + match "/gridfs/*path" => "gridfs#serve" + # match "/images/*path" => "gridfs#serve_images" # match "/admin/pages/images/*path" => "gridfs#serve_images" diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index 88920b9e..8a67bfe7 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -20,4 +20,21 @@ module Panel::Announcement::BackEnd::BulletinsHelper end end + def file_picture_preview_setting(file_path) + res= "" + ext = File.extname(file_path) + unless file_path.nil? + case ext + when ".jpg",".png",".gif" + #res = '' + #res.html_safe + {"data-content" => "#{image_tag file_path}" } + else + {"data-content" => t("sys.not_previewable") } + end + end + end + end \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb index e2765c33..d448b5ff 100644 --- a/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb +++ b/vendor/built_in_modules/news/app/helpers/panel/news/back_end/news_bulletins_helper.rb @@ -14,9 +14,8 @@ module Panel::News::BackEnd::NewsBulletinsHelper def show_news_bulletin_title_at_index (news_bulletin) if news_bulletin.is_checked? - link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue '' - else + else news_bulletin.title[I18n.locale] end end diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index 837ebffe..f3d1753b 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -237,6 +237,8 @@
<%= hidden_field_tag 'news_bulletin_file_field_count', @news_bulletin.news_bulletin_files.count %> <%= t(:add) %> +

<%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %>

+
@@ -249,10 +251,9 @@ <%= render :partial => 'form_news_bulletin_file', :object => news_bulletin_file, :locals => {:f => f, :i => i} %> <% end %> <% end %> - + - @@ -275,17 +276,20 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "inc/jquery.imagesloaded.js" %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb index 27867f49..da05812a 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb @@ -4,7 +4,8 @@
<%= f.file_field :file %> - <%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> + <%#= file_picture_preview_setting(form_news_bulletin_file.file.url) %> + <%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_news_bulletin_file.file.url)) ) : '' %>