Add basket

This commit is contained in:
2012-01-05 00:44:23 +00:00
parent 885d12ceb7
commit b6a0899141
10 changed files with 367 additions and 38 deletions

View File

@@ -0,0 +1,55 @@
<h2>Basket</h2>
{if $basket->count()}
<form method="post" action="{$base_uri}basket/do/edit/">
<table>
<thead>
<tr>
<th>
<input id="list_select_all" class="select_all" type="checkbox" />
Remove
</th>
<th>Item</th>
<th>Size</th>
</tr>
</thead>
<tbody>
{foreach from=$basket->getItems() item=item}
<tr>
<td><input type="checkbox" class="list_select_all" name="items[]" value="{$item|escape:html}" /></td>
<td>{$item|escape:html}</td>
<td>{$basket->size($item)|formatFilesize|escape:html}</td>
</tr>
{/foreach}
</tbody>
<tfoot>
<tr>
<td colspan="2">
<input type="submit" class="btn danger" name="remove-items" value="Remove from Basket" />
<input type="submit" class="btn danger" name="clear" value="Clear Basket" />
<button id="basket_list_copy" class="btn secondary pull-right">Copy List</button>
</td>
<td>
{$basket->totalSize()|formatFilesize|escape:html}
</td>
</tr>
</tfoot>
</table>
{else}
<em>There are no items in your basket at the moment.</em>
{/if}
<div id="basket_list" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close">&times;</a>
<h3>Basket Text List</h3>
</div>
<div class="modal-body">
<textarea id="basket_list_text" class="xxlarge" rows="15"></textarea>
</div>
<div class="modal-footer">
<button id="basket_list_close" class="btn primary">Close</button>
</div>
</div>
<script type="text/javascript">
ml.basket.init();
</script>

View File

@@ -5,7 +5,6 @@
<script type="text/javascript">
var base_uri = "{$base_uri|escape:'quote'}";
var base_url = "{$base_url|escape:'quote'}";
</script>
<!-- JQuery //-->

View File

@@ -1,31 +1,54 @@
<table>
<thead>
<tr>
<th>Filename</th>
<th>Size</th>
</tr>
</thead>
<tbody>
{if $parent}
<tr>
<td><a href="{$base_uri}list/source/{$source->name()}/{$parent_path}" title="Parent Directory">../ <em>Parent Directory</em></a></td>
<td>-</td>
</tr>
{/if}
{foreach from=$files item=file}
<tr>
{if $file->isFile()}
<td>{$file->basename()}</td>
{else}
<td><a href="{$base_uri}list/source/{$source->name()}/{$path}{$file->basename()}" title="{$file->basename()}">{$file->basename()}</a></td>
{/if}
<td>{if $file->isFile()}
{$file->size()|formatFilesize}
{else}
-
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
<form method="post" action="{$base_uri}basket/do/add-items/">
<input type="hidden" name="redirect" value="list/source/{$source->name()|escape:html}/{$path|escape:html}" />
<table>
<thead>
<tr>
<th>
<input id="list_select_all" class="select_all" type="checkbox" />
Add to Basket
</th>
<th>Filename</th>
<th>Size</th>
</tr>
</thead>
<tbody>
{if $parent}
<tr>
<td>&nbsp;</td>
<td><a href="{$base_uri}list/source/{$source->name()|escape:html}/{$parent_path|escape:html}" title="Parent Directory">../ <em>Parent Directory</em></a></td>
<td>-</td>
</tr>
{/if}
{foreach from=$files item=file}
{assign var=item value="{$source->name()}:{$path}{$file->basename()}"}
<tr>
<td>
{if $basket->contains($item)}
<input type="checkbox" checked="checked" disabled="disabled" />
{else}
<input type="checkbox" class="list_select_all" name="items[]" value="{$item|escape:html}" />
{/if}
</td>
<td>
{if $file->isFile()}
{$file->basename()|escape:html}
{else}
<a href="{$base_uri}list/source/{$source->name()|escape:html}/{$path|escape:html}{$file->basename()|escape:html}" title="{$file->basename()|escape:html}">{$file->basename()|escape:html}</a>
{/if}
</td>
<td>{*if $file->isFile()*}
{$file->size()|formatFilesize|escape:html}
{*else}
-
{/if*}
</td>
</tr>
{/foreach}
</tbody>
<tfoot>
<tr>
<td colspan="3"><input type="submit" class="btn primary" name="submit" value="Add to Basket" /></td>
</tr>
</tfoot>
</table>
</form>

View File

@@ -13,7 +13,10 @@
{/foreach}
</ul>
</li>
</ul>
<ul>
</ul>
<li class="{if $source_name == $source->name()}active{/if}">
<a href="{$base_uri}basket/" title="Basket">
Basket ({$basket_items} {MediaListing_Formatting::pluralise($basket_items, 'item', 'items')})
</a>
</li>
</ul>