Allow admins to mkdir rmdir
[squasher.git] / templates / index.tpl
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5 <link rel=stylesheet href="css/squasher.css">
6 <title>Squasher</title>
7 <script type="text/javascript" language="JavaScript">{literal}
8    function toggle_id(hideshow){
9     if(document.getElementById(hideshow).style.visibility == 'visible') {
10      document.getElementById(hideshow).style.visibility = 'hidden';
11     }else{
12      document.getElementById(hideshow).style.visibility = 'visible';
13     }
14    }
15    function selectAllList() {
16     var aSelect = document.deletetool["h[]"];
17     var aSelectLen = aSelect.length;
18     for(i = 0; i < aSelectLen; i++) {
19      aSelect.options[i].selected = true;
20     }
21    }
22    function deleteFolder(foldername) {
23     if (!confirm('Are you sure you want to delete folder '+foldername+' ?'))
24      return;
25     document.rmdir.submit();
26    }
27    function deleteFolderNotEmpty(foldername) {
28     alert(foldername+' in not empty. Please empty it first');
29    }
30    function createFolder() {
31     var folder = prompt("New folder name");
32     if (folder == null)
33      return; // canceled
34     if (folder.indexOf('/')>=0 || folder=='.' || folder=='..') {
35      // detect the most common errors
36      alert('Invalid name');
37      return;
38     }
39     document.mkdir.newname.value = folder;
40     document.mkdir.submit();
41    }
42 {/literal}</script>
43 </head>
44 <body>
45 <div class="wrappercontainer">
46
47         <div class="banner">&nbsp;<div class="control">{if $user_level > 99}<a href="?">home</a>&nbsp;|&nbsp;<a href="?tools=access">access</a>&nbsp;|&nbsp;<a href="?tools=users">users</a>&nbsp;|&nbsp;<a href="?tools=logs">logs</a>&nbsp;|{/if}&nbsp;<a href="index.php?tools=logout">logout({$user_name|escape})</a>&nbsp;</div></div>
48
49         <div class="menucontainer">
50
51                 <div class="menu">
52         
53                         <div class="menuhead">current folder</div>
54         
55                         {foreach item=crumb key=cookie from=$base}<a href="?path={$cookie|escape:'url'}">{$crumb|escape}</a>{/foreach}
56
57                         {if $user_level > 99 AND count($base)>1 }
58                                 <form name=rmdir method=post>
59                                 <input type=hidden name=tools value=rmdir>
60                                 <a href="javascript:deleteFolder{if count($squashed)>0 || count($subfolders)>0}NotEmpty{/if}('{$currentfolder|escape:'javascript'|escape}');" class=tool>delete this folder</a>
61                                 </form>
62                         {/if}
63
64                 </div>
65         
66                 <div class="menu">
67
68                         <div class="menuhead">subfolders</div>
69
70                         {foreach item=folder key=folderpath from=$subfolders}<a href="?path={$folderpath|escape:'url'}">{$folder|escape}</a>{/foreach}
71
72                         {if $user_level > 99}
73                                 <form name=mkdir method=post>
74                                 <input type=hidden name=tools value=mkdir>
75                                 <input type=hidden name=newname>
76                                 <a href="javascript:createFolder();" class=tool>new subfolder</a>
77                                 </form>
78                         {/if}
79
80                 </div>
81
82         </div>
83         
84         <div class="content">
85 {assign var=mass_delete_size value=count($squashed)}
86 {foreach item=item key=id from=$squashed}
87 {if $item.squashed}{*These items are in chunks / uploaded by the squasher tool*}
88
89 {if $item.hidden eq false OR $user_level > 99 }
90                 <div class={if $item.finished==true}"status3"{elseif $item.finished!=true && $item.embedable==true}"status2"{elseif $item.finished!=true && $item.embedable!=true}"status1"{else}"item"{/if}>
91
92                         <div class="name">{$item.name|escape} {if $user_level > 99}{if $item.hidden}<font color=red>|<a href='?tools=unhide&amp;h={$id|escape:'url'}'>publish</a>|</font>{else}<font color=green>|<a href='?tools=hide&amp;h={$id|escape:'url'}'>hide</a>|</font>{/if}{if $user_level > 100}<font color=red>|<a href='?tools=delete&amp;h={$id|escape:'url'}' onClick="javascript:return confirm('Are you sure you want to permanently delete {$item.name|escape:'quotes'}?')">delete</a>|</font>{/if}{/if}</div>
93
94                         <div class="status">status: {$item.status|escape}</div>
95
96                         <div class="clear"></div>
97
98                         <div class="added">added: {$item.date|escape}</div>
99                 
100                         <div class="size">size:&nbsp;{if $item.size>(1024*1024)}{math equation="((x / 1024) / 1024) * (y / z)" x=$item.size y=$item.chunks_finished z=$item.chunks format="%.2f"}&nbsp;/&nbsp;{math equation="(x / 1024) / 1024" x=$item.size format="%.2f"}mb{elseif $item.size>(1024)}{math equation="(x / 1024) * (y / z)" x=$item.size y=$item.chunks_finished z=$item.chunks format="%.2f"}&nbsp;/&nbsp;{math equation="(x / 1024)" x=$item.size format="%.2f"}kb{else}{math equation="x * (y / z)" x=$item.size y=$item.chunks_finished z=$item.chunks format="%.0f"}&nbsp;/&nbsp;{$item.size|escape}b{/if}({math equation="(y / x) * 100" x=$item.chunks y=$item.chunks_finished format="%.0f"}%)</div>
101
102                         <div class="clear"></div>
103
104                         <div class="updated">last updated: {$item.lastchange|escape}</div>
105
106
107 {if $item.finished==true}
108                         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
109 {/if}
110 {if $item.embedable eq true and $item.finished eq false}
111         {if $item.mime=='video/mpeg'}
112                         <div class="stream"><a href='?f={$id|escape:'url'}'>download ({math equation="(y / x) * 100" x=$item.chunks y=$item.chunks_partial format="%.0f"}%)</a></div>
113         {/if}
114 {/if}
115
116                         <div class="clear"></div>
117                 </div>
118         
119                 <div class="clear"></div>
120 {/if}
121
122 {else}{*These items are plain files / uploaded manually by the user via ftp*}
123
124 {if $item.hidden eq false OR $user_level > 99 }
125                 <div class={if $item.finished==true}"status3"{elseif $item.finished!=true && $item.embedable==true}"status2"{elseif $item.finished!=true && $item.embedable!=true}"status1"{else}"item"{/if}>
126
127                         <div class="name">{$item.name|escape} {if $user_level > 99}{if $item.hidden}<font color=red>|<a href='?tools=unhide&amp;h={$id|escape:'url'}'>publish</a>|</font>{else}<font color=green>|<a href='?tools=hide&amp;h={$id|escape:'url'}'>hide</a>|</font>{/if}{if $user_level > 199}<font color=red>|<a href='?tools=delete&amp;h={$id|escape:'url'}' onClick="javascript:return confirm('Are you sure you want to permanently delete {$item.name|escape:'quotes'}?')">delete</a>|</font>{/if}{/if}</div>
128
129                         <div class="status">status: {$item.status|escape}</div>
130
131                         <div class="clear"></div>
132
133                         <div class="added">added: {$item.date|escape}</div>
134
135                         <div class="size">size:&nbsp;{if $item.size>(1024*1024)}{math equation="(x / 1024) / 1024" x=$item.size format="%.2f"}mb{elseif $item.size>(1024)}{math equation="(x / 1024)" x=$item.size format="%.2f"}kb{else}{$item.size|escape}b{/if}</div>
136
137                         <div class="clear"></div>
138
139                         <div class="updated">last updated: {$item.lastchange|escape}</div>
140
141
142 {if $item.finished==true}
143                         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
144 {/if}
145 {if $item.embedable eq true and $item.finished eq false}
146         {if $item.mime=='video/mpeg'}
147                         <div class="stream"><a href='?f={$id|escape:'url'}'>download (partial)</a></div>
148         {/if}
149 {/if}
150
151                         <div class="clear"></div>
152                 </div>
153         
154                 <div class="clear"></div>
155 {/if}
156 {/if}
157 {/foreach}
158         </div>
159
160         <div class="filler">
161 {if $user_level > 100 and $mass_delete_size > 1}
162                 <div class="massdelete"><br>
163                         <div class="deletebox" id="deletebox">
164                                 <form name="deletetool" action="?tools=delete&amp;h=multiple" method="post" onSubmit='return confirm("Are you sure you want to delete the selected files? \nThis page may take a while to reload while the files are removed.");'>
165                                         <select multiple="" size="{$mass_delete_size|escape}" id="h" name="h[]" width="300px">
166                                                 {foreach item=item key=id from=$squashed}
167                                                 <option value="{$id|escape}" title="{$item.name|escape}">{$item.name|truncate:39|escape}</option>
168                                                 {/foreach}
169                                         </select>
170                                         <input type="button" value="Select All" OnClick="selectAllList();" ><input type="reset" value="Clear"><input type="submit" value="Delete Selected Items">
171                                 </form>
172                         </div>
173                 </div>
174 {/if}
175         </div>
176
177         <div class="bottomimage"></div>
178         <div class="footer">&nbsp;</div>
179 </div>
180 {if $debug}{debug}{/if}
181 </body>
182 </html>