43 function form(&$form, &$form_state, $list) {
44 $type = $form_state[
'build_info'][
'args'][2];
46 $msgid = $form_state[
'build_info'][
'args'][3];
47 $sort = $form_state[
'build_info'][
'args'][4];
59 $dates = $form_state[
'build_info'][
'args'][$off+3];
61 $start_date =
'1980-00-00 00:00:00';
62 $end_date =
'2030-12-31 23:59:59';
65 $pos = strpos($dates,
'-');
67 $pos = strlen($dates);
70 $start_date = $this->
decodeDate(substr($dates, 0, $pos));
73 $start_date =
'1980-00-00 00:00:00';
75 if($pos < strlen($dates) -1 ) {
76 $end_date = $this->
decodeDate(substr($dates, $pos+1));
79 $end_date =
'2030-12-31 23:59:59';
86 $page = $form_state[
'build_info'][
'args'][$off+4];
88 $tablename =
'mailinglist_archives__' . $list->admin_name;
90 $base = variable_get(
'mailinglist_base',
'mailinglist');
94 $pre =
"$base/{$list->admin_name}/archive/";
97 $post .=
'/' . $dates;
100 $form[
'#theme'] =
'mailinglist_archive_form';
103 $form[
'nav'] = array(
104 '#theme' =>
'mailinglist_archive_form_header',
108 '#title' =>
'Sort Order:',
110 '#default_value' => $sort,
112 'author' =>
'Author ',
115 'subject' =>
'Subject ',
116 'thread' =>
'Threads ',
119 'start-wrap' => array(
120 '#type' =>
'container',
121 '#attributes' => array(
'style' => array(
'float: left')),
124 '#type' =>
'textfield',
126 '#title' => t(
'Start Date'),
127 '#default_value' => date(
'Y-m-d H:i:s', $start_ts),
129 '#description' => t(
'The beginning of the period to use'),
133 '#type' =>
'container',
134 '#attributes' => array(
'style' => array(
'float: left')),
137 '#type' =>
'textfield',
139 '#title' => t(
'End Date'),
140 '#default_value' => date(
'Y-m-d H:i:s', $end_ts),
142 '#description' => t(
'The ending of the period to use'),
147 '#type' =>
'container',
148 '#attributes' => array(
'style' => array(
'float: left')),
151 '#value' => t(
'Sort'),
155 '#type' =>
'container',
157 '#attributes' => array(
'style' => array(
'clear: both')),
160 if (user_access(
'administer mailinglist archive')) {
161 $listname = variable_get(
'mailinglist_mailbox_current_list');
163 $offset = variable_get(
'mailinglist_mailbox_current_offset');
164 $msgcnt = variable_get(
'mailinglist_mailbox_current_max');
165 $queue = DrupalQueue::get(
'mailinglist_message');
166 $numitems = $queue->numberOfItems();
172 $progress =
"$listname:$path (" . number_format($offset) .
' / ' .
173 number_format($msgcnt) .
") ";
175 $progress .=
"Items to process " . $numitems;
177 $mid = $list->parameters[
'ArchiveCheck'];
178 $form[
'progress'] = array(
180 '#markup' => $progress,
186 if (user_access(
'administer mailinglist archive')) {
197 $form[
'msg'] = array(
198 '#theme' =>
'mailinglist_message',
201 'subject' => array(
'#markup' => $result[
'subject']),
202 'email' => array(
'#markup' => $result[
'email']),
203 'name' => array(
'#markup' => $result[
'name']),
205 '#theme' =>
'mailinglist_body',
206 '#item' => $result[
'body'],
207 '#markup' => nl2br(check_plain($result[
'body'])),
210 if($result[
'reply_to']){
217 $order =
'ORDER BY n.name ASC';
221 $order =
'ORDER BY a.time ASC';
227 $order =
'ORDER BY a.subject ASC';
232 $order =
'ORDER BY a.time DESC';
236 array(
':start' => $start_date,
':end' => $end_date),
237 'a.time >= :start AND a.time <= :end', $order, 50);
261 function submit(&$form, &$form_state, $list) {
262 $base = variable_get(
'mailinglist_base',
'mailinglist');
263 $pre =
"$base/{$list->admin_name}/archive/";
268 switch($form_state[
'values'][
'op']){
270 $order = $form_state[
'values'][
'order'];
271 $start = $this->
encodeDate($form_state[
'values'][
'start']);
272 $end = $this->
encodeDate($form_state[
'values'][
'end']);
274 drupal_goto(
"$pre$order/$start-$end/$page");
286 $time = strtotime($date);
287 $str = gmdate(
"YmdHis", $time);
293 if(strlen($date) < 4) {
296 if(strlen($date) > 4) {
297 $date = substr($date, 0, 4) .
'-' . substr($date, 4);
302 if(strlen($date) > 7) {
303 $date = substr($date, 0, 7) .
'-' . substr($date, 7);
308 if(strlen($date) > 10) {
309 $date = substr($date, 0, 10) .
' ' . substr($date, 10);
314 if(strlen($date) > 13) {
315 $date = substr($date, 0, 13) .
':' . substr($date, 13);
320 if(strlen($date) > 16) {
321 $date = substr($date, 0, 16) .
':' . substr($date, 16);
_mailinglist_mailbox_scan()
Process the configured mailing boxes.
submit(&$form, &$form_state, $list)
Operation page form submission.
Base Class for Mailinglist extensions.
Base Class for Mailinglist extensions.
_mailinglist_archive_scan($list)
Perform incremental scan of archive for problems.
encodeDate($date)
Decode a "compressed" date into normal form.
mailinglist_archive_reply_tree($list, $msgid, $n=0)
form(&$form, &$form_state, $list)
Operation page form generation.
mailinglist_archive_message_get($list, $msgid)
Get a full message by Msg ID.
mailinglist_archive_summary_list($list, $vars, $cond= '', $order="", $limit="")
Return list of message summaries.
_mailinglist_base_filename($path)
_mailinglist_base_filename().
_mailinglist_datetime_ts($time)
Convert a 'datetime' field into a timestamp.
validate(&$form, &$form_state, $list)
Operation page form validation.