install.sql 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. SET @sName = 'bx_massmailer';
  2. -- TABLES
  3. CREATE TABLE `bx_massmailer_campaigns` (
  4. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  5. `title` varchar(255) DEFAULT NULL,
  6. `subject` varchar(255) DEFAULT NULL,
  7. `from_name` varchar(255) DEFAULT NULL,
  8. `reply_to` varchar(255) DEFAULT NULL,
  9. `body` text DEFAULT NULL,
  10. `segments` varchar(255) DEFAULT NULL,
  11. `author` int(11) NOT NULL,
  12. `added` int(11) NOT NULL default '0',
  13. `changed` int(11) NOT NULL default '0',
  14. `date_sent` int(11) NOT NULL default '0',
  15. `email_list` text DEFAULT NULL,
  16. PRIMARY KEY (`id`)
  17. );
  18. CREATE TABLE `bx_massmailer_segments` (
  19. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  20. `title` varchar(255) DEFAULT NULL,
  21. `info` text DEFAULT NULL,
  22. `email_list` text DEFAULT NULL,
  23. PRIMARY KEY (`id`)
  24. );
  25. CREATE TABLE `bx_massmailer_letters` (
  26. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  27. `campaign_id` int(11) NOT NULL,
  28. `email` varchar(255) NOT NULL,
  29. `date_sent` int(11) NOT NULL default '0',
  30. `date_seen` int(11) NOT NULL default '0',
  31. `date_click` int(11) NOT NULL default '0',
  32. `hash` varchar(35) NOT NULL,
  33. PRIMARY KEY (`id`)
  34. );
  35. CREATE TABLE `bx_massmailer_links` (
  36. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  37. `letter_hash` varchar(35) DEFAULT NULL,
  38. `hash` varchar(35) DEFAULT NULL,
  39. `link` varchar(255) DEFAULT NULL,
  40. `title` varchar(255) DEFAULT NULL,
  41. `campaign_id` int(11) DEFAULT NULL,
  42. `date_click` int(11) NOT NULL default '0',
  43. PRIMARY KEY (`id`)
  44. );
  45. CREATE TABLE `bx_massmailer_unsubscribe` (
  46. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  47. `account_id` int(11) DEFAULT NULL,
  48. `unsubscribed` int(11) NOT NULL default '0',
  49. PRIMARY KEY (`id`)
  50. );
  51. -- STUDIO: page & widget
  52. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  53. (3, @sName, '_bx_massmailer', '_bx_massmailer', 'bx_massmailer@modules/boonex/massmailer/|std-icon.svg');
  54. SET @iPageId = LAST_INSERT_ID();
  55. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`, `bookmark`)
  56. VALUES(@iPageId, @sName, '{url_studio}module.php?name=bx_massmailer', '', 'bx_massmailer@modules/boonex/massmailer/|std-icon.svg', '_bx_massmailer', '', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:11:"get_actions";s:6:"params";a:0:{}s:5:"class";s:18:"TemplStudioModules";}', 0);
  57. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  58. SET @iParentPageOrder = (SELECT IFNULL(MAX(`order`), 0) + 1 FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  59. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  60. (@iParentPageId, LAST_INSERT_ID(), @iParentPageOrder);
  61. -- FORMS
  62. INSERT INTO `sys_objects_form` (`object`, `module`, `title`, `action`, `form_attrs`, `submit_name`, `table`, `key`, `uri`, `uri_title`, `params`, `deletable`, `active`, `override_class_name`, `override_class_file`)
  63. VALUES(@sName, @sName, '_bx_massmailer_form_campaign', '', 'a:1:{s:7:"enctype";s:19:"multipart/form-data";}', 'a:2:{i:0;s:9:"do_submit";i:1;s:7:"do_send";}', 'bx_massmailer_campaigns', 'id', '', '', 'a:1:{s:14:"checker_helper";s:29:"BxMassMailerFormCheckerHelper";}', 0, 1, 'BxMassMailerFormEntry', 'modules/boonex/massmailer/classes/BxMassMailerFormEntry.php');
  64. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  65. ('bx_massmailer_campaign_add', @sName, @sName, '_bx_massmailer_form_campaign_add_display', 0),
  66. ('bx_massmailer_campaign_edit', @sName, @sName, '_bx_massmailer_form_campaign_edit_display', 0),
  67. ('bx_massmailer_campaign_send_test', @sName, @sName, '_bx_massmailer_form_campaign_send_test_display', 0),
  68. ('bx_massmailer_campaign_send_all', @sName, @sName, '_bx_massmailer_form_campaign_send_all_display', 0);
  69. INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `checked`, `type`, `caption_system`, `caption`, `info`, `required`, `unique`, `collapsed`, `html`, `attrs`, `attrs_tr`, `attrs_wrapper`, `checker_func`, `checker_params`, `checker_error`, `db_pass`, `db_params`, `editable`, `deletable`) VALUES
  70. (@sName, @sName, 'do_submit', '_bx_massmailer_form_entry_input_do_submit', '', 0, 'submit', '_bx_massmailer_form_entry_input_sys_do_submit', '', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  71. (@sName, @sName, 'do_send', '_bx_massmailer_form_entry_input_do_send', '', 0, 'submit', '_bx_massmailer_form_entry_input_sys_do_send', '', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  72. (@sName, @sName, 'title', '', '', 0, 'text', '_bx_massmailer_form_campaign_input_sys_title', '_bx_massmailer_form_campaign_input_title', '', 1, 0, 0, 2, '', '', '', 'Avail', '', '_bx_massmailer_form_campaign_input_title_err', 'XssHtml', '', 1, 0),
  73. (@sName, @sName, 'segments', '', '', 0, 'select', '_bx_massmailer_form_campaign_input_sys_segments', '_bx_massmailer_form_campaign_input_segments', '', 1, 0, 0, 2, '', '', '', 'Avail', '', '_bx_massmailer_form_campaign_input_segments_err', 'XssHtml', '', 1, 0),
  74. (@sName, @sName, 'subject', '', '', 0, 'text', '_bx_massmailer_form_campaign_input_sys_subject', '_bx_massmailer_form_campaign_input_subject', '', 1, 0, 0, 2, '', '', '', 'Avail', '', '_bx_massmailer_form_campaign_input_subject_err', 'XssHtml', '', 1, 0),
  75. (@sName, @sName, 'from_name', '', '', 0, 'text', '_bx_massmailer_form_campaign_input_sys_from_name', '_bx_massmailer_form_campaign_input_from_name', '_bx_massmailer_form_campaign_input_from_name_info', 1, 0, 0, 2, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
  76. (@sName, @sName, 'reply_to', '', '', 0, 'text', '_bx_massmailer_form_campaign_input_sys_reply_to', '_bx_massmailer_form_campaign_input_reply_to', '_bx_massmailer_form_campaign_input_reply_to_info', 1, 0, 0, 2, '', '', '', 'EmailOrEmpty', '', '_bx_massmailer_form_campaign_input_reply_to_err', 'XssHtml', '', 1, 0),
  77. (@sName, @sName, 'body', '', '', 0, 'textarea', '_bx_massmailer_form_campaign_input_sys_body', '_bx_massmailer_form_campaign_input_body', '', 1, 0, 0, 2, '', '', '', 'Avail', '', '_bx_massmailer_form_campaign_input_body_err', 'XssHtml', '', 1, 0),
  78. (@sName, @sName, 'email', '', '', 0, 'text', '_bx_massmailer_form_campaign_input_sys_test_email', '_bx_massmailer_form_campaign_input_email', '', 1, 0, 0, 2, '', '', '', 'Email', '', '_sys_form_account_input_email_error', 'XssHtml', '', 1, 0),
  79. (@sName, @sName, 'campaign_info', '_bx_massmailer_form_campaign_input_from_name_info_value', '', 0, 'value', '_bx_massmailer_form_campaign_input_sys_campaign_info', '', '', 0, 0, 0, 2, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
  80. (@sName, @sName, 'cancel', '_bx_massmailer_form_entry_input_cancel', '', 0, 'button', '_bx_dev_bp_btn_sys_block_cancel', '', '', 0, 0, 0, 0, 'a:2:{s:7:"onclick";s:45:"$(''.bx-popup-applied:visible'').dolPopupHide()";s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', 'Avail', '', '', '', '', 0, 0),
  81. (@sName, @sName, 'controls', '', 'do_submit,cancel', 0, 'input_set', '', '', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
  82. (@sName, @sName, 'controls2', '', 'do_send,cancel', 0, 'input_set', '', '', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  83. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  84. ('bx_massmailer_campaign_add', 'title', 2147483647, 1, 1),
  85. ('bx_massmailer_campaign_add', 'segments', 2147483647, 1, 2),
  86. ('bx_massmailer_campaign_add', 'subject', 2147483647, 1, 3),
  87. ('bx_massmailer_campaign_add', 'from_name', 2147483647, 1, 4),
  88. ('bx_massmailer_campaign_add', 'reply_to', 2147483647, 1, 5),
  89. ('bx_massmailer_campaign_add', 'body', 2147483647, 1, 6),
  90. ('bx_massmailer_campaign_add', 'controls', 2147483647, 1, 7),
  91. ('bx_massmailer_campaign_add', 'do_submit', 2147483647, 1, 8),
  92. ('bx_massmailer_campaign_add', 'cancel', 2147483647, 1, 9),
  93. ('bx_massmailer_campaign_edit', 'title', 2147483647, 1, 1),
  94. ('bx_massmailer_campaign_edit', 'segments', 2147483647, 1, 2),
  95. ('bx_massmailer_campaign_edit', 'subject', 2147483647, 1, 3),
  96. ('bx_massmailer_campaign_edit', 'from_name', 2147483647, 1, 4),
  97. ('bx_massmailer_campaign_edit', 'reply_to', 2147483647, 1, 5),
  98. ('bx_massmailer_campaign_edit', 'body', 2147483647, 1, 6),
  99. ('bx_massmailer_campaign_edit', 'controls', 2147483647, 1, 7),
  100. ('bx_massmailer_campaign_edit', 'do_submit', 2147483647, 1, 8),
  101. ('bx_massmailer_campaign_edit', 'cancel', 2147483647, 1, 9),
  102. ('bx_massmailer_campaign_send_test', 'email', 2147483647, 1, 1),
  103. ('bx_massmailer_campaign_send_test', 'controls2', 2147483647, 1, 2),
  104. ('bx_massmailer_campaign_send_test', 'do_send', 2147483647, 1, 3),
  105. ('bx_massmailer_campaign_send_test', 'cancel', 2147483647, 1, 4),
  106. ('bx_massmailer_campaign_send_all', 'campaign_info', 2147483647, 1, 1),
  107. ('bx_massmailer_campaign_send_all', 'controls2', 2147483647, 1, 2),
  108. ('bx_massmailer_campaign_send_all', 'do_send', 2147483647, 1, 3),
  109. ('bx_massmailer_campaign_send_all', 'cancel', 2147483647, 1, 4);