X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fsystem_pictures_controller.rb;h=4b544d3ca1698ad4995857b28c257fa9d730ec6a;hb=6a9125ccbacea489311fc4cc548ac03e7d0b412d;hp=4d341f7e56708034440c6b4c126f5e4c3259a0ff;hpb=97850a27ff412de6ea4230e51a9cca4d92d62ca8;p=pettanr%2Fpettanr.git diff --git a/app/controllers/system_pictures_controller.rb b/app/controllers/system_pictures_controller.rb index 4d341f7e..4b544d3c 100644 --- a/app/controllers/system_pictures_controller.rb +++ b/app/controllers/system_pictures_controller.rb @@ -1,75 +1,38 @@ class SystemPicturesController < ApplicationController - layout 'test' if Pettanr::Application.test_layout - before_filter :authenticate_user!, :only => [:index, :show] - before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create] - - # GET /system_pictures - # GET /system_pictures.json - def index - @page = SystemPicture.page params[:page] - @page_size = SystemPicture.page_size params[:page_size] - @system_pictures = SystemPicture.list(@page, @page_size) - - respond_to do |format| - format.html # index.html.erb - format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) } - end - end - - # GET /system_pictures/1 - # GET /system_pictures/1.json - def show - @system_picture = SystemPicture.show(params[:id], @author) - - respond_to do |format| - opt = {:type => @system_picture.mime_type, :disposition=>"inline"} - format.png { send_data(@system_picture.restore, opt ) } - format.gif { send_data(@system_picture.restore, opt ) } - format.jpeg { send_data(@system_picture.restore, opt ) } - format.html # show.html.erb - format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)} - end + if Manifest.manifest.magic_numbers['run_mode'] == 0 + before_action :authenticate_user, :only => [] + before_action :authenticate_author, :only => [] + else + before_action :authenticate_resource_reader, :only => [:index, :show] + before_action :authenticate_user, :only => [] + before_action :authenticate_author, :only => [] end - - def list - @system_pictures = SystemPicture.all - - respond_to do |format| - format.html { render layout: 'system' } - format.json { render json: @system_pictures } - end + before_action :authenticate_admin!, :only => [] + + def index + filer_list end - - def browse - @system_picture = SystemPicture.find(params[:id]) - - respond_to do |format| - format.html { render layout: 'system' } - format.json { render json: @system_picture} - end + + def show_html_format format + format.html { + } end - - def new + + def show + set_show respond_to do |format| - format.html # new.html.erb + opt = {:type => @item.mime_type, :disposition=>"inline"} + format.png { send_data(@item.restore, opt ) } + format.gif { send_data(@item.restore, opt ) } + format.jpeg { send_data(@item.restore, opt ) } + show_html_format format + show_prof_format format + show_json_format format end end - - # POST /system_pictures - # POST /system_pictures.json - def create - @imager = PettanImager.load set_image params[:system_picture][:file] - - respond_to do |format| - @system_picture = SystemPicture.store @imager - if @system_picture - format.html { redirect_to @system_picture, notice: 'system picture was successfully created.' } - format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt), status: :created, location: @system_picture } - else - format.html { render action: "new" } - format.json { render json: {}, status: :unprocessable_entity } - end - end + + def count + list_count end - + end