Skip to content

Commit

Permalink
Merge pull request #28 from proxyconcept/directory-view-enhancement
Browse files Browse the repository at this point in the history
Directory view enhancement
  • Loading branch information
coudot authored Feb 21, 2018
2 parents 4a107b2 + 0795867 commit 4f6efac
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
2 changes: 2 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@
# Directory
$use_directory = true;
$directory_items = array('firstname', 'lastname', 'mail', 'organization');
$directory_linkto = array('firstname', 'lastname');
$directory_sortby = "lastname";
$default_page_length = 10; // 10, 25, 50, 100 or -1 for all

# CSV
$use_csv = true;
Expand Down
17 changes: 17 additions & 0 deletions htdocs/css/white-pages.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ img.logo {
margin: 0;
font-weight: normal;
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after,
table.dataTable thead .sorting_asc_disabled::after,
table.dataTable thead .sorting_desc_disabled::after {
position: initial;
display: inline;
margin-left: 8px;
}

@media print {
a[href]:after {
/*content: " (" attr(href) ")";*/
content: none;
}
}
1 change: 1 addition & 0 deletions htdocs/directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
$smarty->assign("entries", $entries);
$smarty->assign("size_limit_reached", $size_limit_reached);
$smarty->assign("columns", $directory_items);
$smarty->assign("linkto", $directory_linkto);
$smarty->assign("sortby", $sortidx);

?>
2 changes: 2 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$smarty->assign('use_advanced_search',$use_advanced_search);
$smarty->assign('advanced_search_criteria',$advanced_search_criteria);
$smarty->assign('results_display_mode',$results_display_mode);
$smarty->assign('default_page_length',$default_page_length);
$smarty->assign('display_items',$display_items);
$smarty->assign('display_title',$display_title);
$smarty->assign('use_directory',$use_directory);
Expand Down Expand Up @@ -92,6 +93,7 @@
if (isset($_GET["page"]) and $_GET["page"]) { $page = $_GET["page"]; }
if ( $page === "search" and !$use_quick_search ) { $page = "welcome"; }
if ( $page === "advancedsearch" and !$use_advanced_search ) { $page = "welcome"; }
if ( $page === "directory" and !$use_directory ) { $page = "welcome"; }
if ( $page === "gallery" and !$use_gallery ) { $page = "welcome"; }
if ( file_exists($page.".php") ) { require_once($page.".php"); }
$smarty->assign('page',$page);
Expand Down
20 changes: 18 additions & 2 deletions templates/directory.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,25 @@
<tbody>
{foreach $entries as $entry}
<tr>
<th><a href="index.php?page=display&dn={$entry.dn|escape:'url'}&search={$search}" class="btn btn-info btn-sm" role="button" title="{$msg_displayentry}"><i class="fa fa-fw fa-id-card"></i></a></th>
<th><a href="index.php?page=display&dn={$entry.dn|escape:'url'}" class="btn btn-info btn-sm" role="button" title="{$msg_displayentry}"><i class="fa fa-fw fa-id-card"></i></a></th>
{foreach $columns as $column}
<td>{$entry.{$attributes_map.{$column}.attribute}.0}</td>
<td>
{$attribute=$attributes_map.{$column}.attribute}
{if !({$entry.$attribute.0})}
&mdash;{continue}
{/if}
{if in_array($column, $linkto)}
<a href="index.php?page=display&dn={$entry.dn|escape:'url'}" title="{$msg_displayentry}">
{/if}
{foreach $entry.{$attribute} as $value}
{if $value@index eq 0}{continue}{/if}
{$type=$attributes_map.{$column}.type}
{include 'value_displayer.tpl' value=$value type=$type truncate_value_after=$search_result_truncate_value_after ldap_params=$ldap_params date_specifiers=$date_specifiers}<br />
{/foreach}
{if in_array($column, $linkto)}
</a>
{/if}
</td>
{/foreach}
</tr>
{/foreach}
Expand Down
8 changes: 6 additions & 2 deletions templates/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
"paging": true,
"info": true,
"processing": true,
"pageLength": {/literal}{$default_page_length|default:10}{literal},
"lengthMenu": [
[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]
],
"order": [
[ {/literal}{$sortby + 1}{literal}, "asc" ]
[ {/literal}{$sortby|default:0 + 1}{literal}, "asc" ]
],
"aoColumnDefs": [
{ "bSortable": false, "aTargets": ['nosort'] },
],
"language": {
"url": "vendor/datatables/i18n/{/literal}{$lang}{literal}.json"
"url": "vendor/datatables/i18n/{/literal}{$lang|default:'en'}{literal}.json"
}
});
});
Expand Down

0 comments on commit 4f6efac

Please sign in to comment.