1 class SystemPicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => []
6 before_filter :authenticate_resource_reader, :only => [:index, :show]
7 before_filter :authenticate_user, :only => []
9 before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
11 # GET /system_pictures
12 # GET /system_pictures.json
14 @page = SystemPicture.page params[:page]
15 @page_size = SystemPicture.page_size params[:page_size]
16 @system_pictures = SystemPicture.list(@page, @page_size)
18 respond_to do |format|
19 format.html # index.html.erb
20 format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
24 # GET /system_pictures/1
25 # GET /system_pictures/1.json
27 @system_picture = SystemPicture.show(params[:id], @author)
29 respond_to do |format|
30 opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
31 format.png { send_data(@system_picture.restore, opt ) }
32 format.gif { send_data(@system_picture.restore, opt ) }
33 format.jpeg { send_data(@system_picture.restore, opt ) }
34 format.html # show.html.erb
35 format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
40 @system_pictures = SystemPicture.all
42 respond_to do |format|
43 format.html { render layout: 'system' }
44 format.json { render json: @system_pictures }
49 @system_picture = SystemPicture.find(params[:id])
51 respond_to do |format|
52 format.html { render layout: 'system' }
53 format.json { render json: @system_picture}