OSDN Git Service

fom
[pettanr/pettanr.git] / app / controllers / system_pictures_controller.rb
1 class SystemPicturesController < ApplicationController
2   if Manifest.manifest.magic_numbers['run_mode'] == 0
3     before_filter :authenticate_user, :only => []
4     before_filter :authenticate_author, :only => []
5   else
6     before_filter :authenticate_resource_reader, :only => [:index, :show, :count]
7     before_filter :authenticate_user, :only => []
8     before_filter :authenticate_author, :only => []
9   end
10   before_filter :authenticate_admin!, :only => []
11
12   def self.model
13     SystemPicture
14   end
15   
16   def index
17     filer_list
18   end
19   
20   def show
21     @item = SystemPicture.show(params[:id], @operators)
22     
23     respond_to do |format|
24       opt = {:type => @item.mime_type, :disposition=>"inline"}
25       format.png { send_data(@item.restore, opt ) }
26       format.gif { send_data(@item.restore, opt ) }
27       format.jpeg { send_data(@item.restore, opt ) }
28       format.html {
29         @system_picture = @item
30       }
31       format_prof format
32       format.json { render json: @item.to_json(SystemPicture.show_json_opt)}
33     end
34   end
35   
36   def count
37     list_count
38   end
39   
40 end