diff --git a/workflow/engine/classes/class.propelTable.php b/workflow/engine/classes/class.propelTable.php index a50206659..a412e5bac 100755 --- a/workflow/engine/classes/class.propelTable.php +++ b/workflow/engine/classes/class.propelTable.php @@ -338,18 +338,18 @@ class propelTable if (($this->style[$r]['showInTable'] != '0') && (! (in_array( $this->fields[$r]['Name'], $this->masterdetail )))) { //if (($this->style[$r]['showInTable'] != '0' )) $this->tpl->newBlock( "headers" ); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? 'DESC' : 'ASC'); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder); + + $sortDir = "ASC"; + + if (isset($this->aOrder[$this->fields[$r]["Name"]])) { + $sortDir = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "DESC" : "ASC"; + } if ($this->style[$r]['titleVisibility'] != '0') { - $this->style[$r]['href'] = $this->ownerPage . '?order=' . ($sortOrder !== '' ? (G::createUID( '', $this->fields[$r]['Name'] ) . '=' . $sortOrder) : '') . '&page=' . $this->currentPage; - if ($this->sortable == '0') { - $this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , ""); return false;';; - } else { - $this->style[$r]['onsort'] = $this->id . '.doSort("' . G::createUID( '', $this->fields[$r]['Name'] ) . '" , "' . $sortOrder . '"); return false;'; - } + $this->style[$r]["href"] = "javascript:;"; + $this->style[$r]["onsort"] = $this->id . ".doSort(\"" . G::createUID("", $this->fields[$r]["Name"]) . "\", \"" . (($this->sortable == "0")? "" : $sortDir) . "\"); return false;"; } else { - $this->style[$r]['href'] = '#'; + $this->style[$r]["href"] = "javascript:;"; $this->style[$r]['onsort'] = 'return false;'; } if (isset( $this->style[$r]['href'] )) { @@ -378,10 +378,14 @@ class propelTable $this->tpl->assign( "align", 'text-align:' . $this->style[$r]['titleAlign'] . ';' ); } if ($this->style[$r]['titleVisibility'] != '0') { - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'ASC')) ? '' : ''); - $sortOrder = (((isset( $this->aOrder[$this->fields[$r]['Name']] )) && ($this->aOrder[$this->fields[$r]['Name']] === 'DESC')) ? '' : $sortOrder); - $this->tpl->assign( "header", $this->fields[$r]['Label'] . $sortOrder ); - $this->tpl->assign( 'displaySeparator', (($this->colCount == 0) || (! isset( $this->fields[$r]['Label'] )) || ($this->fields[$r]['Label'] === '')) ? 'display:none;' : '' ); + $sortDirImg = ""; + + if (isset($this->aOrder[$this->fields[$r]["Name"]])) { + $sortDirImg = ($this->aOrder[$this->fields[$r]["Name"]] == "ASC")? "" : ""; + } + + $this->tpl->assign("header", $this->fields[$r]["Label"] . $sortDirImg); + $this->tpl->assign("displaySeparator", ($this->colCount == 0 || !isset($this->fields[$r]["Label"]) || $this->fields[$r]["Label"] == "")? "display: none;" : ""); } else { $this->tpl->assign( 'displaySeparator', 'display:none;' ); } @@ -753,29 +757,30 @@ class propelTable } } } + + $strjsCurrentOrder = $this->id . ".currentOrder = '" . addslashes($this->orderBy) . "';"; + $this->tpl->assign( '_ROOT.gridRows', '=' . $gridRows ); //number of rows in the current page $this->tpl->newBlock( 'rowTag' ); $this->tpl->assign( 'rowId', 'insertAtLast' ); if ($this->currentPage > 1) { - $firstUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=1'; - $firstAjax = $this->id . ".doGoToPage(1);return false;"; $prevpage = $this->currentPage - 1; - $prevUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $prevpage; - $prevAjax = $this->id . ".doGoToPage(" . $prevpage . ");return false;"; - $first = "     "; - $prev = "     "; + + $firstAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(1); return false;"; + $prevAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $prevpage . "); return false;"; + $first = "     "; + $prev = "     "; } else { $first = "     "; $prev = "     "; } if ($this->currentPage < $this->totPages) { - $lastUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $this->totPages; - $lastAjax = $this->id . ".doGoToPage(" . $this->totPages . ");return false;"; $nextpage = $this->currentPage + 1; - $nextUrl = $this->ownerPage . '?order=' . $this->orderBy . '&page=' . $nextpage; - $nextAjax = $this->id . ".doGoToPage(" . $nextpage . ");return false;"; - $next = "     "; - $last = "     "; + + $nextAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $nextpage . "); return false;"; + $lastAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $this->totPages . "); return false;"; + $next = "     "; + $last = "     "; } else { $next = "     "; $last = "     "; @@ -783,9 +788,10 @@ class propelTable $pagesEnum = ''; for ($r = 1; $r <= $this->totPages; $r ++) { if (($r >= ($this->currentPage - 5)) && ($r <= ($this->currentPage + 5))) { - $pageAjax = $this->id . ".doGoToPage(" . $r . ");return false;"; + $pageAjax = $strjsCurrentOrder . $this->id . ".doGoToPage(" . $r . "); return false;"; + if ($r != $this->currentPage) { - $pagesEnum .= " ownerPage . '?order=' . $this->orderBy . '&page=' . $r, ENT_QUOTES, 'utf-8' ) . "\" onclick=\"" . $pageAjax . "\">" . $r . ""; + $pagesEnum .= " " . $r . ""; } else { $pagesEnum .= " " . $r . ""; }