Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-19-2011, 03:31 PM   PM User | #1
blivori
New to the CF scene

 
Join Date: Jul 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
blivori is an unknown quantity at this point
Editing FlexPaper Source - Open URL Automatically

Hi,

Basically I have two PHP scripts: list.php, which lists all the files in a web directory and search.php, which searches files in a MySQL database depending on the search term entered. It then saves the file name, ID and Path into a table called files_tbl. Search.php also creates hyperlinks to files (which appear as search results).

I want that when a hyperlink is clicked, it automatically opens a new window with FlexPaper and the selected (clicked) URL.

My problem is that FlexPaper opens a file by default and I need to edit it (FlexPaper is open source) so that it opens the selected link.

Here is the FlexPaper source that does this:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">	
    <head> 
        <title>FlexPaper</title>         
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <style type="text/css" media="screen"> 
			html, body	{ height:100%; }
			body { margin:0; padding:0; overflow:auto; }   
			#flashContent { display:none; }
        </style> 
		
		<script type="text/javascript" src="js/flexpaper_flash.js"></script>
    </head> 
    <body> 
    	<div style="position:absolute;left:10px;top:10px;">
	        <a id="viewerPlaceHolder" style="width:660px;height:480px;display:block"></a>
	        
	        <script type="text/javascript"> 
				var fp = new FlexPaperViewer(	
						 'FlexPaperViewer',
						 'viewerPlaceHolder', { config : {
						 SwfFile : escape('Paper.swf'),
						 Scale : 0.6, 
						 ZoomTransition : 'easeOut',
						 ZoomTime : 0.5,
						 ZoomInterval : 0.2,
						 FitPageOnLoad : true,
						 FitWidthOnLoad : true,
						 PrintEnabled : false,
						 FullScreenAsMaxWindow : true,
						 ProgressiveLoading : false,
						 MinZoomSize : 0.2,
						 MaxZoomSize : 5,
						 SearchMatchAll : true,
						 InitViewMode : 'Portrait',
						 
						 ViewModeToolsVisible : false,
						 ZoomToolsVisible : true,
						 NavToolsVisible : true,
						 CursorToolsVisible : true,
						 SearchToolsVisible : true,
  						
  						 localeChain: 'en_US'
						 }});
	        </script>
        </div>
        
		<!-- THE FOLLOWING CODE BLOCK CAN SAFELY BE REMOVED, IT IS ONLY PLACED HERE TO HELP YOU GET STARTED. -->
        <div style="position:absolute;left:680px;height:540px;top:10px;font-family:Verdana;font-size:9pt;background-color:#CACACA;width:300px">
			<div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:10px;">FlexPaper Sample Document</div>
			<div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;">Can't see the document and running FlexPaper from your local directory?<br/><br/> Upload the contents of the zip file to a web server or make FlexPaper trusted to run locally. You can manage your trusted flash applications at <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html#119065">Adobe's website</a>.</div>
			
			<div style="background-color:#EFEFEF">
				<div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">More Examples</div>
				<div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%">
						» <a href="examples/two_page.html">FlexPaper starting up in Two-Page mode</a><br/>
						» <a href="examples/interactive_API.html">Interactive API html page</a><br/>
						» <a href="examples/searchmatchall.html">Search and highlight all matches</a><br/>
						</div>
						
				<div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">Publishing with PHP</div>
				<div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%">
						» <a href="php/simple_document.php">On the fly conversion (requires PHP5)</a><br/>
						» <a href="php/split_document.php">Split file conversion (requires PHP5)</a>
				</div>
						
				<div style="padding: 5px 5px 5px 5px;font-size:15px;font-weight:bold;text-align:center;margin-top:50px;">Documentation</div>
				<div style="padding: 5px 5px 5px 5px;font-size:11px;text-align:left;margin-bottom:10px;line-height:150%">
						» <a href="http://flexpaper.devaldi.com/docs_php.jsp">Configuring and Publishing with PHP</a><br/>
						» <a href="http://flexpaper.devaldi.com/docs_converting.jsp">Converting Documents</a><br/>
						» <a href="http://flexpaper.devaldi.com/docs_parameters.jsp">Parameters</a><br/>
						» <a href="http://flexpaper.devaldi.com/docs_api.jsp">API</a><br/>
				</div>		
			</div>					
		</div>
   </body> 
</html>
Note the Paper.swf. That has to be changed to *USER_SELECTION/URL_CLICKED*.

I don't know if I have to do this with JavaScript or PHP.

I have some knowledge in Java, VB.NET, Python and PHP but no JavaScript.

Any help would be appreciated.

Thanks & Regards,
blivori
blivori is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:23 AM.


Advertisement
Log in to turn off these ads.