Opened 10 years ago

Closed 10 years ago

#225 closed defect (fixed)

ImageManager fixes

Reported by: Paul Baranowski <paul@…> Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

A bunch of imagemanager fixes:

1) When the image manager loads, the alignment drop down will always show the english translation if the alignment is not set. Add the following lines to the init() function in /plugins/ImageManager/assets/manager.js:

        // This is so the translated string shows up in the drop down.
	document.getElementById("f_align").selectedIndex = 1;
	document.getElementById("f_align").selectedIndex = 0;

in the location shown below:

	//initialise the form
	init = function () 
	{
		__dlg_init();

		__dlg_translate('ImageManager');

		// This is so the translated string shows up in the drop down.
		document.getElementById("f_align").selectedIndex = 1;
		document.getElementById("f_align").selectedIndex = 0;

		var uploadForm = document.getElementById('uploadForm');
		if(uploadForm) uploadForm.target = 'imgManager';

		var param = window.dialogArguments;
		if (param) 
		{
			document.getElementById("f_url").value = param["f_url"];
			document.getElementById("f_alt").value = param["f_alt"];
			document.getElementById("f_border").value = param["f_border"];
			document.getElementById("f_vert").value = param["f_vert"];
			document.getElementById("f_horiz").value = param["f_horiz"];
			document.getElementById("f_width").value = param["f_width"];
			document.getElementById("f_height").value = param["f_height"];
			setAlign(param["f_align"]);
		}

		document.getElementById("f_url").focus();
	}

2) Change the following strings in /plugins/ImageManager/manager.php in order to take advantage of the main translation catalog:

Old:

	<td align="right"><label for="f_align">Align</label></td>

New:

	<td align="right"><label for="f_align">Alignment:</label></td>

Old:

	  <option value=""                             >Not Set</option>

New:

	  <option value=""                             >Not set</option>

3) All instances of "<?" should be changed to "<?php" because some php.ini files do not have short_tags turned on (and many users do not have the ability to change this).

4) Allow the user to click anywhere in a thumbnail box in order to select the image, instead of having to click directly on the image (which matters a lot for small images). Note: there was also a missing space between the end of the "onclick" attribute and the beginning of the "title" attribute in the first "href" statement. (File: /plugins/ImageManage/images.php, function drawFiles().)

Changed:

<table width="100" cellpadding="0" cellspacing="0"><tr><td class="block">

to:

<table width="100" cellpadding="0" cellspacing="0"><tr><td class="block" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);" >

Here's the context:

function drawFiles($list, &$manager)
{
	global $relative;
	global $IMConfig;

	foreach($list as $entry => $file) 
	{ 
		?>
		<td>

		<? _ddt( __FILE__, __LINE__, "drawFiles(): relative is '" . $file['relative'] . "' thumbnail '" . $manager->getThumbnail($file['relative']) . "'" ); ?>

		<table width="100" cellpadding="0" cellspacing="0"><tr><td class="block" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);" >

		<a href="javascript:;" onclick="selectImage('<? echo $file['relative'];?>', '<? echo $entry; ?>', <? echo $file['image'][0];?>, <? echo $file['image'][1]; ?>);" title="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"><img src="<? print $manager->getThumbnail($file['relative']); ?>" alt="<? echo $entry; ?> - <? echo Files::formatSize($file['stat']['size']); ?>"/></a>
		</td></tr><tr><td class="edit">
			<a href="<? print $IMConfig['backend_url']; ?>__function=images&dir=<? echo $relative; ?>&amp;delf=<? echo rawurlencode($file['relative']);?>" title="Trash" onclick="return confirmDeleteFile('<? echo $entry; ?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_trash.gif" height="15" width="15" alt="Trash"/></a><a href="javascript:;" title="Edit" onclick="editImage('<? echo rawurlencode($file['relative']);?>');"><img src="<? print $IMConfig['base_url'];?>img/edit_pencil.gif" height="15" width="15" alt="Edit"/></a>
		<? if($file['image']){ echo $file['image'][0].'x'.$file['image'][1]; } else echo $entry;?>
		</td></tr></table></td> 
	  <? 
	}//foreach
}//function drawFiles

Change History (2)

comment:1 Changed 10 years ago by Paul Baranowski <paul@…>

5) Use the popup.js file instead of a custom one in manager.php:

Old:

<script type="text/javascript" src="<? print $IMConfig['base_url'];?>assets/popup.js"></script>

New:

<script type="text/javascript" src="../../popups/popup.js"></script>

comment:2 Changed 10 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

commited all your fixes in changeset:111
i hope i didn't break anything...

Note: See TracTickets for help on using tickets.