Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

see #808 - Migrate the code to display the trashed date in the admin interface #49

Merged
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
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
<style type="text/css">
{literal}
table.list td { max-width: 500px; word-wrap: break-word; }
table.list td.width-280 { max-width: 280px; }
.mt-20 { margin-top: 20px; }
{/literal}
</style>
{let item_type = ezpreference( 'admin_list_limit' )
number_of_items = min( $item_type, 3)|choose( 10, 10, 25, 50 )
trash_sort_field = first_set( $view_parameters.sort_field, 'name' )
trash_sort_order = first_set( $view_parameters.sort_order, '1' )
trash_sort_field = first_set( $view_parameters.sort_field, 'trashed' )
trash_sort_order = first_set( $view_parameters.sort_order, '0' )
list_count = fetch( 'content', 'trash_count', hash( 'objectname_filter', $view_parameters.namefilter ) ) }

{def
$sort_method = 1
$sort_order = ''
$col_class = ''
$link_order = 1
}

{if eq($trash_sort_order, '0')}
{set $sort_order = 'Descending'|i18n( 'design/admin/node/view/full' )}
{elseif eq($trash_sort_order, '1')}
{set $sort_order = 'Ascending'|i18n( 'design/admin/node/view/full' )}
{/if}

<form name="trashform" action={'content/trash/'|ezurl} method="post" >

<div class="context-block content-trash">

{* DESIGN: Header START *}
<div class="box-header">
<div class="box-header"><div class="box-ml">

<h1 class="context-title">{'Trash (%list_count)'|i18n( 'design/admin/content/trash',, hash( '%list_count', $list_count ) )}</h1>

{* DESIGN: Mainline *}<div class="header-mainline"></div>

{* DESIGN: Header END *}</div>
{* DESIGN: Header END *}</div></div>

{* DESIGN: Content START *}
<div class="box-content panel">
Expand Down Expand Up @@ -53,12 +73,97 @@

<table class="list" cellspacing="0">
<tr>
<th class="tight"><i class="fa fa-check-square-o" onclick="ezjs_toggleCheckboxes( document.trashform, 'DeleteIDArray[]' ); return false;" title="{'Invert selection.'|i18n( 'design/admin/content/trash' )}"></i></th>
<th>{'Name'|i18n( 'design/admin/content/trash')}</th>
<th>{'Type'|i18n( 'design/admin/content/trash')}</th>
<th>{'Section'|i18n( 'design/admin/content/trash')}</th>
<th>{'Original Placement'|i18n( 'design/admin/content/trash')}</th>
<th class="tight">&nbsp;</th>
<th class="tight"><i class="fa fa-check-square-o" onclick="ezjs_toggleCheckboxes( document.trashform, 'DeleteIDArray[]' ); return false;" title="{'Invert selection.'|i18n( 'design/admin/content/trash' )}"></i></th>
{* set Name column link & asc/desc icon *}
{set
$col_class = ''
$link_order = 1
}
{if eq( 'name', $trash_sort_field )}
{if eq($trash_sort_order, '0')}
{set $col_class = ' yui-dt-desc'}
{elseif eq($trash_sort_order, '1')}
{set
$col_class = ' yui-dt-asc'
$link_order = 0
}
{/if}
{/if}
<th class="yui-dt-col-name yui-dt-sortable{$col_class}">
<div id="yui-dt0-th-class_name-liner" class="yui-dt-liner">
<span class="yui-dt-label">
<a href="{concat( 'content/trash/(sort_field)/name/(sort_order)/', $link_order )|ezurl( 'no' )}" title="Click to sort {$sort_order}" class="yui-dt-sortable">{'Name'|i18n( 'design/adin/content/trash')}</a>
</span>
</div>
</th>
{* set Class name column link & asc/desc icon *}
{set
$col_class = ''
$link_order = 1
}
{if eq( 'class_name', $trash_sort_field )}
{if eq($trash_sort_order, '0')}
{set $col_class = ' yui-dt-desc'}
{elseif eq($trash_sort_order, '1')}
{set
$col_class = ' yui-dt-asc'
$link_order = 0
}
{/if}
{/if}
<th class="yui-dt-col-name yui-dt-sortable{$col_class}">
<div id="yui-dt0-th-class_name-liner" class="yui-dt-liner">
<span class="yui-dt-label">
<a href="{concat( 'content/trash/(sort_field)/class_name/(sort_order)/', $link_order )|ezurl( 'no' )}" title="Click to sort {$sort_order}" class="yui-dt-sortable">{'Type'|i18n( 'design/admin/content/trash')}</a>
</span>
</div>
</th>
{* set Section column link & asc/desc icon *}
{set
$col_class = ''
$link_order = 1
}
{if eq( 'section', $trash_sort_field )}
{if eq($trash_sort_order, '0')}
{set $col_class = ' yui-dt-desc'}
{elseif eq($trash_sort_order, '1')}
{set
$col_class = ' yui-dt-asc'
$link_order = 0
}
{/if}
{/if}
<th class="yui-dt-col-name yui-dt-sortable{$col_class}">
<div id="yui-dt0-th-class_name-liner" class="yui-dt-liner">
<span class="yui-dt-label">
<a href="{concat( 'content/trash/(sort_field)/section/(sort_order)/', $link_order )|ezurl( 'no' )}" title="Click to sort {$sort_order}" class="yui-dt-sortable">{'Section'|i18n( 'design/admin/content/trash')}</a>
</span>
</div>
</th>
<th class="yui-dt-col-name yui-dt-sortable">{'Original Placement'|i18n( 'design/admin/content/trash')}</th>
{* set Trashed column link & asc/desc icon *}
{set
$col_class = ''
$link_order = 1
}
{if eq( 'trashed', $trash_sort_field )}
{if eq($trash_sort_order, '0')}
{set $col_class = ' yui-dt-desc'}
{elseif eq($trash_sort_order, '1')}
{set
$col_class = ' yui-dt-asc'
$link_order = 0
}
{/if}
{/if}
<th class="yui-dt-col-name yui-dt-sortable{$col_class}">
<div id="yui-dt0-th-class_name-liner" class="yui-dt-liner">
<span class="yui-dt-label">
<a href="{concat( 'content/trash/(sort_field)/trashed/(sort_order)/', $link_order )|ezurl( 'no' )}" title="Click to sort {$sort_order}" class="yui-dt-sortable">{'Date trashed'|i18n( 'design/admin/content/trash')}</a>
</span>
</div>
</th>
<th class="tight yui-dt-col-name yui-dt-sortable">&nbsp;</th>
</tr>

{section var=tObjects loop=fetch( 'content', 'trash_object_list', hash( 'limit', $number_of_items,
Expand All @@ -81,17 +186,21 @@
<td>
{let section_object=fetch( section, object, hash( section_id, $cur_c_object.section_id ) )}{section show=$section_object}{$section_object.name|wash}{section-else}<i>{'Unknown'|i18n( 'design/admin/content/trash' )}</i>{/section}{/let}
</td>
<td>
<td class="width-280">
{if $original_parent}<a href={concat( '/', $original_parent.path_identification_string )|ezurl}>{/if}/{$tObjects.item.original_parent_path_id_string|wash}{if $original_parent}</a>{/if}
</td>
<td>
{$tObjects.item.trashed|l10n( 'shortdatetime' )}
</td>
<td>
<a href={concat( '/content/restore/', $cur_c_object.id, '/' )|ezurl}><i class="fa fa-pencil-square-o"></i></a>
</td>
</tr>

{/let}
{/section}
</table>
</div>

{else}

Expand All @@ -112,7 +221,7 @@
</div>


{* DESIGN: Content END *}
{* DESIGN: Content END *}</div></div></div>

<div class="controlbar">
{* DESIGN: Control bar START *}
Expand All @@ -125,54 +234,13 @@
<input class="btn btn-default" type="submit" name="EmptyButton" value="{'Empty trash'|i18n( 'design/admin/content/trash' )}" disabled="disabled" />
{/if}
</div>
{* Sorting *}
<div class="button-right form-inline" id="trash-list-sort-control" style="display:none;">
<div class="form-group">
<label>{'Sorting'|i18n( 'design/admin/node/view/full' )}:</label>

{def $sort_fields = hash( 'class_identifier', 'Class identifier'|i18n( 'design/admin/node/view/full' ),
'class_name', 'Class name'|i18n( 'design/admin/node/view/full' ),
'modified', 'Modified'|i18n( 'design/admin/node/view/full' ),
'name', 'Name'|i18n( 'design/admin/node/view/full' ),
'published', 'Published'|i18n( 'design/admin/node/view/full' ),
'section', 'Section'|i18n( 'design/admin/node/view/full' ) )
$sort_title = 'Use these controls to set the sorting method for the sub items of the current location.'|i18n( 'design/admin/node/view/full' )}

<select class="form-control" id="trash_sort_field" title="{$sort_title}">
{foreach $sort_fields as $key => $item}
<option value="{$key}" {if eq( $key, $trash_sort_field )}selected="selected"{/if}>{$item}</option>
{/foreach}
</select>
</div>
<div class="form-group">
<select class="form-control" id="trash_sort_order" title="{$sort_title}">
<option value="0"{if eq($trash_sort_order, '0')} selected="selected"{/if}>{'Descending'|i18n( 'design/admin/node/view/full' )}</option>
<option value="1"{if eq($trash_sort_order, '1')} selected="selected"{/if}>{'Ascending'|i18n( 'design/admin/node/view/full' )}</option>
</select>

<input class="btn btn-default" type="submit" onclick="return trashSortingSelection({'content/trash'|ezurl('single')})" name="SetSorting" value="{'Set'|i18n( 'design/admin/node/view/full' )}" title="{$sort_title}" />
</div>

</div>

</div>
{literal}
<script type="text/javascript">
document.getElementById('trash-list-sort-control').style.display = '';

function trashSortingSelection( trashUrl )
{
trashUrl += '/(sort_field)/' + document.getElementById('trash_sort_field').value;
trashUrl += '/(sort_order)/' + document.getElementById('trash_sort_order').value;
document.location = trashUrl;
return false;
}
</script>
{/literal}
<div class="float-break"></div>
{* DESIGN: Control bar END *}
{* DESIGN: Control bar END *}</div></div>
</div>
</div>
</form>
{undef $sort_fields $sort_title}
{/let}