OSDN Git Service

fix Manifest
[pettanr/pettanr.git] / app / controllers / system_pictures_controller.rb
index 7b6da92..58bd89b 100644 (file)
@@ -1,47 +1,43 @@
 class SystemPicturesController < ApplicationController
-  layout 'test' if MagicNumber['test_layout']
-  if MagicNumber['run_mode'] == 0
+  if Manifest.manifest.magic_numbers['run_mode'] == 0
     before_filter :authenticate_user, :only => []
     before_filter :authenticate_author, :only => []
   else
-    before_filter :authenticate_resource_reader, :only => [:index, :show]
+    before_filter :authenticate_resource_reader, :only => [:index, :show, :speech_balloon_templates, :licenses]
     before_filter :authenticate_user, :only => []
     before_filter :authenticate_author, :only => []
   end
   before_filter :authenticate_admin!, :only => [:list, :browse, :new, :create]
 
-  # GET /system_pictures
-  # GET /system_pictures.json
+  def self.model
+    SystemPicture
+  end
+  
   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 {
-        @paginate = SystemPicture.list_paginate(@page, @page_size)
-        render :template => 'system/filer', :locals => {
-          :items => @system_pictures, :model => SystemPicture, 
-          :roles => [@user, @admin], :pager => @paginate
-        }
-      }
-      format.json { render json: @system_pictures.to_json(SystemPicture.list_json_opt) }
-    end
+    public_list
   end
-
-  # GET /system_pictures/1
-  # GET /system_pictures/1.json
+  
+  def speech_balloon_templates
+    has_many_list
+  end
+  
+  def licenses
+    has_many_list
+  end
+  
   def show
-    @system_picture = SystemPicture.show(params[:id], [@user, @admin, @demand_user])
+    @item = SystemPicture.show(params[:id], @operators)
     
     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.prof  { render :template => 'top/prof', :layout => true }
-      format.json { render json: @system_picture.to_json(SystemPicture.show_json_opt)}
+      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 ) }
+      format.html {
+        @system_picture = @item
+      }
+      format_prof format
+      format.json { render json: @item.to_json(SystemPicture.show_json_opt)}
     end
   end