A Qcodo based CMS/ecommerce framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
4.0 KiB

13 years ago
  1. <?php
  2. /**
  3. * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
  4. * of the HtmlMetaTag class. It uses the code-generated
  5. * HtmlMetaTagMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a HtmlMetaTag columns.
  7. *
  8. * Any display customizations and presentation-tier logic can be implemented
  9. * here by overriding existing or implementing new methods, properties and variables.
  10. *
  11. * NOTE: This file is overwritten on any code regenerations. If you want to make
  12. * permanent changes, it is STRONGLY RECOMMENDED to move both html_meta_tag_edit.php AND
  13. * html_meta_tag_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quasi
  16. * @subpackage Drafts
  17. */
  18. class HtmlMetaTagEditPanel extends QPanel {
  19. // Local instance of the HtmlMetaTagMetaControl
  20. protected $mctHtmlMetaTag;
  21. // Controls for HtmlMetaTag's Data Fields
  22. public $lblId;
  23. public $txtName;
  24. public $txtContent;
  25. public $txtType;
  26. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  27. public $lstPages;
  28. // Other Controls
  29. public $btnSave;
  30. public $btnDelete;
  31. public $btnCancel;
  32. // Callback
  33. protected $strClosePanelMethod;
  34. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  35. // Call the Parent
  36. try {
  37. parent::__construct($objParentObject, $strControlId);
  38. } catch (QCallerException $objExc) {
  39. $objExc->IncrementOffset();
  40. throw $objExc;
  41. }
  42. // Setup Callback and Template
  43. $this->strTemplate = 'HtmlMetaTagEditPanel.tpl.php';
  44. $this->strClosePanelMethod = $strClosePanelMethod;
  45. // Construct the HtmlMetaTagMetaControl
  46. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  47. $this->mctHtmlMetaTag = HtmlMetaTagMetaControl::Create($this, $intId);
  48. // Call MetaControl's methods to create qcontrols based on HtmlMetaTag's data fields
  49. $this->lblId = $this->mctHtmlMetaTag->lblId_Create();
  50. $this->txtName = $this->mctHtmlMetaTag->txtName_Create();
  51. $this->txtContent = $this->mctHtmlMetaTag->txtContent_Create();
  52. $this->txtType = $this->mctHtmlMetaTag->txtType_Create();
  53. $this->lstPages = $this->mctHtmlMetaTag->lstPages_Create();
  54. // Create Buttons and Actions on this Form
  55. $this->btnSave = new QButton($this);
  56. $this->btnSave->Text = QApplication::Translate('Save');
  57. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  58. $this->btnSave->CausesValidation = $this;
  59. $this->btnCancel = new QButton($this);
  60. $this->btnCancel->Text = QApplication::Translate('Cancel');
  61. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  62. $this->btnDelete = new QButton($this);
  63. $this->btnDelete->Text = QApplication::Translate('Delete');
  64. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('HtmlMetaTag') . '?'));
  65. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  66. $this->btnDelete->Visible = $this->mctHtmlMetaTag->EditMode;
  67. }
  68. // Control AjaxAction Event Handlers
  69. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  70. // Delegate "Save" processing to the HtmlMetaTagMetaControl
  71. $this->mctHtmlMetaTag->SaveHtmlMetaTag();
  72. $this->CloseSelf(true);
  73. }
  74. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  75. // Delegate "Delete" processing to the HtmlMetaTagMetaControl
  76. $this->mctHtmlMetaTag->DeleteHtmlMetaTag();
  77. $this->CloseSelf(true);
  78. }
  79. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  80. $this->CloseSelf(false);
  81. }
  82. // Close Myself and Call ClosePanelMethod Callback
  83. protected function CloseSelf($blnChangesMade) {
  84. $strMethod = $this->strClosePanelMethod;
  85. $this->objForm->$strMethod($blnChangesMade);
  86. }
  87. }
  88. ?>