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", "", "", $src="$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 += '<object type=\"axyl/embedded-media\" 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. $wysiwyg = new form_wysiwygfield("wysiwyg_content", "", $wysiwyg_blocklet->content);
  495. $wysiwyg->setclass("axmemo");
  496. $wysiwyg->setstyle("width:$awidth;height:400px;");
  497. $wysiwyg->register_plugins("all");
  498. $wysiwyg->set_toolbar("full");
  499.  
  500. $Tin = new table("content");
  501. $Tin->tr();
  502. $Tin->td( $wysiwyg->render() );
  503. $Ted->tr("axbglite");
  504. $Ted->td( $Tin->render() );
  505. $Ted->td_colspan(2);
  506. // ..................................................................
  507. // Provide the user interfaces to insert content..
  508. $this->add_image_ui($Ted);
  509. $this->add_document_ui($Ted);
  510. $this->add_media_ui($Ted);
  511. $this->add_datasrc_ui($Ted);
  512.  
  513. // ..................................................................
  514. // Render the whole table..
  515. $Ted->tr("axfoot");
  516. $Ted->td("", "axfoot");
  517. $Ted->td_colspan(2);
  518. $s .= $Ted->render();
  519.  
  520. // ..................................................................
  521. $hid = new form_hiddenfield("_wysiwygpost_form", $this->block->blockfm);
  522. $s .= $hid->render();
  523.  
  524. debug_trace();
  525. // Return the html..
  526. return $s;
  527. } // wysiwyg_editform
  528. // ....................................................................
  529. /**
  530. * Render the block editing suite.
  531. * @return string The HTML for the editing suite form etc.
  532. * @access private
  533. */
  534. function block_editform($lang_encoding, $lang_direction) {
  535. debug_trace($this);
  536. global $LIBDIR;
  537. global $RESPONSE;
  538. global $gen_addbtn, $gen_blocklettype;
  539. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  540. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  541. global $colourCombo, $tstylesCombo, $langsCombo;
  542.  
  543. // Insert javascript for block editing..
  544. insert_block_jscript();
  545.  
  546. // Initialise content..
  547. $s = "";
  548.  
  549. // ..................................................................
  550. // KEYFIELD and RECORD MAINTAINER
  551. // Blocklet listbox
  552. // Declared here so we can create the maintainer and register buttons
  553. // before they are used in the form.
  554. //
  555. // This is the keyfield listbox which controls the maintainance
  556. // process. It lists all records being maintained..
  557. $blocklet_listbox = new form_combofield("blocklet_id");
  558. $blocklet_listbox->setclass("axlistbox");
  559. // Make a new record maintainer, and attach the buttons..
  560. $maintainer = new recmaintainer($this->block->blockfm, $blocklet_listbox);
  561.  
  562. // Create buttons..
  563. $bup = new form_imagebutton("_up", "", "", "$LIBDIR/img/_up.gif", "Move up", 57, 15);
  564. $bdown = new form_imagebutton("_down", "", "", "$LIBDIR/img/_down.gif", "Move down", 57, 15);
  565. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete blocklet", 57, 15);
  566. $badd = new form_imagebutton("_add", "", "", "$LIBDIR/img/_add.gif", "Add new blocklet", 57, 15);
  567. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save blocklet settings", 57, 15);
  568. $bdone = new form_imagebutton("_done", "", "", "$LIBDIR/img/_done.gif", "Exit without saving", 57, 15);
  569. $breset = new form_imagebutton("_reset", "", "", "$LIBDIR/img/_reset.gif", "Reset form", 57, 15);
  570. $breset->set_onclick("document.forms." . $this->block->blockfm . ".reset()");
  571.  
  572. // Register all relevant buttons to the maintainer..
  573. $maintainer->register_button("up" , $bup);
  574. $maintainer->register_button("down", $bdown);
  575. $maintainer->register_button("add", $badd);
  576. $maintainer->register_button("save", $bsave);
  577. $maintainer->register_button("del", $bdel);
  578. $maintainer->register_button("reset", $breset);
  579.  
  580. // Control table..
  581. $Ted = new table("block_" . $this->block->blockid);
  582. $Ted->setpadding(2);
  583.  
  584. // ..................................................................
  585. // Toolbar..
  586. $toolbar = array();
  587. $toolbar[] = $bdone;
  588. $toolbar[] = $bsave;
  589. $Tbar = new table("toolbar");
  590. $Tbar->tr("axtitle");
  591. switch ($this->block->layout_version) {
  592. case VERSION_PENDING: $hdg = "PENDING"; break;
  593. case VERSION_LIVE: $hdg = "LIVE"; break;
  594. case VERSION_PREVIOUS: $hdg = "PREVIOUS"; break;
  595. case VERSION_UNDEFINED: $hdg = "EDITING"; break;
  596. default: $hdg = "Version: " . $this->block->layout_version;
  597. } // switch
  598. $Tbar->th("<b>$hdg</b> [B" . $this->block->blockid . "]", "axtitle");
  599. $tools = "";
  600. foreach ($toolbar as $tool) {
  601. $tools .= $tool->render();
  602. }
  603. $Tbar->th($tools, "axtitle");
  604. $Tbar->th_css("text-align:right");
  605. $Ted->thead();
  606. $Ted->tr("axtitle");
  607. $Ted->td( $Tbar->render(), "axtitle" );
  608. $Ted->td_colspan(2);
  609.  
  610. // ..................................................................
  611. $Ted->tr("axhdg");
  612. $Ted->td("<b>BLOCK SETTINGS</b>", "axhdg");
  613. $Ted->td_colspan(2);
  614. // ..................................................................
  615.  
  616. // Block parameters..
  617. $block_desc = new form_textfield("block_desc", "", $this->block->block_desc);
  618. $block_desc->setclass("axtxtbox");
  619. $block_desc->setstyle("width:$bigwidth");
  620.  
  621. $block_cols = new form_textfield("cols", "", $this->block->cols);
  622. $block_cols->setclass("axtxtbox");
  623. $block_cols->setstyle("width:30px;text-align:center;");
  624. $block_cols->set_onblur("limitInt(this, 1, 9)");
  625.  
  626. $block_gutter_width = new form_textfield("gutter_width", "", $this->block->gutter_width);
  627. $block_gutter_width->setclass("axtxtbox");
  628. $block_gutter_width->setstyle("width:30px;text-align:center;");
  629. $block_gutter_width->set_onblur("limitInt(this, 1, 99)");
  630.  
  631. $block_gutter_colour = $colourCombo;
  632. $block_gutter_colour->name = "gutter_colour";
  633. $block_gutter_colour->setvalue($this->block->gutter_colour);
  634.  
  635. $block_justify = new form_combofield("block_justify", "", $this->block->justify);
  636. $block_justify->setclass("axcombo");
  637. $block_justify->additem("", "default");
  638. $block_justify->additem("left", "Left");
  639. $block_justify->additem("center", "Centre");
  640. $block_justify->additem("right", "Right");
  641.  
  642. $block_valign = new form_combofield("block_valign", "", $this->block->valign);
  643. $block_valign->setclass("axcombo");
  644. $block_valign->additem("", "default");
  645. $block_valign->additem("top", "Top");
  646. $block_valign->additem("middle", "Middle");
  647. $block_valign->additem("bottom", "Bottom");
  648.  
  649. $block_bg_colour = $colourCombo;
  650. $block_bg_colour->name = "background_colour";
  651. $block_bg_colour->setvalue($this->block->background_colour);
  652.  
  653. $block_border_width = new form_textfield("block_border_width", "", $this->block->border_width);
  654. $block_border_width->setclass("axtxtbox");
  655. $block_border_width->setstyle("width:30px;text-align:center;");
  656. $block_border_width->set_onblur("limitInt(this, 0, 99)");
  657.  
  658. $blocklet_sep = new form_textfield("blocklet_sep", "", $this->block->blocklet_sep);
  659. $blocklet_sep->setclass("axtxtbox");
  660. $blocklet_sep->setstyle("width:30px;text-align:center;");
  661. $blocklet_sep->set_onblur("limitInt(this, 0, 99)");
  662.  
  663. $block_exportable = new form_checkbox("block_exportable");
  664. $block_exportable->checked = $this->block->exportable;
  665.  
  666. $block_border_colour = $colourCombo;
  667. $block_border_colour->name = "block_border_colour";
  668. $block_border_colour->setvalue($this->block->border_colour);
  669.  
  670. $block_style = new form_textfield("block_style", "", $this->block->block_style);
  671. $block_style->setclass("axtxtbox");
  672. $block_style->setstyle("width:$ewidth;");
  673.  
  674. $block_bgimgs = new form_combofield("background_img");
  675. $block_bgimgs->setclass("axcombo");
  676. $block_bgimgs->setstyle("width:$ewidth;");
  677. $block_bgimgs->additem(NULLVALUE, "");
  678. $Qimg = dbrecordset("SELECT * FROM ax_catalog WHERE mime_category='image' ORDER BY upload_timestamp DESC");
  679. if ($Qimg->hasdata) {
  680. do {
  681. $catid = $Qimg->field("cat_id");
  682. $catname = $Qimg->field("cat_name");
  683. // Names following ID tell the inserter the fields to get..
  684. $block_bgimgs->additem($catid, $catname);
  685. } while ($Qimg->get_next());
  686. }
  687. $block_bgimgs->setvalue($this->block->background_img);
  688.  
  689. $Tin = new table("blockopts");
  690. $Tin->setpadding(2);
  691.  
  692. $Tin->tr( "axbgdark");
  693. $Tin->td( "Description:&nbsp;" . $block_desc->render() );
  694. $Tin->td_colspan(3);
  695. $Tin->td_alignment("right");
  696.  
  697. // Language..
  698. $langsCombo->setvalue($this->block->language);
  699. if ($RESPONSE->multilang) {
  700. // Present the language selector..
  701. $Tin->tr("axbglite");
  702. $Tin->td( "&nbsp;" );
  703. $Tin->td( "Block language:&nbsp;" . $langsCombo->render() );
  704. $Tin->td_alignment("right");
  705. $Tin->td_colspan(2);
  706. }
  707. else {
  708. // In this case it is just a hidden field..
  709. $Tin->tr("axbglite");
  710. $Tin->td( "&nbsp;" );
  711. $Tin->td( $langsCombo->render() );
  712. $Tin->td_colspan(2);
  713. }
  714.  
  715. $Tin->tr("axbgdark");
  716. $Tin->td( "Columns:&nbsp;" . $block_cols->render() );
  717. $Tin->td_alignment("right");
  718. $Tin->td( "Gutter width:&nbsp;" . $block_gutter_width->render() );
  719. $Tin->td_alignment("right");
  720. $Tin->td( "Gutter colour:&nbsp;" . $block_gutter_colour->render() );
  721. $Tin->td_alignment("right");
  722.  
  723. $Tin->tr( "axbglite");
  724. $Tin->td( "Blocklet spacing:&nbsp;" . $blocklet_sep->render() );
  725. $Tin->td_alignment("right");
  726. $Tin->td( "Border width:&nbsp;" . $block_border_width->render() );
  727. $Tin->td_alignment("right");
  728. $Tin->td( "Border colour:&nbsp;" . $block_border_colour->render() );
  729. $Tin->td_alignment("right");
  730.  
  731. $Tin->tr("axbgdark");
  732. $Tin->td( "Justify:&nbsp;" . $block_justify->render() );
  733. $Tin->td_alignment("right");
  734. $Tin->td( "Align:&nbsp;" . $block_valign->render() );
  735. $Tin->td_alignment("right");
  736. $Tin->td( "Background:&nbsp;" . $block_bg_colour->render() );
  737. $Tin->td_alignment("right");
  738.  
  739. $Tin->tr( "axbglite");
  740. $Tin->td( "CSS style:&nbsp;" . $block_style->render() );
  741. $Tin->td_colspan(3);
  742. $Tin->td_alignment("right");
  743.  
  744. $Tin->tr( "axbgdark");
  745. $Tin->td( "Background image:&nbsp;" . $block_bgimgs->render() );
  746. $Tin->td_colspan(3);
  747. $Tin->td_alignment("right");
  748.  
  749. $Tin->tr( "axbglite");
  750. $Tin->td( "Exportable in CSV format&nbsp;" . $block_exportable->render() );
  751. $Tin->td_colspan(3);
  752. $Tin->td_alignment("right");
  753.  
  754. $Ted->tr("axbglite");
  755. $Ted->td( $Tin->render() );
  756. $Ted->td_colspan(2);
  757.  
  758. // ..................................................................
  759. // Blocklets Editing Fields..
  760. $Ted->tr("axhdg");
  761. $Ted->td("<b>BLOCKLETS IN THIS BLOCK</b>", "axhdg");
  762. $Ted->td_colspan(2);
  763.  
  764. // Continue defining listbox..
  765. $blocklet_listbox->setstyle("width:$ewidth;height:140px;");
  766. $blocklet_listbox->size = 6;
  767. foreach ($this->block->blocklets as $b) {
  768. // Populate listbox..
  769. $blocklet_listbox->additem($b->blockletid, $b->blocklet_desc);
  770.  
  771. // Populate maintainer data. The maintainer add_record method
  772. // requires an associative array keyed on listbox key id..
  773. $rec = array(
  774. "blocklet_desc" => $b->blocklet_desc,
  775. "blocklet_type" => $b->type,
  776. "blocklet_width" => $b->width,
  777. "blocklet_style" => $b->blocklet_style,
  778. "justify" => $b->justify,
  779. "heading" => $b->heading,
  780. "heading_level" => $b->heading_level,
  781. "heading_colour" => $b->heading_colour,
  782. "ruler" => $b->ruler,
  783. "ruler_width" => $b->ruler_width,
  784. "ruler_size" => $b->ruler_size,
  785. "ruler_colour" => $b->ruler_colour,
  786. "content" => $b->content,
  787. "content_size" => ($b->content_size == 0) ? "0" : number_format($b->content_size, 1),
  788. "content_colour" => $b->content_colour,
  789. "table_style" => $b->table_style,
  790. "table_autojustify" => (($b->table_autojustify) ? "t" : "f"),
  791. "table_rowstripes" => (($b->table_rowstripes) ? "t" : "f"),
  792. "visible" => (($b->visible) ? "t" : "f")
  793. );
  794. $maintainer->add_record($b->blockletid, $rec);
  795. }
  796. // Now set the defaults for each of the fields. These are
  797. // necessary for when a new record is created..
  798. $defaults = array(
  799. "blocklet_desc" => "(enter a blocklet description)",
  800. "blocklet_type" => "text",
  801. "blocklet_width" => "100",
  802. "blocklet_style" => "",
  803. "justify" => "left",
  804. "heading" => "",
  805. "heading_level" => "3",
  806. "heading_colour" => "",
  807. "ruler" => "none",
  808. "ruler_width" => "100",
  809. "ruler_size" => "1",
  810. "ruler_colour" => "",
  811. "content" => "",
  812. "content_size" => "0",
  813. "content_colour" => "",
  814. "table_style" => "",
  815. "table_autojustify" => "f",
  816. "table_rowstripes" => "f",
  817. "visible" => "t"
  818. );
  819. $maintainer->add_defaults($defaults);
  820.  
  821. // The listbox field..
  822. $Ted->tr("axbgdark");
  823. $Ted->td( $blocklet_listbox->render() );
  824. $Ted->td_width("50%");
  825. $Ted->td(
  826. $bup->render() . "<br>"
  827. . $bdown->render() . "<br>"
  828. . $bdel->render() . "<br>"
  829. . $badd->render()
  830. );
  831. $Ted->td_width("50%");
  832. $Ted->td_alignment("right", "top");
  833.  
  834. // ..................................................................
  835. // Blocklet description field..
  836. $blocklet_desc = new form_textfield("blocklet_desc", "", $b->blocklet_desc);
  837. $maintainer->register_field($blocklet_desc);
  838. $blocklet_desc->setclass("axtxtbox");
  839. $blocklet_desc->setstyle("width:$ewidth;");
  840. $Ted->tr("axbglite");
  841. $Ted->td( $blocklet_desc->render() );
  842. $Ted->td( "< Blocklet Description" );
  843.  
  844. // ..................................................................
  845. $Ted->tr("axhdg");
  846. $Ted->td("<b>BLOCKLET SETTINGS</b>", "axhdg");
  847. $Ted->td_colspan(2);
  848.  
  849. // ..................................................................
  850. // Blocklet type, Width and Visibility
  851. // NOTE: We register each field, beginning with these, to the maintainer.
  852. // We MUST use the database field-name, as our form element name..
  853. global $gen_blocklettype;
  854. $maintainer->register_field($gen_blocklettype);
  855.  
  856. $blocklet_width = new form_textfield("blocklet_width", "", $b->width);
  857. $maintainer->register_field($blocklet_width);
  858. $blocklet_width->setclass("axtxtbox");
  859. $blocklet_width->setstyle("width:35px;text-align:center;");
  860. $blocklet_width->set_onblur("limitInt(this, 0, 100, 100)");
  861.  
  862. $blocklet_visible = new form_checkbox("visible", "", "yes", EDITABLE, "", $b->visible);
  863. $blocklet_visible->setclass("axchkbox");
  864. $maintainer->register_field($blocklet_visible);
  865.  
  866. $Tin1 = new table("type");
  867. $Tin1->tr();
  868. $Tin1->td("<b>Blocklet type:</b>");
  869. $Tin1->td( $gen_blocklettype->render() );
  870. $Tin1->td_alignment("right");
  871. $Tin2 = new table("opts");
  872. $Tin2->setwidth("");
  873. $Tin2->tbody("fmlook");
  874. $Tin2->tr();
  875. $Tin2->td( "Blocklet width%:", "text-align:right");
  876. $Tin2->td( $blocklet_width->render() );
  877. $Tin2->td( "&nbsp;Visible:", "text-align:right" );
  878. $Tin2->td( $blocklet_visible->render() );
  879. $Ted->tr("axbgdark");
  880. $Ted->td( $Tin1->render() );
  881. $Ted->td( $Tin2->render() );
  882. $Ted->td_alignment("right");
  883.  
  884. // ..................................................................
  885. // Blocklet ruler settings
  886. $blocklet_ruler = new form_combofield("ruler", "", $b->ruler);
  887. $maintainer->register_field($blocklet_ruler);
  888. $blocklet_ruler->setclass("axcombo");
  889. $blocklet_ruler->setstyle("width:$cbowidth;");
  890. $blocklet_ruler->additem("top", "Top");
  891. $blocklet_ruler->additem("bottom", "Bottom");
  892. $blocklet_ruler->additem("none", "None");
  893.  
  894. $blocklet_ruler_width = new form_textfield("ruler_width", "", $b->ruler_width);
  895. $maintainer->register_field($blocklet_ruler_width);
  896. $blocklet_ruler_width->setclass("axtxtbox");
  897. $blocklet_ruler_width->setstyle("width:35px;text-align:center;");
  898. $blocklet_ruler_width->set_onblur("limitInt(this, 0, 100, 100)");
  899.  
  900. $blocklet_ruler_size = new form_textfield("ruler_size", "", $b->ruler_size);
  901. $maintainer->register_field($blocklet_ruler_size);
  902. $blocklet_ruler_size->setclass("axtxtbox");
  903. $blocklet_ruler_size->setstyle("width:30px;text-align:center;");
  904. $blocklet_ruler_size->set_onblur("limitInt(this, 1, 99)");
  905. $Tin1 = new table("ruler");
  906. $Tin1->tbody("fmlook");
  907. $Tin1->tr();
  908. $Tin1->td("<b>Ruler:</b>");
  909. $Tin1->td( $blocklet_ruler->render() );
  910. $Tin1->td_alignment("right");
  911. $Tin2 = new table("ruler");
  912. $Tin2->setwidth("");
  913. $Tin2->tbody("fmlook");
  914. $Tin2->tr();
  915. $Tin2->td( "Ruler width%:", "text-align:right");
  916. $Tin2->td( $blocklet_ruler_width->render() );
  917. $Tin2->td( "&nbsp;&nbsp;Size:", "text-align:right" );
  918. $Tin2->td( $blocklet_ruler_size->render() );
  919. $Ted->tr("axbglite");
  920. $Ted->td( $Tin1->render() );
  921. $Ted->td( $Tin2->render() );
  922. $Ted->td_alignment("right");
  923.  
  924. // ..................................................................
  925. // Blocklet ruler colour..
  926. $blocklet_ruler_colour = $colourCombo;
  927. $blocklet_ruler_colour->name = "ruler_colour";
  928. $blocklet_ruler_colour->setvalue($b->ruler_colour);
  929. $maintainer->register_field($blocklet_ruler_colour);
  930. $Tin = new table("ruler_colour");
  931. $Tin->tr();
  932. $Tin->td("&nbsp;");
  933. $Tin->td( $blocklet_ruler_colour->render() );
  934. $Tin->td_alignment("right");
  935. $Ted->tr("axbglite");
  936. $Ted->td( $Tin->render() );
  937. $Ted->td("&nbsp;");
  938.  
  939. // ..................................................................
  940. // Block heading text field..
  941. $blocklet_heading = new form_textfield("heading", "", $b->heading);
  942. $maintainer->register_field($blocklet_heading);
  943. $blocklet_heading->setclass("axtxtbox");
  944. $blocklet_heading->setstyle("width:185px;");
  945.  
  946. $blocklet_heading_level = new form_combofield("heading_level", "", $b->heading_level);
  947. $maintainer->register_field($blocklet_heading_level);
  948. $blocklet_heading_level->setclass("axcombo");
  949. $blocklet_heading_level->setstyle("width:50px;");
  950. $blocklet_heading_level->setvalue($b->heading_level);
  951. for ($h=1; $h<=6; $h++) {
  952. $blocklet_heading_level->additem($h);
  953. }
  954. $Tin1 = new table("ruler");
  955. $Tin1->tr();
  956. $Tin1->td( "<b>Heading:</b>" );
  957. $Tin1->td( $blocklet_heading->render() );
  958. $Tin1->td_alignment("right");
  959.  
  960. $Tin2 = new table("hlevel");
  961. $Tin2->setwidth("");
  962. $Tin2->tr();
  963. $Tin2->td( "Level:" );
  964. $Tin2->td( $blocklet_heading_level->render() );
  965.  
  966. $Ted->tr("axbgdark");
  967. $Ted->td( $Tin1->render() );
  968. $Ted->td( $Tin2->render() );
  969. $Ted->td_alignment("right");
  970.  
  971. // Heading colour..
  972. $blocklet_heading_colour = $colourCombo;
  973. $blocklet_heading_colour->name = "heading_colour";
  974. $blocklet_heading_colour->setvalue($b->heading_colour);
  975. $maintainer->register_field($blocklet_heading_colour);
  976. $Tin = new table("heading_colour");
  977. $Tin->tr();
  978. $Tin->td("&nbsp;");
  979. $Tin->td( $blocklet_heading_colour->render() );
  980. $Tin->td_alignment("right");
  981. $Ted->tr("axbgdark");
  982. $Ted->td( $Tin->render() );
  983. $Ted->td("&nbsp;");
  984.  
  985. // ..................................................................
  986. $Ted->tr("axhdg");
  987. $Ted->td("<b>BLOCKLET CONTENT</b>", "axhdg");
  988. $Ted->td_colspan(2);
  989.  
  990. // ..................................................................
  991. // Blocklet content textarea, table checkboxes, and reset button
  992. $blocklet_content = new form_memofield("content", "", $b->content);
  993. $maintainer->register_field($blocklet_content);
  994. $blocklet_content->setclass("axmemo");
  995. $blocklet_content->setstyle("width:$awidth;height:200px;font-family:'courier-new, monospace'");
  996.  
  997. $Tin = new table("content");
  998. $Tin->tr();
  999. $Tin->td( $blocklet_content->render() );
  1000. $Ted->tr("axbglite");
  1001. $Ted->td( $Tin->render() );
  1002. $Ted->td_colspan(2);
  1003.  
  1004. // ..................................................................
  1005. // Content Properties
  1006.  
  1007. // Content colour..
  1008. $blocklet_content_colour = $colourCombo;
  1009. $blocklet_content_colour->name = "content_colour";
  1010. $blocklet_content_colour->setvalue($b->content_colour);
  1011. $maintainer->register_field($blocklet_content_colour);
  1012.  
  1013. // Content size adjustment..
  1014. $blocklet_content_size = new form_combofield("content_size", "", $b->content_size);
  1015. $maintainer->register_field($blocklet_content_size);
  1016. $blocklet_content_size->setclass("axcombo");
  1017. $blocklet_content_size->setstyle("width:$cbowidth;");
  1018. $blocklet_content_size->additem("-3.0", "-5");
  1019. $blocklet_content_size->additem("-2.5", "-4");
  1020. $blocklet_content_size->additem("-2.0", "-3");
  1021. $blocklet_content_size->additem("-1.5", "-2");
  1022. $blocklet_content_size->additem("-1.0", "-1");
  1023. $blocklet_content_size->additem("0", "default size");
  1024. $blocklet_content_size->additem("1.0", "+1");
  1025. $blocklet_content_size->additem("1.5", "+2");
  1026. $blocklet_content_size->additem("2.0", "+3");
  1027. $blocklet_content_size->additem("2.5", "+4");
  1028. $blocklet_content_size->additem("3.0", "+5");
  1029.  
  1030. // Content justificiation..
  1031. $blocklet_justify = new form_combofield("justify", "", $b->justify);
  1032. $maintainer->register_field($blocklet_justify);
  1033. $blocklet_justify->setclass("axcombo");
  1034. $blocklet_justify->setstyle("width:$cbowidth;");
  1035. $blocklet_justify->additem("", "Default");
  1036. $blocklet_justify->additem("left", "Left");
  1037. $blocklet_justify->additem("center", "Centre");
  1038. $blocklet_justify->additem("right", "Right");
  1039.  
  1040. // Content tablestyle..
  1041. $table_style = $tstylesCombo;
  1042. $maintainer->register_field($table_style);
  1043. $table_style->name = "table_style";
  1044. $table_style->setvalue($b->table_style);
  1045.  
  1046. $table_aj = new form_checkbox("table_autojustify");
  1047. $maintainer->register_field($table_aj);
  1048. $table_aj->setclass("axchkbox");
  1049. $table_aj->checked = $b->table_autojustify;
  1050.  
  1051. $table_rs = new form_checkbox("table_rowstripes");
  1052. $maintainer->register_field($table_rs);
  1053. $table_rs->setclass("axchkbox");
  1054. $table_rs->checked = $b->table_rowstripes;
  1055.  
  1056. $blocklet_style = new form_textfield("blocklet_style", "", $b->blocklet_style);
  1057. $maintainer->register_field($blocklet_style);
  1058. $blocklet_style->setclass("axtxtbox");
  1059. $blocklet_style->setstyle("width:$cbowidth");
  1060.  
  1061. $Tin1 = new table("content_props");
  1062. $Tin1->tr();
  1063. $Tin1->td("Text size adjust:");
  1064. $Tin1->td( $blocklet_content_size->render() );
  1065. $Tin1->td_alignment("right");
  1066. $Tin1->tr();
  1067. $Tin1->td("Text colour:");
  1068. $Tin1->td( $blocklet_content_colour->render() );
  1069. $Tin1->td_alignment("right");
  1070.  
  1071. $Tin2 = new table("content_align");
  1072. $Tin2->setwidth("");
  1073. $Tin2->tr();
  1074. $Tin2->td( "&nbsp;" );
  1075. $Tin2->td( $breset->render() );
  1076. $Tin2->td_alignment("right", "top");
  1077. $Tin2->tr();
  1078. $Tin2->td( "Alignment:" );
  1079. $Tin2->td( $blocklet_justify->render() );
  1080.  
  1081. $Ted->tr("axbgdark");
  1082. $Ted->td( $Tin1->render() );
  1083. $Ted->td( $Tin2->render() );
  1084. $Ted->td_alignment("right", "top");
  1085.  
  1086. // Blocklet style
  1087. $Tin1 = new table("bktstyle");
  1088. $Tin1->tr();
  1089. $Tin1->td( "CSS style:" );
  1090. $Tin1->td( $blocklet_style->render() );
  1091. $Tin1->td_alignment("right");
  1092.  
  1093. $Ted->tr("axbglite");
  1094. $Ted->td( $Tin1->render() );
  1095. $Ted->td( "" );
  1096.  
  1097. // Table options
  1098. $Tin1 = new table("tablestyle");
  1099. $Tin1->tr();
  1100. $Tin1->td( "Table Options:" );
  1101. $Tin1->td( $table_style->render() );
  1102. $Tin1->td_alignment("right");
  1103.  
  1104. $Tin2 = new table("tableopts");
  1105. $Tin2->tr();
  1106. $Tin2->td( "Auto-justify:&nbsp;" . $table_aj->render() );
  1107. $Tin2->td_alignment("right");
  1108. $Tin2->td( "Row-stripes:&nbsp;" . $table_rs->render() );
  1109. $Tin2->td_alignment("right");
  1110.  
  1111. $Ted->tr("axbgdark");
  1112. $Ted->td( $Tin1->render() );
  1113. $Ted->td( $Tin2->render() );
  1114. $Ted->td_alignment("right");
  1115.  
  1116. // CSV import
  1117. $uploader = new form_fileuploadfield("_csvimportdata");
  1118. $uploader->setclass("axtxtbox");
  1119.  
  1120. $importbtn = new form_imagebutton("_csvimport");
  1121. $importbtn->setimage("$LIBDIR/img/_import.gif", "Import CSV data now");
  1122.  
  1123. $Tin1 = new table("csvimporter");
  1124. $Tin1->tr();
  1125. $Tin1->td( "Table CSV:" );
  1126. $Tin1->td( $uploader->render() );
  1127. $Tin1->td( $importbtn->render() );
  1128. $Tin1->td_alignment("right");
  1129.  
  1130. $Ted->tr("axbglite");
  1131. $Ted->td( $Tin1->render() );
  1132. $Ted->td_colspan(2);
  1133.  
  1134. // ..................................................................
  1135. $Ted->tr("axhdg");
  1136. $Ted->td("<b>INSERT SPECIAL CONTENT</b>", "axhdg");
  1137. $Ted->td_colspan(2);
  1138.  
  1139. // ..................................................................
  1140. // Add Link
  1141. $pages = new form_combofield("link_sitepage");
  1142. $pages->setid("fspec");
  1143. $pages->set_onchange("linkpop(this,'" . $this->block->blockfm . "')");
  1144. $pages->setclass("axcombo");
  1145. $pages->setstyle("width:$cwidth;");
  1146. $pages->additem("");
  1147. $Qpage = dbrecordset("SELECT * FROM ax_sitepage WHERE enabled=TRUE ORDER BY page_title");
  1148. if ($Qpage->hasdata) {
  1149. do {
  1150. $pgpath = $Qpage->field("page_path");
  1151. $pgtitle = $Qpage->field("page_title");
  1152. $pages->additem($pgpath, $pgtitle);
  1153. } while ($Qpage->get_next());
  1154. }
  1155. $gen_addbtn->set_onclick("add_link('" . $this->block->blockfm . "')");
  1156. $remote = new form_checkbox("link_remote");
  1157. $remote->setclass("axchkbox");
  1158. $remote->setid("fspec");
  1159. $remote->check();
  1160. $gen_textfield = new form_textfield("add_link");
  1161. $gen_textfield->setid("fspec");
  1162. $gen_textfield->setclass("axtxtbox");
  1163. $gen_textfield->setstyle("width:$cwidth;");
  1164.  
  1165. $Tin = new table("add_link");
  1166. $Tin->tr();
  1167. $Tin->td("<b>Hyperlink:</b>");
  1168. $Tin->td( $gen_textfield->render("link_href") );
  1169. $Tin->td_alignment("right");
  1170. $Ted->tr("axbgdark");
  1171. $Ted->td( $Tin->render() );
  1172. $Ted->td( $gen_addbtn->render() );
  1173. $Ted->td_alignment("right");
  1174.  
  1175. $Tin1 = new table("add_link");
  1176. $Tin1->tr();
  1177. $Tin1->td("Link text:");
  1178. $Tin1->td( $gen_textfield->render("link_desc") );
  1179. $Tin1->td_alignment("right");
  1180.  
  1181. $Tin2 = new table("remote");
  1182. $Tin2->setwidth("");
  1183. $Tin2->tr();
  1184. $Tin2->td( "Remote site:" );
  1185. $Tin2->td( $remote->render() );
  1186.  
  1187. $Ted->tr("axbgdark");
  1188. $Ted->td( $Tin1->render() );
  1189. $Ted->td( $Tin2->render() );
  1190. $Ted->td_alignment("right");
  1191.  
  1192. $Tin = new table("add_page");
  1193. $Tin->tr();
  1194. $Tin->td("Webpage:");
  1195. $Tin->td( $pages->render() );
  1196. $Tin->td_alignment("right");
  1197. $Ted->tr("axbgdark");
  1198. $Ted->td( $Tin->render() );
  1199. $Ted->td("&nbsp;");
  1200.  
  1201. // ..................................................................
  1202. // Add image
  1203. $this->add_image_ui($Ted);
  1204.  
  1205. // ..................................................................
  1206. // Add document
  1207. $this->add_document_ui($Ted);
  1208.  
  1209. // ..................................................................
  1210. // Add multimedia
  1211. $this->add_media_ui($Ted);
  1212.  
  1213. // ..................................................................
  1214. // Add Datasource
  1215. $this->add_datasrc_ui($Ted);
  1216.  
  1217. // ..................................................................
  1218. // Render the whole form..
  1219. $Ted->tr("axfoot");
  1220. $Ted->td("", "axfoot");
  1221. $Ted->td_colspan(2);
  1222. $s .= $Ted->render();
  1223.  
  1224. // Render the maintainer. This adds the Javascript data structures
  1225. // and renders the hidden fields for submitting changed field data..
  1226. $s .= $maintainer->render();
  1227.  
  1228. // ....................................................................
  1229. debug_trace();
  1230. // Return the html..
  1231. return $s;
  1232. } // block_editform
  1233. // ....................................................................
  1234. /** Given a table object passed in (by reference), add to it the rows
  1235. * containing the Image Add form elements..
  1236. * @param object $Ted The table object to add the user interface to
  1237. * @access private
  1238. */
  1239. function add_image_ui(&$Ted) {
  1240. global $gen_addbtn;
  1241. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1242. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1243. global $colourCombo;
  1244. $imgs = new form_combofield("img_src");
  1245. $imgs->setid("fspec");
  1246. $imgs->setclass("axcombo");
  1247. $imgs->setstyle("width:$ewidth;");
  1248. $imgs->additem("");
  1249. $Qimg = dbrecordset("SELECT * FROM ax_catalog WHERE mime_category='image' ORDER BY upload_timestamp DESC");
  1250. if ($Qimg->hasdata) {
  1251. do {
  1252. $catid = $Qimg->field("cat_id");
  1253. $catname = $Qimg->field("cat_name");
  1254. // Names following ID tell the inserter the fields to get..
  1255. $imgs->additem("$catid|img_align|img_pad|img_border|img_bordercolor|img_width|img_height", $catname);
  1256. } while ($Qimg->get_next());
  1257. }
  1258. // Add this catalog item as an IMAGE tag..
  1259. $img_addbtn = $gen_addbtn;
  1260. $img_addbtn->name = "_add_img";
  1261. $img_addbtn->settitle("Add image to content");
  1262. switch ($this->block->block_type) {
  1263. case "w":
  1264. $img_addbtn->set_onclick("add_content('image','img_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1265. break;
  1266. default:
  1267. $img_addbtn->set_onclick("add_content('image','img_src','content','" . $this->block->blockfm . "')");
  1268. } // switch
  1269.  
  1270. $imgalign = new form_combofield("img_align");
  1271. $imgalign->setid("fspec");
  1272. $imgalign->setclass("axcombo");
  1273. $imgalign->setstyle("width:$cbowidth;");
  1274. $imgalign->additem("", "Default");
  1275. $imgalign->additem("left", "Left");
  1276. $imgalign->additem("right", "Right");
  1277. $imgalign->additem("top", "Top");
  1278. $imgalign->additem("middle", "Middle");
  1279. $imgalign->additem("bottom", "Bottom");
  1280. $imgalign->additem("abstop", "Top (abs)");
  1281. $imgalign->additem("absbottom", "Bottom (abs)");
  1282. $imgalign->additem("baseline", "Baseline");
  1283. $imgalign->additem("texttop", "Top (text)");
  1284.  
  1285. $imgbdr = new form_textfield("img_border", "", "0");
  1286. $imgbdr->setid("fspec");
  1287. $imgbdr->setclass("axtxtbox");
  1288. $imgbdr->setstyle("width:35px;text-align:center;");
  1289. $imgbdr->set_onblur("limitInt(this, 0, 99, 0)");
  1290.  
  1291. $imgpad = new form_textfield("img_pad", "", "2");
  1292. $imgpad->setid("fspec");
  1293. $imgpad->setclass("axtxtbox");
  1294. $imgpad->setstyle("width:35px;text-align:center;");
  1295. $imgpad->set_onblur("limitInt(this, 0, 199, 2)");
  1296.  
  1297. $imgwidth = new form_textfield("img_width");
  1298. $imgwidth->setid("fspec");
  1299. $imgwidth->setclass("axtxtbox");
  1300. $imgwidth->setstyle("width:35px;text-align:center;");
  1301. $imgwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1302.  
  1303. $imgheight = new form_textfield("img_height");
  1304. $imgheight->setid("fspec");
  1305. $imgheight->setclass("axtxtbox");
  1306. $imgheight->setstyle("width:35px;text-align:center;");
  1307. $imgheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1308.  
  1309. $Tin = new table("img_src");
  1310. $Tin->tr();
  1311. $Tin->td("<b>Image:</b>");
  1312. $Tin->td( $imgs->render() );
  1313. $Tin->td_alignment("right");
  1314. $Ted->tr("axbglite");
  1315. $Ted->td( $Tin->render() );
  1316. $Ted->td( $img_addbtn->render() );
  1317. $Ted->td_alignment("right");
  1318.  
  1319. $Tin1 = new table("img_align");
  1320. $Tin1->tr();
  1321. $Tin1->td("Border colour:");
  1322. $Tin1->td( $colourCombo->render("img_bordercolor") );
  1323. $Tin1->td_alignment("right");
  1324.  
  1325. $Tin2 = new table("img_pad");
  1326. $Tin2->setwidth("");
  1327. $Tin2->tr();
  1328. $Tin2->td( "Border:", "text-align:right;width:" . ceil($quartwidth/2) . "px");
  1329. $Tin2->td( $imgbdr->render() );
  1330. $Tin2->td( "&nbsp;&nbsp;Pad:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1331. $Tin2->td( $imgpad->render() );
  1332.  
  1333. $Ted->tr("axbglite");
  1334. $Ted->td( $Tin1->render() );
  1335. $Ted->td( $Tin2->render() );
  1336. $Ted->td_alignment("right");
  1337.  
  1338. $Tin1 = new table("img_display");
  1339. $Tin1->tr();
  1340. $Tin1->td("Align:");
  1341. $Tin1->td( $imgalign->render() );
  1342. $Tin1->td_alignment("right");
  1343.  
  1344. $Tin2 = new table("img_size");
  1345. $Tin2->setwidth("");
  1346. $Tin2->tr();
  1347. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1348. $Tin2->td( $imgwidth->render() );
  1349. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1350. $Tin2->td( $imgheight->render() );
  1351. $Ted->tr("axbglite");
  1352. $Ted->td( $Tin1->render() );
  1353. $Ted->td( $Tin2->render() );
  1354. $Ted->td_alignment("right");
  1355.  
  1356. } // add_image_ui
  1357. // ....................................................................
  1358. /** Given a table object passed in (by reference), add to it the rows
  1359. * containing the Document Add form elements..
  1360. * @param object $Ted The table object to add the user interface to
  1361. * @access private
  1362. */
  1363. function add_document_ui(&$Ted) {
  1364. global $gen_addbtn;
  1365. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1366. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1367. $docs = new form_combofield("doc_src");
  1368. $docs->setid("fspec");
  1369. $docs->setclass("axcombo");
  1370. $docs->setstyle("width:$ewidth;");
  1371. $docs->additem("");
  1372. $q = "SELECT * FROM ax_catalog";
  1373. $q .= " WHERE mime_category='document'";
  1374. $q .= " ORDER BY mime_type, upload_timestamp DESC";
  1375. $Qdoc = dbrecordset($q);
  1376. if ($Qdoc->hasdata) {
  1377. do {
  1378. $catid = $Qdoc->field("cat_id");
  1379. $catname = $Qdoc->field("cat_name");
  1380. $extn = get_file_extn($Qdoc->field("filepath"));
  1381. if ($extn != "") {
  1382. $catname .= " ($extn)";
  1383. }
  1384. // Names following ID tell the inserter the fields to get..
  1385. $docs->additem("$catid|doc_display|doc_width|doc_height", $catname);
  1386. } while ($Qdoc->get_next());
  1387. }
  1388. // Add this catalog item as a DOCUMENT tag..
  1389. $doc_addbtn = $gen_addbtn;
  1390. $doc_addbtn->name = "_add_doc";
  1391. $doc_addbtn->settitle("Add document to content");
  1392. switch ($this->block->block_type) {
  1393. case "w":
  1394. $doc_addbtn->set_onclick("add_content('document','doc_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1395. break;
  1396. default:
  1397. $doc_addbtn->set_onclick("add_content('document','doc_src','content','" . $this->block->blockfm . "')");
  1398. } // switch
  1399. $docdisplay = new form_combofield("doc_display");
  1400. $docdisplay->setid("fspec");
  1401. $docdisplay->setclass("axcombo");
  1402. $docdisplay->setstyle("width:$cbowidth;");
  1403. $docdisplay->additem("icon", "clickable icon");
  1404. $docdisplay->additem("link", "hyperlink");
  1405.  
  1406. $docwidth = new form_textfield("doc_width");
  1407. $docwidth->setid("fspec");
  1408. $docwidth->setclass("axtxtbox");
  1409. $docwidth->setstyle("width:35px;text-align:center;");
  1410. $docwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1411.  
  1412. $docheight = new form_textfield("doc_height");
  1413. $docheight->setid("fspec");
  1414. $docheight->setclass("axtxtbox");
  1415. $docheight->setstyle("width:35px;text-align:center;");
  1416. $docheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1417.  
  1418. $Tin = new table("doc_src");
  1419. $Tin->tr();
  1420. $Tin->td("<b>Document:</b>");
  1421. $Tin->td( $docs->render() );
  1422. $Tin->td_alignment("right");
  1423. $Ted->tr("axbgdark");
  1424. $Ted->td( $Tin->render() );
  1425. $Ted->td( $doc_addbtn->render() );
  1426. $Ted->td_alignment("right");
  1427.  
  1428. $Tin1 = new table("doc_display");
  1429. $Tin1->tr();
  1430. $Tin1->td("Display as:");
  1431. $Tin1->td( $docdisplay->render() );
  1432. $Tin1->td_alignment("right");
  1433.  
  1434. $Tin2 = new table("doc_size");
  1435. $Tin2->setwidth("");
  1436. $Tin2->tr();
  1437. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1438. $Tin2->td( $docwidth->render() );
  1439. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1440. $Tin2->td( $docheight->render() );
  1441. $Ted->tr("axbgdark");
  1442. $Ted->td( $Tin1->render() );
  1443. $Ted->td( $Tin2->render() );
  1444. $Ted->td_alignment("right");
  1445. } // add_document_ui
  1446. // ....................................................................
  1447. /** Given a table object passed in (by reference), add to it the rows
  1448. * containing the Media Add form elements..
  1449. * @param object $Ted The table object to add the user interface to
  1450. * @access private
  1451. */
  1452. function add_media_ui(&$Ted) {
  1453. global $gen_addbtn;
  1454. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1455. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1456. $MMs = new form_combofield("mm_src");
  1457. $MMs->setid("fspec");
  1458. $MMs->setclass("axcombo");
  1459. $MMs->setstyle("width:$ewidth;");
  1460. $MMs->additem("");
  1461. $q = "SELECT * FROM ax_catalog";
  1462. $q .= " WHERE mime_category='movie'";
  1463. $q .= " OR mime_category='audio'";
  1464. $q .= " OR mime_category='flash'";
  1465. $q .= " ORDER BY mime_category, mime_type, upload_timestamp DESC";
  1466. $QMM = dbrecordset($q);
  1467. if ($QMM->hasdata) {
  1468. do {
  1469. $catid = $QMM->field("cat_id");
  1470. $catname = $QMM->field("cat_name");
  1471. $extn = get_file_extn($QMM->field("filepath"));
  1472. if ($extn != "") {
  1473. $catname .= " ($extn)";
  1474. }
  1475. // Names following ID tell the inserter the fields to get..
  1476. $MMs->additem("$catid|mm_display|mm_width|mm_height|autostart|loop|showcontrols", $catname);
  1477. } while ($QMM->get_next());
  1478. }
  1479. // Add this catalog item as a MEDIA tag..
  1480. $mm_addbtn = $gen_addbtn;
  1481. $mm_addbtn->name = "_add_mm";
  1482. $mm_addbtn->settitle("Add media to content");
  1483. switch ($this->block->block_type) {
  1484. case "w":
  1485. $mm_addbtn->set_onclick("add_content('media','mm_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1486. break;
  1487. default:
  1488. $mm_addbtn->set_onclick("add_content('media','mm_src','content','" . $this->block->blockfm . "')");
  1489. } // switch
  1490.  
  1491. $MMdisplay = new form_combofield("mm_display");
  1492. $MMdisplay->setid("fspec");
  1493. $MMdisplay->setclass("axcombo");
  1494. $MMdisplay->setstyle("width:$cbowidth;");
  1495. $MMdisplay->additem("icon", "clickable icon");
  1496. $MMdisplay->additem("embedded", "embedded in page");
  1497. $MMdisplay->additem("link", "hyperlink");
  1498.  
  1499. $MMwidth = new form_textfield("mm_width");
  1500. $MMwidth->setid("fspec");
  1501. $MMwidth->setclass("axtxtbox");
  1502. $MMwidth->setstyle("width:35px;text-align:center;");
  1503. $MMwidth->set_onblur("limitInt(this, 0, 1999, 0)");
  1504.  
  1505. $MMheight = new form_textfield("mm_height");
  1506. $MMheight->setid("fspec");
  1507. $MMheight->setclass("axtxtbox");
  1508. $MMheight->setstyle("width:35px;text-align:center;");
  1509. $MMheight->set_onblur("limitInt(this, 0, 1999, 0)");
  1510.  
  1511. $MMautostart = new form_checkbox("autostart");
  1512. $MMautostart->setid("fspec");
  1513. $MMautostart->setclass("axchkbox");
  1514. $MMautostart->check();
  1515.  
  1516. $MMloop = new form_checkbox("loop");
  1517. $MMloop->setid("fspec");
  1518. $MMloop->setclass("axchkbox");
  1519.  
  1520. $MMcontrols = new form_checkbox("showcontrols");
  1521. $MMcontrols->setid("fspec");
  1522. $MMcontrols->setclass("axchkbox");
  1523. $MMcontrols->check();
  1524.  
  1525. $Tin = new table("mm_src");
  1526. $Tin->tr();
  1527. $Tin->td("<b>Media:</b>");
  1528. $Tin->td( $MMs->render() );
  1529. $Tin->td_alignment("right");
  1530. $Ted->tr("axbglite");
  1531. $Ted->td( $Tin->render() );
  1532. $Ted->td( $mm_addbtn->render() );
  1533. $Ted->td_alignment("right");
  1534.  
  1535. $Tin1 = new table("mm_display");
  1536. $Tin1->tr();
  1537. $Tin1->td("Display as:");
  1538. $Tin1->td( $MMdisplay->render() );
  1539. $Tin1->td_alignment("right");
  1540.  
  1541. $Tin2 = new table("mm_size");
  1542. $Tin2->setwidth("");
  1543. $Tin2->tr();
  1544. $Tin2->td( "Width:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1545. $Tin2->td( $MMwidth->render() );
  1546. $Tin2->td( "&nbsp;&nbsp;Height:", "text-align:right;width:" . ceil($quartwidth/2) . "px" );
  1547. $Tin2->td( $MMheight->render() );
  1548. $Ted->tr("axbglite");
  1549. $Ted->td( $Tin1->render() );
  1550. $Ted->td( $Tin2->render() );
  1551. $Ted->td_alignment("right");
  1552.  
  1553. $Tin = new table("mm_opts");
  1554. $Tin->tr();
  1555. $Tin->td("Autostart:&nbsp;" . $MMautostart->render());
  1556. $Tin->td_alignment("right");
  1557. $Tin->td("Loop:&nbsp;" . $MMloop->render());
  1558. $Tin->td_alignment("right");
  1559. $Tin->td("Controls:&nbsp;" . $MMcontrols->render());
  1560. $Tin->td_alignment("right");
  1561. $Ted->tr("axbglite");
  1562. $Ted->td( $Tin->render() );
  1563. $Ted->td( "&nbsp;" );
  1564. $Ted->td_alignment("right");
  1565. } // add_media_ui
  1566. // ....................................................................
  1567. /** Given a table object passed in (by reference), add to it the rows
  1568. * containing the Data Source Add form elements..
  1569. * @param object $Ted The table object to add the user interface to
  1570. * @access private
  1571. */
  1572. function add_datasrc_ui(&$Ted) {
  1573. global $gen_addbtn;
  1574. global $fullwidth, $halfwidth, $thirdwidth, $quartwidth, $threeqwidth;
  1575. global $awidth, $ewidth, $cwidth, $cbowidth, $bigwidth;
  1576. $datas = new form_combofield("data_src");
  1577. $datas->setid("fspec");
  1578. $datas->setclass("axcombo");
  1579. $datas->setstyle("width:$ewidth;");
  1580. $datas->additem("");
  1581. $Qdata = dbrecordset("SELECT * FROM ax_query_resource WHERE enabled=TRUE ORDER BY q_desc DESC");
  1582. if ($Qdata->hasdata) {
  1583. do {
  1584. $quid = $Qdata->field("quid");
  1585. $qdesc = $Qdata->field("q_desc");
  1586. $datas->additem("$quid|where|data_format|tableheadings", $qdesc);
  1587. } while ($Qdata->get_next());
  1588. }
  1589. // Add this catalog item as a DATA tag..
  1590. $dat_addbtn = $gen_addbtn;
  1591. $dat_addbtn->name = "_add_dat";
  1592. $dat_addbtn->settitle("Add data query to content");
  1593. switch ($this->block->block_type) {
  1594. case "w":
  1595. $dat_addbtn->set_onclick("add_content('data','data_src','wysiwyg_content','" . $this->block->blockfm . "')");
  1596. break;
  1597. default:
  1598. $dat_addbtn->set_onclick("add_content('data','data_src','content','" . $this->block->blockfm . "')");
  1599. } // switch
  1600.  
  1601. $datawhere = new form_textfield("where");
  1602. $datawhere->setid("fspec");
  1603. $datawhere->setclass("axtxtbox");
  1604. $datawhere->setstyle("width:$cwidth;");
  1605.  
  1606. global $gen_blocklettype;
  1607. $dataformat = $gen_blocklettype;
  1608. $dataformat->setvalue("text");
  1609.  
  1610. $tablehdgs = new form_checkbox("tableheadings");
  1611. $tablehdgs->setid("fspec");
  1612. $tablehdgs->setclass("axchkbox");
  1613.  
  1614. $Tin = new table("data_src");
  1615. $Tin->tr();
  1616. $Tin->td("<b>Database:</b>");
  1617. $Tin->td( $datas->render() );
  1618. $Tin->td_alignment("right");
  1619. $Ted->tr("axbgdark");
  1620. $Ted->td( $Tin->render() );
  1621. $Ted->td( $dat_addbtn->render() );
  1622. $Ted->td_alignment("right");
  1623.  
  1624. $Tin = new table("where");
  1625. $Tin->tr();
  1626. $Tin->td("Where:");
  1627. $Tin->td( $datawhere->render() );
  1628. $Tin->td_alignment("right");
  1629. $Ted->tr("axbgdark");
  1630. $Ted->td( $Tin->render() );
  1631. $Ted->td( "&nbsp;" );
  1632.  
  1633. $Tin1 = new table("data_format");
  1634. $Tin1->tr();
  1635. $Tin1->td("Format:");
  1636. $Tin1->td( $dataformat->render("data_format") );
  1637. $Tin1->td_alignment("right");
  1638.  
  1639. $Tin2 = new table("thdgs");
  1640. $Tin2->setwidth("");
  1641. $Tin2->tr();
  1642. $Tin2->td( "Table headings:" );
  1643. $Tin2->td( $tablehdgs->render() );
  1644.  
  1645. $Ted->tr("axbgdark");
  1646. $Ted->td( $Tin1->render() );
  1647. $Ted->td( $Tin2->render() );
  1648. $Ted->td_alignment("right");;
  1649. } // add_datasrc_ui
  1650.  
  1651. } // blockeditor class
  1652. // ----------------------------------------------------------------------
  1653.  
  1654. ?>

Documentation generated by phpDocumentor 1.3.0RC3