Source for file block-editor-defs.php

Documentation is available at block-editor-defs.php

  1. <?php
  2. /* ******************************************************************** */
  3. /* CATALYST PHP Source Code */
  4. /* -------------------------------------------------------------------- */
  5. /* This program is free software; you can redistribute it and/or modify */
  6. /* it under the terms of the GNU General Public License as published by */
  7. /* the Free Software Foundation; either version 2 of the License, or */
  8. /* (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU General Public License for more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License */
  16. /* along with this program; if not, write to: */
  17. /* The Free Software Foundation, Inc., 59 Temple Place, Suite 330, */
  18. /* Boston, MA 02111-1307 USA */
  19. /* -------------------------------------------------------------------- */
  20. /* */
  21. /* Filename: block-defs.php */
  22. /* Author: Paul Waite */
  23. /* Description: Definitions for content block management in webpages. */
  24. /* */
  25. /* ******************************************************************** */
  26. /** @package cm */
  27. include_once("recmaint-defs.php");
  28.  
  29. // ......................................................................
  30. // GLOBAL GENERIC WIDGETS
  31.  
  32. // Common width settings for form elements..
  33.  
  34. global $fullwidth;
  35. global $quartwidth;
  36. global $thirdwidth;
  37. global $halfwidth;
  38. global $threeqwidth;
  39.  
  40. global $awidth; // Content
  41. global $ewidth; // Blocklet list, desc
  42. global $cwidth; // Media/doc combos (wide)
  43. global $cbowidth; // All property combos
  44. global $bigwidth; // Very wide widgets
  45.  
  46. $fullwidth = 540;
  47. $quartwidth = ceil($fullwidth * 0.25);
  48. $thirdwidth = ceil($fullwidth * 0.37);
  49. $halfwidth = ceil($fullwidth * 0.50);
  50. $threeqwidth = ceil($fullwidth * 0.75);
  51.  
  52. $awidth = $fullwidth . "px";
  53. $ewidth = $halfwidth . "px";
  54. $cwidth = $thirdwidth . "px";
  55. $cbowidth = $quartwidth . "px";
  56. $bigwidth = $threeqwidth . "px";
  57.  
  58. // Generic add button..
  59. global $gen_addbtn;
  60. $gen_addbtn = new form_imagebutton("_add_link", "", "", "$LIBDIR/img/_add.gif", "Add link to content", 57, 15);
  61. $gen_addbtn->setalt("Add");
  62.  
  63. global $gen_blocklettype;
  64. $gen_blocklettype = new form_combofield("blocklet_type", "", $b->type);
  65. $gen_blocklettype->setclass("axtxtbox");
  66. $gen_blocklettype->setstyle("width:$cbowidth;");
  67. $gen_blocklettype->additem("text", "Text");
  68. $gen_blocklettype->additem("list", "List");
  69. $gen_blocklettype->additem("ordered", "Ordered list");
  70. $gen_blocklettype->additem("bullets", "Bullet points");
  71. $gen_blocklettype->additem("table", "Table");
  72. $gen_blocklettype->additem("raw", "Unformatted");
  73.  
  74. // An Axyl colour palette combobox..
  75. $ss = new stylesheet($RESPONSE->site_docroot . $RESPONSE->head->stylesheet);
  76. global $colourCombo;
  77. $colourCombo = new form_combofield("colours");
  78. $colourCombo->setclass("axcombo");
  79. $colourCombo->setstyle("width:$cbowidth;");
  80. $colourCombo->additem("", "default colour");
  81. $TotColours = defaulted($ss->style("axylpalette", "total_colours"), 0);
  82. if ($TotColours > 0) {
  83. for ($c = 1; $c <= $TotColours; $c++) {
  84. $colour_style = $ss->style("axylpalette", "colour_$c");
  85. $colour_bits = explode(",", $colour_style);
  86. if (isset($colour_bits[0]) && isset($colour_bits[1])) {
  87. $colourCombo->additem($colour_bits[0], $colour_bits[1]);
  88. }
  89. }
  90. }
  91. // An Axyl table styles combobox..
  92. global $tstylesCombo;
  93. $tstylesCombo = new form_combofield("table_style");
  94. $tstylesCombo->setclass("axcombo");
  95. $tstylesCombo->setstyle("width:$cbowidth;");
  96. $tstylesCombo->additem("", "default style");
  97. $Totstyles = defaulted($ss->style("axyl_tablestyles", "total_styles"), 0);
  98. if ($Totstyles > 0) {
  99. for ($c = 1; $c <= $Totstyles; $c++) {
  100. $tstyle_style = $ss->style("axyl_tablestyles", "style_$c");
  101. $tstyle_bits = explode(",", $tstyle_style);
  102. if (isset($tstyle_bits[0]) && isset($tstyle_bits[1])) {
  103. $tstylesCombo->additem($tstyle_bits[0], $tstyle_bits[1]);
  104. }
  105. }
  106. }
  107. // Multi-language selector..
  108. global $langsCombo;
  109. if (isset($RESPONSE) && $RESPONSE->multilang) {
  110. $langsCombo = new form_combofield("language");
  111. $langsCombo->setclass("axcombo");
  112. $langsCombo->setstyle("width:$cbowidth;");
  113. $LQ = dbrecordset("SELECT * FROM ax_language ORDER BY display_order");
  114. $langsCombo->add_querydata($LQ, "lang_id", "lang_desc");
  115. $langsCombo->setvalue($this->language);
  116. }
  117. else {
  118. $langsCombo = new form_hiddenfield("language");
  119. }
  120.  
  121. // ......................................................................
  122. // Javascript which is always required for block content being edited..
  123.  
  124. global $blockmode, $_edit_x;
  125. if ((isset($blockmode) && $blockmode == "editing" || $blockmode == "saving")
  126. ||(isset($_edit_x)) ) {
  127. $RESPONSE->head->add_scriptsrc("$LIBDIR/js/fieldvalidation.js");
  128. $RESPONSE->body->add_script(
  129. "function add_content(ctype,srcfld,dstfld,fm) {\n"
  130. . " var s=''; var title='';\n"
  131. . " var srcFld=eval('document.forms.'+fm+'.'+srcfld);\n"
  132. . " var dstFld=eval('document.forms.'+fm+'.'+dstfld);\n"
  133. . " if (dstFld != null && srcFld != null) {\n"
  134. . " var ix=srcFld.selectedIndex;\n"
  135. . " if (ix != -1) {\n"
  136. . " var info=srcFld.options[ix].value.split('|');\n"
  137. . " var id=info[0];\n"
  138. . " if (id == '') return;\n"
  139. . " var title=srcFld.options[ix].text;\n"
  140. . " s += '<img type=\"axyl/embedded-media\" src=\"$LIBDIR/img/_axmedia.gif\" codetype=\"'\n"
  141. . " + ctype.toLowerCase() + '\" id=\"'+id+'\" title=\"'+title+'\"';\n"
  142. . " for(var i=1; i<=info.length; i++) {\n"
  143. . " theFld=eval('document.forms.'+fm+'.'+info[i]);\n"
  144. . " if (theFld != null) {\n"
  145. . " var fname=info[i];\n"
  146. . " if (fname.indexOf('_') != -1) {\n"
  147. . " var bits=fname.split('_');\n"
  148. . " fname=bits[1];\n"
  149. . " }\n"
  150. . " if (theFld.type != 'checkbox') {\n"
  151. . " if (theFld.value != '') {\n"
  152. . " val=theFld.value;\n"
  153. . " val=val.replace(/ > /,' GT ');\n"
  154. . " val=val.replace(/ < /,' LT ');\n"
  155. . " s += ' '+fname+'=\"'+val+'\"';\n"
  156. . " }\n"
  157. . " }\n"
  158. . " else {\n"
  159. . " s += ' '+fname+'=\"';\n"
  160. . " if (theFld.checked) s+= 'yes';\n"
  161. . " else s+= 'no';\n"
  162. . " s += '\"';\n"
  163. . " }\n"
  164. . " }\n"
  165. . " }\n"
  166. . " s += '>';\n"
  167. . " if (dstfld=='wysiwyg_content') {wysiwyg_content_ed.focusEditor();wysiwyg_content_ed.insertHTML(s);}\n"
  168. . " else {\n"
  169. . " dstFld.value += ' '+s;\n"
  170. . " dstFld.onchange();\n"
  171. . " }\n"
  172. . " }\n"
  173. . " }\n"
  174. . "}\n"
  175. );
  176. }
  177.  
  178. // ......................................................................
  179. /**
  180. * Anything which is editing and uses blocks has to have this Javascript
  181. * available to it in the page when editing..
  182. * @access private
  183. */
  184. function insert_block_jscript() {
  185. static $done = false;
  186. global $RESPONSE, $blockmode, $_edit_x;
  187. if (!$done) {
  188. if ((isset($blockmode) && $blockmode == "editing" || $blockmode == "saving")
  189. ||(isset($_edit_x)) ) {
  190. $RESPONSE->body->add_script(
  191. "function add_link(fm) {\n"
  192. . " var hrefFld = eval('document.forms.'+fm+'.link_href');\n"
  193. . " var descFld = eval('document.forms.'+fm+'.link_desc');\n"
  194. . " var remoFld = eval('document.forms.'+fm+'.link_remote');\n"
  195. . " var contFld = eval('document.forms.'+fm+'.content');\n"
  196. . " if (hrefFld != null && descFld != null && contFld != null && hrefFld.value != '') {\n"
  197. . " var linkHtml = '<a href=\"' + hrefFld.value + '\"';\n"
  198. . " if (remoFld.checked) linkHtml += ' target=\"_blank\"';\n"
  199. . " linkHtml += '>';\n"
  200. . " if (descFld.value == '') linkHtml += hrefFld.value;\n"
  201. . " else linkHtml += descFld.value;\n"
  202. . " linkHtml += '</a>';\n"
  203. . " contFld.value += ' ' + linkHtml;\n"
  204. . " contFld.onchange();\n"
  205. . " }\n"
  206. . "}\n"
  207. . "function linkpop(combo,fm) {\n"
  208. . " var hrefFld = eval('document.forms.'+fm+'.link_href');\n"
  209. . " var descFld = eval('document.forms.'+fm+'.link_desc');\n"
  210. . " var remoFld = eval('document.forms.'+fm+'.link_remote');\n"
  211. . " if (combo.selectedIndex != null && combo.selectedIndex != -1 && hrefFld != null && descFld != null) {\n"
  212. . " hrefFld.value = combo.options[combo.selectedIndex].value;\n"
  213. . " descFld.value = combo.options[combo.selectedIndex].text;\n"
  214. . " remoFld.checked=false;\n"
  215. . " }\n"
  216. . "}\n"
  217. );
  218. $done = true;
  219. } // if editing or saving
  220. } // if not already done
  221. } // insert_block_jscript
  222. // ......................................................................
  223.  
  224. /**
  225. * Block Editor
  226. * A blockeditor is a utility class. It contains all of the methods
  227. * required to edit a block, so that the block class can concentrate
  228. * on the basics of block acquisition and display. The constructor
  229. * of a blockeditor must be passed a reference to the block it is
  230. * going to be providing editing services for.
  231. * @package cm
  232. */
  233. class blockeditor extends RenderableObject {
  234. // Public
  235. // Private
  236. /** The block we are providing
  237. editing services for
  238. @access private */
  239. var $block;
  240. // ....................................................................
  241. /**
  242. * Constructor
  243. * Create a new blockeditor object.
  244. * @param reference $block A reference to the block being edited
  245. */
  246. function blockeditor(&$block) {
  247. $this->block = $block;
  248. } // blockeditor
  249. // ....................................................................
  250. /**
  251. * Replicate this block into a new block with a new set of blocklets
  252. * as a complete content copy of this original block.
  253. * NOTE: We end up with this current block as the replicated one.
  254. */
  255. function replicate() {
  256. if ($this->block->exists) {
  257. $this->block->exists = false;
  258. $savedid = $this->block->blockid;
  259. $this->block->blockid = get_next_sequencevalue("seq_block_id", "ax_block", "block_id");
  260.  
  261. // Prime the blocklets to be created anew..
  262. if (isset($this->block->blocklets)) {
  263. while (list($bid, $bkt) = each ($this->block->blocklets)) {
  264. $bkt->exists = false;
  265. $bkt->blockletid = NEW_BLOCKLET;
  266. $this->block->blocklets[$bid] = $bkt;
  267. }
  268. }
  269. // Create new block & blocklets..
  270. $this->block->put();
  271. }
  272. } // replicate
  273. // ....................................................................
  274. /**
  275. * Delete this block from the database. NB: we do not rely on RI to do
  276. * this since various versions of Postgres don't support this nicely.
  277. * All related entities are explicitly deleted in a transaction.
  278. */
  279. function delete() {
  280. debug_trace($this);
  281. $external_transaction = transaction_open();
  282. // Remove all blocklets one by one..
  283. if (!$external_transaction) {
  284. start_transaction();
  285. }
  286. $bb = dbrecordset("SELECT blocklet_id FROM ax_block_blocklet WHERE block_id=" . $this->block->blockid);
  287. if ($bb->hasdata) {
  288. do {
  289. $bid = $bb->field("blocklet_id");
  290. dbcommand("DELETE FROM ax_blocklet WHERE blocklet_id=$bid");
  291. } while ($bb->get_next());
  292. }
  293. // Remove linkages (may be none, if RI kicked in)..
  294. dbcommand("DELETE FROM ax_block_blocklet WHERE block_id=" . $this->block->blockid);
  295. // Finally remove block..
  296. dbcommand("DELETE FROM ax_block WHERE block_id=" . $this->block->blockid);
  297.  
  298. if (!$external_transaction) {
  299. commit();
  300. }
  301.  
  302. // Un-index from Lucene if applicable..
  303. if (transaction_succeeded()) {
  304. $this->block->unindex();
  305. }
  306. debug_trace();
  307.  
  308. } // delete
  309. // ....................................................................
  310. /**
  311. * Render the Wysiwyg editing suite.
  312. * @return string The HTML for the editing suite form etc.
  313. * @access private
  314. */
  315. function wysiwyg_editform($lang_encoding, $lang_direction) {
  316. debug_trace($this);
  317. global $LIBDIR;
  318. global $RESPONSE;
  319. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  320. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  321. global $colourCombo, $tstylesCombo, $langsCombo;
  322.  
  323. /** HTMLArea form element */
  324. include_once("htmlarea-defs.php");
  325. // Define which plugins to load..
  326. htmlarea_plugins("ContextMenu,CSS,TableOperations,ListType,CharacterMap");
  327.  
  328. // This is a Wysiwyg block. If it is new, then we will need to
  329. // create its single associated blocklet..
  330. if (!isset($this->block->blocklets) || count($this->block->blocklets) == 0) {
  331. $this->block->add_blocklet();
  332. $this->block->put();
  333. }
  334.  
  335. // Now grab the blocklet itself..
  336. $wysiwyg_blocklet = current($this->block->blocklets);
  337.  
  338. // Buttons..
  339. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save changes", 57, 15);
  340. $bdone = new form_imagebutton("_done", "", "", "$LIBDIR/img/_done.gif", "Exit without saving", 57, 15);
  341.  
  342. // Control table..
  343. $Ted = new table("block_" . $this->block->blockid);
  344. $Ted->setpadding(2);
  345.  
  346. // ..................................................................
  347. // Toolbar..
  348. $toolbar = array();
  349. $toolbar[] = $bdone;
  350. $toolbar[] = $bsave;
  351. $Tbar = new table("toolbar");
  352. $Tbar->tr("axtitle");
  353. switch ($this->block->layout_version) {
  354. case VERSION_PENDING: $hdg = "PENDING"; break;
  355. case VERSION_LIVE: $hdg = "LIVE"; break;
  356. case VERSION_PREVIOUS: $hdg = "PREVIOUS"; break;
  357. case VERSION_UNDEFINED: $hdg = "EDITING"; break;
  358. default: $hdg = "Version: " . $this->block->layout_version;
  359. } // switch
  360. $Tbar->th("<b>$hdg</b> [B" . $this->block->blockid . "]", "axtitle");
  361. $tools = "";
  362. foreach ($toolbar as $tool) {
  363. $tools .= $tool->render();
  364. }
  365. $Tbar->th($tools, "axtitle");
  366. $Tbar->th_css("text-align:right");
  367. $Ted->thead();
  368. $Ted->tr("axtitle");
  369. $Ted->td( $Tbar->render(), "axtitle" );
  370. $Ted->td_colspan(2);
  371.  
  372. // ..................................................................
  373. $Ted->tr("axhdg");
  374. $Ted->td("<b>BLOCK SETTINGS</b>", "axhdg");
  375. $Ted->td_colspan(2);
  376. // ..................................................................
  377.  
  378. // Block parameters..
  379. $block_desc = new form_textfield("block_desc", "", $this->block->block_desc);
  380. $block_desc->setclass("axtxtbox");
  381. $block_desc->setstyle("width:$bigwidth");
  382.  
  383. $block_justify = new form_combofield("block_justify", "", $this->block->justify);
  384. $block_justify->setclass("axcombo");
  385. $block_justify->additem("", "default");
  386. $block_justify->additem("left", "Left");
  387. $block_justify->additem("center", "Centre");
  388. $block_justify->additem("right", "Right");
  389.  
  390. $block_valign = new form_combofield("block_valign", "", $this->block->valign);
  391. $block_valign->setclass("axcombo");
  392. $block_valign->additem("", "default");
  393. $block_valign->additem("top", "Top");
  394. $block_valign->additem("middle", "Middle");
  395. $block_valign->additem("bottom", "Bottom");
  396.  
  397. $block_bg_colour = $colourCombo;
  398. $block_bg_colour->name = "background_colour";
  399. $block_bg_colour->setvalue($this->block->background_colour);
  400.  
  401. $block_border_width = new form_textfield("block_border_width", "", $this->block->border_width);
  402. $block_border_width->setclass("axtxtbox");
  403. $block_border_width->setstyle("width:30px;text-align:center;");
  404. $block_border_width->set_onblur("limitInt(this, 0, 99)");
  405.  
  406. $block_border_colour = $colourCombo;
  407. $block_border_colour->name = "block_border_colour";
  408. $block_border_colour->setvalue($this->block->border_colour);
  409.  
  410. $block_style = new form_textfield("block_style", "", $this->block->block_style);
  411. $block_style->setclass("axtxtbox");
  412. $block_style->setstyle("width:$cbowidth;");
  413.  
  414. $block_bgimgs = new form_combofield("background_img");
  415. $block_bgimgs->setclass("axcombo");
  416. $block_bgimgs->setstyle("width:$ewidth;");
  417. $block_bgimgs->additem(NULLVALUE, "");
  418. $Qimg = dbrecordset("SELECT * FROM ax_catalog WHERE mime_category='image' ORDER BY upload_timestamp DESC");
  419. if ($Qimg->hasdata) {
  420. do {
  421. $catid = $Qimg->field("cat_id");
  422. $catname = $Qimg->field("cat_name");
  423. // Names following ID tell the inserter the fields to get..
  424. $block_bgimgs->additem($catid, $catname);
  425. } while ($Qimg->get_next());
  426. }
  427. $block_bgimgs->setvalue($this->block->background_img);
  428.  
  429. $Tin = new table("blockopts");
  430. $Tin->setpadding(2);
  431.  
  432. $Tin->tr("axbgdark");
  433. $Tin->td( "Description:" );
  434. $Tin->td( $block_desc->render() );
  435. $Tin->td_colspan(2);
  436. $Tin->td_alignment("right");
  437.  
  438. // Language..
  439. $langsCombo->setvalue($this->block->language);
  440. if ($RESPONSE->multilang) {
  441. // Present the language selector..
  442. $Tin->tr("axbglite");
  443. $Tin->td( "&nbsp;" );
  444. $Tin->td( "Block language:&nbsp;" . $langsCombo->render() );
  445. $Tin->td_alignment("right");
  446. $Tin->td_colspan(2);
  447. }
  448. else {
  449. // In this case it is just a hidden field..
  450. $Tin->tr("axbglite");
  451. $Tin->td( "&nbsp;" );
  452. $Tin->td( $langsCombo->render() );
  453. $Tin->td_colspan(2);
  454. }
  455.  
  456. $Tin->tr("axbglite");
  457. $Tin->td( "Justify:&nbsp;" . $block_justify->render() );
  458. $Tin->td_colspan(2);
  459. $Tin->td_alignment("right");
  460. $Tin->td( "Align:&nbsp;" . $block_valign->render() );
  461. $Tin->td_alignment("right");
  462.  
  463. $Tin->tr( "axbgdark");
  464. $Tin->td( "Border width:&nbsp;" . $block_border_width->render() );
  465. $Tin->td_colspan(2);
  466. $Tin->td_alignment("right");
  467. $Tin->td( "Border colour:&nbsp;" . $block_border_colour->render() );
  468. $Tin->td_alignment("right");
  469.  
  470. $Tin->tr( "axbglite");
  471. $Tin->td( "Background:&nbsp;" . $block_bg_colour->render() );
  472. $Tin->td_colspan(2);
  473. $Tin->td_alignment("right");
  474. $Tin->td( "CSS style:&nbsp;" . $block_style->render() );
  475. $Tin->td_alignment("right");
  476.  
  477. $Tin->tr( "axbgdark");
  478. $Tin->td( "Background image:&nbsp;" . $block_bgimgs->render() );
  479. $Tin->td_colspan(3);
  480. $Tin->td_alignment("right");
  481.  
  482. $Ted->tr("axbgdark");
  483. $Ted->td( $Tin->render() );
  484. $Ted->td_colspan(2);
  485.  
  486. // ..................................................................
  487. // Wysiwyg Heading..
  488. $Ted->tr("axhdg");
  489. $Ted->td("<b>AXYL CONTENT EDITOR</b>", "axhdg");
  490. $Ted->td_colspan(2);
  491.  
  492. // ..................................................................
  493. // Wysiwyg content textarea
  494. // Convert old <object> media placeholders to new <img> variant..
  495. $wysiwyg = new form_wysiwygfield("wysiwyg_content", "", $wysiwyg_blocklet->content);
  496. $wysiwyg->setclass("axmemo");
  497. $wysiwyg->setstyle("width:$awidth;height:500px;");
  498. $wysiwyg->register_plugins("all");
  499. $wysiwyg->set_toolbar("full");
  500.  
  501. $Tin = new table("content");
  502. $Tin->tr();
  503. $Tin->td( $wysiwyg->render() );
  504. $Ted->tr("axbglite");
  505. $Ted->td( $Tin->render() );
  506. $Ted->td_colspan(2);
  507. // ..................................................................
  508. // Provide the user interfaces to insert content..
  509. $this->add_image_ui($Ted);
  510. $this->add_document_ui($Ted);
  511. $this->add_media_ui($Ted);
  512. $this->add_datasrc_ui($Ted);
  513.  
  514. // ..................................................................
  515. // Render the whole table..
  516. $Ted->tr("axfoot");
  517. $Ted->td("", "axfoot");
  518. $Ted->td_colspan(2);
  519. $s .= $Ted->render();
  520.  
  521. // ..................................................................
  522. $hid = new form_hiddenfield("_wysiwygpost_form", $this->block->blockfm);
  523. $s .= $hid->render();
  524.  
  525. debug_trace();
  526. // Return the html..
  527. return $s;
  528. } // wysiwyg_editform
  529. // ....................................................................
  530. /**
  531. * Render the block editing suite.
  532. * @return string The HTML for the editing suite form etc.
  533. * @access private
  534. */
  535. function block_editform($lang_encoding, $lang_direction) {
  536. debug_trace($this);
  537. global $LIBDIR;
  538. global $RESPONSE;
  539. global $gen_addbtn, $gen_blocklettype;
  540. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  541. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  542. global $colourCombo, $tstylesCombo, $langsCombo;
  543.  
  544. // Insert javascript for block editing..
  545. insert_block_jscript();
  546.  
  547. // Initialise content..
  548. $s = "";
  549.  
  550. // ..................................................................
  551. // KEYFIELD and RECORD MAINTAINER
  552. // Blocklet listbox
  553. // Declared here so we can create the maintainer and register buttons
  554. // before they are used in the form.
  555. //
  556. // This is the keyfield listbox which controls the maintainance
  557. // process. It lists all records being maintained..
  558. $blocklet_listbox = new form_combofield("blocklet_id");
  559. $blocklet_listbox->setclass("axlistbox");
  560. // Make a new record maintainer, and attach the buttons..
  561. $maintainer = new recmaintainer($this->block->blockfm, $blocklet_listbox);
  562.  
  563. // Create buttons..
  564. $bup = new form_imagebutton("_up", "", "", "$LIBDIR/img/_up.gif", "Move up", 57, 15);
  565. $bdown = new form_imagebutton("_down", "", "", "$LIBDIR/img/_down.gif", "Move down", 57, 15);
  566. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete blocklet", 57, 15);
  567. $badd = new form_imagebutton("_add", "", "", "$LIBDIR/img/_add.gif", "Add new blocklet", 57, 15);
  568. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save blocklet settings", 57, 15);
  569. $bdone = new form_imagebutton("_done", "", "", "$LIBDIR/img/_done.gif", "Exit without saving", 57, 15);
  570. $breset = new form_imagebutton("_reset", "", "", "$LIBDIR/img/_reset.gif", "Reset form", 57, 15);
  571. $breset->set_onclick("document.forms." . $this->block->blockfm . ".reset()");
  572.  
  573. // Register all relevant buttons to the maintainer..
  574. $maintainer->register_button("up" , $bup);
  575. $maintainer->register_button("down", $bdown);
  576. $maintainer->register_button("add", $badd);
  577. $maintainer->register_button("save", $bsave);
  578. $maintainer->register_button("del", $bdel);
  579. $maintainer->register_button("reset", $breset);
  580.  
  581. // Control table..
  582. $Ted = new table("block_" . $this->block->blockid);
  583. $Ted->setpadding(2);
  584.  
  585. // ..................................................................
  586. // Toolbar..
  587. $toolbar = array();
  588. $toolbar[] = $bdone;
  589. $toolbar[] = $bsave;
  590. $Tbar = new table("toolbar");
  591. $Tbar->tr("axtitle");
  592. switch ($this->block->layout_version) {
  593. case VERSION_PENDING: $hdg = "PENDING"; break;
  594. case VERSION_LIVE: $hdg = "LIVE"; break;
  595. case VERSION_PREVIOUS: $hdg = "PREVIOUS"; break;
  596. case VERSION_UNDEFINED: $hdg = "EDITING"; break;
  597. default: $hdg = "Version: " . $this->block->layout_version;
  598. } // switch
  599. $Tbar->th("<b>$hdg</b> [B" . $this->block->blockid . "]", "axtitle");
  600. $tools = "";
  601. foreach ($toolbar as $tool) {
  602. $tools .= $tool->render();
  603. }
  604. $Tbar->th($tools, "axtitle");
  605. $Tbar->th_css("text-align:right");
  606. $Ted->thead();
  607. $Ted->tr("axtitle");
  608. $Ted->td( $Tbar->render(), "axtitle" );
  609. $Ted->td_colspan(2);
  610.  
  611. // ..................................................................
  612. $Ted->tr("axhdg");
  613. $Ted->td("<b>BLOCK SETTINGS</b>", "axhdg");
  614. $Ted->td_colspan(2);
  615. // ..................................................................
  616.  
  617. // Block parameters..
  618. $block_desc = new form_textfield("block_desc", "", $this->block->block_desc);
  619. $block_desc->setclass("axtxtbox");
  620. $block_desc->setstyle("width:$bigwidth");
  621.  
  622. $block_cols = new form_textfield("cols", "", $this->block->cols);
  623. $block_cols->setclass("axtxtbox");
  624. $block_cols->setstyle("width:30px;text-align:center;");
  625. $block_cols->set_onblur("limitInt(this, 1, 9)");
  626.  
  627. $block_gutter_width = new form_textfield("gutter_width", "", $this->block->gutter_width);
  628. $block_gutter_width->setclass("axtxtbox");
  629. $block_gutter_width->setstyle("width:30px;text-align:center;");
  630. $block_gutter_width->set_onblur("limitInt(this, 1, 99)");
  631.  
  632. $block_gutter_colour = $colourCombo;
  633. $block_gutter_colour->name = "gutter_colour";
  634. $block_gutter_colour->setvalue($this->block->gutter_colour);
  635.  
  636. $block_justify = new form_combofield("block_justify", "", $this->block->justify);
  637. $block_justify->setclass("axcombo");
  638. $block_justify->additem("", "default");
  639. $block_justify->additem("left", "Left");
  640. $block_justify->additem("center", "Centre");
  641. $block_justify->additem("right", "Right");
  642.  
  643. $block_valign = new form_combofield("block_valign", "", $this->block->valign);
  644. $block_valign->setclass("axcombo");
  645. $block_valign->additem("", "default");
  646. $block_valign->additem("top", "Top");
  647. $block_valign->additem("middle", "Middle");
  648. $block_valign->additem("bottom", "Bottom");
  649.  
  650. $block_bg_colour = $colourCombo;
  651. $block_bg_colour->name = "background_colour";
  652. $block_bg_colour->setvalue($this->block->background_colour);
  653.  
  654. $block_border_width = new form_textfield("block_border_width", "", $this->block->border_width);
  655. $block_border_width->setclass("axtxtbox");
  656. $block_border_width->setstyle("width:30px;text-align:center;");
  657. $block_border_width->set_onblur("limitInt(this, 0, 99)");
  658.  
  659. $blocklet_sep = new form_textfield("blocklet_sep", "", $this->block->blocklet_sep);
  660. $blocklet_sep->setclass("axtxtbox");
  661. $blocklet_sep->setstyle("width:30px;text-align:center;");
  662. $blocklet_sep->set_onblur("limitInt(this, 0, 99)");
  663.  
  664. $block_exportable = new form_checkbox("block_exportable");
  665. $block_exportable->checked = $this->block->exportable;
  666.  
  667. $block_border_colour = $colourCombo;
  668. $block_border_colour->name = "block_border_colour";
  669. $block_border_colour->setvalue($this->block->border_colour);
  670.  
  671. $block_style = new form_textfield("block_style", "", $this->block->block_style);
  672. $block_style->setclass("axtxtbox");
  673. $block_style->setstyle("width:$ewidth;");
  674.  
  675. $block_bgimgs = new form_combofield("background_img");
  676. $block_bgimgs->setclass("axcombo");
  677. $block_bgimgs->setstyle("width:$ewidth;");
  678. $block_bgimgs->additem(NULLVALUE, "");
  679. $Qimg = dbrecordset("SELECT * FROM ax_catalog WHERE mime_category='image' ORDER BY upload_timestamp DESC");
  680. if ($Qimg->hasdata) {
  681. do {
  682. $catid = $Qimg->field("cat_id");
  683. $catname = $Qimg->field("cat_name");
  684. // Names following ID tell the inserter the fields to get..
  685. $block_bgimgs->additem($catid, $catname);
  686. } while ($Qimg->get_next());
  687. }
  688. $block_bgimgs->setvalue($this->block->background_img);
  689.  
  690. $Tin = new table("blockopts");
  691. $Tin->setpadding(2);
  692.  
  693. $Tin->tr( "axbgdark");
  694. $Tin->td( "Description:&nbsp;" . $block_desc->render() );
  695. $Tin->td_colspan(3);
  696. $Tin->td_alignment("right");
  697.  
  698. // Language..
  699. $langsCombo->setvalue($this->block->language);
  700. if ($RESPONSE->multilang) {
  701. // Present the language selector..
  702. $Tin->tr("axbglite");
  703. $Tin->td( "&nbsp;" );
  704. $Tin->td( "Block language:&nbsp;" . $langsCombo->render() );
  705. $Tin->td_alignment("right");
  706. $Tin->td_colspan(2);
  707. }
  708. else {
  709. // In this case it is just a hidden field..
  710. $Tin->tr("axbglite");
  711. $Tin->td( "&nbsp;" );
  712. $Tin->td( $langsCombo->render() );
  713. $Tin->td_colspan(2);
  714. }
  715.  
  716. $Tin->tr("axbgdark");
  717. $Tin->td( "Columns:&nbsp;" . $block_cols->render() );
  718. $Tin->td_alignment("right");
  719. $Tin->td( "Gutter width:&nbsp;" . $block_gutter_width->render() );
  720. $Tin->td_alignment("right");
  721. $Tin->td( "Gutter colour:&nbsp;" . $block_gutter_colour->render() );
  722. $Tin->td_alignment("right");
  723.  
  724. $Tin->tr( "axbglite");
  725. $Tin->td( "Blocklet spacing:&nbsp;" . $blocklet_sep->render() );
  726. $Tin->td_alignment("right");
  727. $Tin->td( "Border width:&nbsp;" . $block_border_width->render() );
  728. $Tin->td_alignment("right");
  729. $Tin->td( "Border colour:&nbsp;" . $block_border_colour->render() );
  730. $Tin->td_alignment("right");
  731.  
  732. $Tin->tr("axbgdark");
  733. $Tin->td( "Justify:&nbsp;" . $block_justify->render() );
  734. $Tin->td_alignment("right");
  735. $Tin->td( "Align:&nbsp;" . $block_valign->render() );
  736. $Tin->td_alignment("right");
  737. $Tin->td( "Background:&nbsp;" . $block_bg_colour->render() );
  738. $Tin->td_alignment("right");
  739.  
  740. $Tin->tr( "axbglite");
  741. $Tin->td( "CSS style:&nbsp;" . $block_style->render() );
  742. $Tin->td_colspan(3);
  743. $Tin->td_alignment("right");
  744.  
  745. $Tin->tr( "axbgdark");
  746. $Tin->td( "Background image:&nbsp;" . $block_bgimgs->render() );
  747. $Tin->td_colspan(3);
  748. $Tin->td_alignment("right");
  749.  
  750. $Tin->tr( "axbglite");
  751. $Tin->td( "Exportable in CSV format&nbsp;" . $block_exportable->render() );
  752. $Tin->td_colspan(3);
  753. $Tin->td_alignment("right");
  754.  
  755. $Ted->tr("axbglite");
  756. $Ted->td( $Tin->render() );
  757. $Ted->td_colspan(2);
  758.  
  759. // ..................................................................
  760. // Blocklets Editing Fields..
  761. $Ted->tr("axhdg");
  762. $Ted->td("<b>BLOCKLETS IN THIS BLOCK</b>", "axhdg");
  763. $Ted->td_colspan(2);
  764.  
  765. // Continue defining listbox..
  766. $blocklet_listbox->setstyle("width:$ewidth;height:140px;");
  767. $blocklet_listbox->size = 6;
  768. foreach ($this->block->blocklets as $b) {
  769. // Populate listbox..
  770. $blocklet_listbox->additem($b->blockletid, $b->blocklet_desc);
  771.  
  772. // Populate maintainer data. The maintainer add_record method
  773. // requires an associative array keyed on listbox key id..
  774. $rec = array(
  775. "blocklet_desc" => $b->blocklet_desc,
  776. "blocklet_type" => $b->type,
  777. "blocklet_width" => $b->width,
  778. "blocklet_style" => $b->blocklet_style,
  779. "justify" => $b->justify,
  780. "heading" => $b->heading,
  781. "heading_level" => $b->heading_level,
  782. "heading_colour" => $b->heading_colour,
  783. "ruler" => $b->ruler,
  784. "ruler_width" => $b->ruler_width,
  785. "ruler_size" => $b->ruler_size,
  786. "ruler_colour" => $b->ruler_colour,
  787. "content" => $b->content,
  788. "content_size" => ($b->content_size == 0) ? "0" : number_format($b->content_size, 1),
  789. "content_colour" => $b->content_colour,
  790. "table_style" => $b->table_style,
  791. "table_autojustify" => (($b->table_autojustify) ? "t" : "f"),
  792. "table_rowstripes" => (($b->table_rowstripes) ? "t" : "f"),
  793. "visible" => (($b->visible) ? "t" : "f")
  794. );
  795. $maintainer->add_record($b->blockletid, $rec);
  796. }
  797. // Now set the defaults for each of the fields. These are
  798. // necessary for when a new record is created..
  799. $defaults = array(
  800. "blocklet_desc" => "(enter a blocklet description)",
  801. "blocklet_type" => "text",
  802. "blocklet_width" => "100",
  803. "blocklet_style" => "",
  804. "justify" => "left",
  805. "heading" => "",
  806. "heading_level" => "3",
  807. "heading_colour" => "",
  808. "ruler" => "none",
  809. "ruler_width" => "100",
  810. "ruler_size" => "1",
  811. "ruler_colour" => "",
  812. "content" => "",
  813. "content_size" => "0",
  814. "content_colour" => "",
  815. "table_style" => "",
  816. "table_autojustify" => "f",
  817. "table_rowstripes" => "f",
  818. "visible" => "t"
  819. );
  820. $maintainer->add_defaults($defaults);
  821.  
  822. // The listbox field..
  823. $Ted->tr("axbgdark");
  824. $Ted->td( $blocklet_listbox->render() );
  825. $Ted->td_width("50%");
  826. $Ted->td(
  827. $bup->render() . "<br>"
  828. . $bdown->render() . "<br>"
  829. . $bdel->render() . "<br>"
  830. . $badd->render()
  831. );
  832. $Ted->td_width("50%");
  833. $Ted->td_alignment("right", "top");
  834.  
  835. // ..................................................................
  836. // Blocklet description field..
  837. $blocklet_desc = new form_textfield("blocklet_desc", "", $b->blocklet_desc);
  838. $maintainer->register_field($blocklet_desc);
  839. $blocklet_desc->setclass("axtxtbox");
  840. $blocklet_desc->setstyle("width:$ewidth;");
  841. $Ted->tr("axbglite");
  842. $Ted->td( $blocklet_desc->render() );
  843. $Ted->td( "< Blocklet Description" );
  844.  
  845. // ..................................................................
  846. $Ted->tr("axhdg");
  847. $Ted->td("<b>BLOCKLET SETTINGS</b>", "axhdg");
  848. $Ted->td_colspan(2);
  849.  
  850. // ..................................................................
  851. // Blocklet type, Width and Visibility
  852. // NOTE: We register each field, beginning with these, to the maintainer.
  853. // We MUST use the database field-name, as our form element name..
  854. global $gen_blocklettype;
  855. $maintainer->register_field($gen_blocklettype);
  856.  
  857. $blocklet_width = new form_textfield("blocklet_width", "", $b->width);
  858. $maintainer->register_field($blocklet_width);
  859. $blocklet_width->setclass("axtxtbox");
  860. $blocklet_width->setstyle("width:35px;text-align:center;");
  861. $blocklet_width->set_onblur("limitInt(this, 0, 100, 100)");
  862.  
  863. $blocklet_visible = new form_checkbox("visible", "", "yes", EDITABLE, "", $b->visible);
  864. $blocklet_visible->setclass("axchkbox");
  865. $maintainer->register_field($blocklet_visible);
  866.  
  867. $Tin1 = new table("type");
  868. $Tin1->tr();
  869. $Tin1->td("<b>Blocklet type:</b>");
  870. $Tin1->td( $gen_blocklettype->render() );
  871. $Tin1->td_alignment("right");
  872. $Tin2 = new table("opts");
  873. $Tin2->setwidth("");
  874. $Tin2->tbody("fmlook");
  875. $Tin2->tr();
  876. $Tin2->td( "Blocklet width%:", "text-align:right");
  877. $Tin2->td( $blocklet_width->render() );
  878. $Tin2->td( "&nbsp;Visible:", "text-align:right" );
  879. $Tin2->td( $blocklet_visible->render() );
  880. $Ted->tr("axbgdark");
  881. $Ted->td( $Tin1->render() );
  882. $Ted->td( $Tin2->render() );
  883. $Ted->td_alignment("right");
  884.  
  885. // ..................................................................
  886. // Blocklet ruler settings
  887. $blocklet_ruler = new form_combofield("ruler", "", $b->ruler);
  888. $maintainer->register_field($blocklet_ruler);
  889. $blocklet_ruler->setclass("axcombo");
  890. $blocklet_ruler->setstyle("width:$cbowidth;");
  891. $blocklet_ruler->additem("top", "Top");
  892. $blocklet_ruler->additem("bottom", "Bottom");
  893. $blocklet_ruler->additem("none", "None");
  894.  
  895. $blocklet_ruler_width = new form_textfield("ruler_width", "", $b->ruler_width);
  896. $maintainer->register_field($blocklet_ruler_width);
  897. $blocklet_ruler_width->setclass("axtxtbox");
  898. $blocklet_ruler_width->setstyle("width:35px;text-align:center;");
  899. $blocklet_ruler_width->set_onblur("limitInt(this, 0, 100, 100)");
  900.  
  901. $blocklet_ruler_size = new form_textfield("ruler_size", "", $b->ruler_size);
  902. $maintainer->register_field($blocklet_ruler_size);
  903. $blocklet_ruler_size->setclass("axtxtbox");
  904. $blocklet_ruler_size->setstyle("width:30px;text-align:center;");
  905. $blocklet_ruler_size->set_onblur("limitInt(this, 1, 99)");
  906. $Tin1 = new table("ruler");
  907. $Tin1->tbody("fmlook");
  908. $Tin1->tr();
  909. $Tin1->td("<b>Ruler:</b>");
  910. $Tin1->td( $blocklet_ruler->render() );
  911. $Tin1->td_alignment("right");
  912. $Tin2 = new table("ruler");
  913. $Tin2->setwidth("");
  914. $Tin2->tbody("fmlook");
  915. $Tin2->tr();
  916. $Tin2->td( "Ruler width%:", "text-align:right");
  917. $Tin2->td( $blocklet_ruler_width->render() );
  918. $Tin2->td( "&nbsp;&nbsp;Size:", "text-align:right" );
  919. $Tin2->td( $blocklet_ruler_size->render() );
  920. $Ted->tr("axbglite");
  921. $Ted->td( $Tin1->render() );
  922. $Ted->td( $Tin2->render() );
  923. $Ted->td_alignment("right");
  924.  
  925. // ..................................................................
  926. // Blocklet ruler colour..
  927. $blocklet_ruler_colour = $colourCombo;
  928. $blocklet_ruler_colour->name = "ruler_colour";
  929. $blocklet_ruler_colour->setvalue($b->ruler_colour);
  930. $maintainer->register_field($blocklet_ruler_colour);
  931. $Tin = new table("ruler_colour");
  932. $Tin->tr();
  933. $Tin->td("&nbsp;");
  934. $Tin->td( $blocklet_ruler_colour->render() );
  935. $Tin->td_alignment("right");
  936. $Ted->tr("axbglite");
  937. $Ted->td( $Tin->render() );
  938. $Ted->td("&nbsp;");
  939.  
  940. // ..................................................................
  941. // Block heading text field..
  942. $blocklet_heading = new form_textfield("heading", "", $b->heading);
  943. $maintainer->register_field($blocklet_heading);
  944. $blocklet_heading->setclass("axtxtbox");
  945. $blocklet_heading->setstyle("width:185px;");
  946.  
  947. $blocklet_heading_level = new form_combofield("heading_level", "", $b->heading_level);
  948. $maintainer->register_field($blocklet_heading_level);
  949. $blocklet_heading_level->setclass("axcombo");
  950. $blocklet_heading_level->setstyle("width:50px;");
  951. $blocklet_heading_level->setvalue($b->heading_level);
  952. for ($h=1; $h<=6; $h++) {
  953. $blocklet_heading_level->additem($h);
  954. }
  955. $Tin1 = new table("ruler");
  956. $Tin1->tr();
  957. $Tin1->td( "<b>Heading:</b>" );
  958. $Tin1->td( $blocklet_heading->render() );
  959. $Tin1->td_alignment("right");
  960.  
  961. $Tin2 = new table("hlevel");
  962. $Tin2->setwidth("");
  963. $Tin2->tr();
  964. $Tin2->td( "Level:" );
  965. $Tin2->td( $blocklet_heading_level->render() );
  966.  
  967. $Ted->tr("axbgdark");
  968. $Ted->td( $Tin1->render() );
  969. $Ted->td( $Tin2->render() );
  970. $Ted->td_alignment("right");
  971.  
  972. // Heading colour..
  973. $blocklet_heading_colour = $colourCombo;
  974. $blocklet_heading_colour->name = "heading_colour";
  975. $blocklet_heading_colour->setvalue($b->heading_colour);
  976. $maintainer->register_field($blocklet_heading_colour);
  977. $Tin = new table("heading_colour");
  978. $Tin->tr();
  979. $Tin->td("&nbsp;");
  980. $Tin->td( $blocklet_heading_colour->render() );
  981. $Tin->td_alignment("right");
  982. $Ted->tr("axbgdark");
  983. $Ted->td( $Tin->render() );
  984. $Ted->td("&nbsp;");
  985.  
  986. // ..................................................................
  987. $Ted->tr("axhdg");
  988. $Ted->td("<b>BLOCKLET CONTENT</b>", "axhdg");
  989. $Ted->td_colspan(2);
  990.  
  991. // ..................................................................
  992. // Blocklet content textarea, table checkboxes, and reset button
  993. $blocklet_content = new form_memofield("content", "", $b->content);
  994. $maintainer->register_field($blocklet_content);
  995. $blocklet_content->setclass("axmemo");
  996. $blocklet_content->setstyle("width:$awidth;height:200px;font-family:'courier-new, monospace'");
  997.  
  998. $Tin = new table("content");
  999. $Tin->tr();
  1000. $Tin->td( $blocklet_content->render() );
  1001. $Ted->tr("axbglite");
  1002. $Ted->td( $Tin->render() );
  1003. $Ted->td_colspan(2);
  1004.  
  1005. // ..................................................................
  1006. // Content Properties
  1007.  
  1008. // Content colour..
  1009. $blocklet_content_colour = $colourCombo;
  1010. $blocklet_content_colour->name = "content_colour";
  1011. $blocklet_content_colour->setvalue($b->content_colour);
  1012. $maintainer->register_field($blocklet_content_colour);
  1013.  
  1014. // Content size adjustment..
  1015. $blocklet_content_size = new form_combofield("content_size", "", $b->content_size);
  1016. $maintainer->register_field($blocklet_content_size);
  1017. $blocklet_content_size->setclass("axcombo");
  1018. $blocklet_content_size->setstyle("width:$cbowidth;");
  1019. $blocklet_content_size->additem("-3.0", "-5");
  1020. $blocklet_content_size->additem("-2.5", "-4");
  1021. $blocklet_content_size->additem("-2.0", "-3");
  1022. $blocklet_content_size->additem("-1.5", "-2");
  1023. $blocklet_content_size->additem("-1.0", "-1");
  1024. $blocklet_content_size->additem("0", "default size");
  1025. $blocklet_content_size->additem("1.0", "+1");
  1026. $blocklet_content_size->additem("1.5", "+2");
  1027. $blocklet_content_size->additem("2.0", "+3");
  1028. $blocklet_content_size->additem("2.5", "+4");
  1029. $blocklet_content_size->additem("3.0", "+5");
  1030.  
  1031. // Content justificiation..
  1032. $blocklet_justify = new form_combofield("justify", "", $b->justify);
  1033. $maintainer->register_field($blocklet_justify);
  1034. $blocklet_justify->setclass("axcombo");
  1035. $blocklet_justify->setstyle("width:$cbowidth;");
  1036. $blocklet_justify->additem("", "Default");
  1037. $blocklet_justify->additem("left", "Left");
  1038. $blocklet_justify->additem("center", "Centre");
  1039. $blocklet_justify->additem("right", "Right");
  1040.  
  1041. // Content tablestyle..
  1042. $table_style = $tstylesCombo;
  1043. $maintainer->register_field($table_style);
  1044. $table_style->name = "table_style";
  1045. $table_style->setvalue($b->table_style);
  1046.  
  1047. $table_aj = new form_checkbox("table_autojustify");
  1048. $maintainer->register_field($table_aj);
  1049. $table_aj->setclass("axchkbox");
  1050. $table_aj->checked = $b->table_autojustify;
  1051.  
  1052. $table_rs = new form_checkbox("table_rowstripes");
  1053. $maintainer->register_field($table_rs);
  1054. $table_rs->setclass("axchkbox");
  1055. $table_rs->checked = $b->table_rowstripes;
  1056.  
  1057. $blocklet_style = new form_textfield("blocklet_style", "", $b->blocklet_style);
  1058. $maintainer->register_field($blocklet_style);
  1059. $blocklet_style->setclass("axtxtbox");
  1060. $blocklet_style->setstyle("width:$cbowidth");
  1061.  
  1062. $Tin1 = new table("content_props");
  1063. $Tin1->tr();
  1064. $Tin1->td("Text size adjust:");
  1065. $Tin1->td( $blocklet_content_size->render() );
  1066. $Tin1->td_alignment("right");
  1067. $Tin1->tr();
  1068. $Tin1->td("Text colour:");
  1069. $Tin1->td( $blocklet_content_colour->render() );
  1070. $Tin1->td_alignment("right");
  1071.  
  1072. $Tin2 = new table("content_align");
  1073. $Tin2->setwidth("");
  1074. $Tin2->tr();
  1075. $Tin2->td( "&nbsp;" );
  1076. $Tin2->td( $breset->render() );
  1077. $Tin2->td_alignment("right", "top");
  1078. $Tin2->tr();
  1079. $Tin2->td( "Alignment:" );
  1080. $Tin2->td( $blocklet_justify->render() );
  1081.  
  1082. $Ted->tr("axbgdark");
  1083. $Ted->td( $Tin1->render() );
  1084. $Ted->td( $Tin2->render() );
  1085. $Ted->td_alignment("right", "top");
  1086.  
  1087. // Blocklet style
  1088. $Tin1 = new table("bktstyle");
  1089. $Tin1->tr();
  1090. $Tin1->td( "CSS style:" );
  1091. $Tin1->td( $blocklet_style->render() );
  1092. $Tin1->td_alignment("right");
  1093.  
  1094. $Ted->tr("axbglite");
  1095. $Ted->td( $Tin1->render() );
  1096. $Ted->td( "" );
  1097.  
  1098. // Table options
  1099. $Tin1 = new table("tablestyle");
  1100. $Tin1->tr();
  1101. $Tin1->td( "Table Options:" );
  1102. $Tin1->td( $table_style->render() );
  1103. $Tin1->td_alignment("right");
  1104.  
  1105. $Tin2 = new table("tableopts");
  1106. $Tin2->tr();
  1107. $Tin2->td( "Auto-justify:&nbsp;" . $table_aj->render() );
  1108. $Tin2->td_alignment("right");
  1109. $Tin2->td( "Row-stripes:&nbsp;" . $table_rs->render() );
  1110. $Tin2->td_alignment("right");
  1111.  
  1112. $Ted->tr("axbgdark");
  1113. $Ted->td( $Tin1->render() );
  1114. $Ted->td( $Tin2->render() );
  1115. $Ted->td_alignment("right");
  1116.  
  1117. // CSV import
  1118. $uploader = new form_fileuploadfield("_csvimportdata");
  1119. $uploader->setclass("axtxtbox");
  1120.  
  1121. $importbtn = new form_imagebutton("_csvimport");
  1122. $importbtn->setimage("$LIBDIR/img/_import.gif", "Import CSV data now");
  1123.  
  1124. $Tin1 = new table("csvimporter");
  1125. $Tin1->tr();
  1126. $Tin1->td( "Table CSV:" );
  1127. $Tin1->td( $uploader->render() );
  1128. $Tin1->td( $importbtn->render() );
  1129. $Tin1->td_alignment("right");
  1130.  
  1131. $Ted->tr("axbglite");
  1132. $Ted->td( $Tin1->render() );
  1133. $Ted->td_colspan(2);
  1134.  
  1135. // ..................................................................
  1136. $Ted->tr("axhdg");
  1137. $Ted->td("<b>INSERT SPECIAL CONTENT</b>", "axhdg");
  1138. $Ted->td_colspan(2);
  1139.  
  1140. // ..................................................................
  1141. // Add Link
  1142. $pages = new form_combofield("link_sitepage");
  1143. $pages->setid("fspec");
  1144. $pages->set_onchange("linkpop(this,'" . $this->block->blockfm . "')");
  1145. $pages->setclass("axcombo");
  1146. $pages->setstyle("width:$cwidth;");
  1147. $pages->additem("");
  1148. $Qpage = dbrecordset("SELECT * FROM ax_sitepage WHERE enabled=TRUE ORDER BY page_title");
  1149. if ($Qpage->hasdata) {
  1150. do {
  1151. $pgpath = $Qpage->field("page_path");
  1152. $pgtitle = $Qpage->field("page_title");
  1153. $pages->additem($pgpath, $pgtitle);
  1154. } while ($Qpage->get_next());
  1155. }
  1156. $gen_addbtn->set_onclick("add_link('" . $this->block->blockfm . "')");
  1157. $remote = new form_checkbox("link_remote");
  1158. $remote->setclass("axchkbox");
  1159. $remote->setid("fspec");
  1160. $remote->check();
  1161. $gen_textfield = new form_textfield("add_link");
  1162. $gen_textfield->setid("fspec");
  1163. $gen_textfield->setclass("axtxtbox");
  1164. $gen_textfield->setstyle("width:$cwidth;");
  1165.  
  1166. $Tin = new table("add_link");
  1167. $Tin->tr();
  1168. $Tin->td("<b>Hyperlink:</b>");
  1169. $Tin->td( $gen_textfield->render("link_href") );
  1170. $Tin->td_alignment("right");
  1171. $Ted->tr("axbgdark");
  1172. $Ted->td( $Tin->render() );
  1173. $Ted->td( $gen_addbtn->render() );
  1174. $Ted->td_alignment("right");
  1175.  
  1176. $Tin1 = new table("add_link");
  1177. $Tin1->tr();
  1178. $Tin1->td("Link text:");
  1179. $Tin1->td( $gen_textfield->render("link_desc") );
  1180. $Tin1->td_alignment("right");
  1181.  
  1182. $Tin2 = new table("remote");
  1183. $Tin2->setwidth("");
  1184. $Tin2->tr();
  1185. $Tin2->td( "Remote site:" );
  1186. $Tin2->td( $remote->render() );
  1187.  
  1188. $Ted->tr("axbgdark");
  1189. $Ted->td( $Tin1->render() );
  1190. $Ted->td( $Tin2->render() );
  1191. $Ted->td_alignment("right");
  1192.  
  1193. $Tin = new table("add_page");
  1194. $Tin->tr();
  1195. $Tin->td("Webpage:");
  1196. $Tin->td( $pages->render() );
  1197. $Tin->td_alignment("right");
  1198. $Ted->tr("axbgdark");
  1199. $Ted->td( $Tin->render() );
  1200. $Ted->td("&nbsp;");
  1201.  
  1202. // ..................................................................
  1203. // Add image
  1204. $this->add_image_ui($Ted);
  1205.  
  1206. // ..................................................................
  1207. // Add document
  1208. $this->add_document_ui($Ted);
  1209.  
  1210. // ..................................................................
  1211. // Add multimedia
  1212. $this->add_media_ui($Ted);
  1213.  
  1214. // ..................................................................
  1215. // Add Datasource
  1216. $this->add_datasrc_ui($Ted);
  1217.  
  1218. // ..................................................................
  1219. // Render the whole form..
  1220. $Ted->tr("axfoot");
  1221. $Ted->td("", "axfoot");
  1222. $Ted->td_colspan(2);
  1223. $s .= $Ted->render();
  1224.  
  1225. // Render the maintainer. This adds the Javascript data structures
  1226. // and renders the hidden fields for submitting changed field data..
  1227. $s .= $maintainer->render();
  1228.  
  1229. // ....................................................................
  1230. debug_trace();
  1231. // Return the html..
  1232. return $s;
  1233. } // block_editform
  1234. // ....................................................................
  1235. /** Given a table object passed in (by reference), add to it the rows
  1236. * containing the Image Add form elements..
  1237. * @param object $Ted The table object to add the user interface to
  1238. * @access private
  1239. */
  1240. function add_image_ui(&$Ted) {
  1241. global $gen_addbtn;
  1242. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1243. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1244. global $colourCombo;
  1245. $imgs = new form_combofield("img_src");
  1246. $imgs->setid("fspec");
  1247. $imgs->setclass("axcombo");
  1248. $imgs->setstyle("width:$ewidth;");
  1249. $imgs->additem("");
  1250. $Qimg = dbrecordset("SELECT * FROM ax_catalog WHERE mime_category='image' ORDER BY upload_timestamp DESC");
  1251. if ($Qimg->hasdata) {
  1252. do {
  1253. $catid = $Qimg->field("cat_id");
  1254. $catname = $Qimg->field("cat_name");
  1255. // Names following ID tell the inserter the fields to get..
  1256. $imgs->additem("$catid|img_align|img_pad|img_border|img_bordercolor|img_width|img_height", $catname);
  1257. } while ($Qimg->get_next());
  1258. }
  1259. // Add this catalog item as an IMAGE tag..
  1260. $img_addbtn = $gen_addbtn;
  1261. $img_addbtn->name = "_add_img";
  1262. $img_addbtn->settitle("Add image to content");
  1263. switch ($this->block->block_type) {
  1264. case "w":
  1265. $img_addbtn->set_onclick("add_content('image','img_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1266. break;
  1267. default:
  1268. $img_addbtn->set_onclick("add_content('image','img_src','content','" . $this->block->blockfm . "')");
  1269. } // switch
  1270.  
  1271. $imgalign = new form_combofield("img_align");
  1272. $imgalign->setid("fspec");
  1273. $imgalign->setclass("axcombo");
  1274. $imgalign->setstyle("width:$cbowidth;");
  1275. $imgalign->additem("", "Default");
  1276. $imgalign->additem("left", "Left");
  1277. $imgalign->additem("right", "Right");
  1278. $imgalign->additem("top", "Top");
  1279. $imgalign->additem("middle", "Middle");
  1280. $imgalign->additem("bottom", "Bottom");
  1281. $imgalign->additem("abstop", "Top (abs)");
  1282. $imgalign->additem("absbottom", "Bottom (abs)");
  1283. $imgalign->additem("baseline", "Baseline");
  1284. $imgalign->additem("texttop", "Top (text)");
  1285.  
  1286. $imgbdr = new form_textfield("img_border", "", "0");
  1287. $imgbdr->setid("fspec");
  1288. $imgbdr->setclass("axtxtbox");
  1289. $imgbdr->setstyle("width:35px;text-align:center;");
  1290. $imgbdr->set_onblur("limitInt(this, 0, 99, 0)");
  1291.  
  1292. $imgpad = new form_textfield("img_pad", "", "2");
  1293. $imgpad->setid("fspec");
  1294. $imgpad->setclass("axtxtbox");
  1295. $imgpad->setstyle("width:35px;text-align:center;");
  1296. $imgpad->set_onblur("limitInt(this, 0, 199, 2)");
  1297.  
  1298. $imgwidth = new form_textfield("img_width");
  1299. $imgwidth->setid("fspec");
  1300. $imgwidth->setclass("axtxtbox");
  1301. $imgwidth->setstyle("width:35px;text-align:center;");
  1302. $imgwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1303.  
  1304. $imgheight = new form_textfield("img_height");
  1305. $imgheight->setid("fspec");
  1306. $imgheight->setclass("axtxtbox");
  1307. $imgheight->setstyle("width:35px;text-align:center;");
  1308. $imgheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1309.  
  1310. $Tin = new table("img_src");
  1311. $Tin->tr();
  1312. $Tin->td("<b>Image:</b>");
  1313. $Tin->td( $imgs->render() );
  1314. $Tin->td_alignment("right");
  1315. $Ted->tr("axbglite");
  1316. $Ted->td( $Tin->render() );
  1317. $Ted->td( $img_addbtn->render() );
  1318. $Ted->td_alignment("right");
  1319.  
  1320. $Tin1 = new table("img_align");
  1321. $Tin1->tr();
  1322. $Tin1->td("Border colour:");
  1323. $Tin1->td( $colourCombo->render("img_bordercolor") );
  1324. $Tin1->td_alignment("right");
  1325.  
  1326. $Tin2 = new table("img_pad");
  1327. $Tin2->setwidth("");
  1328. $Tin2->tr();
  1329. $Tin2->td( "Border:", "text-align:right;width:" . ceil($quartwidth/2) . "px");
  1330. $Tin2->td( $imgbdr->render() );
  1331. $Tin2->td( "&nbsp;&nbsp;Pad:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1332. $Tin2->td( $imgpad->render() );
  1333.  
  1334. $Ted->tr("axbglite");
  1335. $Ted->td( $Tin1->render() );
  1336. $Ted->td( $Tin2->render() );
  1337. $Ted->td_alignment("right");
  1338.  
  1339. $Tin1 = new table("img_display");
  1340. $Tin1->tr();
  1341. $Tin1->td("Align:");
  1342. $Tin1->td( $imgalign->render() );
  1343. $Tin1->td_alignment("right");
  1344.  
  1345. $Tin2 = new table("img_size");
  1346. $Tin2->setwidth("");
  1347. $Tin2->tr();
  1348. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1349. $Tin2->td( $imgwidth->render() );
  1350. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1351. $Tin2->td( $imgheight->render() );
  1352. $Ted->tr("axbglite");
  1353. $Ted->td( $Tin1->render() );
  1354. $Ted->td( $Tin2->render() );
  1355. $Ted->td_alignment("right");
  1356.  
  1357. } // add_image_ui
  1358. // ....................................................................
  1359. /** Given a table object passed in (by reference), add to it the rows
  1360. * containing the Document Add form elements..
  1361. * @param object $Ted The table object to add the user interface to
  1362. * @access private
  1363. */
  1364. function add_document_ui(&$Ted) {
  1365. global $gen_addbtn;
  1366. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1367. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1368. $docs = new form_combofield("doc_src");
  1369. $docs->setid("fspec");
  1370. $docs->setclass("axcombo");
  1371. $docs->setstyle("width:$ewidth;");
  1372. $docs->additem("");
  1373. $q = "SELECT * FROM ax_catalog";
  1374. $q .= " WHERE mime_category='document'";
  1375. $q .= " ORDER BY mime_type, upload_timestamp DESC";
  1376. $Qdoc = dbrecordset($q);
  1377. if ($Qdoc->hasdata) {
  1378. do {
  1379. $catid = $Qdoc->field("cat_id");
  1380. $catname = $Qdoc->field("cat_name");
  1381. $extn = get_file_extn($Qdoc->field("filepath"));
  1382. if ($extn != "") {
  1383. $catname .= " ($extn)";
  1384. }
  1385. // Names following ID tell the inserter the fields to get..
  1386. $docs->additem("$catid|doc_display|doc_width|doc_height", $catname);
  1387. } while ($Qdoc->get_next());
  1388. }
  1389. // Add this catalog item as a DOCUMENT tag..
  1390. $doc_addbtn = $gen_addbtn;
  1391. $doc_addbtn->name = "_add_doc";
  1392. $doc_addbtn->settitle("Add document to content");
  1393. switch ($this->block->block_type) {
  1394. case "w":
  1395. $doc_addbtn->set_onclick("add_content('document','doc_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1396. break;
  1397. default:
  1398. $doc_addbtn->set_onclick("add_content('document','doc_src','content','" . $this->block->blockfm . "')");
  1399. } // switch
  1400. $docdisplay = new form_combofield("doc_display");
  1401. $docdisplay->setid("fspec");
  1402. $docdisplay->setclass("axcombo");
  1403. $docdisplay->setstyle("width:$cbowidth;");
  1404. $docdisplay->additem("icon", "clickable icon");
  1405. $docdisplay->additem("link", "hyperlink");
  1406.  
  1407. $docwidth = new form_textfield("doc_width");
  1408. $docwidth->setid("fspec");
  1409. $docwidth->setclass("axtxtbox");
  1410. $docwidth->setstyle("width:35px;text-align:center;");
  1411. $docwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1412.  
  1413. $docheight = new form_textfield("doc_height");
  1414. $docheight->setid("fspec");
  1415. $docheight->setclass("axtxtbox");
  1416. $docheight->setstyle("width:35px;text-align:center;");
  1417. $docheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1418.  
  1419. $Tin = new table("doc_src");
  1420. $Tin->tr();
  1421. $Tin->td("<b>Document:</b>");
  1422. $Tin->td( $docs->render() );
  1423. $Tin->td_alignment("right");
  1424. $Ted->tr("axbgdark");
  1425. $Ted->td( $Tin->render() );
  1426. $Ted->td( $doc_addbtn->render() );
  1427. $Ted->td_alignment("right");
  1428.  
  1429. $Tin1 = new table("doc_display");
  1430. $Tin1->tr();
  1431. $Tin1->td("Display as:");
  1432. $Tin1->td( $docdisplay->render() );
  1433. $Tin1->td_alignment("right");
  1434.  
  1435. $Tin2 = new table("doc_size");
  1436. $Tin2->setwidth("");
  1437. $Tin2->tr();
  1438. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1439. $Tin2->td( $docwidth->render() );
  1440. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1441. $Tin2->td( $docheight->render() );
  1442. $Ted->tr("axbgdark");
  1443. $Ted->td( $Tin1->render() );
  1444. $Ted->td( $Tin2->render() );
  1445. $Ted->td_alignment("right");
  1446. } // add_document_ui
  1447. // ....................................................................
  1448. /** Given a table object passed in (by reference), add to it the rows
  1449. * containing the Media Add form elements..
  1450. * @param object $Ted The table object to add the user interface to
  1451. * @access private
  1452. */
  1453. function add_media_ui(&$Ted) {
  1454. global $gen_addbtn;
  1455. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1456. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1457. $MMs = new form_combofield("mm_src");
  1458. $MMs->setid("fspec");
  1459. $MMs->setclass("axcombo");
  1460. $MMs->setstyle("width:$ewidth;");
  1461. $MMs->additem("");
  1462. $q = "SELECT * FROM ax_catalog";
  1463. $q .= " WHERE mime_category='movie'";
  1464. $q .= " OR mime_category='audio'";
  1465. $q .= " OR mime_category='flash'";
  1466. $q .= " ORDER BY mime_category, mime_type, upload_timestamp DESC";
  1467. $QMM = dbrecordset($q);
  1468. if ($QMM->hasdata) {
  1469. do {
  1470. $catid = $QMM->field("cat_id");
  1471. $catname = $QMM->field("cat_name");
  1472. $extn = get_file_extn($QMM->field("filepath"));
  1473. if ($extn != "") {
  1474. $catname .= " ($extn)";
  1475. }
  1476. // Names following ID tell the inserter the fields to get..
  1477. $MMs->additem("$catid|mm_display|mm_width|mm_height|autostart|loop|showcontrols", $catname);
  1478. } while ($QMM->get_next());
  1479. }
  1480. // Add this catalog item as a MEDIA tag..
  1481. $mm_addbtn = $gen_addbtn;
  1482. $mm_addbtn->name = "_add_mm";
  1483. $mm_addbtn->settitle("Add media to content");
  1484. switch ($this->block->block_type) {
  1485. case "w":
  1486. $mm_addbtn->set_onclick("add_content('media','mm_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1487. break;
  1488. default:
  1489. $mm_addbtn->set_onclick("add_content('media','mm_src','content','" . $this->block->blockfm . "')");
  1490. } // switch
  1491.  
  1492. $MMdisplay = new form_combofield("mm_display");
  1493. $MMdisplay->setid("fspec");
  1494. $MMdisplay->setclass("axcombo");
  1495. $MMdisplay->setstyle("width:$cbowidth;");
  1496. $MMdisplay->additem("icon", "clickable icon");
  1497. $MMdisplay->additem("embedded", "embedded in page");
  1498. $MMdisplay->additem("link", "hyperlink");
  1499.  
  1500. $MMwidth = new form_textfield("mm_width");
  1501. $MMwidth->setid("fspec");
  1502. $MMwidth->setclass("axtxtbox");
  1503. $MMwidth->setstyle("width:35px;text-align:center;");
  1504. $MMwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1505.  
  1506. $MMheight = new form_textfield("mm_height");
  1507. $MMheight->setid("fspec");
  1508. $MMheight->setclass("axtxtbox");
  1509. $MMheight->setstyle("width:35px;text-align:center;");
  1510. $MMheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1511.  
  1512. $MMautostart = new form_checkbox("autostart");
  1513. $MMautostart->setid("fspec");
  1514. $MMautostart->setclass("axchkbox");
  1515. $MMautostart->check();
  1516.  
  1517. $MMloop = new form_checkbox("loop");
  1518. $MMloop->setid("fspec");
  1519. $MMloop->setclass("axchkbox");
  1520.  
  1521. $MMcontrols = new form_checkbox("showcontrols");
  1522. $MMcontrols->setid("fspec");
  1523. $MMcontrols->setclass("axchkbox");
  1524. $MMcontrols->check();
  1525.  
  1526. $Tin = new table("mm_src");
  1527. $Tin->tr();
  1528. $Tin->td("<b>Media:</b>");
  1529. $Tin->td( $MMs->render() );
  1530. $Tin->td_alignment("right");
  1531. $Ted->tr("axbglite");
  1532. $Ted->td( $Tin->render() );
  1533. $Ted->td( $mm_addbtn->render() );
  1534. $Ted->td_alignment("right");
  1535.  
  1536. $Tin1 = new table("mm_display");
  1537. $Tin1->tr();
  1538. $Tin1->td("Display as:");
  1539. $Tin1->td( $MMdisplay->render() );
  1540. $Tin1->td_alignment("right");
  1541.  
  1542. $Tin2 = new table("mm_size");
  1543. $Tin2->setwidth("");
  1544. $Tin2->tr();
  1545. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1546. $Tin2->td( $MMwidth->render() );
  1547. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1548. $Tin2->td( $MMheight->render() );
  1549. $Ted->tr("axbglite");
  1550. $Ted->td( $Tin1->render() );
  1551. $Ted->td( $Tin2->render() );
  1552. $Ted->td_alignment("right");
  1553.  
  1554. $Tin = new table("mm_opts");
  1555. $Tin->tr();
  1556. $Tin->td("Autostart:&nbsp;" . $MMautostart->render());
  1557. $Tin->td_alignment("right");
  1558. $Tin->td("Loop:&nbsp;" . $MMloop->render());
  1559. $Tin->td_alignment("right");
  1560. $Tin->td("Controls:&nbsp;" . $MMcontrols->render());
  1561. $Tin->td_alignment("right");
  1562. $Ted->tr("axbglite");
  1563. $Ted->td( $Tin->render() );
  1564. $Ted->td( "&nbsp;" );
  1565. $Ted->td_alignment("right");
  1566. } // add_media_ui
  1567. // ....................................................................
  1568. /** Given a table object passed in (by reference), add to it the rows
  1569. * containing the Data Source Add form elements..
  1570. * @param object $Ted The table object to add the user interface to
  1571. * @access private
  1572. */
  1573. function add_datasrc_ui(&$Ted) {
  1574. global $gen_addbtn;
  1575. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1576. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1577. $datas = new form_combofield("data_src");
  1578. $datas->setid("fspec");
  1579. $datas->setclass("axcombo");
  1580. $datas->setstyle("width:$ewidth;");
  1581. $datas->additem("");
  1582. $Qdata = dbrecordset("SELECT * FROM ax_query_resource WHERE enabled=TRUE ORDER BY q_desc DESC");
  1583. if ($Qdata->hasdata) {
  1584. do {
  1585. $quid = $Qdata->field("quid");
  1586. $qdesc = $Qdata->field("q_desc");
  1587. $datas->additem("$quid|where|data_format|tableheadings", $qdesc);
  1588. } while ($Qdata->get_next());
  1589. }
  1590. // Add this catalog item as a DATA tag..
  1591. $dat_addbtn = $gen_addbtn;
  1592. $dat_addbtn->name = "_add_dat";
  1593. $dat_addbtn->settitle("Add data query to content");
  1594. switch ($this->block->block_type) {
  1595. case "w":
  1596. $dat_addbtn->set_onclick("add_content('data','data_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1597. break;
  1598. default:
  1599. $dat_addbtn->set_onclick("add_content('data','data_src','content','" . $this->block->blockfm . "')");
  1600. } // switch
  1601.  
  1602. $datawhere = new form_textfield("where");
  1603. $datawhere->setid("fspec");
  1604. $datawhere->setclass("axtxtbox");
  1605. $datawhere->setstyle("width:$cwidth;");
  1606.  
  1607. global $gen_blocklettype;
  1608. $dataformat = $gen_blocklettype;
  1609. $dataformat->setvalue("text");
  1610.  
  1611. $tablehdgs = new form_checkbox("tableheadings");
  1612. $tablehdgs->setid("fspec");
  1613. $tablehdgs->setclass("axchkbox");
  1614.  
  1615. $Tin = new table("data_src");
  1616. $Tin->tr();
  1617. $Tin->td("<b>Database:</b>");
  1618. $Tin->td( $datas->render() );
  1619. $Tin->td_alignment("right");
  1620. $Ted->tr("axbgdark");
  1621. $Ted->td( $Tin->render() );
  1622. $Ted->td( $dat_addbtn->render() );
  1623. $Ted->td_alignment("right");
  1624.  
  1625. $Tin = new table("where");
  1626. $Tin->tr();
  1627. $Tin->td("Where:");
  1628. $Tin->td( $datawhere->render() );
  1629. $Tin->td_alignment("right");
  1630. $Ted->tr("axbgdark");
  1631. $Ted->td( $Tin->render() );
  1632. $Ted->td( "&nbsp;" );
  1633.  
  1634. $Tin1 = new table("data_format");
  1635. $Tin1->tr();
  1636. $Tin1->td("Format:");
  1637. $Tin1->td( $dataformat->render("data_format") );
  1638. $Tin1->td_alignment("right");
  1639.  
  1640. $Tin2 = new table("thdgs");
  1641. $Tin2->setwidth("");
  1642. $Tin2->tr();
  1643. $Tin2->td( "Table headings:" );
  1644. $Tin2->td( $tablehdgs->render() );
  1645.  
  1646. $Ted->tr("axbgdark");
  1647. $Ted->td( $Tin1->render() );
  1648. $Ted->td( $Tin2->render() );
  1649. $Ted->td_alignment("right");;
  1650. } // add_datasrc_ui
  1651.  
  1652. } // blockeditor class
  1653. // ----------------------------------------------------------------------
  1654.  
  1655. ?>

Documentation generated by phpDocumentor 1.3.0RC3