/[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.3 by rabit, Mon Sep 6 01:05:41 2004 UTC revision 1.5 by rabit, Fri Sep 10 21:44:17 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 63  common_benchmark_addstep('header'); Line 61  common_benchmark_addstep('header');
61    
62  otd_html1_pagetitle('CMS test page');  otd_html1_pagetitle('CMS test page');
63    
64  otd_html1_paragraph('This is the first outstanding page and was created for testing.');  otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');
65    
66  otd_html1_headline('CMS (Content Management System) test queries:');  //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.');
   
 otd_html1_paragraph('In the following basic CMS queries are tested. Each result list is shown as a table. If you want to see explicit results turn "Debug outputs" on.');  
   
 common_benchmark_addstep('content');  
67    
68  //----------------------------------------------------------  //----------------------------------------------------------
69    
70  $query = 'LIST languages';  $queries = array(
71     'GET COUNT FROM SOURCES',
72  $response = null;   'GET FIELDNAMES FROM SOURCES',
73  $success = cms_query($query, $response);   'GET name FROM SOURCES',
74     'GET * FROM SOURCES',
75  common_benchmark_addstep('CMS query');   'GET COUNT FROM contenttypes',
76     'GET FIELDNAMES FROM contenttypes',
77  otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":');   'GET id, name FROM contenttypes',
78     'GET COUNT FROM languages',
79  $idlist = '';   'GET FIELDNAMES FROM languages',
80     'GET id, name FROM languages',
81  for($r = 0; $r < count($response[1]); $r++)   'GET * FROM languages',
82   $idlist .= ($r ? ', ' : '') . $response[1][$r][0];   'GET COUNT FROM contents',
83     'GET FIELDNAMES FROM contents',
84  otd_html1_paragraph('List of IDs: "<b>' . $idlist . '</b>"', 'hl12');   'GET type, language_id, description FROM contents',
85    /*
86  if($common_sessiondata['user_prefs']['debug']) variablebox('response');   'GET content FROM contents WITH id 3',
87     'GET FROM contents WITH timestamp >1000000000',
88     'GET description, language_id FROM contents WITH keyname Home',
89    */
90    );
91    
92    $query = (isset($_POST['q']) ? $_POST['q'] : '');
93    
94    otd_html1_headline('Query command:');
95    
96    for($q = 0, $options = ''; $q < count($queries); $q++)
97     $options .= '<option' . ($query == $queries[$q] ? ' selected="selected"' : '') . ' value="' . $queries[$q] . '">' . $queries[$q] . '</option>
98    ';
99    
100    otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
101    <select name="q" size="1">
102    ' . $options . '</select>
103    <input type="submit" value="OK" />
104    </form>', 'box1');
105    
106    otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
107    <input name="q" size="50" value="' . $query . '" />
108    <input type="submit" value="OK" />
109    </form>', 'box1');
110    
111  common_benchmark_addstep('content');  common_benchmark_addstep('content');
112    
113  //----------------------------------------------------------  if($query) {
114    
115  $query = 'GET 1, 2 FROM languages';    $response = null;
116      $success = cms_query($query, $response);
117    
118  $response = null;    common_benchmark_addstep('CMS query');
 $success = cms_query($query, $response);  
119    
120  common_benchmark_addstep('CMS query');    otd_html1_headline('Query execution response:');
121    
122  otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":');    otd_html1_paragraph('Command: "<b>' . $query . '</b>"', 'hl12');
123    
124  $rows = $response[1];    $resultinfo = $response[0];
125    
126  for($y = 0; $y < count($rows); $y++) {    otd_html1_paragraph('Error: "<code>' . $resultinfo['error'] . '</code>" - "<b>' . $resultinfo['errortext'] . '</b>"', ($resultinfo['error'] ? 'hl11' : 'hl12'));
127    
128    for($x = 0; $x < count($rows[$y]); $x++) {  //  otd_html1_headline('Result:');
129    
130      $rows[$y][$x] = htmlentities($rows[$y][$x]);    if($success) {
131    
132    }      switch($resultinfo['operation']) {
133    
134  }        case 'GET':
135    
136  otd_html1_table($response[2], $rows);          $rows = $response[1];
137    
138  if($common_sessiondata['user_prefs']['debug']) variablebox('response');          for($y = 0; $y < count($rows); $y++) {
139    
140  common_benchmark_addstep('content');            for($x = 0; $x < count($rows[$y]); $x++) {
   
 //----------------------------------------------------------  
   
 $query = 'LIST contents  
 WITH keyname=Home, language_id=2';  
   
 $response = null;  
 $success = cms_query($query, $response);  
   
 common_benchmark_addstep('CMS query');  
141    
142  otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":');              if(strlen($rows[$y][$x]) > 97) {
143    
144  $idlist = '';                $rows[$y][$x] = substr($rows[$y][$x], 0, 97) . '...';
145    
146  for($r = 0; $r < count($response[1]); $r++)              }
  $idlist .= ($r ? ', ' : '') . $response[1][$r][0];  
147    
148  otd_html1_paragraph('List of IDs: "<b>' . $idlist . '</b>"', 'hl12');              $rows[$y][$x] = htmlentities($rows[$y][$x]);
149    
150  if($common_sessiondata['user_prefs']['debug']) variablebox('response');            }
151    
152  common_benchmark_addstep('content');          }
153    
154  //----------------------------------------------------------          otd_html1_table($response[2], $rows);
155    
156  $query = 'GET 3 FROM contents';          break;
157    
158  $response = null;      }
 $success = cms_query($query, $response);  
159    
160  common_benchmark_addstep('CMS query');    } else {
161    
162  otd_html1_paragraph('CMS query "<b>' . $query . '</b>" returned "<code>' . $success . '</code>":');      otd_html1_paragraph('(No result returned)');
163    
164  $rows = $response[1];    }
165    
166  for($y = 0; $y < count($rows); $y++) {    if($common_sessiondata['user_prefs']['debug']) variablebox('response');
167    
168    for($x = 0; $x < count($rows[$y]); $x++) {  } else {
169    
170      $rows[$y][$x] = htmlentities($rows[$y][$x]);    otd_html1_headline('Query execution');
171    
172    }    otd_html1_paragraph('Select a pre-defined query string from the list or enter a new one into the text input field. Press the "<b>GO</b>" button in both cases to execute the query.');
173    
   $rows[$y][6] = '<small><code>' . substr($rows[$y][6], 0, 64) . '...</code><small>';  
174  }  }
175    
 otd_html1_table($response[2], $rows);  
   
 if($common_sessiondata['user_prefs']['debug']) variablebox('response');  
   
176  common_benchmark_addstep('content');  common_benchmark_addstep('content');
177    
178  //----------------------------------------------------------  //----------------------------------------------------------

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

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