- def self.show cid, au
- opt = {}
- opt.merge!(GroundPicture.show_opt)
- res = GroundPicture.find(cid, opt)
- raise ActiveRecord::Forbidden unless res.visible?(au)
- res
+ def supply_default
+ self.x = 0
+ self.y = 0
+ self.repeat = 0
+ if self.panel
+ self.t = self.panel.new_t
+ self.z = self.panel.new_z
+ end
+ end
+
+ def overwrite pid
+ self.panel_id = pid
+ end
+
+ def style spot = nil, opacity = 20
+ r = {
+ 'position' => 'absolute', 'top' => '0px', 'left' => '0px', 'z-index' => self.z,
+ 'background-image' => "url(#{self.picture.url})",
+ 'background-repeat' => self.repeat_text,
+ 'background-position' => "#{self.x}px #{self.y}px"
+ }
+ self.merge_opacity(r, opacity) if spot and spot != self
+ r
+ end
+
+ def tmb_opt_img_tag
+ tw, th = PettanImager.thumbnail_size(self.picture.width, self.picture.height)
+ {:src => self.picture.url, :width => tw, :height => th, :alt => self.caption}
+ end
+
+ def symbol_option
+ self.tmb_opt_img_tag
+ end
+
+ def repeat_text
+ @@repeat_texts[self.repeat]
+ end
+
+ def self.public_list_where list
+ 'panels.publish > 0'