X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fpictures_controller.rb;h=1dd8e5bbb0134dc049a2c6b125a114c009d951dd;hb=3f39d78e1a786b269960e57530eed81802920e6c;hp=96f44b4c56a6291958e04152817609e2f28918ff;hpb=d85b46502d897da30c19df5b2978bcf05c82ef52;p=pettanr%2Fpettanr.git diff --git a/app/controllers/pictures_controller.rb b/app/controllers/pictures_controller.rb index 96f44b4c..1dd8e5bb 100644 --- a/app/controllers/pictures_controller.rb +++ b/app/controllers/pictures_controller.rb @@ -1,32 +1,54 @@ class PicturesController < ApplicationController - layout 'test' if MagicNumber['test_layout'] - before_filter :authenticate_user!, :only => [:show, :credit, :md5] - before_filter :authenticate_artist, :only => [:md5] - before_filter :authenticate_admin!, :only => [:list, :browse] + if Manifest.manifest.magic_numbers['run_mode'] == 0 + before_filter :authenticate_user, :only => [] + before_filter :authenticate_author, :only => [] + else + before_filter :authenticate_user, :only => [] + before_filter :authenticate_resource_reader, :only => [ + :show, :credit, :search + ] + before_filter :authenticate_author, :only => [] + end + before_filter :authenticate_admin, :only => [:index, :by_artist ] + + def index + filer_list + end + + def by_artist + filer_list + end + + def show_html_format format + format.html { + @item.boosts 'post' + @picture = @item + } + end def show - @picture = Picture.show(params[:id], @author) - + set_show respond_to do |format| - opt = {:type => @picture.mime_type, :disposition=>"inline"} - format.png { send_data(@picture.restore(params[:subdir]), opt ) } - format.gif { send_data(@picture.restore(params[:subdir]), opt ) } - format.jpeg { send_data(@picture.restore(params[:subdir]), opt ) } - format.html - format.json { render :json => @picture.to_json} + opt = {:type => @item.mime_type, :disposition=>"inline"} + format.png { send_data(@item.restore(params[:subdir]), opt ) } + format.gif { send_data(@item.restore(params[:subdir]), opt ) } + format.jpeg { send_data(@item.restore(params[:subdir]), opt ) } + show_html_format format + show_json_format format + show_prof_format format end end def credit - @picture = Picture.show(params[:id], @author) + @picture = Picture.show(params[:id], @operators) respond_to do |format| - format.html { render :layout => false } # show.html.erb + format.html { render :layout => false } format.json { render :json => @picture.to_json} end end - def md5 + def search @pictures = Picture.list_by_md5(params[:md5]) respond_to do |format| @@ -35,21 +57,4 @@ class PicturesController < ApplicationController end end - def list - @pictures = Picture.all - - respond_to do |format| - format.html { render layout: 'system' }# index.html.erb - format.json { render json: @pictures } - end - end - - def browse - @picture = Picture.find(params[:id]) - - respond_to do |format| - format.html { render layout: 'system' } # show.html.erb - format.json { render json: @picture } - end - end end