1 class SystemPicturesController < ApplicationController
2 layout 'test' if MagicNumber['test_layout']
3 if MagicNumber['run_mode'] == 0
4 before_filter :authenticate_user, :only => []
5 before_filter :authenticate_author, :only => []
7 before_filter :authenticate_resource_reader, :only => [:index, :show]
8 before_filter :authenticate_user, :only => []
9 before_filter :authenticate_author, :only => []
11 before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
13 # GET /system_pictures
14 # GET /system_pictures.json
16 @page = SystemPicture.page params[:page]
17 @page_size = SystemPicture.page_size params[:page_size]
18 @system_pictures = SystemPicture.list(@page, @page_size)
20 respond_to do |format|
21 format.html # index.html.erb
22 format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
26 # GET /system_pictures/1
27 # GET /system_pictures/1.json
29 @system_picture = SystemPicture.show(params[:id], [@user, @admin, @demand_user])
31 respond_to do |format|
32 opt = {:type => @system_picture.mime_type, :disposition=>"inline"}
33 format.png { send_data(@system_picture.restore, opt ) }
34 format.gif { send_data(@system_picture.restore, opt ) }
35 format.jpeg { send_data(@system_picture.restore, opt ) }
36 format.html # show.html.erb
37 format.prof { render :template => 'top/prof', :layout => true }
38 format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
43 @system_pictures = SystemPicture.all
45 respond_to do |format|
46 format.html { render layout: 'system' }
47 format.json { render json: @system_pictures }
52 @system_picture = SystemPicture.find(params[:id])
54 respond_to do |format|
55 format.html { render layout: 'system' }
56 format.json { render json: @system_picture}