[pLog-svn] r5435 - in plog/branches/lifetype-1.2: class/gallery/dao js/tinymce/plugins/insertresource js/tinymce/plugins/insertresource/images templates/admin/chooser

oscar at devel.lifetype.net oscar at devel.lifetype.net
Wed May 23 17:26:05 EDT 2007


Author: oscar
Date: 2007-05-23 17:26:04 -0400 (Wed, 23 May 2007)
New Revision: 5435

Modified:
   plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php
   plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/editor_plugin.js
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/images/player.png
   plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template
Log:
If the resource is a FLV file (Flash Video), there will also be an "insert player" link next to it so that the video can be embedded in the post, YouTube style.


Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php	2007-05-23 19:48:01 UTC (rev 5434)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryresource.class.php	2007-05-23 21:26:04 UTC (rev 5435)
@@ -396,15 +396,18 @@
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE )
 				$previewFile = $fileName;
 			else
-				$previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $fileName );
+				$previewFile = str_replace( ".".$this->getFileExtension(), ".".$this->getThumbnailFormat(), $fileName );
 
 			return $previewFile;
 		}
 		
 		/**
-		 * @private
+		 * Returns the file extension
+		 *
+		 * @param toLower Whether the extension should be returned in lower case, false by default
+		 * @return The file extension
 		 */
-		function _getFileExtension()
+		function getFileExtension( $toLower = false )
 		{
 			$fileName = $this->getFileName();
 			if(( $extPos = strrpos( $fileName, "." )) !== false ) {					
@@ -438,7 +441,7 @@
 			if( $this->getThumbnailFormat() == THUMBNAIL_OUTPUT_FORMAT_SAME_AS_IMAGE )
 				$previewFile = $fileName;
 			else
-				$previewFile = str_replace( ".".$this->_getFileExtension(), ".".$this->getThumbnailFormat(), $fileName );
+				$previewFile = str_replace( ".".$this->getFileExtension(), ".".$this->getThumbnailFormat(), $fileName );
 
 			return $previewFile;
 		}

Modified: plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php	2007-05-23 19:48:01 UTC (rev 5434)
+++ plog/branches/lifetype-1.2/class/gallery/dao/galleryresources.class.php	2007-05-23 21:26:04 UTC (rev 5435)
@@ -59,6 +59,7 @@
         "divx" => GALLERY_RESOURCE_VIDEO,
 		"rm" => GALLERY_RESOURCE_VIDEO,
 		"swf" => GALLERY_RESOURCE_VIDEO,
+		"flv" => GALLERY_RESOURCE_VIDEO,
 		"qt" => GALLERY_RESOURCE_VIDEO,
         "pdf" => GALLERY_RESOURCE_DOCUMENT,
         "zip" => GALLERY_RESOURCE_ZIP
@@ -430,6 +431,7 @@
             lt_include( PLOG_CLASS_PATH."class/gallery/getid3/getid3.php" );            
             $getId3 = new GetID3();
             $metadata = $getId3->analyze( $upload->getTmpName());
+
             // nifty helper method from the getid3 package
             getid3_lib::CopyTagsToComments($metadata);
 

Modified: plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/editor_plugin.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/editor_plugin.js	2007-05-23 19:48:01 UTC (rev 5434)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/editor_plugin.js	2007-05-23 21:26:04 UTC (rev 5435)
@@ -154,10 +154,15 @@
 					}			
 					//window.alert("val = " + attribs["value"] + " - " + fileUrl);		
 					
-					// Insert image
+					// default values for height and width in case they were not defined (for some reason)
+					if( attribs["height"] == undefined )
+						attribs["height"] = 20;
+					if( attribs["width"] == undefined )
+						attribs["width"] = 320;
+					// Insert image						
 					var contentAfter = content.substring(endPos);
 					content = content.substring(0, startPos);
-					content += '<img width="320" height="20"';
+					content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
 					content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + fileUrl + '"';
 					content += ' alt="' + fileUrl + '" class="ltFlashPlayer" />' + content.substring(endPos);
 					content += contentAfter;
@@ -187,7 +192,11 @@
 
 					var embedHTML = '';
 					
-					embedHTML = getFlashPlayerHTML( attribs["alt"] );
+					if( attribs["height"] == undefined )
+						attribs["height"] = 20;
+					if( attribs["width"] == undefined )
+						attribs["width"] = 320;					
+					embedHTML = getFlashPlayerHTML( attribs["alt"], attribs["height"], attribs["width"] );
 
 					// Insert embed/object chunk
 					chunkBefore = content.substring(0, startPos);

Modified: plog/branches/lifetype-1.2/js/tinymce/plugins/insertresource/images/player.png
===================================================================
(Binary files differ)

Modified: plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template	2007-05-23 19:48:01 UTC (rev 5434)
+++ plog/branches/lifetype-1.2/templates/admin/chooser/resourcelist.template	2007-05-23 21:26:04 UTC (rev 5435)
@@ -143,7 +143,12 @@
     {/if}
   {/if}
   {if $resource->isSound()}
-      <a href="javascript:insertMediaPlayer('{$resourceDownloadLink}', '{$htmlarea}')">{$locale->tr("insert_player")}</a>
+      <a href="javascript:insertMediaPlayer('{$resourceDownloadLink}', '{$htmlarea}', '20', '300')">{$locale->tr("insert_player")}</a>
+  {elseif $resource->isVideo() && $resource->getFileExtension(true) == "flv"}
+      {assign var=metadata value=$resource->getMetadataReader()}
+      {assign var=height value=$metadata->getHeight()}
+      {assign var=width value=$metadata->getWidth()}
+      <a href="javascript:insertMediaPlayer('{$resourceDownloadLink}', '{$htmlarea}', '{$height}', '{$width}')">{$locale->tr("insert_player")}</a>
   {/if}
  </td>
 {/foreach}



More information about the pLog-svn mailing list