hfs_hansi.tpl 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
  1. Welcome! This is the default template for HFS 2.3
  2. template revision TR2.
  3. Here below you'll find some options affecting the template.
  4. Consider 1 is used for "yes", and 0 is used for "no".
  5. DO NOT EDIT this template just to change options. It's a very bad way to do it, and you'll pay for it!
  6. Correct way: in Virtual file system, right click on home/root, properties, diff template,
  7. put this text [+special:strings]
  8. and following all the options you want to change, using the same syntax you see here.
  9. [+special:strings]
  10. option.paged=1
  11. COMMENT this option causes your file list to be paged by default
  12. option.newfolder=1
  13. option.move=1
  14. option.comment=1
  15. option.rename=1
  16. COMMENT with these you can disable some features of the template. Please note this is not about user permissions, this is global!
  17. []
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  19. <html>
  20. <head>
  21. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  22. <title>{.!HFS.} %folder%</title>
  23. <link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
  24. <script type="text/javascript" src="/?mode=jquery"></script>
  25. <link rel="shortcut icon" href="/favicon.ico">
  26. <style class='trash-me'>
  27. .onlyscript, button[onclick] { display:none; }
  28. </style>
  29. <script>
  30. // this object will store some %symbols% in the javascript space, so that libs can read them
  31. HFS = { folder:'{.js encode|%folder%.}', number:%number%, paged:{.!option.paged.} };
  32. </script>
  33. <script type="text/javascript" src="/?mode=section&id=lib.js"></script>
  34. </head>
  35. <body>
  36. <!--{.comment|--><h1 style='margin-bottom:100em'>WARNING: this template is only to be used with HFS 2.3 (and macros enabled)</h1> <!--.} -->
  37. {.$box panel.}
  38. {.$list.}
  39. </body>
  40. </html>
  41. <!-- Build-time: %build-time% -->
  42. [list]
  43. <div id='files_outer'>
  44. <div style='height:1.6em;'></div> {.comment| this is quite ugly, i know, but if i use any vertical padding with height:100% i'll get a scrollbar .}
  45. {.if not| %number% |{: <div style='font-size:200%; padding:1em;'>{.!No {.if|{.length|{.?search.}.}|results|files.}.}</div> :}|{:
  46. <form method='post'>
  47. <table id='files' style="width:80%;">
  48. {.set|sortlink| {:<a href="{.trim|
  49. {.get|url|sort=$1| {.if| {.{.?sort.} = $1.} | rev={.not|{.?rev.} .} /if.} /get.}
  50. /trim.}">{.!$2.}{.if| {.{.?sort.} = $1.} | &{.if|{.?rev.}|u|d.}arr;.}</a>:} .}
  51. <th>{.^sortlink|n|Name.}{.^sortlink|e|.extension.}
  52. <th>{.^sortlink|s|Size.}
  53. <th>{.^sortlink|t|Timestamp.}
  54. <th>{.^sortlink|d|Hits.}
  55. %list%
  56. </table>
  57. </form>
  58. :}.}
  59. </div>
  60. [box panel]
  61. <div id='panel' style="width:20%;">
  62. {.$box messages.}
  63. {.$box login.}
  64. {.$box folder.}
  65. {.$box search.}
  66. {.$box selection.}
  67. {.$box upload.}
  68. {.$box actions.}
  69. {.$box server info.}
  70. </div>
  71. [box messages]
  72. <fieldset id='msgs'>
  73. <legend><img src="/~img10"> {.!Messages.}</legend>
  74. <ul style='padding-left:2em'>
  75. </ul>
  76. </fieldset>
  77. [box login]
  78. <fieldset id='login'>
  79. <legend><img src="/~img27"> {.!User.}</legend>
  80. <center>
  81. {.if| {.length|%user%.} |{:
  82. %user%
  83. {.if|{.can change pwd.} |
  84. <button onclick='changePwd.call(this)' style='font-size:x-small;'>{.!Change password.}</button>
  85. .}
  86. :}
  87. | <a href="~login">Login</a>
  88. .}
  89. </center>
  90. </fieldset>
  91. [box folder]
  92. <fieldset id='folder'>
  93. <legend><img src="/~img8"> {.!Folder.}</legend>
  94. <div style='float:right; position:relative; top:-1em; font-weight:bold;'>
  95. {.if| {.length|{.?search.}.} | <a href="."><img src="/~img14"> {.!Back.}</a>
  96. | {.if| {.%folder% != / .} | <a href=".."><img src="/~img14"> {.!Up.}</a> .}
  97. /if.}
  98. </div>
  99. <div id='breadcrumbs'>
  100. {.comment|we need this to start from 1 {.count|folder levels.}.}
  101. {.breadcrumbs|{:<a href="%bread-url%" {.if|{.length|%bread-name%.}|style='padding-left:{.calc|{.count|folder levels.}*0.7.}em;'.} /> {.if|{.length|%bread-name%.}|&raquo; %bread-name%|<img src="/~img1"> {.!Home.}.}</a>:} .}
  102. </div>
  103. <div id='folder-stats'>%number-folders% {.!folders.}, %number-files% {.!files.}, {.add bytes|%total-size%.}
  104. </div>
  105. {.123 if 2| <div id='foldercomment'>|{.commentNL|%folder-item-comment%.}|</div> .}
  106. </fieldset>
  107. [box search]
  108. {.if| {.get|can recur.} |
  109. <fieldset id='search'>
  110. <legend><img src="/~img3"> {.!Search.}</legend>
  111. <form style='text-align:center'>
  112. <input name='search' size='15' value="{.escape attr|{.?search.}.}">
  113. <input type='submit' value="{.!go.}">
  114. </form>
  115. <div style='margin-top:0.5em;' class='hidden popup'>
  116. <fieldset>
  117. <legend>{.!Where to search.}</legend>
  118. <input type='radio' name='where' value='fromhere' checked='true' /> {.!this folder and sub-folders.}
  119. <br><input type='radio' name='where' value='here' /> {.!this folder only.}
  120. <br><input type='radio' name='where' value='anywhere' /> {.!entire server.}
  121. </fieldset>
  122. </div>
  123. </fieldset>
  124. /if.}
  125. [box selection]
  126. <fieldset id='select' class='onlyscript'>
  127. <legend><img src="/~img15"> {.!Select.}</legend>
  128. <center>
  129. <button onclick="
  130. var x = $('#files .selector');
  131. if (x.size() > x.filter(':checked').size())
  132. x.attr('checked', true).closest('tr').addClass('selected');
  133. else
  134. x.attr('checked', false).closest('tr').removeClass('selected');
  135. selectedChanged();
  136. ">{.!All.}</button>
  137. <button onclick="
  138. $('#files .selector').attr('checked', function(i,v){ return !v }).closest('tr').toggleClass('selected');
  139. selectedChanged();
  140. ">{.!Invert.}</button>
  141. <button onclick='selectionMask.call(this)'>{.!Mask.}</button>
  142. <p style='display:none; margin-top:1em;'><span id='selected-number'>0</span> items selected</p>
  143. </center>
  144. </fieldset>
  145. [box upload]
  146. {.if| {.get|can upload.} |{:
  147. <fieldset id='upload'>
  148. <legend><img src="/~img32"> {.!Upload.}</legend>
  149. <form action="." method='post' enctype="multipart/form-data" style='text-align:right;'>
  150. <input type='file' name='file' multiple style='display:block;' />
  151. <input type='submit' value='{.!Upload.}' style='margin-top:0.5em;' />
  152. </form>
  153. </fieldset>
  154. :}.}
  155. [box actions]
  156. <fieldset id='actions'>
  157. <legend><img src="/~img18"> {.!Actions.}</legend>
  158. <center>
  159. {.if|{.can mkdir.}|
  160. <button id='newfolderBtn' onclick='ezprompt(this.innerHTML, {type:"text"}, function(s){
  161. ajax("mkdir", {name:s});
  162. });'>{.!New folder.}</button>
  163. .}
  164. {.if|{.can comment.}|
  165. <button id='commentBtn' onclick='setComment.call(this)'>{.!Comment.}</button>
  166. .}
  167. {.if|{.get|can delete.}|
  168. <button id='deleteBtn' onclick='if (confirm("{.!confirm.}")) submit({action:"delete"}, "{.get|url.}")'>{.!Delete.}</button>
  169. {.if|{.and|{.!option.move.}|{.can move.}.}| <button id='moveBtn' onclick='moveClicked()'>{.!Move.}</button> .}
  170. .}
  171. {.if|{.can rename.}|
  172. <button id='renameBtn' onclick='
  173. var a = selectedItems();
  174. if (a.size() != 1)
  175. return alert("You must select a single item to rename");
  176. ezprompt(this.innerHTML, {type:"text"}, function(s){
  177. ajax("rename", {from:getItemName(a[0]), to:s});
  178. });'>{.!Rename.}</button>
  179. .}
  180. {.if|{.get|can archive.}|
  181. <button id='archiveBtn' onclick='if (confirm("{.!confirm.}")) submit({}, "{.get|url|mode=archive|recursive.}")'>{.!Archive.}</button>
  182. .}
  183. <a href="{.get|url|tpl=list|sort=|{.if not|{.length|{.?search.}.}|{:folders-filter=\|recursive:}.}.}">{.!Get list.}</a>
  184. </center>
  185. </fieldset>
  186. [box server info]
  187. <fieldset id='serverinfo'>
  188. <legend><img src="/~img0"> {.!Server information.}</legend>
  189. <a href="http://www.rejetto.com/hfs/">HttpFileServer %version%</a>
  190. <br />{.!Server time.}: %timestamp%
  191. <br />{.!Server uptime.}: %uptime%
  192. </fieldset>
  193. [+special:strings]
  194. max s dl msg=There is a limit on the number of <b>simultaneous</b> downloads on this server.<br>This limit has been reached. Retry later.
  195. retry later=Please, retry later.
  196. item folder=in folder
  197. no files=No files in this folder
  198. no results=No items match your search query
  199. confirm=Are you sure?
  200. [style.css|no log]
  201. body { font-family:微软雅黑, tahoma, verdana, arial, helvetica, sans; font-weight:normal; font-size:9pt; background-color:#eee; }
  202. html, body { padding:0; border:0; height:100%; }
  203. html, body, p, form { margin:0 }
  204. a { text-decoration:none; color:#47c; border:1px solid transparent; padding:0 0.1em; }
  205. a:visited { color:#55F; }
  206. a:hover { background-color:#fff; border-color:#47c; }
  207. img { border-style:none }
  208. fieldset { margin-bottom:0.7em; text-align:left; padding:0.6em; }
  209. #panel { float:left; margin-top:1em; margin-left:1em; max-width:350px; }
  210. #panel hr { width:80%; margin:1em auto; }
  211. #files_outer { height:100%; overflow:auto; text-align:left; padding:0 1.6em; }
  212. #files { background:#ddf; border:0; }
  213. #files tr { background:#fff; }
  214. #files tr.even { background:#eef; }
  215. #files tr.selected { background:#bcf; }
  216. #files td { padding:0.2em 0.5em; text-align:right; }
  217. #files tr td:first-child { text-align:left; }
  218. #files th { padding:0.5em 1em; background:#47c; text-align:center; }
  219. #files th a { color:white; font-size:110%; }
  220. #files th a:hover { background:transparent; border-color:#fff; color:#fff; font-size:130%; }
  221. #files td:first-child { text-align:left; }
  222. #files td.nosize { text-align:center; font-style:italic; }
  223. #files .selector { display:none; }
  224. #actions button { margin:0.2em; }
  225. #breadcrumbs { margin-top:1em; padding-left:0.5em; }
  226. #breadcrumbs a { padding:0.15em 0; border-width:1px; display:block; word-break:break-all; }
  227. #folder-stats, #foldercomment { margin-top:1em; padding-top:0.5em; border-top:1px solid #666; }
  228. #folder-stats { color:#666; text-align:center; }
  229. #msgs { display:none; }
  230. #msgs li:first-child { font-weight:bold; }
  231. #pages span { border:1px solid #4477cc; padding:3px 6px; cursor:pointer; }
  232. #pages button { font-size:smaller; }
  233. .selectedPage { font-weight:bold; font-size:larger; }
  234. .hidden { display:none; }
  235. [file=folder=link|private]
  236. <tr class='{.if|{.mod|{.count|row.}|2.}|even.}'><td>
  237. <input type='checkbox' class='selector' name='selection' value="%item-url%" {.if not|{.or|{.get|can delete.}|{.get|can access.}|{.get|can archive item.}.}|disabled='disabled'.} />
  238. {.if|{.get|is new.}|<span class='flag'>&nbsp;NEW&nbsp;</span>.}
  239. {.if not|{.get|can access.}|<img src='/~img_lock'>.}
  240. <a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
  241. {.if| {.length|{.?search.}.} |{:{.123 if 2|<div class='item-folder'>{.!item folder.} |{.breadcrumbs|{:<a href="%bread-url%">%bread-name%/</a>:}|from={.count substring|/|%folder%.}/breadcrumbs.}|</div>.}:} .}
  242. {.123 if 2|<div class='comment'>|{.commentNL|%item-comment%.}|</div>.}
  243. [+file]
  244. <td>%item-size%B<td>%item-modified%<td>%item-dl-count%
  245. [+folder]
  246. <td class='nosize'>folder<td>%item-modified%<td>%item-dl-count%
  247. [+link]
  248. <td class='nosize'>link<td colspan='2'>
  249. [error-page]
  250. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  251. <html>
  252. <head>
  253. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  254. <style type="text/css">
  255. {.$style.css.}
  256. </style>
  257. </head>
  258. <body>
  259. %content%
  260. <hr>
  261. <div style="font-family:tahoma, verdana, arial, helvetica, sans; font-size:8pt;">
  262. <a href="http://www.rejetto.com/hfs/">HttpFileServer %version%</a>
  263. <br>%timestamp%
  264. </div>
  265. </body>
  266. </html>
  267. [not found]
  268. <h1>{.!Not found.}</h1>
  269. <a href="/">{.!go to root.}</a>
  270. [overload]
  271. <h1>{.!Server Too Busy.}</h1>
  272. {.!The server is too busy to handle your request at this time. Retry later.}
  273. [max contemp downloads]
  274. <h1>{.!Download limit.}</h1>
  275. {.!max s dl msg.}
  276. <br>({.disconnection reason.})
  277. [unauthorized]
  278. <h1>{.!Unauthorized.}</h1>
  279. {.!Either your user name and password do not match, or you are not permitted to access this resource..}
  280. [deny]
  281. <h1>{.!Forbidden.}</h1>
  282. {.or|%reason%|{.!This resource is not accessible..}.}
  283. [ban]
  284. <h1>{.!You are banned.}</h1>
  285. %reason%
  286. [upload]
  287. [upload-file]
  288. [upload-results]
  289. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
  290. <html>
  291. <head>
  292. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  293. <title>HFS %folder%</title>
  294. <link rel="stylesheet" href="/?mode=section&id=style.css" type="text/css">
  295. <style>
  296. li {list-style-image:url(/~img7); padding-bottom:1em; }
  297. li.bad { list-style-image:url(/~img11); }
  298. ul { border:1px solid #999; border-left:0; border-right:0; padding-top:1em; }
  299. a.back { display: block; width: 10em; white-space:nowrap; padding:0.3em 0.5em; margin-top:1em; }
  300. </style>
  301. </head>
  302. <body style='margin:2em;'>
  303. <h1>{.!Upload results.}</h1>
  304. {.or|{.^ok.}|0.} {.!files uploaded correctly..}
  305. {.123 if 2|<br /> |{.^ko.}| files failed..}
  306. <a href="." class='back'><img src="/~img14"> {.!Back.}</a>
  307. {.^back.}
  308. <ul>
  309. %uploaded-files%
  310. </ul>
  311. <a href="." class='back'><img src="/~img14"> {.!Back.}</a>
  312. </body>
  313. </html>
  314. [upload-success]
  315. {.inc|ok.}
  316. <li> <a href="%item-url%">%item-name%</a>
  317. <br />%item-size% @ %smart-speed%B/s
  318. {.if| {.length|%user%.} |{: {.append| %folder-resource%\hfs.comments.txt |{.filename|%item-resource%.}=uploaded by %user%
  319. /append.} :}/if.}
  320. [upload-failed]
  321. {.inc|ko.}
  322. <li class='bad'>%item-name%
  323. <br />{.!%reason%.}
  324. [progress|no log]
  325. <style>
  326. #progress .fn { font-weight:bold; }
  327. .out_bar { margin-top:0.25em; width:100px; font-size:15px; background:#fff; border:#555 1px solid; margin-right:5px; float:left; }
  328. .in_bar { height:0.5em; background:#47c; }
  329. </style>
  330. <ul style='padding-left:1.5em;'>
  331. %progress-files%
  332. </ul>
  333. [progress-nofiles]
  334. {.!No file exchange in progress..}
  335. [progress-upload-file]
  336. {.if not|{.{.?only.} = down.}|{:
  337. <li> Uploading %total% @ %speed-kb% KB/s
  338. <br /><span class='fn'>%filename%</span>
  339. <br />{.!Time left.} %time-left%"
  340. <br /><div class='out_bar'><div class='in_bar' style="width:%perc%px"></div></div> %perc%%
  341. :}.}
  342. [progress-download-file]
  343. {.if not|{.{.?only.} = up.}|{:
  344. <li> Downloading %total% @ %speed-kb% KB/s
  345. <br /><span class='fn'>%filename%</span>
  346. <br />{.!Time left.} %time-left%"
  347. <br><div class='out_bar'><div class='in_bar' style="width:%perc%px"></div></div> %perc%%
  348. :}.}
  349. [ajax.mkdir|no log]
  350. {.check session.}
  351. {.set|x|{.postvar|name.}.}
  352. {.break|if={.pos|\|var=x.}{.pos|/|var=x.}|result=forbidden.}
  353. {.break|if={.not|{.can mkdir.}.}|result=not authorized.}
  354. {.set|x|{.force ansi|%folder%{.^x.}.}.}
  355. {.break|if={.exists|{.^x.}.}|result=exists.}
  356. {.break|if={.not|{.length|{.mkdir|{.^x.}.}.}.}|result=failed.}
  357. {.add to log|User %user% created folder "{.^x.}".}
  358. {.pipe|ok.}
  359. [ajax.rename|no log]
  360. {.check session.}
  361. {.break|if={.not|{.can rename.}.}|result=forbidden.}
  362. {.break|if={.is file protected|{.postvar|from.}.}|result=forbidden.}
  363. {.break|if={.is file protected|{.postvar|to.}.}|result=forbidden.}
  364. {.set|x|{.force ansi|%folder%{.postvar|from.}.}.}
  365. {.set|y|{.force ansi|%folder%{.postvar|to.}.}.}
  366. {.break|if={.not|{.exists|{.^x.}.}.}|result=not found.}
  367. {.break|if={.exists|{.^y.}.}|result=exists.}
  368. {.break|if={.not|{.length|{.rename|{.^x.}|{.^y.}.}.}.}|result=failed.}
  369. {.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}
  370. {.pipe|ok.}
  371. [ajax.move|no log]
  372. {.check session.}
  373. {.set|dst|{.force ansi|{.postvar|dst.}.}.}
  374. {.break|if={.not|{.and|{.can move.}|{.get|can delete.}|{.get|can upload|path={.^dst.}.}/and.}.} |result={.!forbidden.}.}
  375. {.set|log|{.!Moving items to.} {.^dst.}.}
  376. {.for each|fn|{.replace|:|{.no pipe||.}|{.force ansi|{.postvar|files.}.}.}|{:
  377. {.break|if={.is file protected|var=fn.}|result=forbidden.}
  378. {.set|x|{.force ansi|%folder%.}{.^fn.}.}
  379. {.set|y|{.^dst.}/{.^fn.}.}
  380. {.if not |{.exists|{.^x.}.}|{.^x.}: {.!not found.}|{:
  381. {.if|{.exists|{.^y.}.}|{.^y.}: {.!already exists.}|{:
  382. {.if|{.length|{.move|{.^x.}|{.^y.}.}.} |{:
  383. {.set|log|{.chr|13.}{.^fn.}|mode=append.}
  384. {.move|{.^x.}.md5|{.^y.}.md5.}
  385. {.move|{.^x.}.comment|{.^y.}.comment.}
  386. :} | {:
  387. {.set|log|{.chr|13.}{.^fn.} (failed)|mode=append.}
  388. {.maybe utf8|{.^fn.}.}: {.!not moved.}
  389. :}/if.}
  390. :}/if.}
  391. :}.}
  392. ;
  393. :}.}
  394. {.add to log|{.^log.}.}
  395. [ajax.comment|no log]
  396. {.check session.}
  397. {.break|if={.not|{.can comment.}.} |result=forbidden.}
  398. {.for each|fn|{.replace|:|{.no pipe||.}|{.postvar|files.}.}|{:
  399. {.break|if={.is file protected|var=fn.}|result=forbidden.}
  400. {.set item|{.force ansi|%folder%{.^fn.}.}|comment={.encode html|{.force ansi|{.postvar|text.}.}.}.}
  401. :}.}
  402. {.pipe|ok.}
  403. [ajax.changepwd|no log]
  404. {.check session.}
  405. {.break|if={.not|{.can change pwd.}.} |result=forbidden.}
  406. {.if|{.length|{.set account||password={.force ansi|{.postvar|new.}.}.}/length.}|ok|failed.}
  407. [special:alias]
  408. check session=if|{.{.cookie|HFS_SID_.} != {.postvar|token.}.}|{:{.cookie|HFS_SID_|value=|expires=-1.} {.break|result=bad session}:}
  409. can mkdir=and|{.get|can upload.}|{.!option.newfolder.}
  410. can comment=and|{.get|can upload.}|{.!option.comment.}
  411. can rename=and|{.get|can delete.}|{.!option.rename.}
  412. can change pwd=member of|can change password
  413. can move=or|1
  414. escape attr=replace|"|&quot;|$1
  415. commentNL=if|{.pos|<br|$1.}|$1|{.replace|{.chr|10.}|<br />|$1.}
  416. add bytes=switch|{.cut|-1||$1.}|,|0,1,2,3,4,5,6,7,8,9|$1 bytes|K,M,G,T|$1bytes
  417. [special:import]
  418. {.new account|can change password|enabled=1|is group=1|notes=accounts members of this group will be allowed to change their password.}
  419. [lib.js|no log]
  420. // <script> // this is here for the syntax highlighter
  421. function outsideV(e, additionalMargin) {
  422. outsideV.w || (outsideV.w = $(window));
  423. if (!(e instanceof $))
  424. e = $(e);
  425. return e.offset().top + e.height() > outsideV.w.height() - (additionalMargin || 0) - 17;
  426. } // outsideV
  427. function quotedString(s) { return '"'+s.replace(/(['"\\])/g, "\\$1")+'"' }
  428. $(function(){
  429. // make these links into buttons for homogeneity
  430. $('#actions a').replaceWith(function(){ return "<button onclick='location = "+quotedString(this.getAttribute('href'))+"'>"+this.innerHTML+"</button>"; });
  431. // selecting functionality
  432. $('#files .selector').show().change(function(){
  433. $(this).closest('tr').toggleClass('selected');
  434. selectedChanged();
  435. });
  436. $('.trash-me').detach(); // this was hiding things for those w/o js capabilities
  437. // infinite upload fields available
  438. var x = $('input[type=file]');
  439. x.change(function(){
  440. if ($(this).data('fired')) return;
  441. $(this).data('fired',1);
  442. fileTpl.clone(true).insertAfter(this).css('display','block');
  443. });
  444. // we must create an empty "template", by cloning before it's set to a file, because on some browsers (Opera 10) emptying the value run-time is not allowed.
  445. // this must be done after the above instruction, so we'll clone also the behavior.
  446. var fileTpl = x.clone(true).css('display','none');
  447. var x = $('#upload');
  448. if (x.size()) {
  449. // make it popup by button, so we save some vertical space and avoid some scrollbar
  450. x.hide();
  451. $('#actions button:first').before(
  452. $("<button>{.!Upload.}</button>").click(function(){
  453. $(this).slideUp(); x.fadeIn();
  454. })
  455. );
  456. // on submit
  457. x.find('form').submit(function(){
  458. if (!$("[name=file]").val()) return false; // no file, no submit
  459. $(this).hide(); // we don't need the form anymore, make space for the progress bars
  460. // build the gui
  461. x.append("<div id='progress'>in progress...</div>");
  462. x.append($("<button style='float:right'>{.!Cancel.}</button>").click(function(){
  463. // stop submit/upload
  464. if (typeof stop == 'function')
  465. stop();
  466. else
  467. document.execCommand("Stop");
  468. $(this).add($("#progress")).remove(); // remove progress indicators and this button too
  469. $("#upload form").slideDown(); // re-show the form
  470. }));
  471. // refresh information
  472. function updateProgress() {
  473. var now = new Date();
  474. if (now-updateProgress.last < updateProgress.refresh*3) return; // until the request is fulfilled, we give it 3 times the refresh time
  475. updateProgress.last = now;
  476. $.get('/?mode=section&id=progress&only=up', function(txt) {
  477. if (!txt) return;
  478. var x = $('#progress');
  479. if (!x.size()) return clearInterval(updateProgress.handle);
  480. if (txt.indexOf('<li>') >= 0) x.html(txt);
  481. updateProgress.last = 0;
  482. });
  483. }//updateProgress
  484. updateProgress.refresh = 3; // choose the time, in seconds
  485. updateProgress.refresh *= 1000; // javascript wants it in milliseconds
  486. updateProgress.handle = setInterval(updateProgress, updateProgress.refresh);
  487. return true;
  488. });
  489. }
  490. // search options appear when it gets focus
  491. $('#search').focusin(function(evt){
  492. inSearch = 1;
  493. if (evt.target.getAttribute('type') == 'submit') return; // the submitter button won't expand the popup, but sets the flag to avoid the popup to be closed
  494. $("#search .popup").slideDown();
  495. }).focusout(function(evt){
  496. inSearch = 0;
  497. setTimeout(function(){
  498. if (!inSearch)
  499. $("#search .popup").fadeOut();
  500. });
  501. });
  502. $('#search form').submit(function(){
  503. var s = $(this).find('[name=search]').val();
  504. var a = '';
  505. var ps = [];
  506. switch ($('[name=where]:checked').val()) {
  507. case 'anywhere':
  508. a = '/';
  509. case 'fromhere':
  510. ps.push('search='+s);
  511. break;
  512. case 'here':
  513. if (s.indexOf('*') < 0) s = '*'+s+'*';
  514. ps.push('files-filter='+s);
  515. ps.push('folders-filter='+s);
  516. break;
  517. }
  518. location = a+'?'+ps.join('&');
  519. return false;
  520. });
  521. // workaround for those browsers not supporting :first-child selector used in style
  522. if ($('#files td:first').css('text-align') != 'left')
  523. $('#files tr td:first-child').css('text-align','left');
  524. // here we make some changes trying to make the panel fit the window
  525. var removed = 0;
  526. var e = $('#panel');
  527. while (outsideV(e)) {
  528. switch (++removed) {
  529. case 1: $('#serverinfo').hide(); continue;
  530. case 2: $('#select').hide(); continue;
  531. case 3: $('#breadcrumbs a').css({display:'inline',paddingLeft:0}); continue;
  532. case 4: $('#login').replaceWith($('#login center').prepend('<img src="/~img27">')); continue;
  533. }
  534. break; // give up
  535. }
  536. if (HFS.paged)
  537. if (getCookie('paged') == 'no')
  538. addPagingButton('#actions button:first');
  539. else
  540. pageIt();
  541. {.$more onload.}
  542. selectedChanged();
  543. // darn you ie6!
  544. if (!$.browser.msie || $.browser.version > 6) return;
  545. $('fieldset').width('250px').after('<br>');
  546. $('#panel').css('margin-right','1.5em');
  547. $('a').css('border-width','0');
  548. setTimeout(pageIt, 500); // at this time the page is not correctly formatted in IE6
  549. });//onload
  550. function ajax(method, data, cb) {
  551. if (!data)
  552. data = {};
  553. data.token = "{.cookie|HFS_SID_.}";
  554. return $.post("?mode=section&id=ajax."+method, data, cb||getStdAjaxCB());
  555. }//ajax
  556. function addPagingButton(where) {
  557. $("<button>{.!Paged list.}</button>").insertBefore(where || '#files').click(function(){
  558. $(this).remove();
  559. pageIt(true);
  560. delCookie('paged');
  561. });
  562. }//addPagingButton
  563. function pageIt(anim) {
  564. var rows = $('#files tr');
  565. if (!rows.size()) return;
  566. page = 0; // this is global
  567. var pages = $("<div id='pages'>{.!Page.} </div>").css('visibility','hidden').insertBefore('#files');
  568. var pageSize = 0;
  569. while (!outsideV(rows[pageSize], 20))
  570. if (++pageSize >= rows.size())
  571. return pages.remove();
  572. if (pageSize == 0) return; // this happens when the page is not formatted at this exact time, and the table is misplaced
  573. Npages = Math.ceil(HFS.number / pageSize);
  574. if (Npages == 1)
  575. return pages.remove();
  576. $('#files').width($('#files').width()); // hold it still
  577. var s = '';
  578. for (var i=1; i <= Npages; i++)
  579. s += '<span>'+i+'</span> ';
  580. s = $(s);
  581. s.appendTo(pages).click(function(){
  582. page = Number(this.innerHTML)-1;
  583. $('#files tr:gt(0):visible').hide();
  584. $('#files tr:gt('+(page*pageSize)+'):lt('+pageSize+')').show();
  585. pages.find('span').removeClass('selectedPage').filter(':nth('+page+')').addClass('selectedPage');
  586. });
  587. s.first().addClass('selectedPage');
  588. $('#files tr:gt('+((page+1)*pageSize)+')').hide();
  589. pages.append($("<button type='button'>{.!No pages.}</button>").click(function(){
  590. pages.slideUp(function(){ pages.remove(); });
  591. $('#files tr:hidden').show();
  592. addPagingButton();
  593. setCookie('paged', 'no');
  594. }));
  595. pages.css({visibility:'', display:'none'});
  596. if (anim) pages.slideDown()
  597. else pages.show();
  598. }//pageIt
  599. function selectedChanged() {
  600. $("#selected-number").text( selectedItems().size() ).parent().show();
  601. } // selectedChanged
  602. function getItemName(el) {
  603. if (typeof el == 'undefined')
  604. return false;
  605. // we handle elements, not jquery sets
  606. if (el.jquery)
  607. if (el.size())
  608. el = el[0];
  609. else
  610. return false;
  611. // take the url, and ignore any #anchor part
  612. var s = el.getAttribute('href') || el.getAttribute('value');
  613. s = s.split('#')[0];
  614. // remove protocol and hostname
  615. var i = s.indexOf('://');
  616. if (i > 0)
  617. s = s.slice(s.indexOf('/',i+3));
  618. // current folder is specified. Remove it.
  619. if (s.indexOf(HFS.folder) == 0)
  620. s = s.slice(HFS.folder.length);
  621. // folders have a trailing slash that's not truly part of the name
  622. if (s.slice(-1) == '/')
  623. s = s.slice(0,-1);
  624. // it is encoded
  625. s = (decodeURIComponent || unescape)(s);
  626. return s;
  627. } // getItemName
  628. function submit(data, url) {
  629. var f = $('#files').closest('form');
  630. if (url) f.attr('action', url);
  631. f.find('.temp').remove();
  632. for (var k in data)
  633. f.append("<input class='temp' type='hidden' name='"+k+"' value='"+data[k]+"' />");
  634. f.submit();
  635. }//submit
  636. function putMsg(txt, time) {
  637. if (!time) time = 4000;
  638. var msgs = $('#msgs');
  639. msgs.slideDown();
  640. if (msgs.find('ul li:first').html() == txt)
  641. clearTimeout(lastTimeoutID);
  642. else
  643. msgs.find('ul').prepend("<li>"+txt+"</li>");
  644. lastTimeoutID = setTimeout("$('#msgs li:last').fadeOut(function(){$(this).detach(); if (!$('#msgs li').size()) $('#msgs').slideUp(); });", time);
  645. }//putMsg
  646. RegExp.escape = function(text) {
  647. if (!arguments.callee.sRE) {
  648. var specials = '/.*+?|()[]{}\\'.split('');
  649. arguments.callee.sRE = new RegExp('(\\' + specials.join('|\\') + ')', 'g');
  650. }
  651. return text.replace(arguments.callee.sRE, '\\$1');
  652. }//escape
  653. function include(url, type) {
  654. $.ajaxSetup({async: false}); // we'll wait.
  655. if (!type)
  656. type = /[^.]+$/.exec(url);
  657. var res;
  658. if (type == 'js')
  659. res = $.getScript(url);
  660. else res = $.get(url, function(){
  661. if (type == 'css')
  662. $('head').append('<link rel="stylesheet" href="'+url+'" type="text/css" />');
  663. });
  664. $.ajaxSetup({async: true}); // restore it
  665. return res.responseText;
  666. }//include
  667. function ezprompt(msg, options, cb) {
  668. // 2 parameters means "options" is missing
  669. if (arguments.length == 2) {
  670. cb = options;
  671. options = {};
  672. }
  673. if (!$.prompt) { // load on demand
  674. include('/?mode=section&id=impromptu.css');
  675. include('/?mode=section&id=jquery.impromptu.js');
  676. }
  677. var v;
  678. if (v = options.type) {
  679. msg += '<br />';
  680. if (v == 'textarea')
  681. msg += '<textarea name="txt" cols="30" rows="8">'+options['default']+'</textarea>';
  682. else
  683. msg += '<input name="txt" type="'+v+'"'
  684. + ((v = options['default']) ? ' value="'+v+'"' : '')
  685. + ' />';
  686. }
  687. $.prompt(msg, {
  688. opacity: 0.9,
  689. overlayspeed: 'fast',
  690. loaded: function(){
  691. $('#jqibox').find(':input').keypress(function (e) {
  692. var c = (e.keyCode || e.which);
  693. if (options.keypress && options.keypress(c, this, e) === false) return;
  694. if (c != 13 || this.tagName == 'TEXTAREA') return; // ENTER key is like submit, but not in textarea
  695. $('.jqibuttons button:first').click();
  696. return false;
  697. }).filter(':first').focus()[0].select();
  698. },
  699. submit: function(val,div,form) {
  700. var res = cb(options.type ? form.txt : form, $('#jqibox'), options.cbData );
  701. if (res === false) {
  702. $('#jqibox').find(':input:first').focus();
  703. return false;
  704. }
  705. return true;
  706. },
  707. fadeClicked: function() { $('#jqibox').find(':input:first').focus(); }
  708. });
  709. }//ezprompt
  710. // this is a factory for ajax request handlers
  711. function getStdAjaxCB(what2do) {
  712. if (!arguments.length)
  713. what2do = true;
  714. return function(res){
  715. res = $.trim(res);
  716. if (res !== "ok") {
  717. alert("{.!Error.}: "+res);
  718. if (res === 'bad session')
  719. location.reload();
  720. return;
  721. }
  722. // what2do is a list of actions we are supposed to do if the ajax result is "ok"
  723. if (typeof what2do == 'undefined')
  724. return;
  725. if (!$.isArray(what2do))
  726. what2do = [what2do];
  727. for (var i=0; i<what2do.length; i++) {
  728. var w = what2do[i];
  729. switch (typeof w) {
  730. case 'function': w(); break; // you specify exactly what to do
  731. case 'string':
  732. switch (w[0]) {
  733. case '!': alert(w.substr(1)); break;
  734. case '>': location = w.substr(1); break;
  735. default: putMsg(w); break;
  736. }
  737. case 'boolean': if (w) location = location; break;
  738. }
  739. }
  740. }
  741. }//getStdAjaxCB
  742. function changePwd() {
  743. ezprompt(this.innerHTML, {type:'password'}, function(s){
  744. if (s) ajax('changepwd', {'new':s}, getStdAjaxCB([
  745. "!{.!Password changed, you'll have to login again..}",
  746. '>~login'
  747. ]));
  748. });
  749. }//changePwd
  750. function selectedItems() { return $('#files .selector:checked') }
  751. function selectedFilesAsStr() {
  752. var a = [];
  753. selectedItems().each(function(){
  754. a.push(getItemName(this));
  755. });
  756. return a.join(":");
  757. }//selectedFilesAsStr
  758. function setComment() {
  759. var sel = selectedItems();
  760. if (!sel.size())
  761. return putMsg("{.!No file selected.}");
  762. var def = sel.closest('tr').find('.comment').html() || '';
  763. ezprompt(this.innerHTML, {type:'textarea', 'default':def}, function(s){
  764. if (s == def && sel.size() == 1) return true; // there s no work to do
  765. ajax('comment', {text:s, files:selectedFilesAsStr()});
  766. });
  767. }//setComment
  768. function moveClicked() {
  769. ezprompt("{.!Enter the destination folder.}", {type:'text'}, function(s){
  770. ajax('move', {dst:s, files:selectedFilesAsStr()}, function(res){
  771. var a = res.split(";");
  772. if (a.length < 2)
  773. return alert($.trim(res));
  774. var failed = 0;
  775. var ok = 0;
  776. var msg = "";
  777. for (var i=0; i<a.length-1; i++) {
  778. var s = $.trim(a[i]);
  779. if (!s.length) {
  780. ok++;
  781. continue;
  782. }
  783. failed++;
  784. msg += s+"\n";
  785. }
  786. if (failed)
  787. msg = "{.!We met the following problems:.}\n"+msg;
  788. msg = (ok ? ok+" {.!files were moved..}\n" : "{.!No file was moved..}\n")+msg;
  789. alert(msg);
  790. if (ok) location = location; // reload
  791. });
  792. });
  793. }//moveClicked
  794. function selectionMask() {
  795. ezprompt('{.!Please enter the file mask to select.}', {'type':'text', 'default':'*'}, function(s){
  796. if (!s) return false;
  797. var re = s.match('^/([^/]+)/([a-zA-Z]*)');
  798. if (re)
  799. re = new RegExp(re[1], re[2]);
  800. else {
  801. var n = s.match(/^(\\*)/)[0].length;
  802. s = s.substring(n);
  803. var invert = !!(n % 2); // a leading "\" will invert the logic
  804. s = RegExp.escape(s).replace(/[?]/g,".");;
  805. if (s.match(/\\\*/)) {
  806. s = s.replace(/\\\*/g,".*");
  807. s = "^ *"+s+" *$"; // in this case let the user decide exactly how it is placed in the string
  808. }
  809. re = new RegExp(s, "i");
  810. }
  811. $("#files .selector")
  812. .filter(function(){ return invert ^ re.test(getItemName(this)); })
  813. .closest('tr').addClass("selected").find('.selector').attr('checked',true);
  814. selectedChanged();
  815. });
  816. }//selectionMask
  817. function setCookie(name,value,days) {
  818. if (days) {
  819. var date = new Date();
  820. date.setTime(date.getTime()+(days*24*60*60*1000));
  821. var expires = "; expires="+date.toGMTString();
  822. }
  823. else var expires = "";
  824. document.cookie = name+"="+value+expires+"; path=/";
  825. } // setCookie
  826. function getCookie(name) {
  827. var a = document.cookie.match(new RegExp('(^|;\s*)('+name+'=)([^;]*)'));
  828. return (a && a[2]) ? a[3] : null;
  829. } // getCookie
  830. function delCookie(name) {
  831. setCookie(name,"",-1);
  832. } // delCookie
  833. [jquery.impromptu.js|no log]
  834. /*
  835. * jQuery Impromptu
  836. * By: Trent Richardson [http://trentrichardson.com]
  837. * Version 2.7
  838. * Last Modified: 6/7/2009
  839. *
  840. * Copyright 2009 Trent Richardson
  841. * Dual licensed under the MIT and GPL licenses.
  842. * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
  843. * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
  844. *
  845. */
  846. (function($) {
  847. $.prompt = function(message, options) {
  848. options = $.extend({},$.prompt.defaults,options);
  849. $.prompt.currentPrefix = options.prefix;
  850. var ie6 = ($.browser.msie && $.browser.version < 7);
  851. var $body = $(document.body);
  852. var $window = $(window);
  853. //build the box and fade
  854. var msgbox = '<div class="'+ options.prefix +'box" id="'+ options.prefix +'box">';
  855. if(options.useiframe && (($('object, applet').length > 0) || ie6)) {
  856. msgbox += '<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></iframe>';
  857. } else {
  858. if(ie6) {
  859. $('select').css('visibility','hidden');
  860. }
  861. msgbox +='<div class="'+ options.prefix +'fade" id="'+ options.prefix +'fade"></div>';
  862. }
  863. msgbox += '<div class="'+ options.prefix +'" id="'+ options.prefix +'"><div class="'+ options.prefix +'container"><div class="';
  864. msgbox += options.prefix +'close">X</div><div id="'+ options.prefix +'states"></div>';
  865. msgbox += '</div></div></div>';
  866. var $jqib = $(msgbox).appendTo($body);
  867. var $jqi = $jqib.children('#'+ options.prefix);
  868. var $jqif = $jqib.children('#'+ options.prefix +'fade');
  869. //if a string was passed, convert to a single state
  870. if(message.constructor == String){
  871. message = {
  872. state0: {
  873. html: message,
  874. buttons: options.buttons,
  875. focus: options.focus,
  876. submit: options.submit
  877. }
  878. };
  879. }
  880. //build the states
  881. var states = "";
  882. $.each(message,function(statename,stateobj){
  883. stateobj = $.extend({},$.prompt.defaults.state,stateobj);
  884. message[statename] = stateobj;
  885. states += '<div id="'+ options.prefix +'_state_'+ statename +'" class="'+ options.prefix + '_state" style="display:none;"><div class="'+ options.prefix +'message">' + stateobj.html +'</div><div class="'+ options.prefix +'buttons">';
  886. $.each(stateobj.buttons, function(k, v){
  887. states += '<button name="' + options.prefix + '_' + statename + '_button' + k + '" id="' + options.prefix + '_' + statename + '_button' + k + '" value="' + v + '">' + k + '</button>';
  888. });
  889. states += '</div></div>';
  890. });
  891. //insert the states...
  892. $jqi.find('#'+ options.prefix +'states').html(states).children('.'+ options.prefix +'_state:first').css('display','block');
  893. $jqi.find('.'+ options.prefix +'buttons:empty').css('display','none');
  894. //Events
  895. $.each(message,function(statename,stateobj){
  896. var $state = $jqi.find('#'+ options.prefix +'_state_'+ statename);
  897. $state.children('.'+ options.prefix +'buttons').children('button').click(function(){
  898. var msg = $state.children('.'+ options.prefix +'message');
  899. var clicked = stateobj.buttons[$(this).text()];
  900. var forminputs = {};
  901. //collect all form element values from all states
  902. $.each($jqi.find('#'+ options.prefix +'states :input').serializeArray(),function(i,obj){
  903. if (forminputs[obj.name] === undefined) {
  904. forminputs[obj.name] = obj.value;
  905. } else if (typeof forminputs[obj.name] == Array) {
  906. forminputs[obj.name].push(obj.value);
  907. } else {
  908. forminputs[obj.name] = [forminputs[obj.name],obj.value];
  909. }
  910. });
  911. var close = stateobj.submit(clicked,msg,forminputs);
  912. if(close === undefined || close) {
  913. removePrompt(true,clicked,msg,forminputs);
  914. }
  915. });
  916. $state.find('.'+ options.prefix +'buttons button:eq('+ stateobj.focus +')').addClass(options.prefix +'defaultbutton');
  917. });
  918. var ie6scroll = function(){
  919. $jqib.css({ top: $window.scrollTop() });
  920. };
  921. var fadeClicked = function(){
  922. if(options.persistent){
  923. if (options.fadeClicked() === false) return; // mod by rejetto
  924. var i = 0;
  925. $jqib.addClass(options.prefix +'warning');
  926. var intervalid = setInterval(function(){
  927. $jqib.toggleClass(options.prefix +'warning');
  928. if(i++ > 1){
  929. clearInterval(intervalid);
  930. $jqib.removeClass(options.prefix +'warning');
  931. }
  932. }, 100);
  933. }
  934. else {
  935. removePrompt();
  936. }
  937. };
  938. var keyPressEventHandler = function(e){
  939. var key = (window.event) ? event.keyCode : e.keyCode; // MSIE or Firefox?
  940. //escape key closes
  941. if(key==27) {
  942. removePrompt();
  943. }
  944. //constrain tabs
  945. if (key == 9){
  946. var $inputels = $(':input:enabled:visible',$jqib);
  947. var fwd = !e.shiftKey && e.target == $inputels[$inputels.length-1];
  948. var back = e.shiftKey && e.target == $inputels[0];
  949. if (fwd || back) {
  950. setTimeout(function(){
  951. if (!$inputels)
  952. return;
  953. var el = $inputels[back===true ? $inputels.length-1 : 0];
  954. if (el)
  955. el.focus();
  956. },10);
  957. return false;
  958. }
  959. }
  960. };
  961. var positionPrompt = function(){
  962. $jqib.css({
  963. position: (ie6) ? "absolute" : "fixed",
  964. height: $window.height(),
  965. width: "100%",
  966. top: (ie6)? $window.scrollTop() : 0,
  967. left: 0,
  968. right: 0,
  969. bottom: 0
  970. });
  971. $jqif.css({
  972. position: "absolute",
  973. height: $window.height(),
  974. width: "100%",
  975. top: 0,
  976. left: 0,
  977. right: 0,
  978. bottom: 0
  979. });
  980. $jqi.css({
  981. position: "absolute",
  982. top: options.top,
  983. left: "50%",
  984. marginLeft: (($jqi.outerWidth()/2)*-1)
  985. });
  986. };
  987. var stylePrompt = function(){
  988. $jqif.css({
  989. zIndex: options.zIndex,
  990. display: "none",
  991. opacity: options.opacity
  992. });
  993. $jqi.css({
  994. zIndex: options.zIndex+1,
  995. display: "none"
  996. });
  997. $jqib.css({
  998. zIndex: options.zIndex
  999. });
  1000. };
  1001. var removePrompt = function(callCallback, clicked, msg, formvals){
  1002. $jqi.remove();
  1003. //ie6, remove the scroll event
  1004. if(ie6) {
  1005. $body.unbind('scroll',ie6scroll);
  1006. }
  1007. $window.unbind('resize',positionPrompt);
  1008. $jqif.fadeOut(options.overlayspeed,function(){
  1009. $jqif.unbind('click',fadeClicked);
  1010. $jqif.remove();
  1011. if(callCallback) {
  1012. options.callback(clicked,msg,formvals);
  1013. }
  1014. $jqib.unbind('keypress',keyPressEventHandler);
  1015. $jqib.remove();
  1016. if(ie6 && !options.useiframe) {
  1017. $('select').css('visibility','visible');
  1018. }
  1019. });
  1020. };
  1021. positionPrompt();
  1022. stylePrompt();
  1023. //ie6, add a scroll event to fix position:fixed
  1024. if(ie6) {
  1025. $window.scroll(ie6scroll);
  1026. }
  1027. $jqif.click(fadeClicked);
  1028. $window.resize(positionPrompt);
  1029. $jqib.bind("keydown keypress",keyPressEventHandler);
  1030. $jqi.find('.'+ options.prefix +'close').click(removePrompt);
  1031. //Show it
  1032. $jqif.fadeIn(options.overlayspeed);
  1033. $jqi[options.show](options.promptspeed,options.loaded);
  1034. $jqi.find('#'+ options.prefix +'states .'+ options.prefix +'_state:first .'+ options.prefix +'defaultbutton').focus();
  1035. if(options.timeout > 0)
  1036. setTimeout($.prompt.close,options.timeout);
  1037. return $jqib;
  1038. };
  1039. $.prompt.defaults = {
  1040. prefix:'jqi',
  1041. buttons: {
  1042. Ok: true
  1043. },
  1044. loaded: function(){
  1045. },
  1046. submit: function(){
  1047. return true;
  1048. },
  1049. callback: function(){
  1050. },
  1051. opacity: 0.6,
  1052. zIndex: 9999,
  1053. overlayspeed: 'slow',
  1054. promptspeed: 'fast',
  1055. show: 'fadeIn',
  1056. focus: 0,
  1057. useiframe: false,
  1058. top: "15%",
  1059. persistent: true,
  1060. timeout: 0,
  1061. state: {
  1062. html: '',
  1063. buttons: {
  1064. Ok: true
  1065. },
  1066. focus: 0,
  1067. submit: function(){
  1068. return true;
  1069. }
  1070. }
  1071. };
  1072. $.prompt.currentPrefix = $.prompt.defaults.prefix;
  1073. $.prompt.setDefaults = function(o) {
  1074. $.prompt.defaults = $.extend({}, $.prompt.defaults, o);
  1075. };
  1076. $.prompt.setStateDefaults = function(o) {
  1077. $.prompt.defaults.state = $.extend({}, $.prompt.defaults.state, o);
  1078. };
  1079. $.prompt.getStateContent = function(state) {
  1080. return $('#'+ $.prompt.currentPrefix +'_state_'+ state);
  1081. };
  1082. $.prompt.getCurrentState = function() {
  1083. return $('.'+ $.prompt.currentPrefix +'_state:visible');
  1084. };
  1085. $.prompt.getCurrentStateName = function() {
  1086. var stateid = $.prompt.getCurrentState().attr('id');
  1087. return stateid.replace($.prompt.currentPrefix +'_state_','');
  1088. };
  1089. $.prompt.goToState = function(state) {
  1090. $('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
  1091. $('#'+ $.prompt.currentPrefix +'_state_'+ state).slideDown('slow',function(){
  1092. $(this).find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
  1093. });
  1094. };
  1095. $.prompt.nextState = function() {
  1096. var $next = $('.'+ $.prompt.currentPrefix +'_state:visible').next();
  1097. $('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
  1098. $next.slideDown('slow',function(){
  1099. $next.find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
  1100. });
  1101. };
  1102. $.prompt.prevState = function() {
  1103. var $next = $('.'+ $.prompt.currentPrefix +'_state:visible').prev();
  1104. $('.'+ $.prompt.currentPrefix +'_state').slideUp('slow');
  1105. $next.slideDown('slow',function(){
  1106. $next.find('.'+ $.prompt.currentPrefix +'defaultbutton').focus();
  1107. });
  1108. };
  1109. $.prompt.close = function() {
  1110. $('#'+ $.prompt.currentPrefix +'box').fadeOut('fast',function(){
  1111. $(this).remove();
  1112. });
  1113. };
  1114. })(jQuery);
  1115. [impromptu.css|no log]
  1116. /*
  1117. ------------------------------
  1118. Impromptu's
  1119. ------------------------------
  1120. */
  1121. .jqifade{
  1122. position: absolute;
  1123. background-color: #aaaaaa;
  1124. }
  1125. div.jqi{
  1126. min-width: 300px;
  1127. max-width: 600px;
  1128. font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  1129. position: absolute;
  1130. background-color: #ffffff;
  1131. font-size: 11px;
  1132. text-align: left;
  1133. border: solid 1px #eeeeee;
  1134. -moz-border-radius: 10px;
  1135. -webkit-border-radius: 10px;
  1136. padding: 7px;
  1137. }
  1138. div.jqi .jqicontainer{
  1139. font-weight: bold;
  1140. }
  1141. div.jqi .jqiclose{
  1142. position: absolute;
  1143. top: 4px; right: -2px;
  1144. width: 18px;
  1145. cursor: default;
  1146. color: #bbbbbb;
  1147. font-weight: bold;
  1148. }
  1149. div.jqi .jqimessage{
  1150. padding: 10px;
  1151. line-height: 20px;
  1152. color: #444444;
  1153. }
  1154. div.jqi .jqibuttons{
  1155. text-align: right;
  1156. padding: 5px 0 5px 0;
  1157. border: solid 1px #eeeeee;
  1158. background-color: #f4f4f4;
  1159. }
  1160. div.jqi button{
  1161. padding: 3px 10px;
  1162. margin: 0 10px;
  1163. background-color: #2F6073;
  1164. border: solid 1px #f4f4f4;
  1165. color: #ffffff;
  1166. font-weight: bold;
  1167. font-size: 12px;
  1168. }
  1169. div.jqi button:hover{
  1170. background-color: #728A8C;
  1171. }
  1172. div.jqi button.jqidefaultbutton{
  1173. /*background-color: #8DC05B;*/
  1174. background-color: #BF5E26;
  1175. }
  1176. .jqiwarning .jqi .jqibuttons{
  1177. background-color: #BF5E26;
  1178. }
  1179. /*
  1180. ------------------------------
  1181. impromptu
  1182. ------------------------------
  1183. */
  1184. .impromptuwarning .impromptu{ background-color: #aaaaaa; }
  1185. .impromptufade{
  1186. position: absolute;
  1187. background-color: #ffffff;
  1188. }
  1189. div.impromptu{
  1190. position: absolute;
  1191. background-color: #cccccc;
  1192. padding: 10px;
  1193. width: 300px;
  1194. text-align: left;
  1195. }
  1196. div.impromptu .impromptuclose{
  1197. float: right;
  1198. margin: -35px -10px 0 0;
  1199. cursor: pointer;
  1200. color: #213e80;
  1201. }
  1202. div.impromptu .impromptucontainer{
  1203. background-color: #213e80;
  1204. padding: 5px;
  1205. color: #ffffff;
  1206. font-weight: bold;
  1207. }
  1208. div.impromptu .impromptumessage{
  1209. background-color: #415ea0;
  1210. padding: 10px;
  1211. }
  1212. div.impromptu .impromptubuttons{
  1213. text-align: center;
  1214. padding: 5px 0 0 0;
  1215. }
  1216. div.impromptu button{
  1217. padding: 3px 10px 3px 10px;
  1218. margin: 0 10px;
  1219. }
  1220. /*
  1221. ------------------------------
  1222. columns ex
  1223. ------------------------------
  1224. */
  1225. .colsJqifadewarning .colsJqi{ background-color: #b0be96; }
  1226. .colsJqifade{
  1227. position: absolute;
  1228. background-color: #ffffff;
  1229. }
  1230. div.colsJqi{
  1231. position: absolute;
  1232. background-color: #d0dEb6;
  1233. padding: 10px;
  1234. width: 400px;
  1235. text-align: left;
  1236. }
  1237. div.colsJqi .colsJqiclose{
  1238. float: right;
  1239. margin: -35px -10px 0 0;
  1240. cursor: pointer;
  1241. color: #bbbbbb;
  1242. }
  1243. div.colsJqi .colsJqicontainer{
  1244. background-color: #e0eEc6;
  1245. padding: 5px;
  1246. color: #ffffff;
  1247. font-weight: bold;
  1248. height: 160px;
  1249. }
  1250. div.colsJqi .colsJqimessage{
  1251. background-color: #c0cEa6;
  1252. padding: 10px;
  1253. width: 280px;
  1254. height: 140px;
  1255. float: left;
  1256. }
  1257. div.colsJqi .jqibuttons{
  1258. text-align: center;
  1259. padding: 5px 0 0 0;
  1260. }
  1261. div.colsJqi button{
  1262. background: url(../images/button_bg.jpg) top left repeat-x #ffffff;
  1263. border: solid #777777 1px;
  1264. font-size: 12px;
  1265. padding: 3px 10px 3px 10px;
  1266. margin: 5px 5px 5px 10px;
  1267. width: 75px;
  1268. }
  1269. div.colsJqi button:hover{
  1270. border: solid #aaaaaa 1px;
  1271. }
  1272. /*
  1273. ------------------------------
  1274. brown theme
  1275. ------------------------------
  1276. */
  1277. .brownJqiwarning .brownJqi{ background-color: #cccccc; }
  1278. .brownJqifade{
  1279. position: absolute;
  1280. background-color: #ffffff;
  1281. }
  1282. div.brownJqi{
  1283. position: absolute;
  1284. background-color: transparent;
  1285. padding: 10px;
  1286. width: 300px;
  1287. text-align: left;
  1288. }
  1289. div.brownJqi .brownJqiclose{
  1290. float: right;
  1291. margin: -20px 0 0 0;
  1292. cursor: pointer;
  1293. color: #777777;
  1294. font-size: 11px;
  1295. }
  1296. div.brownJqi .brownJqicontainer{
  1297. position: relative;
  1298. background-color: transparent;
  1299. border: solid 1px #5F5D5A;
  1300. color: #ffffff;
  1301. font-weight: bold;
  1302. }
  1303. div.brownJqi .brownJqimessage{
  1304. position: relative;
  1305. background-color: #F7F6F2;
  1306. border-top: solid 1px #C6B8AE;
  1307. border-bottom: solid 1px #C6B8AE;
  1308. }
  1309. div.brownJqi .brownJqimessage h3{
  1310. background: url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
  1311. margin: 0;
  1312. padding: 7px 0 7px 15px;
  1313. color: #4D4A47;
  1314. }
  1315. div.brownJqi .brownJqimessage p{
  1316. padding: 10px;
  1317. color: #777777;
  1318. }
  1319. div.brownJqi .brownJqimessage img.helpImg{
  1320. position: absolute;
  1321. bottom: -25px;
  1322. left: 10px;
  1323. }
  1324. div.brownJqi .brownJqibuttons{
  1325. text-align: right;
  1326. }
  1327. div.brownJqi button{
  1328. background: url(../images/brown_theme_gradient.jpg) top left repeat-x #ffffff;
  1329. border: solid #777777 1px;
  1330. font-size: 12px;
  1331. padding: 3px 10px 3px 10px;
  1332. margin: 5px 5px 5px 10px;
  1333. }
  1334. div.brownJqi button:hover{
  1335. border: solid #aaaaaa 1px;
  1336. }
  1337. /*
  1338. *------------------------
  1339. * clean blue ex
  1340. *------------------------
  1341. */
  1342. .cleanbluewarning .cleanblue{ background-color: #acb4c4; }
  1343. .cleanbluefade{ position: absolute; background-color: #aaaaaa; }
  1344. div.cleanblue{ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; position: absolute; background-color: #ffffff; width: 300px; font-size: 11px; text-align: left; border: solid 1px #213e80; }
  1345. div.cleanblue .cleanbluecontainer{ background-color: #ffffff; border-top: solid 14px #213e80; padding: 5px; font-weight: bold; }
  1346. div.cleanblue .cleanblueclose{ float: right; width: 18px; cursor: default; margin: -19px -12px 0 0; color: #ffffff; font-weight: bold; }
  1347. div.cleanblue .cleanbluemessage{ padding: 10px; line-height: 20px; font-size: 11px; color: #333333; }
  1348. div.cleanblue .cleanbluebuttons{ text-align: right; padding: 5px 0 5px 0; border: solid 1px #eeeeee; background-color: #f4f4f4; }
  1349. div.cleanblue button{ padding: 3px 10px; margin: 0 10px; background-color: #314e90; border: solid 1px #f4f4f4; color: #ffffff; font-weight: bold; font-size: 12px; }
  1350. div.cleanblue button:hover{ border: solid 1px #d4d4d4; }
  1351. /*
  1352. *------------------------
  1353. * Ext Blue Ex
  1354. *------------------------
  1355. */
  1356. .extbluewarning .extblue{ border:1px red solid; }
  1357. .extbluefade{ position: absolute; background-color: #ffffff; }
  1358. div.extblue{ border:1px #6289B6 solid; position: absolute; background-color: #CAD8EA; padding: 0; width: 300px; text-align: left; }
  1359. div.extblue .extblueclose{ background-color: #CAD8EA; margin:2px -2px 0 0; cursor: pointer; color: red; text-align: right; }
  1360. div.extblue .extbluecontainer{ background-color: #CAD8EA; padding: 0 5px 5px 5px; color: #000000; font:normal 11px Verdana; }
  1361. div.extblue .extbluemessage{ background-color: #CAD8EA; padding: 0; margin:0 15px 15px 15px; }
  1362. div.extblue .extbluebuttons{ text-align: center; padding: 0px 0 0 0; }
  1363. div.extblue button{ padding: 1px 4px; margin: 0 10px; background-color:#cccccc; font-weight:normal; font-family:Verdana; font-size:10px; }