/[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.1 by rabit, Sun Sep 5 03:12:22 2004 UTC revision 1.4 by rabit, Mon Sep 6 03:03:28 2004 UTC
# Line 16  include('../../inc/otdef/otd_html1/otd_h Line 16  include('../../inc/otdef/otd_html1/otd_h
16    
17  common_benchmark_addstep('OTD_HTML1 included');  common_benchmark_addstep('OTD_HTML1 included');
18    
19  common_benchmark_addstep('start');  //------------------------------------------------------------------------------
20    
21    function variablebox($varname) {
22    
23    global $$varname;
24    
25      $arraytext = htmlentities(print_r($$varname, true));
26      $arraytext = str_replace('    ', ' ', $arraytext);
27      $arraytext = str_replace("Array\n", 'array ', $arraytext);
28      $arraytext = str_replace(' )', ')', $arraytext);
29      $arraytext = str_replace("\n\n", "\n", $arraytext);
30    
31      $len = strlen($arraytext);
32      $oldlen = 0;
33    
34      while($len != $oldlen) {
35    
36        $oldlen = strlen($arraytext);
37        $arraytext = str_replace("array  ", 'array ', $arraytext);
38        $len = strlen($arraytext);
39    
40      }
41    
42      otd_html1_codeparagraph('<small>
43    <b>$' . $varname . '</b> = ' . nl2br($arraytext) . '
44    </small>');
45    
46    }
47    
48    common_benchmark_addstep('functions');
49    
50  //------------------------------------------------------------------------------  //------------------------------------------------------------------------------
51    
52    common_benchmark_addstep('start');
53    
54  otd_html1_pagehead();  otd_html1_pagehead();
55    
56  common_benchmark_addstep('head');  common_benchmark_addstep('head');
# Line 30  common_benchmark_addstep('header'); Line 61  common_benchmark_addstep('header');
61    
62  //----------------------------------------------------------  //----------------------------------------------------------
63    
64  otd_html1_pagetitle('User info');  otd_html1_pagetitle('CMS test page');
65    
66  otd_html1_paragraph('This is an overview of your preferences and informations related to you and your visit. You may also change global settings here.');  otd_html1_paragraph('This is the first outstanding page and it was created for testing the CMS query mechanism.');
67    
68  otd_html1_paragraph('Also it is the first outstanding page and was created for testing yet.');  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.');
69    
70  // Only show debug outputs when set as preference:  //----------------------------------------------------------
 if($common_sessiondata['user_prefs']['debug']) {  
71    
72    otd_html1_headline('User preferences array:');  $queries = array(
73    otd_html1_codeparagraph('$common_sessiondata[user_prefs] = ' . nl2br(htmlentities(print_r($common_sessiondata['user_prefs'], true))));   'LIST contenttypes',
74     'GET 1, 2 FROM contenttypes',
75     'LIST languages',
76     'GET 1, 2 FROM languages',
77     'LIST contents',
78     'LIST contents WITH keyname=Home, language_id=1',
79     'GET 2 FROM contents'
80    );
81    
82    $query = (isset($_POST['q']) ? $_POST['q'] : '');
83    
84    otd_html1_headline('Query command:');
85    
86    $options = '';
87    
88    for($q = 0; $q < count($queries); $q++) {
89    
90      $options .= '<option value="' . $queries[$q] . '">' . $queries[$q] . '</option>
91    ';
92    
93  }  }
94    
95  //----------------------------------------------------------  otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
96    <select name="q" size="6">
97    ' . $options . '</select>
98    <input type="submit" value="OK" />
99    </form>', 'box1');
100    
101    otd_html1_paragraph('<form action="' . $common['page']['filename'] . '" method="post" style="margin:0;">
102    <input name="q" size="53" value="' . $query . '" />
103    <input type="submit" value="OK" />
104    </form>', 'box1');
105    
106    common_benchmark_addstep('content');
107    
108    if($query) {
109    
110      $response = null;
111      $success = cms_query($query, $response);
112    
113      common_benchmark_addstep('CMS query');
114    
115      otd_html1_headline('Query execution:');
116    
117      otd_html1_paragraph('Command: "<b>' . $query . '</b>"<br />
118    Success: <b>' . ($success ? 'Yes' : 'No') . '</b>');
119    
120      $resultinfo = $response[0];
121    
122      if($resultinfo['error']) {
123    
124        otd_html1_headline('Query error:');
125    
126        otd_html1_paragraph('Error number: "<code>' . $resultinfo['error'] . '</code>"<br />
127    Error text: "<b>' . $resultinfo['errortext'] . '</b>"', 'hl12');
128    
129      } else {
130    
131        otd_html1_headline('Result:');
132    
133        switch($resultinfo['operation']) {
134    
135          case 'LIST':
136    
137            $idlist = '';
138    
139            for($r = 0; $r < count($response[1]); $r++)
140             $idlist .= ($r ? ', ' : '') . $response[1][$r][0];
141    
142            otd_html1_paragraph('List of IDs: "<code>' . $idlist . '</code>"', 'hl12');
143    
144            break;
145    
146          case 'GET':
147    
148            $rows = $response[1];
149    
150            for($y = 0; $y < count($rows); $y++) {
151    
152              for($x = 0; $x < count($rows[$y]); $x++) {
153    
154                $rows[$y][$x] = htmlentities($rows[$y][$x]);
155    
156              }
157    
158              if($resultinfo['source'] == 'contents') {
159    
160                $rows[$y][6] = '<small><code>' . substr($rows[$y][6], 0, 124) . ' ...</code></small>';
161    
162              }
163    
164            }
165    
166            otd_html1_table($response[2], $rows);
167    
168            break;
169    
170        }
171    
172      }
173    
174      if($common_sessiondata['user_prefs']['debug']) variablebox('response');
175    
176    } else {
177    
178      otd_html1_headline('Query execution');
179    
180      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.');
181    
182    }
183    
184  common_benchmark_addstep('content');  common_benchmark_addstep('content');
185    
186    //----------------------------------------------------------
187    
188  $extrapageinfocontents = 'Page created by <b>rabit</b> on <b>2004/09/05, 02:29</b>.';  $extrapageinfocontents = 'Page created by <b>rabit</b> on <b>2004/09/05, 02:29</b>.';
189    
190  otd_html1_pagefooter($extrapageinfocontents);  otd_html1_pagefooter($extrapageinfocontents);

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

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