/[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.5 by rabit, Fri Sep 10 21:44:17 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><b>$' . $varname . '</b> = ' . trim($arraytext) . '</small>');
43    
44    }
45    
46    common_benchmark_addstep('functions');
47    
48  //------------------------------------------------------------------------------  //------------------------------------------------------------------------------
49    
50    common_benchmark_addstep('start');
51    
52  otd_html1_pagehead();  otd_html1_pagehead();
53    
54  common_benchmark_addstep('head');  common_benchmark_addstep('head');
# Line 30  common_benchmark_addstep('header'); Line 59  common_benchmark_addstep('header');
59    
60  //----------------------------------------------------------  //----------------------------------------------------------
61    
62  otd_html1_pagetitle('User info');  otd_html1_pagetitle('CMS test page');
63    
64  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.');
65    
66  otd_html1_paragraph('Also it is the first outstanding page and was created for testing yet.');  //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  // Only show debug outputs when set as preference:  //----------------------------------------------------------
 if($common_sessiondata['user_prefs']['debug']) {  
69    
70    otd_html1_headline('User preferences array:');  $queries = array(
71    otd_html1_codeparagraph('$common_sessiondata[user_prefs] = ' . nl2br(htmlentities(print_r($common_sessiondata['user_prefs'], true))));   'GET COUNT FROM SOURCES',
72     'GET FIELDNAMES FROM SOURCES',
73     'GET name FROM SOURCES',
74     'GET * FROM SOURCES',
75     'GET COUNT FROM contenttypes',
76     'GET FIELDNAMES FROM contenttypes',
77     '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    /*
86     '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');
112    
113  //----------------------------------------------------------  if($query) {
114    
115      $response = null;
116      $success = cms_query($query, $response);
117    
118      common_benchmark_addstep('CMS query');
119    
120      otd_html1_headline('Query execution response:');
121    
122      otd_html1_paragraph('Command: "<b>' . $query . '</b>"', 'hl12');
123    
124      $resultinfo = $response[0];
125    
126      otd_html1_paragraph('Error: "<code>' . $resultinfo['error'] . '</code>" - "<b>' . $resultinfo['errortext'] . '</b>"', ($resultinfo['error'] ? 'hl11' : 'hl12'));
127    
128    //  otd_html1_headline('Result:');
129    
130      if($success) {
131    
132        switch($resultinfo['operation']) {
133    
134          case 'GET':
135    
136            $rows = $response[1];
137    
138            for($y = 0; $y < count($rows); $y++) {
139    
140              for($x = 0; $x < count($rows[$y]); $x++) {
141    
142                if(strlen($rows[$y][$x]) > 97) {
143    
144                  $rows[$y][$x] = substr($rows[$y][$x], 0, 97) . '...';
145    
146                }
147    
148                $rows[$y][$x] = htmlentities($rows[$y][$x]);
149    
150              }
151    
152            }
153    
154            otd_html1_table($response[2], $rows);
155    
156            break;
157    
158        }
159    
160      } else {
161    
162        otd_html1_paragraph('(No result returned)');
163    
164      }
165    
166      if($common_sessiondata['user_prefs']['debug']) variablebox('response');
167    
168    } else {
169    
170      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    
174    }
175    
176  common_benchmark_addstep('content');  common_benchmark_addstep('content');
177    
178    //----------------------------------------------------------
179    
180  $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>.';
181    
182  otd_html1_pagefooter($extrapageinfocontents);  otd_html1_pagefooter($extrapageinfocontents);

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

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