3e3407897ff9ba30c93f00854b4540e9591d7805
[squasher.git] / templates / index.tpl
1 {extends file='layout.tpl'}
2
3
4 {block extra_head}
5 <script>
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 {/block}
44
45
46 {block menu}
47 <div class="menu">
48         <div class="menuhead">current folder</div>
49         {foreach item=crumb key=cookie from=$base}<a href="?path={$cookie|escape:'url'}">{$crumb|escape}</a>{/foreach}
50         {if $user_level > 99 AND count($base)>1 }
51                 <form name=rmdir method=post>
52                 <input type=hidden name=tools value=rmdir>
53                 <a href="javascript:deleteFolder{if count($squashed)>0 || count($subfolders)>0}NotEmpty{/if}('{$currentfolder|escape:'javascript'|escape}');" class=tool>delete this folder</a>
54                 </form>
55         {/if}
56 </div>
57 <div class="menu">
58         <div class="menuhead">subfolders</div>
59         {foreach item=folder key=folderpath from=$subfolders}<a href="?path={$folderpath|escape:'url'}">{$folder|escape}</a>{/foreach}
60         {if $user_level > 99}
61                 <form name=mkdir method=post>
62                 <input type=hidden name=tools value=mkdir>
63                 <input type=hidden name=newname>
64                 <a href="javascript:createFolder();" class=tool>new subfolder</a>
65                 </form>
66         {/if}
67 </div>
68 {/block}
69
70 {block content}
71 {assign var=mass_delete_size value=count($squashed)}
72 {foreach item=item key=id from=$squashed}
73 {if $item.squashed}{*These items are in chunks / uploaded by the squasher tool*}
74
75 {if $item.hidden eq false OR $user_level > 99 }
76 <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}>
77
78         <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>
79
80         <div class="status">status: {$item.status|escape}</div>
81
82         <div class="clear"></div>
83
84         <div class="added">added: {$item.date|escape}</div>
85
86         <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>
87
88         <div class="clear"></div>
89
90         <div class="updated">last updated: {$item.lastchange|escape}</div>
91
92
93 {if $item.finished==true}
94         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
95 {/if}
96 {if $item.embedable eq true and $item.finished eq false}
97         {if $item.mime=='video/mpeg'}
98         <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>
99         {/if}
100 {/if}
101
102         <div class="clear"></div>
103 </div>
104         
105 <div class="clear"></div>
106 {/if}
107
108 {else}{*These items are plain files / uploaded manually by the user via ftp*}
109
110 {if $item.hidden eq false OR $user_level > 99 }
111 <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}>
112
113         <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>
114
115         <div class="status">status: {$item.status|escape}</div>
116
117         <div class="clear"></div>
118
119         <div class="added">added: {$item.date|escape}</div>
120
121         <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>
122
123         <div class="clear"></div>
124
125         <div class="updated">last updated: {$item.lastchange|escape}</div>
126
127
128 {if $item.finished==true}
129         <div class="download"><a href='?f={$id|escape:'url'}'>download</a></div>
130 {/if}
131 {if $item.embedable eq true and $item.finished eq false}
132         {if $item.mime=='video/mpeg'}
133         <div class="stream"><a href='?f={$id|escape:'url'}'>download (partial)</a></div>
134         {/if}
135 {/if}
136
137         <div class="clear"></div>
138 </div>
139         
140 <div class="clear"></div>
141 {/if}
142 {/if}
143 {/foreach}
144 {/block}
145
146
147 {block filler}
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 {/block}
165
166
167 {* vim: set syntax=smarty ts=4 sw=4 sts=4 sr noet: *}