1
0

install.sql 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. `is_one_per_account` smallint(1) NOT NULL,
  17. `is_track_links` smallint(1) NOT NULL,
  18. PRIMARY KEY (`id`),
  19. FULLTEXT KEY `title_text` (`title`, `subject`)
  20. );
  21. CREATE TABLE `bx_massmailer_segments` (
  22. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  23. `title` varchar(255) DEFAULT NULL,
  24. `info` text DEFAULT NULL,
  25. `email_list` text DEFAULT NULL,
  26. PRIMARY KEY (`id`)
  27. );
  28. CREATE TABLE `bx_massmailer_letters` (
  29. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  30. `campaign_id` int(11) NOT NULL,
  31. `email` varchar(255) NOT NULL,
  32. `date_sent` int(11) NOT NULL default '0',
  33. `date_seen` int(11) NOT NULL default '0',
  34. `date_click` int(11) NOT NULL default '0',
  35. `hash` varchar(35) NOT NULL,
  36. PRIMARY KEY (`id`),
  37. INDEX `campaign_id` (`campaign_id`),
  38. INDEX `hash` (`hash`)
  39. );
  40. CREATE TABLE `bx_massmailer_links` (
  41. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  42. `letter_hash` varchar(35) DEFAULT NULL,
  43. `hash` varchar(35) DEFAULT NULL,
  44. `link` varchar(255) DEFAULT NULL,
  45. `title` varchar(255) DEFAULT NULL,
  46. `campaign_id` int(11) DEFAULT NULL,
  47. `date_click` int(11) NOT NULL default '0',
  48. PRIMARY KEY (`id`),
  49. INDEX `campaign_id` (`campaign_id`),
  50. INDEX `hash` (`hash`),
  51. INDEX `letter_hash` (`letter_hash`)
  52. );
  53. CREATE TABLE `bx_massmailer_unsubscribe` (
  54. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  55. `account_id` int(11) DEFAULT NULL,
  56. `campaign_id` int(11) DEFAULT NULL,
  57. `unsubscribed` int(11) NOT NULL default '0',
  58. PRIMARY KEY (`id`),
  59. INDEX `campaign_id` (`campaign_id`)
  60. );
  61. -- STUDIO: page & widget
  62. INSERT INTO `sys_std_pages`(`index`, `name`, `header`, `caption`, `icon`) VALUES
  63. (3, @sName, '_bx_massmailer', '_bx_massmailer', 'bx_massmailer@modules/boonex/massmailer/|std-icon.svg');
  64. SET @iPageId = LAST_INSERT_ID();
  65. INSERT INTO `sys_std_widgets` (`page_id`, `module`, `type`, `url`, `click`, `icon`, `caption`, `cnt_notices`, `cnt_actions`, `featured`)
  66. VALUES(@iPageId, @sName, 'extensions', '{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);
  67. SET @iParentPageId = (SELECT `id` FROM `sys_std_pages` WHERE `name` = 'home');
  68. SET @iParentPageOrder = (SELECT IFNULL(MAX(`order`), 0) + 1 FROM `sys_std_pages_widgets` WHERE `page_id` = @iParentPageId);
  69. INSERT INTO `sys_std_pages_widgets` (`page_id`, `widget_id`, `order`) VALUES
  70. (@iParentPageId, LAST_INSERT_ID(), @iParentPageOrder);
  71. -- FORMS
  72. 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`)
  73. 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');
  74. INSERT INTO `sys_form_displays` (`display_name`, `module`, `object`, `title`, `view_mode`) VALUES
  75. ('bx_massmailer_campaign_add', @sName, @sName, '_bx_massmailer_form_campaign_add_display', 0),
  76. ('bx_massmailer_campaign_edit', @sName, @sName, '_bx_massmailer_form_campaign_edit_display', 0),
  77. ('bx_massmailer_campaign_send_test', @sName, @sName, '_bx_massmailer_form_campaign_send_test_display', 0),
  78. ('bx_massmailer_campaign_send_all', @sName, @sName, '_bx_massmailer_form_campaign_send_all_display', 0);
  79. 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
  80. (@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),
  81. (@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),
  82. (@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),
  83. (@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),
  84. (@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),
  85. (@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', 0, 0, 0, 2, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
  86. (@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', 0, 0, 0, 2, '', '', '', 'EmailOrEmpty', '', '_bx_massmailer_form_campaign_input_reply_to_err', 'XssHtml', '', 1, 0),
  87. (@sName, @sName, 'body', '', '', 0, 'textarea', '_bx_massmailer_form_campaign_input_sys_body', '_bx_massmailer_form_campaign_input_body', '', 1, 0, 0, 2, '', '', '', 'UnsubscribeUrl', '', '_bx_massmailer_form_campaign_input_body_err', 'XssHtml', '', 1, 0),
  88. (@sName, @sName, 'body_info', '', '', 0, 'custom', '_bx_massmailer_form_campaign_input_sys_body_info', '_bx_massmailer_form_campaign_input_body_info', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
  89. (@sName, @sName, 'is_one_per_account', '1', '', 1, 'switcher', '_bx_massmailer_form_campaign_input_sys_is_one_per_account', '_bx_massmailer_form_campaign_input_is_one_per_account', '', 0, 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  90. (@sName, @sName, 'is_track_links', '1', '', 1, 'switcher', '_bx_massmailer_form_campaign_input_sys_is_track_links', '_bx_massmailer_form_campaign_input_is_track_links', '', 0, 0, 0, 0, '', '', '', '', '', '', 'Int', '', 1, 0),
  91. (@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),
  92. (@sName, @sName, 'campaign_info', '_bx_massmailer_form_campaign_input_from_name_info_value', '', 0, 'value', '_bx_massmailer_form_campaign_input_sys_campaign_info', '_bx_massmailer_form_campaign_input_campaign_info', '', 0, 0, 0, 2, '', '', '', '', '', '', 'XssHtml', '', 1, 0),
  93. (@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),
  94. (@sName, @sName, 'controls', '', 'do_send,cancel', 0, 'input_set', '', '', '', 0, 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0);
  95. INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_for_levels`, `active`, `order`) VALUES
  96. ('bx_massmailer_campaign_add', 'title', 2147483647, 1, 1),
  97. ('bx_massmailer_campaign_add', 'segments', 2147483647, 1, 2),
  98. ('bx_massmailer_campaign_add', 'subject', 2147483647, 1, 3),
  99. ('bx_massmailer_campaign_add', 'from_name', 2147483647, 1, 4),
  100. ('bx_massmailer_campaign_add', 'reply_to', 2147483647, 1, 5),
  101. ('bx_massmailer_campaign_add', 'body', 2147483647, 1, 6),
  102. ('bx_massmailer_campaign_add', 'body_info', 2147483647, 1, 7),
  103. ('bx_massmailer_campaign_add', 'is_one_per_account', 2147483647, 1, 8),
  104. ('bx_massmailer_campaign_add', 'is_track_links', 2147483647, 1, 9),
  105. ('bx_massmailer_campaign_add', 'do_submit', 2147483647, 1, 10),
  106. ('bx_massmailer_campaign_edit', 'title', 2147483647, 1, 1),
  107. ('bx_massmailer_campaign_edit', 'segments', 2147483647, 1, 2),
  108. ('bx_massmailer_campaign_edit', 'subject', 2147483647, 1, 3),
  109. ('bx_massmailer_campaign_edit', 'from_name', 2147483647, 1, 4),
  110. ('bx_massmailer_campaign_edit', 'reply_to', 2147483647, 1, 5),
  111. ('bx_massmailer_campaign_edit', 'body', 2147483647, 1, 6),
  112. ('bx_massmailer_campaign_edit', 'body_info', 2147483647, 1, 7),
  113. ('bx_massmailer_campaign_edit', 'is_one_per_account', 2147483647, 1, 8),
  114. ('bx_massmailer_campaign_edit', 'is_track_links', 2147483647, 1, 9),
  115. ('bx_massmailer_campaign_edit', 'do_submit', 2147483647, 1, 10),
  116. ('bx_massmailer_campaign_send_test', 'email', 2147483647, 1, 1),
  117. ('bx_massmailer_campaign_send_test', 'controls', 2147483647, 1, 2),
  118. ('bx_massmailer_campaign_send_test', 'do_send', 2147483647, 1, 3),
  119. ('bx_massmailer_campaign_send_test', 'cancel', 2147483647, 1, 4),
  120. ('bx_massmailer_campaign_send_all', 'campaign_info', 2147483647, 1, 1),
  121. ('bx_massmailer_campaign_send_all', 'controls', 2147483647, 1, 2),
  122. ('bx_massmailer_campaign_send_all', 'do_send', 2147483647, 1, 3),
  123. ('bx_massmailer_campaign_send_all', 'cancel', 2147483647, 1, 4);