Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
messaging_service_config.inc
1 <?php
18 require_once SQ_LIB_PATH.'/config/config.inc';
19 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
20 
33 {
34 
39  var $config_vars = Array(
40  'SQ_MS_LOG_TO_FILE_WHITE_LIST' => Array('editable' => 1, 'default' => '*'),
41  'SQ_MS_LOG_TO_FILE_BLACK_LIST' => Array('editable' => 1, 'default' => "asset.attributes\nasset.workflow.invitation\nasset.workflow.announce\nasset.workflow.invitation.*\nasset.workflow.announce.*"),
42  'SQ_MS_LOG_TO_DB_WHITE_LIST' => Array('editable' => 1, 'default' => '*'),
43  'SQ_MS_LOG_TO_DB_BLACK_LIST' => Array('editable' => 1, 'default' => "asset.attributes.fulllog\nasset.workflow.invitation\nasset.workflow.announce\nasset.workflow.invitation.*\nasset.workflow.announce.*\ninstall.*"),
44  'SQ_MS_SEND_MAIL_WHITE_LIST' => Array('editable' => 1, 'default' => "asset.locking.forced\nconfig.*\nhipo.*\ninbox.*\nasset.status.notify\nasset.workflow.invitation\nasset.workflow.announce\nasset.workflow.invitation.*\nasset.workflow.announce.*\nasset.workflow.stale\nasset.workflow.bundle.*\ncron.deadlock"),
45  'SQ_MS_SEND_MAIL_BLACK_LIST' => Array('editable' => 1, 'default' => ''),
46  );
47 
48 
53  function __construct()
54  {
55  parent::__construct();
56  $this->config_file = SQ_DATA_PATH.'/private/conf/messaging_service.inc';
57 
58  }//end constructor
59 
60 
73  function paintBackend(&$o)
74  {
75  parent::paintBackend($o);
76 
77  $write_access = $this->writeAccess();
78  $class = get_class_lower($this);
79 
80  require_once SQ_ATTRIBUTES_PATH.'/option_list/option_list.inc';
81 
82  $option_list = new Asset_Attribute_Option_List(0, NULL, SQ_OPTION_LIST_DELIMITER_UNIX);
83  $option_list->setEditParam('width', 60);
84 
85  $o->openSection(translate('messaging_service_configuration'));
86  $o->openField(translate('messaging_service_file_white_list'));
87  if ($write_access) {
88  $option_list->value = SQ_MS_LOG_TO_FILE_WHITE_LIST;
89  $option_list->paint('SQ_MS_LOG_TO_FILE_WHITE_LIST');
90  } else {
91  echo nl2br(SQ_MS_LOG_TO_FILE_WHITE_LIST);
92  }
93  $o->note(translate('messaging_service_file_white_list_note'));
94  $o->closeField();
95  $o->openField(translate('messaging_service_file_black_list'));
96  if ($write_access) {
97  $option_list->value = SQ_MS_LOG_TO_FILE_BLACK_LIST;
98  $option_list->paint('SQ_MS_LOG_TO_FILE_BLACK_LIST');
99  } else {
100  echo nl2br(SQ_MS_LOG_TO_FILE_BLACK_LIST);
101  }
102  $o->note(translate('messaging_service_file_black_list_note'));
103  $o->closeField();
104  $o->openField(translate('messaging_service_db_white_list'));
105  if ($write_access) {
106  $option_list->value = SQ_MS_LOG_TO_DB_WHITE_LIST;
107  $option_list->paint('SQ_MS_LOG_TO_DB_WHITE_LIST');
108  } else {
109  echo nl2br(SQ_MS_LOG_TO_DB_WHITE_LIST);
110  }
111  $o->note(translate('messaging_service_db_white_list_note'));
112  $o->closeField();
113  $o->openField(translate('messaging_service_db_black_list'));
114  if ($write_access) {
115  $option_list->value = SQ_MS_LOG_TO_DB_BLACK_LIST;
116  $option_list->paint('SQ_MS_LOG_TO_DB_BLACK_LIST');
117  } else {
118  echo nl2br(SQ_MS_LOG_TO_DB_BLACK_LIST);
119  }
120  $o->note(translate('messaging_service_db_black_list_note'));
121  $o->closeField();
122  $o->openField(translate('messaging_service_mail_white_list'));
123  if ($write_access) {
124  $option_list->value = SQ_MS_SEND_MAIL_WHITE_LIST;
125  $option_list->paint('SQ_MS_SEND_MAIL_WHITE_LIST');
126  } else {
127  echo nl2br(SQ_MS_SEND_MAIL_WHITE_LIST);
128  }
129  $o->note(translate('messaging_service_mail_white_list_note'));
130  $o->closeField();
131  $o->openField(translate('messaging_service_mail_black_list'));
132  if ($write_access) {
133  $option_list->value = SQ_MS_SEND_MAIL_BLACK_LIST;
134  $option_list->paint('SQ_MS_SEND_MAIL_BLACK_LIST');
135  } else {
136  echo nl2br(SQ_MS_SEND_MAIL_BLACK_LIST);
137  }
138  $o->note(translate('messaging_service_mail_black_list_note'));
139  $o->closeField();
140  $o->closeSection();
141 
142  if ($write_access) $o->commitButton('', TRUE);
143 
144  }//end paintBackend()
145 
146 
156  function processBackend(&$o)
157  {
158  $write_access = $this->writeAccess();
159  if (!$write_access) return parent::processBackend($o);
160 
161  $class = get_class_lower($this);
162 
163  require_once SQ_ATTRIBUTES_PATH.'/option_list/option_list.inc';
164  $option_list = new Asset_Attribute_Option_List(0, NULL, SQ_OPTION_LIST_DELIMITER_UNIX);
165 
166  // We assume namining of these constants, and that they always have white/black lists.
167  $message_types = Array(
168  'LOG_TO_FILE',
169  'LOG_TO_DB',
170  'SEND_MAIL',
171  );
172 
173  foreach ($message_types as $message_type) {
174  // Names for both white and black list for this message type.
175  $w = 'SQ_MS_'.$message_type.'_WHITE_LIST';
176  $b = 'SQ_MS_'.$message_type.'_BLACK_LIST';
177 
178  // Process attribute. Value is string seperated by newlines (\n).
179  $option_list->process($w);
180  $_POST[$class][$w] = $option_list->value;
181 
182  $option_list->process($b);
183  $_POST[$class][$b] = $option_list->value;
184  }
185  return parent::processBackend($o);
186 
187  }//end processBackend()
188 
189 
190 }//end class
191 
192 ?>