Adds a permission for exporting wiki pages.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3371 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e5d300af0a
commit
6c8b87fbc8
|
@ -47,15 +47,17 @@ class WikiController < ApplicationController
|
|||
return
|
||||
end
|
||||
@content = @page.content_for_version(params[:version])
|
||||
if params[:format] == 'html'
|
||||
export = render_to_string :action => 'export', :layout => false
|
||||
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
||||
return
|
||||
elsif params[:format] == 'txt'
|
||||
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
|
||||
return
|
||||
if User.current.allowed_to?(:export_wiki_pages, @project)
|
||||
if params[:format] == 'html'
|
||||
export = render_to_string :action => 'export', :layout => false
|
||||
send_data(export, :type => 'text/html', :filename => "#{@page.title}.html")
|
||||
return
|
||||
elsif params[:format] == 'txt'
|
||||
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
|
||||
return
|
||||
end
|
||||
end
|
||||
@editable = editable?
|
||||
@editable = editable?
|
||||
render :action => 'show'
|
||||
end
|
||||
|
||||
|
@ -177,9 +179,13 @@ class WikiController < ApplicationController
|
|||
@pages_by_parent_id = @pages.group_by(&:parent_id)
|
||||
# export wiki to a single html file
|
||||
when 'export'
|
||||
@pages = @wiki.pages.find :all, :order => 'title'
|
||||
export = render_to_string :action => 'export_multiple', :layout => false
|
||||
send_data(export, :type => 'text/html', :filename => "wiki.html")
|
||||
if User.current.allowed_to?(:export_wiki_pages, @project)
|
||||
@pages = @wiki.pages.find :all, :order => 'title'
|
||||
export = render_to_string :action => 'export_multiple', :layout => false
|
||||
send_data(export, :type => 'text/html', :filename => "wiki.html")
|
||||
else
|
||||
redirect_to :action => 'index', :id => @project, :page => nil
|
||||
end
|
||||
return
|
||||
else
|
||||
# requested special page doesn't exist, redirect to default page
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'HTML', :url => {:page => @page.title, :version => @content.version} %>
|
||||
<%= f.link_to 'TXT', :url => {:page => @page.title, :version => @content.version} %>
|
||||
<% end %>
|
||||
<% end if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'scm' %>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<% unless @pages.empty? %>
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
|
||||
<%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
|
||||
<%= f.link_to('HTML', :url => {:action => 'special', :page => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% unless @pages.empty? %>
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:controller => 'projects', :action => 'activity', :id => @project, :show_wiki_edits => 1, :key => User.current.rss_key} %>
|
||||
<%= f.link_to 'HTML', :url => {:action => 'special', :page => 'export'} %>
|
||||
<%= f.link_to('HTML', :url => {:action => 'special', :page => 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -878,3 +878,4 @@ bg:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -902,3 +902,4 @@ bs:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -881,3 +881,4 @@ ca:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -884,3 +884,4 @@ cs:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -904,3 +904,4 @@ da:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -904,3 +904,4 @@ de:
|
|||
label_close_versions: Vollständige Versionen schließen
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -884,3 +884,4 @@ el:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -382,6 +382,7 @@ en:
|
|||
permission_edit_own_messages: Edit own messages
|
||||
permission_delete_messages: Delete messages
|
||||
permission_delete_own_messages: Delete own messages
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
||||
project_module_issue_tracking: Issue tracking
|
||||
project_module_time_tracking: Time tracking
|
||||
|
|
|
@ -928,3 +928,4 @@ es:
|
|||
label_close_versions: Cerrar versiones completadas
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -888,3 +888,4 @@ eu:
|
|||
enumeration_system_activity: Sistemako Jarduera
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -914,3 +914,4 @@ fi:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -405,6 +405,7 @@ fr:
|
|||
permission_edit_own_messages: Modifier ses propres messages
|
||||
permission_delete_messages: Supprimer les messages
|
||||
permission_delete_own_messages: Supprimer ses propres messages
|
||||
permission_export_wiki_pages: Exporter les pages
|
||||
|
||||
project_module_issue_tracking: Suivi des demandes
|
||||
project_module_time_tracking: Suivi du temps passé
|
||||
|
|
|
@ -904,3 +904,4 @@ gl:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -888,3 +888,4 @@ he:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -891,3 +891,4 @@ hr:
|
|||
Are you sure you want to continue?
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -909,3 +909,4 @@
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -896,3 +896,4 @@ id:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -891,3 +891,4 @@ it:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -913,3 +913,4 @@ ja:
|
|||
enumeration_doc_categories: 文書カテゴリ
|
||||
enumeration_activities: 作業分類 (時間トラッキング)
|
||||
enumeration_system_activity: システム作業分類
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -944,3 +944,4 @@ ko:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -952,3 +952,4 @@ lt:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -866,3 +866,4 @@ nl:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -879,3 +879,4 @@
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -909,3 +909,4 @@ pl:
|
|||
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -912,3 +912,4 @@ pt-BR:
|
|||
label_board_sticky: Marcado
|
||||
label_board_locked: Travado
|
||||
label_change_log: Registro de alterações
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -896,3 +896,4 @@ pt:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -881,3 +881,4 @@ ro:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -992,3 +992,4 @@ ru:
|
|||
label_close_versions: Закрыть завершенные версии
|
||||
label_board_sticky: Прикреплена
|
||||
label_board_locked: Заблокирована
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -883,3 +883,4 @@ sk:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -880,3 +880,4 @@ sl:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -899,3 +899,4 @@
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -933,3 +933,4 @@ sv:
|
|||
enumeration_doc_categories: Dokumentkategorier
|
||||
enumeration_activities: Aktiviteter (tidsuppföljning)
|
||||
enumeration_system_activity: Systemaktivitet
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -881,3 +881,4 @@ th:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -911,3 +911,4 @@ tr:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -880,3 +880,4 @@ uk:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -943,3 +943,4 @@ vi:
|
|||
label_close_versions: Close completed versions
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -975,3 +975,4 @@
|
|||
enumeration_doc_categories: 文件分類
|
||||
enumeration_activities: 活動 (時間追蹤)
|
||||
enumeration_system_activity: 系統活動
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -906,3 +906,4 @@ zh:
|
|||
enumeration_system_activity: 系统活动
|
||||
label_board_sticky: Sticky
|
||||
label_board_locked: Locked
|
||||
permission_export_wiki_pages: Export wiki pages
|
||||
|
|
|
@ -92,6 +92,7 @@ Redmine::AccessControl.map do |map|
|
|||
map.permission :rename_wiki_pages, {:wiki => :rename}, :require => :member
|
||||
map.permission :delete_wiki_pages, {:wiki => :destroy}, :require => :member
|
||||
map.permission :view_wiki_pages, :wiki => [:index, :special]
|
||||
map.permission :export_wiki_pages, {}
|
||||
map.permission :view_wiki_edits, :wiki => [:history, :diff, :annotate]
|
||||
map.permission :edit_wiki_pages, :wiki => [:edit, :preview, :add_attachment]
|
||||
map.permission :delete_wiki_pages_attachments, {}
|
||||
|
|
|
@ -33,6 +33,7 @@ roles_001:
|
|||
- :view_documents
|
||||
- :manage_documents
|
||||
- :view_wiki_pages
|
||||
- :export_wiki_pages
|
||||
- :view_wiki_edits
|
||||
- :edit_wiki_pages
|
||||
- :delete_wiki_pages_attachments
|
||||
|
|
Loading…
Reference in New Issue