| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <cfprocessingdirective pageencoding="utf-8"> |
|---|
| 3 | <!--- |
|---|
| 4 | Name : /client/admin/imgbrowse.cfm |
|---|
| 5 | Author : Raymond Camden |
|---|
| 6 | Created : 11/29/06 |
|---|
| 7 | Last Updated : 12/14/06 |
|---|
| 8 | History : support imageroot (rkc 12/14/06) |
|---|
| 9 | ---> |
|---|
| 10 | |
|---|
| 11 | <cfif len(application.imageroot)> |
|---|
| 12 | <cfset sImgRoot = "../" & application.imageroot /> |
|---|
| 13 | <cfelse> |
|---|
| 14 | <cfset sImgRoot = "../images/" /> |
|---|
| 15 | </cfif> |
|---|
| 16 | |
|---|
| 17 | <cfset sImgRoot = application.utils.fixUrl(sImgRoot) /> |
|---|
| 18 | <cfset imageDirectory = expandPath(sImgRoot) /> |
|---|
| 19 | |
|---|
| 20 | <cfif not directoryExists(imageDirectory)> |
|---|
| 21 | <cfdirectory action="create" directory="#imageDirectory#"> |
|---|
| 22 | </cfif> |
|---|
| 23 | |
|---|
| 24 | <cfparam name="url.dir" default="/"> |
|---|
| 25 | <cfset currentDirectory = imageDirectory & url.dir> |
|---|
| 26 | <cfdirectory name="files" directory="#currentDirectory#" sort="type asc"> |
|---|
| 27 | |
|---|
| 28 | <!--- filter to gif,jpg,png ---> |
|---|
| 29 | <cfquery name="files" dbtype="query"> |
|---|
| 30 | select * |
|---|
| 31 | from files |
|---|
| 32 | where upper(name) like '%.JPG' |
|---|
| 33 | or upper(name) like '%.GIF' |
|---|
| 34 | or upper(name) like '%.PNG' |
|---|
| 35 | or type = 'Dir' |
|---|
| 36 | </cfquery> |
|---|
| 37 | |
|---|
| 38 | <cfoutput> |
|---|
| 39 | <html> |
|---|
| 40 | |
|---|
| 41 | <head> |
|---|
| 42 | <title>Image Browser</title> |
|---|
| 43 | <link rel="stylesheet" type="text/css" href="#application.rooturl#/includes/admin_popup.css" media="screen" /> |
|---|
| 44 | <script> |
|---|
| 45 | function showImage(url) { |
|---|
| 46 | cWin = window.open(url,"cWin","width=500,height=500,menubar=no,personalbar=no,dependent=true,directories=no,status=yes,toolbar=no,scrollbars=yes,resizable=yes"); |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | function insertIt(url) { |
|---|
| 50 | opener.newImage(url); |
|---|
| 51 | window.close(); |
|---|
| 52 | } |
|---|
| 53 | </script> |
|---|
| 54 | </head> |
|---|
| 55 | |
|---|
| 56 | <body> |
|---|
| 57 | |
|---|
| 58 | <div id="content"> |
|---|
| 59 | <table border="1" width="100%"> |
|---|
| 60 | <tr bgcolor="##e0e0e0"> |
|---|
| 61 | <td colspan="3"><b>Current Directory:</b> #url.dir#</td> |
|---|
| 62 | <td align="center"> |
|---|
| 63 | <cfif url.dir is not "/"> |
|---|
| 64 | <cfset higherdir = replace(url.dir, "/" & listLast(currentDirectory, "/"), "")> |
|---|
| 65 | <a href="#cgi.script_name#?dir=#higherdir#"><img src="#application.rooturl#/images/arrow_up.png" title="Go up one directory" border="0"></a> |
|---|
| 66 | <cfelse> |
|---|
| 67 | |
|---|
| 68 | </cfif> |
|---|
| 69 | </td> |
|---|
| 70 | </tr> |
|---|
| 71 | <cfloop query="files"> |
|---|
| 72 | <tr <cfif currentRow mod 2>bgcolor="##fffecf"</cfif>> |
|---|
| 73 | <td> |
|---|
| 74 | <cfif type is "Dir"> |
|---|
| 75 | <img src="#application.rooturl#/images/folder.png"> <a href="#cgi.script_name#?dir=#url.dir##urlencodedformat(name)#/">#name#</a> |
|---|
| 76 | <cfelse> |
|---|
| 77 | <cfset img = "photo.png"> |
|---|
| 78 | <img src="#application.rooturl#/images/#img#"> #name# |
|---|
| 79 | </cfif> |
|---|
| 80 | </td> |
|---|
| 81 | <td><cfif type is not "Dir">#kbytes(size)#<cfelse> </cfif></td> |
|---|
| 82 | <td><cfif type is not "Dir"><a href="javascript:showImage('#urlEncodedFormat(application.utils.fixUrl("#sImgRoot#/#url.dir#/#name#"))#')"><img src="#sImgRoot#/#url.dir#/#name#" width="50" height"50" align="absmiddle" border="0"></a><cfelse> </cfif></td> |
|---|
| 83 | <td width="50" align="center"> |
|---|
| 84 | <cfif type is not "Dir"> |
|---|
| 85 | <!--- quick mod - this apps uses / by default while imgwin isnt, so remove a solo / ---> |
|---|
| 86 | <cfset theurl = right(url.dir & name, len(url.dir & name) - 1)> |
|---|
| 87 | <a href="javascript:insertIt('#theurl#')">Insert</a> |
|---|
| 88 | <cfelse> |
|---|
| 89 | |
|---|
| 90 | </cfif> |
|---|
| 91 | </td> |
|---|
| 92 | </tr> |
|---|
| 93 | </cfloop> |
|---|
| 94 | </table> |
|---|
| 95 | </div> |
|---|
| 96 | |
|---|
| 97 | </body> |
|---|
| 98 | </html> |
|---|
| 99 | </cfoutput> |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | <cfsetting enablecfoutputonly=false> |
|---|