Browse Source

Solve path problem when uploading media with fckeditor if url_append != "" - ref#3933

Hubert Borderiou 13 years ago
parent
commit
7c02aa60fa

+ 5 - 2
main/inc/lib/fckeditor/editor/dialog/fck_flash/fck_flash.js

@@ -233,9 +233,12 @@ function BrowseServer()
 
 function SetUrl( url, width, height )
 {
-	// Added by Ivan Tcholakov.
-	//url = FCK.GetSelectedUrl( url ) ;
 	url = FCK.GetSelectedFlashUrl( url ) ;
+	// search the URLPrefix like it is the configuration.php file
+	PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/dialog\/fck_flash.\html/, "");
+	PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");
+	url = PrefixeUrl + url ;
+	// 
 
 	GetE('txtUrl').value = url ;
 

+ 16 - 9
main/inc/lib/fckeditor/editor/dialog/fck_image/fck_image.js

@@ -33,13 +33,13 @@ var FCKTools	= oEditor.FCKTools ;
 window.document.dir = FCKLang.Dir ;
 
 // We have to avoid javascript errors if some language variables have not been defined.
-FCKLang['UploadSelectFileFirst']    = FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
+FCKLang['UploadSelectFileFirst'] = FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
 FCKLang['FileSuccessfullyUploaded'] = FCKLang['FileSuccessfullyUploaded'] ? FCKLang['FileSuccessfullyUploaded'] : 'Your file has been successfully uploaded.' ;
-FCKLang['FileRenamed']              = FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
-FCKLang['InvalidFileType']          = FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
-FCKLang['SecurityError']            = FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
-FCKLang['ConnectorDisabled']        = FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
-FCKLang['UploadError']              = FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
+FCKLang['FileRenamed'] = FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
+FCKLang['InvalidFileType'] = FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
+FCKLang['SecurityError'] = FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
+FCKLang['ConnectorDisabled'] = FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
+FCKLang['UploadError'] = FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
 
 var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ;
 
@@ -77,10 +77,13 @@ var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ;
 
 var oImageOriginal ;
 
-function UpdateOriginal( resetSize ) {
+function UpdateOriginal( resetSize )
+{
 	if ( !eImgPreview )
 		return ;
-	if ( GetE('txtUrl').value.length == 0 ) {
+
+	if ( GetE('txtUrl').value.length == 0 )
+	{
 		oImageOriginal = null ;
 		return ;
 	}
@@ -433,8 +436,12 @@ var sActualBrowser ;
 
 function SetUrl( url, width, height, alt )
 {
-	// Added by Ivan Tcholakov.
 	url = FCK.GetSelectedUrl ( url ) ;
+	// search the URLPrefix like it is the configuration.php file
+	PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/dialog\/fck_image.\html/, "");
+	PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");
+	url = PrefixeUrl + url ;
+	// 
 
 	if ( sActualBrowser == 'Link' )
 	{

+ 13 - 1
main/inc/lib/fckeditor/editor/dialog/fck_link/fck_link.js

@@ -811,7 +811,19 @@ function BrowseServer()
 
 function SetUrl( url )
 {
-	url = FCK.GetSelectedUrl ( url ) ;
+    
+//	url = FCK.GetSelectedUrl ( url ) ;
+    url = FCK.GetUrl( url, FCK.SEMI_ABSOLUTE_URL ) ;
+    PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/dialog\/fck_link\.html/, "");
+    PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "")
+    // if url_append in configuration file != "" (see ticket ref #3933)
+    if (PrefixeUrl != "") {
+        url = PrefixeUrl + url;
+    }
+    else {
+        url = FCK.GetSelectedUrl ( url ) ;
+    }
+    
 	GetE('cmbLinkProtocol').value = '' ;
 
 	GetE('txtUrl').value = url ;

+ 16 - 13
main/inc/lib/fckeditor/editor/filemanager/connectors/php/config.php

@@ -21,7 +21,6 @@
  *
  * Configuration file for the File Manager Connector for PHP.
  */
-
 // Modifications by Ivan Tcholakov, JUN-2009.
 
 // Some language variables are needed.
@@ -47,36 +46,40 @@ if (api_is_in_course()) {
 	if (!api_is_in_group()) {
 		// 1. We are inside a course and not in a group.
 		if (api_is_allowed_to_edit()) {
-			$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/';
+			//			$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/';
+			$Config['UserFilesPath'] = '/'.$_configuration['course_folder'].api_get_course_path().'/document/'; // 
 		} else {
-			// 1.2. Student	
+			// 1.2. Student
 			$current_session_id = api_get_session_id();
-			if($current_session_id==0)
-			{
-				$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';
+			if($current_session_id==0) {
+				// $Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/'; // 
+					$Config['UserFilesPath'] = '/'.$_configuration['course_folder'].api_get_course_path().'/document/shared_folder/sf_user_'.api_get_user_id().'/';//
 			}
-			else
-			{
-				$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';		
+			else {
+				// $Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';						
+				$Config['UserFilesPath'] = '/'.$_configuration['course_folder'].api_get_course_path().'/document/shared_folder_session_'.$current_session_id.'/sf_user_'.api_get_user_id().'/';		
 			}
 		}
 	} else {
 		// 2. Inside a course and inside a group.
 		global $group_properties;
-		$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/';
+		//		$Config['UserFilesPath'] = api_get_path(REL_COURSE_PATH).api_get_course_path().'/document'.$group_properties['directory'].'/'; // 
+		$Config['UserFilesPath'] = '/'.$_configuration['course_folder'].api_get_course_path().'/document'.$group_properties['directory'].'/';//
 	}
 } else {
 	if (api_is_platform_admin() && $_SESSION['this_section'] == 'platform_admin') {
 		// 3. Platform administration activities.
-		$Config['UserFilesPath'] = api_get_path(REL_PATH).'home/default_platform_document/';
+		//		$Config['UserFilesPath'] = api_get_path(REL_PATH).'home/default_platform_document/';//
+		$Config['UserFilesPath'] = '/home/default_platform_document/';//
 	} else {
 		// 4. The user is outside courses.
-        $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'rel');
-		$Config['UserFilesPath'] = $my_path['dir'].'my_files/';
+    $my_path = UserManager::get_user_picture_path_by_id(api_get_user_id(),'rel');
+		$Config['UserFilesPath'] = $my_path['dir'].'my_files/';		
 	}
 }
 
 
+
 // Fill the following value it you prefer to specify the absolute path for the
 // user files directory. Useful if you are using a virtual directory, symbolic
 // link or alias. Examples: 'C:\\MySite\\userfiles\\' or '/root/mysite/userfiles/'.

+ 6 - 1
main/inc/lib/fckeditor/editor/filemanager/connectors/php/io.php

@@ -20,6 +20,7 @@
  * == END LICENSE ==
  *
  * This is the File Manager Connector for PHP.
+
  */
 function CombinePaths( $sBasePath, $sFolder )
 {
@@ -126,6 +127,7 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
 		else
 		{
 			$permissions = 0777 ;
+			// $permissions = 0770 ;
 			if ( isset( $Config['ChmodOnFolderCreate'] ) )
 			{
 				$permissions = $Config['ChmodOnFolderCreate'] ;
@@ -149,7 +151,10 @@ function CreateServerFolder( $folderPath, $lastFolder = null )
 				$to_group_id = $group_properties['id'];
 			}
 
-			$folder_path = substr($folderPath, strpos($folderPath, $repository_path) + strlen($repository_path) - 1);
+			$folder_path=preg_replace("/^.*".TOOL_DOCUMENT."/", "", $folderPath);	// 
+			$folder_path=preg_replace("/\/$/", "", $folder_path);	// should be done in 1 regexp I guess ... 
+			// $folder_path = substr($folderPath, strpos($folderPath, $repository_path) + strlen($repository_path) - 1);
+			
 			$folder_name = explode('/', $folder_path);
 			$folder_name = $folder_name[count($folder_name) - 1];
 			$doc_id = add_document($_course, $folder_path, 'folder', 0, $folder_name);

+ 15 - 2
main/inc/lib/fckeditor/editor/plugins/ImageManager/images.php

@@ -50,11 +50,24 @@ function drawFiles($list, &$manager)
 {
 	global $relative;
 	global $IMConfig;
-
+	// add filename with course code in it
+	// here filename is images/gallery/COMES.jpg
+	// it should be /chamilo1884url/courses/COURSTESTSIMSUURLAPP/document/
+	
+	global $_configuration;	// 
+
+	//var topDoc = window.top.document;
+		
 	foreach($list as $entry => $file)
-	{ ?>
+	{ 
+		$chamiloPath = '/'.$_configuration['url_append'].'/courses/'.api_get_course_path().'/document'.$file['relative']; // 
+		// 
+		?>
 		<td><table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">
+		<!-- change <?php echo $file['relative'];?> with <?php echo $chamiloPath; ?>
 		<a href="javascript: void(0);" onclick="selectImage('<?php echo $file['relative'];?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a>
+		-->
+		<a href="javascript: void(0);" onclick="selectImage('<?php echo $chamiloPath; ?>', '<?php echo $entry; ?>', <?php echo $file['image'][0];?>, <?php echo $file['image'][1]; ?>);"title="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"><img src="<?php echo $manager->getThumbnail($file['relative']); ?>" alt="<?php echo $entry; ?> - <?php echo Files::formatSize($file['stat']['size']); ?>"/></a>
 		</td></tr><tr><td class="edit" style="padding-top: 5px;">
 		<?php if ($IMConfig['allow_delete']) { ?>
 			<a href="images.php?dir=<?php echo $relative; ?>&amp;delf=<?php echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<?php echo $entry; ?>');"><img src="img/edit_trash.gif" height="15" width="15" alt="Trash"/></a>

+ 8 - 3
main/inc/lib/fckeditor/editor/plugins/MP3/fck_mp3.js

@@ -47,7 +47,7 @@ if ( oFakeImage )
 }
 
 function window_onload(tab_to_select)
-{ 
+{
 	// Translate the dialog box texts.
 	oEditor.FCKLanguageManager.TranslatePage(document) ;
 
@@ -123,7 +123,6 @@ function LoadSelection()
 //#### The OK button was hit.
 function Ok()
 {
-	
 	if ( GetE('mpUrl').value.length == 0 )
 	{
 		window.parent.SetSelectedTab( 'Info' ) ;
@@ -200,7 +199,8 @@ function updateMovie(e)
 }
 
 var ePreview ;
-function SetPreviewElement( previewEl ) {
+function SetPreviewElement( previewEl )
+{
 	ePreview = previewEl ;
 
 	if ( GetE('mpUrl').value.length > 0 )
@@ -238,6 +238,11 @@ function BrowseServer()
 
 function SetUrl( url )
 {
+	PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/plugins\/MP3\/fck_mp3.\html/, "");
+	PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");
+	url = PrefixeUrl + url;
+	// 
+
 	document.getElementById('mpUrl').value = url ;
 	//updatePreview();
 	Ok();

+ 32 - 14
main/inc/lib/fckeditor/editor/plugins/audio/fck_audio.js

@@ -32,13 +32,13 @@ var FCKTools	= oEditor.FCKTools ;
 window.document.dir = FCKLang.Dir ;
 
 // We have to avoid javascript errors if some language variables have not been defined.
-FCKLang['UploadSelectFileFirst']	= FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
+FCKLang['UploadSelectFileFirst'] = FCKLang['UploadSelectFileFirst'] ? FCKLang['UploadSelectFileFirst'] : 'Please, select a file before pressing the upload button.' ;
 FCKLang['FileSuccessfullyUploaded'] = FCKLang['FileSuccessfullyUploaded'] ? FCKLang['FileSuccessfullyUploaded'] : 'Your file has been successfully uploaded.' ;
-FCKLang['FileRenamed']				= FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
-FCKLang['InvalidFileType']			= FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
-FCKLang['SecurityError']				= FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
-FCKLang['ConnectorDisabled']		= FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
-FCKLang['UploadError']				= FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
+FCKLang['FileRenamed'] = FCKLang['FileRenamed'] ? FCKLang['FileRenamed'] : 'A file with the same name is already available. The uploaded file has been renamed to ' ;
+FCKLang['InvalidFileType'] = FCKLang['InvalidFileType'] ? FCKLang['InvalidFileType'] : 'Invalid file type.' ;
+FCKLang['SecurityError'] = FCKLang['SecurityError'] ? FCKLang['SecurityError'] : 'Security error. You probably don\'t have enough permissions to upload. Please check your server.' ;
+FCKLang['ConnectorDisabled'] = FCKLang['ConnectorDisabled'] ? FCKLang['ConnectorDisabled'] : 'The upload feature (connector) is disabled.' ;
+FCKLang['UploadError'] = FCKLang['UploadError'] ? FCKLang['UploadError'] : 'Error on file upload. Error number: ' ;
 
 //#### Dialog Tabs
 
@@ -65,18 +65,21 @@ lib_path = FCK.GetUrl( lib_path, FCK.SEMI_ABSOLUTE_URL ) ;
 // This is the semi-absolute URL of the audio player.
 var player = lib_path + 'mediaplayer/player.swf' ;
 
+
 // Get the selected audio (if available).
 var oFakeImage = dialog.Selection.GetSelectedElement() ;
 var oEmbed ;
 
-if ( oFakeImage ) {
+if ( oFakeImage )
+{
 	if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckmp3') )
 		oEmbed = FCK.GetRealElement( oFakeImage ) ;
 	else
 		oFakeImage = null ;
 }
 
-window.onload = function() {
+window.onload = function()
+{
 	// Translate the dialog box texts.
 	oEditor.FCKLanguageManager.TranslatePage(document) ;
 
@@ -98,7 +101,8 @@ window.onload = function() {
 	SelectField( 'txtUrl' ) ;
 }
 
-function LoadSelection() {
+function LoadSelection()
+{
 	if ( ! oEmbed ) return ;
 
 	var flashvars = GetAttribute( oEmbed, 'flashvars', '' ).toString() ;
@@ -130,8 +134,8 @@ function LoadSelection() {
 }
 
 //#### The OK button was hit.
-function Ok() {
-	
+function Ok()
+{
 	if ( GetE('txtUrl').value.length == 0 )
 	{
 		dialog.SetSelectedTab( 'Info' ) ;
@@ -177,13 +181,16 @@ function UpdateEmbed( e )
 
 var ePreview ;
 
-function SetPreviewElement( previewEl ) {
+function SetPreviewElement( previewEl )
+{
 	ePreview = previewEl ;
+
 	if ( GetE( 'txtUrl' ).value.length > 0 )
 		UpdatePreview() ;
 }
 
-function UpdatePreview() {	
+function UpdatePreview()
+{
 	if ( !ePreview )
 		return;
 
@@ -221,10 +228,21 @@ function BrowseServer()
 	OpenFileBrowser( FCKConfig.MP3BrowserURL, FCKConfig.MP3BrowserWindowWidth, FCKConfig.MP3BrowserWindowHeight ) ;
 }
 
-function SetUrl( url ) {	
+function SetUrl( url )
+{
+	//url = FCK.GetSelectedUrl( url ) ;
 	url = FCK.GetUrl( url, FCK.SEMI_ABSOLUTE_URL ) ;
+
+	PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/plugins\/audio\/fck_audio.\html/, "");
+	PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");
+	url = PrefixeUrl + url;
+	// 
+
+
 	GetE('txtUrl').value = url ;
+
 	UpdatePreview() ;
+
 	dialog.SetSelectedTab( 'Info' ) ;
 }
 

+ 5 - 1
main/inc/lib/fckeditor/editor/plugins/fckEmbedMovies/fck_embedmovies.js

@@ -280,7 +280,11 @@ function BrowseServer()
 function SetUrl( url )
 {
 	url = FCK.GetSelectedUrl( url ) ;
-
+	PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/plugins\/fckEmbedMovies\/fck_embedmovies.\html/, "");
+	PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");	
+	url = PrefixeUrl + url;
+	// 
+	
 	GetE( 'txtUrl' ).value = url ;
 
 	dialog.SetSelectedTab( 'Info' ) ;

+ 106 - 54
main/inc/lib/fckeditor/editor/plugins/flvPlayer/flvPlayer.js

@@ -365,6 +365,10 @@ var sActualBrowser ;
 function SetUrl( url ) {
 
     url = FCK.GetUrl( url, FCK.SEMI_ABSOLUTE_URL ) ;
+		PrefixeUrl = self.location.href.replace(/\/main\/inc\/lib\/fckeditor\/editor\/plugins\/flvPlayer\/flvPlayer\.html/, "");
+		PrefixeUrl = PrefixeUrl.replace(/http:\/\/[^\/]+/, "");
+		url = PrefixeUrl + url;
+		// 
 
     if ( sActualBrowser == 'flv' )
     {
@@ -448,37 +452,44 @@ Media.prototype.setAttribute = function( attr, val )
     }
 } ;
 
-Media.prototype.getInnerHTML = function ( objectId ) {
-	
+Media.prototype.getInnerHTML = function ( objectId )
+{
     var embeddingMethod = FCKConfig[ 'FlashEmbeddingMethod' ];
+
     var randomnumber = Math.floor( Math.random() * 1000001 ) ;
     var thisWidth = this.width ;
     var thisHeight = this.height ;
 
     var thisMediaType = 'single' ;
-    if ( !GetE( 'rbFileType' ).checked ) {
+    if ( !GetE( 'rbFileType' ).checked )
+    {
         thisMediaType = 'mpl' ;
     }
 
     // Alignment
     var cssalign = '' ;
     var cssfloat = '' ;
-    if ( this.align == 'center') {
+    if ( this.align == 'center' )
+    {
         cssalign = 'margin-left: auto;margin-right: auto;' ;
-    } else if ( this.align == 'right' ) {
+    }
+    else if ( this.align == 'right' )
+    {
         cssfloat = 'float: right;' ;
-    } else if ( this.align == 'left' ) {
+    }
+    else if ( this.align == 'left' )
+    {
         cssfloat = 'float: left;' ;
     }
 
-    var s = '';
+    var s = '' ;
 
-    s += '\n';
-	
+    s += '\n' ;
     s += '<div id="player' + randomnumber + '-parent" style="text-align: center;' + cssfloat + '">\n';
     s += '<div style="border-style: none; height: ' + thisHeight + 'px; width: ' + thisWidth + 'px; overflow: hidden; background-color: rgb(220, 220, 220); ' + cssalign + '">' ;
-	
-    if (embeddingMethod == 'swfobject') {
+
+    if (embeddingMethod == 'swfobject')
+    {
         s += '<script src="' + FCKConfig.ScriptSWFObject + '" type="text/javascript"></script>\n' ;
     }
 
@@ -486,26 +497,28 @@ Media.prototype.getInnerHTML = function ( objectId ) {
 
     // A hidden div containing setting, added width, height, overflow for MSIE7
     s += '<div id="player' + randomnumber + '-config" style="display: none; visibility: hidden; width: 0px; height: 0px; overflow: hidden;">' ;
-	
-    // Save settings
-	 
-	//this prints extra params see #4217
-    for ( var i in this ) {
+    // Save settings.
+    for ( var i in this )
+    {
         if ( !i || !this[i] ) continue ;
-            if ( !i.match( /(set|get)/ ) ) {
-                //s += i + '=' + this[i] + ' ' ;
-			}
+            if ( !i.match( /(set|get)/ ) )
+            {
+                s += i + '=' + this[i] + ' ' ;
+            }
     }
-    s += '</div>' ;	
+    s += '</div>' ;
 
     // The player's area.
     s += '<div id="player' + randomnumber + '">' ;
 
-    if ( embeddingMethod == 'swfobject' ) {
+    if ( embeddingMethod == 'swfobject' )
+    {
         s += '<a href="http://www.macromedia.com/go/getflashplayer" target="_blank">Get the Flash Player</a> to see this video.' ;
+
     }
 
-    if (embeddingMethod == 'object' || embeddingMethod == 'adobe' ) {
+    if ( embeddingMethod == 'object' || embeddingMethod == 'adobe' )
+    {
         var p = '' ; // Parameters.
         var v = '' ; // Variables.
 
@@ -516,71 +529,105 @@ Media.prototype.getInnerHTML = function ( objectId ) {
         p += '<param name="allowfullscreen" value="' + this.fullscreen + '" />' ;
 
         v += 'width=' + thisWidth + '&amp;' ;
-        v += 'height=' + thisHeight + '&amp;';
-        v += 'autostart=' + this.play + '&amp;';
+        v += 'height=' + thisHeight + '&amp;' ;
+        v += 'autostart=' + this.play + '&amp;' ;
 
-        if ( thisMediaType == 'mpl' ) {
-            v += 'file=' + this.purl + '&amp;';
-            v += 'autoscroll=true&amp;';
-            p += 'allowscriptaccess="always" ';
+        if ( thisMediaType == 'mpl' )
+        {
+            v += 'file=' + this.purl + '&amp;' ;
+            v += 'autoscroll=true&amp;' ;
+            p += 'allowscriptaccess="always" ' ;
             p += '<param name="allowscriptaccess" value="always" />' ;
 
             var dispWidth = thisWidth ;
             var dispHeight = thisHeight ;
             var dispThumbs = false ;
 
-            if ( this.dispPlaylist != 'none' ) {
-                if ( this.dispPlaylist == 'right' ) {
-                    if ( this.playlistDim.length > 0 ) {
+            if ( this.dispPlaylist != 'none' )
+            {
+                if ( this.dispPlaylist == 'right' )
+                {
+                    if ( this.playlistDim.length > 0 )
+                    {
                         dispWidth = thisWidth - this.playlistDim ;
-                        if ( this.playlistDim < 100 ) {
+                        if ( this.playlistDim < 100 )
+                        {
                             dispThumbs = false ;
-						} else {
+                        }
+                        else
+                        {
                             dispThumbs = true ;
                         }
-                    } else {
-                        if ( thisWidth >= 550 ) {
+                    }
+                    else
+                    {
+                        if ( thisWidth >= 550 )
+                        {
                             dispWidth = thisWidth - 200 ;
                             dispThumbs = true ;
-                        } else if ( thisWidth >= 450 ) {
+                        }
+                        else if ( thisWidth >= 450 )
+                        {
                             dispWidth = thisWidth - 100 ;
                             dispThumbs = false ;
-                        } else if ( thisWidth >= 350 ) {
+                        }
+                        else if ( thisWidth >= 350 )
+                        {
                             dispWidth = thisWidth - 50 ;
                             dispThumbs = false ;
                         }
                     }
+
                     v += 'displaywidth=' + dispWidth + '&amp;' ;
-                } else if ( this.dispPlaylist == 'below' ) {
+                }
+                else if ( this.dispPlaylist == 'below' )
+                {
                     dispThumbs = true ;
-                    if ( this.playlistDim.length > 0 ) {
+
+                    if ( this.playlistDim.length > 0 )
+                    {
                         dispHeight = thisWidth - this.playlistDim ;
-                    } else {
-                        if ( thisHeight >= 550 ) {
+                    }
+                    else
+                    {
+                        if ( thisHeight >= 550 )
+                        {
                             dispHeight = thisWidth - 200 ;
-                        } else if ( thisHeight >= 450 ) {
+                        }
+                        else if ( thisHeight >= 450 )
+                        {
                             dispHeight = thisHeight - 150 ;
-                        } else if ( thisHeight >= 350 ) {
+                        }
+                        else if ( thisHeight >= 350 )
+                        {
                             dispHeight = thisHeight - 100 ;
                         }
                     }
+
                     v += 'displayheight=' + dispHeight + '&amp;' ;
                 }
 
-                if ( this.playlistThumbs == 'false' ) {
+                if ( this.playlistThumbs == 'false' )
+                {
                     dispThumbs = false ;
                 }
+
                 v += 'thumbsinplaylist=' + dispThumbs + '&amp;' ;
             }
 
             v += 'shuffle=false&amp;' ;
-            if (this.loop) {
+            if (this.loop)
+            {
                 v += 'repeat=list&amp;' ;
-            } else {
+            }
+            else
+            {
                 v += 'repeat=' + this.loop + '&amp;' ;
             }
             //v += 'transition=bgfade&amp;' ;
-        } else {
+        }
+        else
+        {
             v += 'file=' + this.url + '&amp;' ;
             v += 'repeat=' + this.loop + '&amp;' ;
             v += 'image=' + this.iurl + '&amp;' ;
@@ -590,36 +637,41 @@ Media.prototype.getInnerHTML = function ( objectId ) {
         v += 'link=' + this.url + '&amp;' ;
 
         v += 'showdigits=' + this.displayDigits + '&amp;' ;
-        v += 'shownavigation=' + this.displayNavigation + '&amp;';		
+        v += 'shownavigation=' + this.displayNavigation + '&amp;' ;
+
 
         // SET THE COLOR OF THE TOOLBAR
         var colorChoice1 = this.toolcolor ;
-        if ( colorChoice1.length > 0 ) {
+        if ( colorChoice1.length > 0 )
+        {
             colorChoice1 = colorChoice1.replace( '#', '0x' ) ;
             v += 'backcolor=' + colorChoice1 + '&amp;' ;
         }
         // SET THE COLOR OF THE TOOLBARS TEXT AND BUTTONS
         var colorChoice2 = this.tooltcolor ;
-        if ( colorChoice2.length > 0 ) {
+        if ( colorChoice2.length > 0 )
+        {
             colorChoice2 = colorChoice2.replace( '#', '0x' ) ;
             v += 'frontcolor=' + colorChoice2 + '&amp;' ;
         }
         // SET COLOR OF ROLLOVER TEXT AND BUTTONS
         var colorChoice3 = this.tooltrcolor ;
-        if ( colorChoice3.length > 0 ) {
+        if ( colorChoice3.length > 0 )
+        {
             colorChoice3 = colorChoice3.replace( '#', '0x' ) ;
             v += 'lightcolor=' + colorChoice3 + '&amp;' ;
         }
-		
         // SET COLOR OF BACKGROUND
         var colorChoice4 = this.bgcolor ;
-        if ( colorChoice4.length > 0 ) {
+        if ( colorChoice4.length > 0 )
+        {
             colorChoice4 = colorChoice4.replace( '#', '0x' ) ;
             v += 'screencolor=' + colorChoice4 + '&amp;' ;
         }
 
         v += 'logo=' + this.wmurl + '&amp;' ;
-        if ( this.rurl.length > 0 ) {
+        if ( this.rurl.length > 0 )
+        {
             v += 'recommendations=' + this.rurl + '&amp;' ;
         }