/[cvs]/nfo/site/htdocs/pages/otd_html1/userinfo.php
ViewVC logotype

Diff of /nfo/site/htdocs/pages/otd_html1/userinfo.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by rabit, Mon Sep 6 03:03:28 2004 UTC revision 1.6 by rabit, Sun Sep 26 17:26:16 2004 UTC
# Line 39  global $$varname; Line 39  global $$varname;
39    
40    }    }
41    
42    otd_html1_codeparagraph('<small>    otd_html1_codeparagraph('<small><b>$' . $varname . '</b> = ' . trim($arraytext) . '</small>');
 <b>$' . $varname . '</b> = ' . nl2br($arraytext) . '  
 </small>');  
43    
44  }  }
45    
# Line 65  otd_html1_pagetitle('CMS test page'); Line 63  otd_html1_pagetitle('CMS test page');
63    
64  otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');  otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');
65    
66  otd_html1_paragraph('The result of each different query operation is shown in its own specific format. If you want to see the complete function response then turn "Debug outputs" on.');  //otd_html1_paragraph('If successful, the result of the query process is shown as a table. If you want to see the complete function response then turn "Debug outputs" on.');
67    
68  //----------------------------------------------------------  //----------------------------------------------------------
69    
70  $queries = array(  $queries = array(
71   'LIST contenttypes',   'GET COUNT FROM SOURCES',
72   'GET 1, 2 FROM contenttypes',   'GET FIELDNAMES FROM SOURCES',
73   'LIST languages',   'GET name FROM SOURCES',
74   'GET 1, 2 FROM languages',   'GET * FROM SOURCES',
75   'LIST contents',   'GET COUNT FROM contenttypes',
76   'LIST contents WITH keyname=Home, language_id=1',   'GET FIELDNAMES FROM contenttypes',
77   'GET 2 FROM contents'   'GET id, name FROM contenttypes',
78     'GET COUNT FROM languages',
79     'GET FIELDNAMES FROM languages',
80     'GET id, name FROM languages',
81     'GET * FROM languages',
82     'GET COUNT FROM contents',
83     'GET FIELDNAMES FROM contents',
84     'GET type, language_id, description FROM contents',
85     'GET id, keyname, description FROM contents WITH type xmlpage',
86     'GET id, description FROM contents WITH language_id 2',
87     'GET id, description FROM contents WITH type xmlpage ORDERBY id COUNT 5',
88    /*
89     'GET content FROM contents WITH id 3',
90     'GET FROM contents WITH timestamp >1000000000',
91     'GET description, language_id FROM contents WITH keyname Home',
92    */
93  );  );
94    
95  $query = (isset($_POST['q']) ? $_POST['q'] : '');  $query = (isset($_POST['q']) ? $_POST['q'] : '');
96    
97  otd_html1_headline('Query command:');  otd_html1_headline('Query command:');
98    
99  $options = '';  for($q = 0, $options = ''; $q < count($queries); $q++)
100     $options .= '<option' . ($query == $queries[$q] ? ' selected="selected"' : '') . ' value="' . $queries[$q] . '">' . $queries[$q] . '</option>
 for($q = 0; $q < count($queries); $q++) {  
   
   $options .= '<option value="' . $queries[$q] . '">' . $queries[$q] . '</option>  
101  ';  ';
102    
 }  
   
103  otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">  otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
104  <select name="q" size="6">  <select name="q" size="1">
105  ' . $options . '</select>  ' . $options . '</select>
106  <input type="submit" value="OK" />  <input type="submit" value="OK" />
107  </form>', 'box1');  </form>', 'box1');
108    
109  otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">  otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
110  <input name="q" size="53" value="' . $query . '" />  <input name="q" size="76" value="' . $query . '" />
111  <input type="submit" value="OK" />  <input type="submit" value="OK" />
112  </form>', 'box1');  </form>', 'box1');
113    
# Line 112  if($query) { Line 120  if($query) {
120    
121    common_benchmark_addstep('CMS query');    common_benchmark_addstep('CMS query');
122    
123    otd_html1_headline('Query execution:');    otd_html1_headline('Query execution response:');
124    
125    otd_html1_paragraph('Command: "<b>' . $query . '</b>"<br />    otd_html1_paragraph('Command: "<b>' . $query . '</b>"', 'hl12');
 Success: <b>' . ($success ? 'Yes' : 'No') . '</b>');  
126    
127    $resultinfo = $response[0];    $resultinfo = $response[0];
128    
129    if($resultinfo['error']) {    otd_html1_paragraph('Error: "<code>' . $resultinfo['error'] . '</code>" - "<b>' . $resultinfo['errortext'] . '</b>"', ($resultinfo['error'] ? 'hl11' : 'hl12'));
   
     otd_html1_headline('Query error:');  
130    
131      otd_html1_paragraph('Error number: "<code>' . $resultinfo['error'] . '</code>"<br />  //  otd_html1_headline('Result:');
 Error text: "<b>' . $resultinfo['errortext'] . '</b>"', 'hl12');  
132    
133    } else {    if($success) {
   
     otd_html1_headline('Result:');  
134    
135      switch($resultinfo['operation']) {      switch($resultinfo['operation']) {
136    
       case 'LIST':  
   
         $idlist = '';  
   
         for($r = 0; $r < count($response[1]); $r++)  
          $idlist .= ($r ? ', ' : '') . $response[1][$r][0];  
   
         otd_html1_paragraph('List of IDs: "<code>' . $idlist . '</code>"', 'hl12');  
   
         break;  
   
137        case 'GET':        case 'GET':
138    
139          $rows = $response[1];          $rows = $response[1];
# Line 151  Error text: "<b>' . $resultinfo['errorte Line 142  Error text: "<b>' . $resultinfo['errorte
142    
143            for($x = 0; $x < count($rows[$y]); $x++) {            for($x = 0; $x < count($rows[$y]); $x++) {
144    
145              $rows[$y][$x] = htmlentities($rows[$y][$x]);              if(strlen($rows[$y][$x]) > 97) {
146    
147            }                $rows[$y][$x] = substr($rows[$y][$x], 0, 97) . '...';
148    
149            if($resultinfo['source'] == 'contents') {              }
150    
151              $rows[$y][6] = '<small><code>' . substr($rows[$y][6], 0, 124) . ' ...</code></small>';              $rows[$y][$x] = htmlentities($rows[$y][$x]);
152    
153            }            }
154    
# Line 169  Error text: "<b>' . $resultinfo['errorte Line 160  Error text: "<b>' . $resultinfo['errorte
160    
161      }      }
162    
163      } else {
164    
165        otd_html1_paragraph('(No result returned)');
166    
167    }    }
168    
169    if($common_sessiondata['user_prefs']['debug']) variablebox('response');    if($common_sessiondata['user_prefs']['debug']) variablebox('response');

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed