Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion helpers/DropboxFunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ function dropbox_dir_list($directory)

foreach ($iter as $fileEntry) {
if ($fileEntry->isFile()) {
$filenames[] = $fileEntry->getFilename();
$filenames[] = array(
$fileEntry->getFilename(),
$fileEntry->getExtension(),
$fileEntry->getSize()
);
}
}

Expand Down
31 changes: 28 additions & 3 deletions views/admin/index/dropboxlist.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,23 @@ function dropboxNoEnter(e) {

jQuery('.dropbox-js').show();
jQuery('#dropbox-show-all').hide();

jQuery('th').click(function(){
var table = jQuery(this).parents('table').eq(0)
var rows = table.find('tr:gt(0)').toArray().sort(comparer(jQuery(this).index()))
this.asc = !this.asc
if (!this.asc){rows = rows.reverse()}
for (var i = 0; i < rows.length; i++){table.append(rows[i])}
})
});

function comparer(index) {
return function(a, b) {
var valA = getCellValue(a, index), valB = getCellValue(b, index)
return jQuery.isNumeric(valA) && jQuery.isNumeric(valB) ? valA - valB : valA.toString().localeCompare(valB)
}
}
function getCellValue(row, index){ return jQuery(row).children('td').eq(index).text() }
</script>

<p class="dropbox-js" style="display:none;">
Expand All @@ -70,13 +86,22 @@ function dropboxNoEnter(e) {
</colgroup>
<thead>
<tr>
<th><input type="checkbox" id="dropbox-select-all" class="dropbox-js" style="display:none"></th>
<th><?php echo __('File Name'); ?></th>
<th><input type="checkbox" id="dropbox-select-all" class="dropbox-js" style="display:none"></th>
<th><?php echo '<a>' . __('File Name') . '</a>'; ?></th>
<th style="text-align: center"><?php echo '<a>' . __('File Type'). '</a>'; ?></th>
<th style="text-align: center"><?php echo '<a>' . __('File Size'). '</a>'; ?></th>
</tr>
</thead>
<tbody id="dropbox-file-checkboxes">
<?php foreach ($fileNames as $fileName): ?>
<tr><td><input type="checkbox" name="dropbox-files[]" value="<?php echo html_escape($fileName); ?>"/></td><td><?php echo html_escape($fileName); ?></td></tr>
<tr>
<td><input type="checkbox" name="dropbox-files[]" value="<?php echo html_escape($fileName[0]); ?>"/></td>
<td><?php echo html_escape($fileName[0]); ?></td>
<td style="text-align: center"><?php echo strtolower(html_escape($fileName[1])); ?></td>
<td style="text-align: right">
<?php echo Zend_Locale_Format::toNumber($fileName[2]) . " B"; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
Expand Down