tentative release
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.2@898 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
		
							parent
							
								
									c4fdf771ee
								
							
						
					
					
						commit
						5f473aff6d
					
				| @ -49,10 +49,9 @@ class Featured extends Extension { | |||||||
| 		} | 		} | ||||||
| 		*/ | 		*/ | ||||||
| 
 | 
 | ||||||
| 		if(is_a($event, 'DisplayingImageEvent')) { | 		if(is_a($event, 'ImageAdminBlockBuildingEvent')) { | ||||||
| 			global $user; | 			if($event->user->is_admin()) { | ||||||
| 			if($user->is_admin()) { | 				$event->add_part($this->theme->get_buttons_html($event->image->id)); | ||||||
| 				$this->theme->display_buttons($event->page, $event->image->id); |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -8,14 +8,13 @@ class FeaturedTheme extends Themelet { | |||||||
| 		$page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3)); | 		$page->add_block(new Block("Featured Image", $this->build_thumb_html($image), "left", 3)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public function display_buttons($page, $image_id) { | 	public function get_buttons_html($image_id) { | ||||||
| 		$html = " | 		return " | ||||||
| 			<form action='".make_link("set_feature")."' method='POST'> | 			<form action='".make_link("set_feature")."' method='POST'> | ||||||
| 			<input type='hidden' name='image_id' value='$image_id'> | 			<input type='hidden' name='image_id' value='$image_id'> | ||||||
| 			<input type='submit' value='Featue This'> | 			<input type='submit' value='Featue This'> | ||||||
| 			</form> | 			</form> | ||||||
| 		";
 | 		";
 | ||||||
| 		$page->add_block(new Block("Featured Image", $html, "left")); |  | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| ?>
 | ?>
 | ||||||
|  | |||||||
| @ -57,12 +57,18 @@ class FlashFileHandler extends Extension { | |||||||
| 		$image->tag_array = tag_explode($metadata['tags']); | 		$image->tag_array = tag_explode($metadata['tags']); | ||||||
| 		$image->source    = $metadata['source']; | 		$image->source    = $metadata['source']; | ||||||
| 
 | 
 | ||||||
| 		$rect = $this->swf_get_bounds($filename); | 		// redundant, since getimagesize() works on SWF o_O
 | ||||||
| 		if(is_null($rect)) { | //		$rect = $this->swf_get_bounds($filename);
 | ||||||
| 			return $null; | //		if(is_null($rect)) {
 | ||||||
| 		} | //			return $null;
 | ||||||
| 		$image->width = $rect[1]; | //		}
 | ||||||
| 		$image->height = $rect[3]; | //		$image->width = $rect[1];
 | ||||||
|  | //		$image->height = $rect[3];
 | ||||||
|  | 		 | ||||||
|  | 		if(!($info = getimagesize($filename))) return null; | ||||||
|  | 
 | ||||||
|  | 		$image->width = $info[0]; | ||||||
|  | 		$image->height = $info[1]; | ||||||
| 
 | 
 | ||||||
| 		return $image; | 		return $image; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -22,10 +22,9 @@ class RegenThumb extends Extension { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if(is_a($event, 'DisplayingImageEvent')) { | 		if(is_a($event, 'ImageAdminBlockBuildingEvent')) { | ||||||
| 			global $user; | 			if($event->user->is_admin()) { | ||||||
| 			if($user->is_admin()) { | 				$event->add_part($this->theme->get_buttons_html($event->image->id)); | ||||||
| 				$this->theme->display_buttons($event->page, $event->image->id); |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -4,14 +4,13 @@ class RegenThumbTheme extends Themelet { | |||||||
| 	/* | 	/* | ||||||
| 	 * Show a form which offers to regenerate the thumb of an image with ID #$image_id
 | 	 * Show a form which offers to regenerate the thumb of an image with ID #$image_id
 | ||||||
| 	 */ | 	 */ | ||||||
| 	public function display_buttons($page, $image_id) { | 	public function get_buttons_html($image_id) { | ||||||
| 		$html = " | 		return " | ||||||
| 			<form action='".make_link("regen_thumb")."' method='POST'> | 			<form action='".make_link("regen_thumb")."' method='POST'> | ||||||
| 			<input type='hidden' name='image_id' value='$image_id'> | 			<input type='hidden' name='image_id' value='$image_id'> | ||||||
| 			<input type='submit' value='Regenerate'> | 			<input type='submit' value='Regenerate'> | ||||||
| 			</form> | 			</form> | ||||||
| 		";
 | 		";
 | ||||||
| 		$page->add_block(new Block("Regen Thumb", $html, "left")); |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* | 	/* | ||||||
|  | |||||||
| @ -70,10 +70,9 @@ class AdminPage extends Extension { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if(is_a($event, 'DisplayingImageEvent')) { | 		if(is_a($event, 'ImageAdminBlockBuildingEvent')) { | ||||||
| 			global $user; | 			if($event->user->is_admin()) { | ||||||
| 			if($user->is_admin()) { | 				$event->add_part($this->theme->get_deleter_html($event->image->id)); | ||||||
| 				$this->theme->display_deleter($event->page, $event->image->id); |  | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ class AdminPageTheme extends Themelet { | |||||||
| 	 * | 	 * | ||||||
| 	 * $image_id = the image to delete | 	 * $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); | 		$i_image_id = int_escape($image_id); | ||||||
| 		$html = " | 		$html = " | ||||||
| 			<form action='".make_link("admin/delete_image")."' method='POST'> | 			<form action='".make_link("admin/delete_image")."' method='POST'> | ||||||
| @ -23,7 +23,7 @@ class AdminPageTheme extends Themelet { | |||||||
| 				<input type='submit' value='Delete'> | 				<input type='submit' value='Delete'> | ||||||
| 			</form> | 			</form> | ||||||
| 		";
 | 		";
 | ||||||
| 		$page->add_block(new Block("Admin", $html, "left")); | 		return $html; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* | 	/* | ||||||
|  | |||||||
| @ -24,6 +24,21 @@ class ImageInfoSetEvent extends Event { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 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 { | class ViewImage extends Extension { | ||||||
| 	var $theme; | 	var $theme; | ||||||
| 
 | 
 | ||||||
| @ -38,6 +53,10 @@ class ViewImage extends Extension { | |||||||
| 
 | 
 | ||||||
| 			if(!is_null($image)) { | 			if(!is_null($image)) { | ||||||
| 				send_event(new DisplayingImageEvent($image, $event->page)); | 				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 { | 			else { | ||||||
| 				$this->theme->display_error($event->page, "Image not found", "No image in the database has the ID #$image_id"); | 				$this->theme->display_error($event->page, "Image not found", "No image in the database has the ID #$image_id"); | ||||||
|  | |||||||
| @ -12,6 +12,12 @@ class ViewTheme extends Themelet { | |||||||
| 		$page->add_block(new Block(null, $this->build_pin($image->id), "main", 11)); | 		$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; | 	var $pin = null; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user