validates :z, :presence => true, :numericality => {:greater_than => 0}
validates :t, :presence => true, :numericality => {:greater_than_or_equal_to => 0}
+ def visible? au
+ if au == nil
+ return false if MagicNumber['run_mode'] == 1
+ elsif au.is_a?(Author)
+ elsif au.is_a?(Admin)
+ return true
+ else
+ return false
+ end
+ self.panel.publish?
+ end
+
def flip
res = (self.height > 0 ? '' : 'v') + (self.width > 0 ? '' : 'h')
res += '/' unless res.empty?
PanelPicture.find(:all, opt)
end
+ def self.show cid, au
+ opt = {}
+ opt.merge!(PanelPicture.show_opt)
+ res = PanelPicture.find(cid, opt)
+ raise ActiveRecord::Forbidden unless res.visible?(au)
+ res
+ end
+
+ def self.show_opt
+ {:include => {:panel => {:author => {}}, :picture => {:artist => {}, :license => {}}}}
+ end
+
+ def self.show_json_opt
+ {:include => {:panel => {:include => {:author => {}}}, :picture => {:include => {:artist => {}, :license => {}}} }}
+ end
+
end