View Single Post
  #7  
Old 26th September 2016, 17:50
bhushanchanda's Avatar
bhushanchanda bhushanchanda is offline
Guru
 
Join Date: Sep 2012
Location: India
Posts: 2,365
bhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura aboutbhushanchanda has a spectacular aura about
Baan: LN FP 1-9, 10.4, a little bit of Baan IV - DB: SQL Server 2008, Oracle - OS: Windows Server 2008 R2, Unix
Replacement for seq.open.dialog.local() is client.upload.file() or client.upload.files() for multiple selection.

Here is a snippet which shows how you can utilize it -

Code:
function extern upload.file()
{
	long id
	long index
	long fcount
	long total
	long l
	
	id = 0
	fcount = 0
	index = 0
	path = trim$(path)	
	
	l = len(path)
	if path(l;1) = "/" then
	else
		path = path & "/"
	endif
	
	if tc.is.html.ui() then
		id = client.upload.files(path)
		if id <> 0 then
			fcount = client.get.upload.filecount(id)
			total = fcount
			index = 1
			while fcount > 0 
				serverfile = client.get.upload.file(id,index,filename)
				serverfile = trim$(serverfile)
				filename = trim$(filename)
				file.mv(trim$(serverfile),trim$(path)&trim$(filename))
				fcount = fcount - 1
				index = index + 1
			endwhile
			
			message("%d files uploaded successfully!",total)
		else
			message("Uploading failed. Please check the path.")
		endif
	else
		seq.open.dialog.local(true,"","","*.*",filename)
		filename = trim$(filename)
		
		while not isspace(filename)
			find = 0
			found = 0
			find = rpos(filename,"\")
			
			serverfile = filename(find+1;len(filename)-find)
			
			ret = client2server(filename,trim$(path)&serverfile,false,false,true)
			if ret = 0 then
			else
				message("File transfer failed for %s",filename)
			endif
			filename = ""
			seq.open.dialog.next(filename)
		endwhile
	endif
	
	}

Offcourse, HTML5 has restrictions over other functions which doesn't involve user interaction like client2server(), start.application.local() etc but you can always have an option for file selector.

Regarding the function client.show.file(), it can be used to open a file directly on client machine. Again, only the files(MIME Types) supported by your browser will be opened . Else it will ask for a default program to open it. Here goes a sample code -

Code:
file.pntr = client.show.file(
				"/home/" & trim$(bhushan) & "/Sample_Report.pdf",
				true,          |Opens a new window
				"Sample Report.pdf" |Name of the report to be shown
				)
__________________
Regards,

Bhushan

Unless you try to do something beyond what you have already mastered, you will never grow!
Reply With Quote