Browse files

tentative release

git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@898 7f39781d-f577-437e-ae19-be835c7a54ca
  • Loading branch information...
1 parent c4fdf77 commit 5f473aff6db57a18da7fce968e876a89fd852895 shish committed Jun 14, 2008
View
7 contrib/featured/main.php
@@ -49,10 +49,9 @@ public function receive_event($event) {
}
*/
- if(is_a($event, 'DisplayingImageEvent')) {
- global $user;
- if($user->is_admin()) {
- $this->theme->display_buttons($event->page, $event->image->id);
+ if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
+ if($event->user->is_admin()) {
+ $event->add_part($this->theme->get_buttons_html($event->image->id));
}
}
}
View
5 contrib/featured/theme.php
@@ -8,14 +8,13 @@ public function display_featured($page, $image) {
$page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3));
}
- public function display_buttons($page, $image_id) {
- $html = "
+ public function get_buttons_html($image_id) {
+ return "
<form action='".make_link("set_feature")."' method='POST'>
<input type='hidden' name='image_id' value='$image_id'>
<input type='submit' value='Featue This'>
</form>
";
- $page->add_block(new Block("Featured Image", $html, "left"));
}
}
?>
View
18 contrib/handle_flash/main.php
@@ -57,12 +57,18 @@ private function create_image_from_data($filename, $metadata) {
$image->tag_array = tag_explode($metadata['tags']);
$image->source = $metadata['source'];
- $rect = $this->swf_get_bounds($filename);
- if(is_null($rect)) {
- return $null;
- }
- $image->width = $rect[1];
- $image->height = $rect[3];
+ // redundant, since getimagesize() works on SWF o_O
+// $rect = $this->swf_get_bounds($filename);
+// if(is_null($rect)) {
+// return $null;
+// }
+// $image->width = $rect[1];
+// $image->height = $rect[3];
+
+ if(!($info = getimagesize($filename))) return null;
+
+ $image->width = $info[0];
+ $image->height = $info[1];
return $image;
}
View
7 contrib/regen_thumb/main.php
@@ -22,10 +22,9 @@ public function receive_event($event) {
}
}
- if(is_a($event, 'DisplayingImageEvent')) {
- global $user;
- if($user->is_admin()) {
- $this->theme->display_buttons($event->page, $event->image->id);
+ if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
+ if($event->user->is_admin()) {
+ $event->add_part($this->theme->get_buttons_html($event->image->id));
}
}
}
View
5 contrib/regen_thumb/theme.php
@@ -4,14 +4,13 @@ class RegenThumbTheme extends Themelet {
/*
* Show a form which offers to regenerate the thumb of an image with ID #$image_id
*/
- public function display_buttons($page, $image_id) {
- $html = "
+ public function get_buttons_html($image_id) {
+ return "
<form action='".make_link("regen_thumb")."' method='POST'>
<input type='hidden' name='image_id' value='$image_id'>
<input type='submit' value='Regenerate'>
</form>
";
- $page->add_block(new Block("Regen Thumb", $html, "left"));
}
/*
View
7 ext/admin/main.php
@@ -70,10 +70,9 @@ public function receive_event($event) {
}
}
- if(is_a($event, 'DisplayingImageEvent')) {
- global $user;
- if($user->is_admin()) {
- $this->theme->display_deleter($event->page, $event->image->id);
+ if(is_a($event, 'ImageAdminBlockBuildingEvent')) {
+ if($event->user->is_admin()) {
+ $event->add_part($this->theme->get_deleter_html($event->image->id));
}
}
View
4 ext/admin/theme.php
@@ -15,15 +15,15 @@ public function display_page($page) {
*
* $image_id = the image to delete
*/
- public function display_deleter($page, $image_id) {
+ public function get_deleter_html($image_id) {
$i_image_id = int_escape($image_id);
$html = "
<form action='".make_link("admin/delete_image")."' method='POST'>
<input type='hidden' name='image_id' value='$i_image_id'>
<input type='submit' value='Delete'>
</form>
";
- $page->add_block(new Block("Admin", $html, "left"));
+ return $html;
}
/*
View
19 ext/view/main.php
@@ -24,6 +24,21 @@ public function ImageInfoSetEvent($image_id) {
}
}
+class ImageAdminBlockBuildingEvent extends Event {
+ var $parts = array();
+ var $image = null;
+ var $user = null;
+
+ public function ImageAdminBlockBuildingEvent($image, $user) {
+ $this->image = $image;
+ $this->user = $user;
+ }
+
+ public function add_part($html, $position=50) {
+ while(isset($this->parts[$position])) $position++;
+ $this->parts[$position] = $html;
+ }
+}
class ViewImage extends Extension {
var $theme;
@@ -38,6 +53,10 @@ public function receive_event($event) {
if(!is_null($image)) {
send_event(new DisplayingImageEvent($image, $event->page));
+ $iabbe = new ImageAdminBlockBuildingEvent($image, $event->user);
+ send_event($iabbe);
+ ksort($iabbe->parts);
+ $this->theme->display_admin_block($event->page, $iabbe->parts);
}
else {
$this->theme->display_error($event->page, "Image not found", "No image in the database has the ID #$image_id");
View
6 ext/view/theme.php
@@ -12,6 +12,12 @@ public function display_page($page, $image, $editor_parts) {
$page->add_block(new Block(null, $this->build_pin($image->id), "main", 11));
}
+ public function display_admin_block($page, $parts) {
+ if(count($parts) > 0) {
+ $page->add_block(new Block("Image Admin", join("<br>", $parts), "left", 50));
+ }
+ }
+
var $pin = null;
View
4 index.php
@@ -1,7 +1,7 @@
<?php
// set up and purify the environment
-define("DEBUG", true);
-define("VERSION", '2.2.0-pre1');
+define("DEBUG", false);
+define("VERSION", '2.2.0');
require_once "core/util.inc.php";

0 comments on commit 5f473af

Please sign in to comment.