summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b66531)
raw | patch | inline | side by side (parent: 5b66531)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Apr 2010 07:42:13 +0000 (07:42 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 1 Apr 2010 07:42:13 +0000 (07:42 +0000) |
-Increased performance, only request entries in range.
-Fixed style
-Fixed w3c errors
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17447 594d385d-05f5-0310-b6e9-bd551577e9d8
-Fixed style
-Fixed w3c errors
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17447 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc b/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc
index bbb6f98ea15f7bd20121675f10eaa206c8531011..1ed3ecfa7bfe78478fea8aa9920cf1dec1a384a2 100644 (file)
Get Query String && Search
*****************/
- $query = $this->CreateQuerySyntax();
$link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']);
@DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query");
+ // Get all matching entries to be able to fill the pager
+ $query = $this->CreateQuerySyntax($limit = FALSE);
+ $count = @mysql_query($query);
+ if ($count === false){
+ msg_dialog::display(_("Error"), msgPool::dbquery(_("GOfon"),@mysql_error(),$cfg['SERVER']),ERROR_DIALOG);
+ return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
+ }
+ $tmp = mysql_fetch_array($count, MYSQL_ASSOC);
+ $res_count = $tmp['count'];
+ if($res_count < $this->start){
+ $this->start = 0;
+ }
+
+ // Get entries for the selected range only.
+ $query = $this->CreateQuerySyntax($limit = TRUE);
$result = @mysql_query($query);
if ($result === false){
msg_dialog::display(_("Error"), msgPool::dbquery(_("GOfon"),@mysql_error(),$cfg['SERVER']),ERROR_DIALOG);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
+ // Check attribute permissions
foreach($line as $attr => $value){
-
if($attr == "duration") continue;
-
$acl = $this->ui->get_permissions($this->search_base,"fonreport/fonreport",$attr);
if(!preg_match("/r/",$acl)){
$line[$attr] = $no_acl;
}
}
+ // Check date permissions
if($this->ui->get_permissions($this->search_base,"fonreport/fonreport","calldate")){
$hour= substr($line["calldate"], 11, 2);
$minute=substr($line["calldate"], 14, 2);
$date_str = $no_acl;
}
- $append_str = "";
- $append_str .= "<td>".$date_str."</td>";
-
+ $append_str = "<td class='list1'>".$date_str."</td>";
foreach(array("src","dst","channel","lastapp","disposition") as $atr){
if(isset($line[$atr])){
- $append_str .= "<td>".$line[$atr]."</td>";
+ $append_str .= "<td class='list1'>".$line[$atr]."</td>";
}
}
-
if($this->ui->get_permissions($this->search_base,"fonreport/fonreport","duration")){
- $append_str .= "<td>".$this->gen_duration($line["duration"])."</td>";
+ $append_str .= "<td class='list1'>".$this->gen_duration($line["duration"])."</td>";
}else{
- $append_str .= "<td>".$no_acl."</td>";
+ $append_str .= "<td class='list1'>".$no_acl."</td>";
}
$report_list[] = $append_str;
}
/* Generate output */
$mod = 0;
$output = "";
- if(count($this->report_list) < $this->start){
- $this->start = 0;
- }
foreach($this->report_list as $val){
- if ($mod < $this->start) {
- $mod++;
- continue;
- }
- if ($mod >= ($this->start + $this->range)){
- $mod++;
- break;
- }
- if ( ($mod++) & 1){
- $col= "background-color: #ECECEC;";
- } else {
- $col= "background-color: #F5F5F5;";
- }
- $output.= "<tr style=\"height:22px; $col\">$val</tr>";
+ $output.= "<tr>$val</tr>";
}
/*****************
if ($output != ""){
$smarty->assign("search_result", $output);
- $smarty->assign("range_selector", range_selector(count($this->report_list), $this->start,$this->range,"EntryPerPage"));
+ $smarty->assign("range_selector", range_selector($res_count, $this->start,$this->range,"EntryPerPage"));
} else {
$smarty->assign("search_result", "");
}
/* Create query string */
- function CreateQuerySyntax()
+ function CreateQuerySyntax($limit = TRUE)
{
/* Get extended search filter which contain uids and so on */
$uidstring = $this->GetUidMatchingFilter();
/* Create times */
$start= date ("YmdHis", mktime(0,0,0,$this->month,1,$this->year));
$end= date ("YmdHis", mktime(23,59,59,($this->month +1),0,$this->year));
- $query = "SELECT ".$fields_str.",calldate FROM cdr ".
+
+ if(!$limit){
+ $fieldset = "count(dst) as `count`";
+ }else{
+
+ /* Create string with all fields seperated by ,*/
+ $fields_str ="";
+ foreach($this->fields as $field){
+ if($field == "calldate") continue;
+ $fields_str .= $field.", ";
+ }
+ $fields_str = preg_replace("/, $/","",$fields_str);
+ $fieldset = $fields_str.",calldate";
+ }
+
+ $query = "SELECT {$fieldset} FROM cdr ".
"WHERE
calldate <= $end
AND
calldate >= $start
". $uidstring."
- ORDER BY ".$this->fields[$this->sort]." $desc;";
+ ORDER BY ".$this->fields[$this->sort]." $desc";
+
+ // Set limitations
+ if($limit){
+ $query.=" LIMIT ".($this->start).", ".$this->range;
+ }
+ $query.=";";
return($query);
}
diff --git a/gosa-plugins/gofon/gofon/fonreports/contents.tpl b/gosa-plugins/gofon/gofon/fonreports/contents.tpl
index 86797c96a282de85229616b65cd132ee621d35fe..94cebf8267ffb978cadfc0718e9b5e546905c5e3 100644 (file)
-<div class="contentboxh">
- <p class="contentboxh">{image path="{$launchimage}" align="right"}{t}Filter{/t}
-</p>
-</div>
-<div class="contentboxb">
- <p class="contentboxb" style="border-top:1px solid #B0B0B0; padding-top:5px;">
- {image path="{$search_image}"} {t}Search for{/t}
-
- <input type='text' name="search_for" size=25 maxlength=60 value="{$search_for}" title="{t}Enter user name to search for{/t}" onChange="mainform.submit()">
- {t}in{/t}
- <select size="1" name="search_base" title="{t}Select subtree to base search on{/t}" onChange="mainform.submit()">
- {html_options options=$bases selected=$base_select}
- </select>
- {t}on{/t}
- <select size="1" name="selected_server" title="{t}Select server to search on{/t}" onChange="mainform.submit()">
- {html_options options=$servers selected=$selected_server}
- </select>
- {t}during{/t}
- <select size="1" name="month" onChange="mainform.submit()">
- {html_options options=$months selected=$month_select}
- </select>
- {t}in{/t}
- <select size="1" name="year" onChange="mainform.submit()">
- {html_options values=$years output=$years selected=$year_select}
- </select>
-
- <button type='submit' name='search'>{t}Search{/t}</button>
-
-</p>
+<div id="mainlist">
+ <div class="mainlist-header">
+ <p>{t}System logs{/t}</p>
+
+ <div class="mainlist-nav">
+ <table summary="{t}Filter{/t}" style="width: 100%;"
+ id="t_scrolltable" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>{t}Server{/t}
+ <select size="1" name="selected_server" title="{t}Select server to search on{/t}" onChange="mainform.submit()">
+ {html_options options=$servers selected=$selected_server}
+ </select>
+ </td>
+ <td>{t}Date{/t}
+ <select size="1" name="month" onChange="mainform.submit()">
+ {html_options options=$months selected=$month_select}
+ </select>
+ <select size="1" name="year" onChange="mainform.submit()">
+ {html_options values=$years output=$years selected=$year_select}
+ </select>
+ </td>
+ <td>{t}Search for{/t}
+ <input type='text' name="search_for" size=25 maxlength=60
+ value="{$search_for}" title="{t}Enter user name to search for{/t}"
+ onChange="mainform.submit()">
+ </td>
+ <td>
+ <button type='submit' name='search'>{t}Search{/t}</button>
+ </td>
+ </tr>
+ </table>
+
+ </div>
+ </div>
</div>
<br>
{if $search_result}
- <table style='width:100%; ' summary="{t}Phone reports{/t}"> <tr style="background-color: #E8E8E8; height:26px; font-weight:bold">
- <td><a href="main.php{$plug}&sort=0">{t}Date{/t} {$mode0}</a></td>
- <td><a href="main.php{$plug}&sort=1">{t}Source{/t} {$mode1}</a></td>
- <td><a href="main.php{$plug}&sort=2">{t}Destination{/t} {$mode2}</a></td>
- <td><a href="main.php{$plug}&sort=3">{t}Channel{/t} {$mode3}</a></td>
- <td><a href="main.php{$plug}&sort=4">{t}Application{/t} {$mode4}</a></td>
- <td><a href="main.php{$plug}&sort=5">{t}Status{/t} {$mode5}</a></td>
- <td><a href="main.php{$plug}&sort=6">{t}Duration{/t} {$mode6}</a></td>
- </tr>
- {$search_result}
- </table>
-
- <table summary="{t}Page selector{/t}" style='width:100%; text-align:center;'> <tr>
- <td>{$range_selector}</td>
- </tr>
- </table>
-
-<hr>
+
+ <div class="listContainer" id="d_scrollbody" style="min-height: 475px; height: 444px;">
+ <table summary="{t}Phone reports{/t}" style="width:100%;" cellpadding="0" cellspacing="0">
+ <thead class="fixedListHeader listHeaderFormat">
+ <tr>
+ <td class='listheader'><a href="main.php{$plug}&sort=0">{t}Date{/t} {$mode0}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=1">{t}Source{/t} {$mode1}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=2">{t}Destination{/t} {$mode2}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=3">{t}Channel{/t} {$mode3}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=4">{t}Application{/t} {$mode4}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=5">{t}Status{/t} {$mode5}</a></td>
+ <td class='listheader'><a href="main.php{$plug}&sort=6">{t}Duration{/t} {$mode6}</a></td>
+ </tr>
+ </thead>
+ <tbody class="listScrollContent listBodyFormat" id="t_nscrollbody">
+ {$search_result}
+ <tr>
+ <td class="list0"> </td>
+ <td class="list0"> </td>
+ <td class="list0"> </td>
+ <td class="list0"> </td>
+ <td class="list0"> </td>
+ <td class="list0"> </td>
+ </tr>
+ </tbody>
+ </table>
+
+ </div>
+ <div class="nlistFooter">
+ <div style='width:100%;'>
+ {$range_selector}
+ </div>
+ </div>
+
{else}
- <b>{t}Search returned no results...{/t}</b>
+ <hr>
+ <b>{t}Search returned no results...{/t}</b>
{/if}
<!-- Place cursor -->
diff --git a/gosa-plugins/gofon/gofon/fonreports/main.inc b/gosa-plugins/gofon/gofon/fonreports/main.inc
index cbd957edd2a3a93a9122cbab549d4541ea68fda0..21660c85cb0c54e3b17059aaf27aa0ba43b6efcc 100644 (file)
$display= $fonreport->execute ();
$display.= "<input type=\"hidden\" name=\"ignore\">\n";
- /* Page header*/
- $display= print_header(get_template_path('plugins/gofon/images/phonereport.png'), _("Phone reports")).$display;
-
/* Store changes in session */
session::set('fonreport',$fonreport);
}