Changeset 778


Ignore:
Timestamp:
03/29/13 17:15:20 (8 years ago)
Author:
ramonb
Message:
  • more fixes to search
Location:
branches/0.4/web/addons/job_monarch
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/libtoga.php

    r767 r778  
    9797global $JOB_ARCHIVE_DIR;
    9898global $JOB_ARCHIVE_DBASE;
     99global $JOB_ARCHIVE_SQL_USER;
     100global $JOB_ARCHIVE_SQL_PASSWORD;
    99101global $skan_str;
    100102global $x_first, $y_first;
     
    160162    var $ip, $dbase, $conn;
    161163
    162     function TarchDbase( $ip = null, $dbase = null )
     164    function TarchDbase( $ip = null, $dbase = null, $user =null, $password=null )
    163165    {
    164166        global $CLUSTER_CONFS, $clustername;
     
    184186    function connect()
    185187    {
     188        global $JOB_ARCHIVE_SQL_USER, $JOB_ARCHIVE_SQL_PASSWORD;
     189
     190        $connect_args ='';
    186191        if( $this->ip == null )
    187             $this->conn = pg_connect( "dbname=".$this->dbase );
     192        {
     193            $connect_args .= "dbname=".$this->dbase;
     194        }
    188195        else
    189             $this->conn = pg_connect( "host=".$this->ip." dbname=".$this->dbase );
     196        {
     197            $connect_args .= "host=".$this->ip." dbname=".$this->dbase;
     198        }
     199        if( isset($JOB_ARCHIVE_SQL_USER) )
     200        {
     201            $connect_args .= " user=".$JOB_ARCHIVE_SQL_USER;
     202        }
     203        if( isset($JOB_ARCHIVE_SQL_PASSWORD) )
     204        {
     205            $connect_args .= " password=".$JOB_ARCHIVE_SQL_PASSWORD;
     206        }
     207
     208
     209        $this->conn = pg_connect( $connect_args );
     210
    190211    }
    191212
     
    260281
    261282        $ids = $this->queryDbase( $select_query );
     283
     284        //print_r( $ids );
    262285
    263286        $ret = array();
     
    335358    {
    336359        $result_rows = array();
    337     
    338         if( !$this->conn )
     360   
     361        if( $this->conn == null )
    339362        {
    340363            $this->connect();
    341364        }
    342365
     366        if( $this->conn == null )
     367        {
     368            printf(" no connection!\n");
     369        }
    343370        $result = pg_query( $this->conn, $query );
    344371
    345372        while ($row = pg_fetch_assoc($result))
    346373        {
     374            //print_r( $row );
    347375            $result_rows[] = $row;
    348376        }
  • branches/0.4/web/addons/job_monarch/search.php

    r776 r778  
    3333    global $end_from_time, $end_to_time, $period_start, $period_stop, $tpl_data;
    3434
    35     $error = 0;
     35    $error = false;
    3636    $error_msg = "<FONT COLOR=\"red\"><B>";
    3737    $show_msg = 0;
     
    4040
    4141    if( $id == '' and $owner== '' and $name == '' and $start_from_time == '' and $start_to_time == '' and $queue == '' and $end_from_time == '' and $end_to_time == '') {
    42         $error = 1;
     42        $error = true;
    4343        $show_msg = 1;
    4444        $error_msg .= "No search criteria set!";
     
    4848    {
    4949
    50         $error = 1;
     50        $error = true;
    5151        $show_msg = 1;
    5252        $error_msg .= "Id must be a number";
     
    6464
    6565                $show_msg = 1;
     66                $error = true;
    6667                $error_msg .= "Graph timeperiod reset: start date/time can't be later than end";
    6768                $period_stop = '';
     
    7071
    7172                $show_msg = 1;
     73                $error = true;
    7274                $error_msg .= "Graph timeperiod reset: start and end date/time can't be the same";
    7375                $period_stop = '';
     
    7880
    7981    $error_msg .= "</B></FONT>";
    80     // doe checks en set error en error_msg in case shit
    81 
    82     //if( $show_msg )
    83         //$tpl_data->assign( "form_error_msg", $error_msg );
    84 
    85     return ($error ? 0 : 1 );
     82
     83    return array( $error_msg, $error);
    8684}
    8785
     
    256254    $tpl_data->assign( "end_to_value", rawurldecode( $end_to_time ) );
    257255
    258     if( validateFormInput() ) {
    259 
     256    list( $form_error_msg, $form_error ) = validateFormInput();
     257
     258    if( $form_error == true )
     259    {
     260        $tpl_data->assign( "form_error_msg", $form_error_msg );
     261    }
     262    else if( $form_error == false )
     263    {
    260264        $tpl_data->assign( "search_results", "yes" );
    261265        $tpl_data->assign( "sortby", $sortby);
     
    268272        $search_ids = $tdb->searchDbase( $id, $queue, $owner, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
    269273
     274        //print_r( $search_ids );
    270275        if( ($tdb->resultcount) > (int) $SEARCH_RESULT_LIMIT ) {
    271         
     276       
    272277            $tpl_data->assign( "form_error_msg", "Got " . $tdb->resultcount . " search results, output limited to last " . $SEARCH_RESULT_LIMIT . " jobs." );
    273278        }
     
    350355            $node_loop[]=$node_list;
    351356        }
    352         $tpl_data->assign("node_loop", $node_loop );
     357        //print_r( $node_loop );
     358        $tpl_data->assign("node_list", $node_loop );
    353359
    354360        if( count( $search_ids ) == 1 ) {
     
    463469                    $sorted_loop[]=$sorted_list;
    464470                }
    465                 $tpl_data->assign("sorted_loop", $sorted_loop );
    466 
     471                $tpl_data->assign("sorted_list", $sorted_loop );
    467472            }
    468473        }
  • branches/0.4/web/addons/job_monarch/templates/search.tpl

    r776 r778  
    197197{$form_error_msg}<BR><BR>
    198198
    199 {if "$search_results" == " yes" }
     199{if "$search_results" == "yes" }
    200200
    201201<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{$sortby}">
     
    223223</TR>
    224224
    225 {loop $node}
     225{loop $node_list}
    226226  <TR CLASS="{$nodeclass}">
    227227    <TD><A HREF="#" onClick="setFilter( 'id', '{$id}' )">{$id}</A></TD>
Note: See TracChangeset for help on using the changeset viewer.