Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
jps26401  
#1 Posted : Wednesday, August 29, 2007 8:11:02 PM(UTC)
jps26401

Rank: Member

Groups: Member
Joined: 3/20/2007(UTC)
Posts: 21

Hi all,
I use ThumbnailWriter for displaying thumbnails of selected images. I have the following code for communication between components:
Code:
		function ImageUploader_SelectionChange() {
			var imageUploader = getImageUploader("ImageUploaderID");
			var thumbnail = getImageUploader("ImageThumbnailID");
			
			if (imageUploader) {
				var selectedFileIndex = null;
		
				//Iterate all upload list items 
				for (var i = 1; i <= imageUploader.getUploadFileCount(); i++){
					if (imageUploader.getUploadFileSelected(i)) {
						//only one image can be thumbnail
						if (selectedFileIndex == null){
							selectedFileIndex = i;
						}
						else {
							selectedFileIndex = "multiple"
						}
					}
				}
			}

			if (selectedFileIndex){			
				//Display selected image preview using <img> tag when only one item is selected. 
				//  For multiple items blank area is displayed.
				if (typeof(selectedFileIndex) == "number") {
					thumbnail.setGuid(imageUploader.getUploadFileGuid(selectedFileIndex));
				}
				else {
					thumbnail.setGuid("");
				}
			}
			else {
				thumbnail.setGuid("");
			}										
		}


In Firefox works everything ok but there are some problems in IE like:
- when I send successfully images then thumbnail is always displayed
- when I remove (or remove all) last component then thumbnail of last image is always displayed

I use these versions of components:
iu.activeXControlVersion = "4,5,4,0";
iu.javaAppletVersion = "2.5.4.0";

PETR

Edited by user Tuesday, February 12, 2008 12:35:03 PM(UTC)  | Reason: Not specified

Alex Makhov  
#2 Posted : Sunday, September 2, 2007 12:22:01 PM(UTC)
Alex Makhov

Rank: Advanced Member

Groups: Member
Joined: 8/3/2003(UTC)
Posts: 998

Hello Petr,

May be you should update to the last version of Image Uploader? ;) We have made some changes regarding the Multiple Descriptions samples too so it could help you.
Sincerely yours,
Alex Makhov

UserPostedImage Follow Aurigma on Twitter!
jps26401  
#3 Posted : Sunday, September 2, 2007 8:36:37 PM(UTC)
jps26401

Rank: Member

Groups: Member
Joined: 3/20/2007(UTC)
Posts: 21

I downloaded last version but nothing new. I also found new scripts for working with thumbnail pane but also nothing new.

For example how can I enforce to clear thumbnail pane after documents upload in ActiveX version? I can use thumbnail.setGuid(""); elsewhere (BeforeUpload or AfterUpload listener) but without result. It's quite strange that pane with selected documents is empty but thumbnail pane contains image.

PETER
Alex Makhov  
#4 Posted : Monday, September 3, 2007 12:16:38 PM(UTC)
Alex Makhov

Rank: Advanced Member

Groups: Member
Joined: 8/3/2003(UTC)
Posts: 998

Hello,
That is strange. Do you use the ActiveX version of Image Uploader or the Java one on your IE? Could you provide us with the direct link to your problem site to check it?
Sincerely yours,
Alex Makhov

UserPostedImage Follow Aurigma on Twitter!
jps26401  
#5 Posted : Monday, September 3, 2007 11:14:03 PM(UTC)
jps26401

Rank: Member

Groups: Member
Joined: 3/20/2007(UTC)
Posts: 21

I'm sorry but I can't give access to customer application and our testing application is available in intranet only.

We use IE with ActiveX version of component. Component stays after sending on the same page, no redirection.

PETER

PS: I would send you access via email only but I can't send you private message.
Alex Makhov  
#6 Posted : Tuesday, September 4, 2007 2:04:56 PM(UTC)
Alex Makhov

Rank: Advanced Member

Groups: Member
Joined: 8/3/2003(UTC)
Posts: 998

Hello,

OK. May be you could make and post here a simple html-page code with Image Uploader where the problem is reproduced?
Sincerely yours,
Alex Makhov

UserPostedImage Follow Aurigma on Twitter!
jps26401  
#7 Posted : Sunday, September 30, 2007 8:47:06 PM(UTC)
jps26401

Rank: Member

Groups: Member
Joined: 3/20/2007(UTC)
Posts: 21

Hello Alex,
here is main code for component.

PETER

Code:

<%@ page language="java" pageEncoding="UTF-8"%>
<jsp:directive.page import="cz.anect.mis.ApplicationConfig;" />
<%@ include file="/includes.jsp" %>
<fmt:setLocale value="cs"/>


	<script type="text/javascript">	
		var prevUploadFileCount = 0;			
		
		/*
			Callback function which is called when upload finished successfully.
		*/					
		function ImageUploaderID_AfterUpload(html) {
			var pos = html.lastIndexOf("##");
			if (pos == -1) {
				alert(html); //show result information
			}
			else {	
				//get doc ids
				var docIds = html.substring(2, pos); //2 is length of '##'

				alert(html.substr(pos + 2));			
								
				//open new window for displaying added documents
				openNewWindowWithParams("<%=ApplicationConfig.getCentralPartUrl()%>displayAddedDocuments.htm", 
						"ids", docIds);
			}
		
			if (elm('exactCreationDate').value == '') {
				elm('exactCreationDate').value = 'DD.MM.RRRR';
			}					    		
		}			

			
		/*
			Callback function which is called during uploading.
		*/		
		function ImageUploader_Progress(Status, Progress, ValueMax, Value, StatusText) {
			//4 - Some server-side error occurred		
			//11 - The server returned HTTP code 3xx (e.g. 302 or 304) during redirection.
    	if (Status == "ERROR" && (Value == 11 || Value == 4)) {
    		//error from server side
    		if (StatusText == "") {
	    		alert('<fmt:message key="errorOccured.js"/>');
	    	}
    		else {
					var pos = StatusText.indexOf('http');
					if (pos != 0) {
		    		alert('<fmt:message key="followingErrorOccured"/>:\n' + StatusText);
					}
					else {	
						//redirect to other page
						window.location = StatusText;
  				}  		
	    	}
	    	
				if (elm('exactCreationDate').value == '') {
					elm('exactCreationDate').value = 'DD.MM.RRRR';
				}
    	}
		}			
			
				
		/*
			Method is invoked when an image is selected.
			Selected image is displayed in thumbnail pane.
		*/
		function ImageUploader_SelectionChange() {
			var imageUploader = getImageUploader("ImageUploaderID");
			var thumbnail = getImageUploader("ImageThumbnailID");
			
			if (imageUploader) {
				var selectedFileIndex = null;
		
				//Iterate all upload list items 
				for (var i = 1; i <= imageUploader.getUploadFileCount(); i++){
					if (imageUploader.getUploadFileSelected(i)) {
						//only one image can be thumbnail
						if (selectedFileIndex == null){
							selectedFileIndex = i;
						}
						else {
							selectedFileIndex = "multiple"
						}
					}
				}
			}

			if (selectedFileIndex){			
				//Display selected image preview using <img> tag when only one item is selected. 
				//  For multiple items blank area is displayed.
				if (typeof(selectedFileIndex) == "number") {
					thumbnail.setGuid(imageUploader.getUploadFileGuid(selectedFileIndex));
				}
				else {
					thumbnail.setGuid("");
				}
			}
			else {
				thumbnail.setGuid("");
			}										
		}

		/*
		* Method is invoked when count of selected files is changed.
		*/
		function ImageUploader_UploadFileCountChange() {
			var imageUploader = getImageUploader("ImageUploaderID");
			var thumbnail = getImageUploader("ImageThumbnailID");
			
			if (imageUploader){
				var uploadFileCount  = imageUploader.getUploadFileCount();
		
				//Files are being added.
				if (prevUploadFileCount <= uploadFileCount) {
					//nothing to do at this moment
				}
				//Files are being removed.
				else {
					if (uploadFileCount == 0) {
						//clear thumbnail pane
						thumbnail.setGuid("");
					}
					else {
						//select last selected document
						thumbnail.setGuid(imageUploader.getUploadFileGuid(uploadFileCount));
					}
				}
		
				prevUploadFileCount = uploadFileCount;
			}
		}


		//
		// component configuration
		//
		var iu = new ImageUploaderWriter("ImageUploaderID", 900, 390);
	
		// If you do not want to use ActiveX or Java version, set the appropriate
		// property to false.
		iu.activeXControlEnabled = true;
		iu.javaAppletEnabled = true;
		iu.activeXControlVersion = "4,5,35,0";
		iu.javaAppletVersion = "2.5.35.0";		
		iu.javaAppletCached = true;				
		iu.activeXControlCodeBase = "includes/ImageUploader4.cab";
		iu.javaAppletCodeBase="includes/";
	
		//component configuration									
		iu.addParam("Action", "addDocument.htm"); //must be
		iu.addParam("AutoRecoverTimeOut", "3000");
		iu.addParam("AllowAutoRotate", "false");
		iu.addParam("AllowRotate", "true");
		iu.addParam("ShowDescriptions", "false");
		iu.addParam("MaxFileCount", "20");		
		iu.addParam("MaxFileSize", "51200000"); //=50MB
		iu.addParam("MaxTotalFileSize", "102400000"); //=100MB
		iu.addParam("ExtractExif", "ExifDateTime");		
		iu.addParam("FolderPaneSortMode", "Name");
		iu.addParam("LicenseKey", "...");
		
		//component apperiance
		iu.addParam("BackgroundColor", "#e8d5c4");
		iu.addParam("TreePaneWidth", "210");
		iu.addParam("FolderPaneHeight", "200");
		iu.addParam("PreviewThumbnailSize", "70"); //96 default				
		iu.addParam("AutoRecoverMaxTriesCount", "1");												

		//thumbnail info								
		iu.addParam("UploadThumbnail1FitMode", "Fit");
		iu.addParam("UploadThumbnail1Width", "800");
		iu.addParam("UploadThumbnail1Height", "600");
		iu.addParam("UploadThumbnail1JpegQuality", "70");								
		iu.addParam("UploadThumbnail1ResizeQuality", "Medium");
				
		//include data from form
		iu.addParam("AdditionalFormName", "addDocument");							

		//Configure file mask to upload supported files only.
		iu.addParam("FileMask", "*.doc;*.pdf;*.htm;*.html;*.jpg;*.jpeg;*.png;*.txt;*.rtf;*.tif;*.tiff");

		//Czech localization	
		cs_resources.addParams(iu);

		//formular checking
		iu.addEventListener("SelectionChange", "ImageUploader_SelectionChange");	
		iu.addEventListener("BeforeUpload", "beforeUploadHandler");		
		iu.addEventListener("AfterUpload", "ImageUploaderID_AfterUpload");	
		iu.addEventListener("UploadFileCountChange", "ImageUploader_UploadFileCountChange");
		iu.addEventListener("Progress", "ImageUploader_Progress");	
	
		iu.writeHtml();							
	</script>				
	

	<div style="border: 1px solid #E5CEBB; width: 900px; margin-bottom: 10px;">
		<script type="text/javascript">							
			//===================== thumbnail pain
			var t = new ThumbnailWriter("ImageThumbnailID", 900, 270);	
			t.activeXControlEnabled = iu.activeXControlEnabled;
			t.javaAppletEnabled = iu.javaAppletEnabled;
			t.activeXControlVersion = iu.activeXControlVersion;
			t.javaAppletVersion = iu.javaAppletVersion;		
			t.javaAppletCached = iu.javaAppletCached;				
			t.activeXControlCodeBase = iu.activeXControlCodeBase;
			t.javaAppletCodeBase = iu.javaAppletCodeBase;
											
			t.addParam("ParentControlName", "ImageUploaderID");
			t.addParam("BackgroundColor", "#f7f0ea");									
			t.writeHtml();	
		</script>			
	</div>	

Edited by user Sunday, February 24, 2008 6:08:55 PM(UTC)  | Reason: Not specified

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.