Fixed delete logs
[squasher.git] / templates / index.tpl
1 <html>
2 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3 <link rel=stylesheet href="css/squasher.css">
4 <title>Squasher</title>
5 <script type="text/javascript" language="JavaScript">
6         {literal}
7         function toggle_id(hideshow){
8                 if(document.getElementById(hideshow).style.visibility == 'visible') {
9                         document.getElementById(hideshow).style.visibility = 'hidden';
10                 }else{
11                         document.getElementById(hideshow).style.visibility = 'visible';
12                 }
13         }
14         function selectAllList() {
15                 var aSelect = document.deletetool["h[]"];
16                 var aSelectLen = aSelect.length;
17                 for(i = 0; i < aSelectLen; i++) {
18                         aSelect.options[i].selected = true;
19                 }
20         }
21         function deleteFolder(foldername) {
22                 if (!confirm('Are you sure you want to delete folder '+foldername+' ?'))
23                         return;
24                 document.rmdir.submit();
25         }
26         function deleteFolderNotEmpty(foldername) {
27                 alert(foldername+' in not empty. Please empty it first');
28         }
29         function createFolder() {
30                 var folder = prompt("New folder name");
31                 if (folder == null)
32                         return; // canceled
33                 if (folder.indexOf('/')>=0 || folder=='.' || folder=='..') {
34                         // detect the most common errors
35                         alert('Invalid name');
36                         return;
37                 }
38                 document.mkdir.newname.value = folder;
39                 document.mkdir.submit();
40         }
41         {/literal}
42 </script>
43
44 <div class="wrappercontainer">
45
46         <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>
47
48         <div class="menucontainer">
49                 <div class="menu">
50                         <div class="menuhead">current folder</div>
51                         {foreach item=crumb key=cookie from=$base}<a href="?path={$cookie|escape:'url'}">{$crumb|escape}</a>{/foreach}
52                         {if $user_level > 99 AND count($base)>1 }
53                                 <form name=rmdir method=post>
54                                 <input type=hidden name=tools value=rmdir>
55                                 <a href="javascript:deleteFolder{if count($squashed)>0 || count($subfolders)>0}NotEmpty{/if}('{$currentfolder|escape:'javascript'|escape}');" class=tool>delete this folder</a>
56                                 </form>
57                         {/if}
58                 </div>
59                 <div class="menu">
60                         <div class="menuhead">subfolders</div>
61                         {foreach item=folder key=folderpath from=$subfolders}<a href="?path={$folderpath|escape:'url'}">{$folder|escape}</a>{/foreach}
62                         {if $user_level > 99}
63                                 <form name=mkdir method=post>
64                                 <input type=hidden name=tools value=mkdir>
65                                 <input type=hidden name=newname>
66                                 <a href="javascript:createFolder();" class=tool>new subfolder</a>
67                                 </form>
68                         {/if}
69                 </div>
70         </div>
71         
72         <div class="content">
73 {assign var=mass_delete_size value=count($squashed)}
74 {foreach item=item key=id from=$squashed}
75 {if $item.squashed}{*These items are in chunks / uploaded by the squasher tool*}
76
77 {if $item.hidden eq false OR $user_level > 99 }
78                 <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}>
79
80                         <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>
81
82                         <div class="status">status: {$item.status|escape}</div>
83
84                         <div class="clear"></div>
85
86                         <div class="added">added: {$item.date|escape}</div>
87                 
88                         <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>
89
90                         <div class="clear"></div>
91
92                         <div class="updated">last updated: {$item.lastchange|escape}</div>
93
94
95 {if $item.finished==true}
96                         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
97 {/if}
98 {if $item.embedable eq true and $item.finished eq false}
99         {if $item.mime=='video/mpeg'}
100                         <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>
101         {/if}
102 {/if}
103
104                         <div class="clear"></div>
105                 </div>
106         
107                 <div class="clear"></div>
108 {/if}
109
110 {else}{*These items are plain files / uploaded manually by the user via ftp*}
111
112 {if $item.hidden eq false OR $user_level > 99 }
113                 <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}>
114
115                         <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>
116
117                         <div class="status">status: {$item.status|escape}</div>
118
119                         <div class="clear"></div>
120
121                         <div class="added">added: {$item.date|escape}</div>
122
123                         <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>
124
125                         <div class="clear"></div>
126
127                         <div class="updated">last updated: {$item.lastchange|escape}</div>
128
129
130 {if $item.finished==true}
131                         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
132 {/if}
133 {if $item.embedable eq true and $item.finished eq false}
134         {if $item.mime=='video/mpeg'}
135                         <div class="stream"><a href='?f={$id|escape:'url'}'>download (partial)</a></div>
136         {/if}
137 {/if}
138
139                         <div class="clear"></div>
140                 </div>
141         
142                 <div class="clear"></div>
143 {/if}
144 {/if}
145 {/foreach}
146         </div>
147
148         <div class="filler">
149 {if $user_level > 100 and $mass_delete_size > 1}
150                 <div class="massdelete"><br>
151                         <div class="deletebox" id="deletebox">
152                                 <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.");'>
153                                         <select multiple="" size="{$mass_delete_size|escape}" id="h" name="h[]" width="300px">
154                                                 {foreach item=item key=id from=$squashed}
155                                                 <option value="{$id|escape}" title="{$item.name|escape}">{$item.name|truncate:39|escape}</option>
156                                                 {/foreach}
157                                         </select>
158                                         <input type="button" value="Select All" OnClick="selectAllList();" ><input type="reset" value="Clear"><input type="submit" value="Delete Selected Items">
159                                 </form>
160                         </div>
161                 </div>
162 {/if}
163         </div>
164
165         <div class="bottomimage"></div>
166         <div class="footer">&nbsp;</div>
167 </div>
168 {if $debug}{debug}{/if}
169 {* vim: set syntax=smarty ts=4 sw=4 sts=4 sr noet: *}