Index: scheduler.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/Attic/scheduler.install,v retrieving revision 1.5.2.5 diff -u -r1.5.2.5 scheduler.install --- scheduler.install 19 Apr 2009 11:29:33 -0000 1.5.2.5 +++ scheduler.install 24 Aug 2009 22:55:12 -0000 @@ -1,15 +1,14 @@ array( @@ -45,27 +44,33 @@ ); } -function scheduler_update_2() { - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $ret[] = update_sql("ALTER TABLE {scheduler} CHANGE timestamp_posted publish_on int(11) NOT NULL default '0'"); - $ret[] = update_sql("ALTER TABLE {scheduler} CHANGE timestamp_hidden unpublish_on int(11) NOT NULL default '0'"); - $ret[] = update_sql("ALTER TABLE {scheduler} ADD timezone int(6) NOT NULL default '0'"); - break; - case 'pgsql': - db_change_column($ret, 'scheduler', 'timestamp_posted', 'publish_on', 'integer', array('not null' => TRUE, 'default' => "0")); - db_change_column($ret, 'scheduler', 'timestamp_hidden', 'unpublish_on', 'integer', array('not null' => TRUE, 'default' => "0")); - db_add_column($ret, 'scheduler', 'timezone', 'integer', array('not null' => TRUE, 'default' => "0")); - break; - } +/** + * Implementation of hook_install(). + */ +function scheduler_install() { + drupal_install_schema('scheduler'); +} +/** + * Implementation of hook_uninstall(). + */ +function scheduler_uninstall() { + drupal_uninstall_schema('scheduler'); + db_query("DELETE FROM {variable} WHERE name LIKE '%s_%%'", 'scheduler'); +} + +function scheduler_update_2() { + $ret = array(); + db_change_column($ret, 'scheduler', 'timestamp_posted', 'publish_on', 'integer', array('not null' => TRUE, 'default' => "0")); + db_change_column($ret, 'scheduler', 'timestamp_hidden', 'unpublish_on', 'integer', array('not null' => TRUE, 'default' => "0")); + db_add_column($ret, 'scheduler', 'timezone', 'integer', array('not null' => TRUE, 'default' => "0")); return $ret; } function scheduler_update_3() { - $ret[] = update_sql("CREATE INDEX scheduler_publish_on ON {scheduler} (publish_on)"); - $ret[] = update_sql("CREATE INDEX scheduler_unpublish_on ON {scheduler} (unpublish_on)"); + $ret = array(); + db_add_index($ret, 'scheduler', 'scheduler_publish_on', array('publish_on')); + db_add_index($ret, 'scheduler', 'scheduler_unpublish_on', array('unpublish_on')); return $ret; } @@ -74,7 +79,7 @@ if (db_column_exists('scheduler', 'timezone')) { $ret[] = update_sql("UPDATE {scheduler} SET publish_on=publish_on-timezone WHERE publish_on<>0"); $ret[] = update_sql("UPDATE {scheduler} SET unpublish_on=unpublish_on-timezone WHERE unpublish_on<>0"); - $ret[] = update_sql("ALTER TABLE {scheduler} DROP COLUMN timezone"); + db_drop_field($ret, 'scheduler', 'timezone'); } - return $ret; + return $ret; } Index: scheduler.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/Attic/scheduler.module,v retrieving revision 1.50.2.25 diff -u -r1.50.2.25 scheduler.module --- scheduler.module 24 Aug 2009 20:59:09 -0000 1.50.2.25 +++ scheduler.module 24 Aug 2009 22:55:13 -0000 @@ -1,18 +1,9 @@ 'Scheduled', 'page callback' => 'scheduler_list', 'access callback' => 'scheduler_list_access_callback', - 'description' => t('Display a list of scheduled nodes'), + 'description' => 'Display a list of scheduled nodes', ); return $items; } @@ -70,7 +61,7 @@ '#default_value' => variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT), '#size' => 20, '#maxlength' => 20, - '#description' => t('The input format for the (un)scheduling time/date. See the date() function for formatting options: http://www.php.net/manual/en/function.date.php'), + '#description' => t('The input format for the (un)scheduling time/date. See the date() function for formatting options: http://www.php.net/manual/en/function.date.php'), ); return system_settings_form($form); } @@ -105,7 +96,7 @@ $node = $form['#node']; $date_format = variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT); - + // if this is a preview then get the values from the form, not the db if ($form_state['values']['op']=='Preview') { $defaults = new StdClass; @@ -153,7 +144,7 @@ '#default_value' => isset($defaults->unpublish_on) && $defaults->unpublish_on ? format_date($defaults->unpublish_on, 'custom', $date_format) : '', '#description' => t('Format: %time. Leave blank to disable scheduled unpublishing.', array('%time' => format_date(time(), 'custom', $date_format))), ); - + if (module_exists('date_popup')) { // Make this a popup calendar widget if Date Popup module is enabled. $form['scheduler_settings']['publish_on']['#type'] = 'date_popup'; @@ -230,7 +221,8 @@ // success $time -= _scheduler_get_user_timezone(); } - } else { + } + else { // $str is empty $time = NULL; } @@ -241,20 +233,20 @@ * Parse a time/date as UTC time * * @param string $date The string to parse - * @param string $format The format used in $date. See date() (http://www.php.net/manual/en/function.date.php) - * specification for format options. Right now only dHhmiaAsyY are supported. + * @param string $format The format used in $date. See date() (http://www.php.net/manual/en/function.date.php) + * specification for format options. Right now only dHhmiaAsyY are supported. * @return the parsed time as a UTC timestamp * @see date() */ function _scheduler_strptime($date, $format) { # we need to build a regex pattern for the date format $date_entities = array('d', 'H', 'h', 'm', 'i', 'a', 'A', 's', 'y', 'Y'); - $date_regex_replacements = array('(\d{2})', '(\d{2})', '(\d{2})', '(\d{2})', '(\d{2})', '([ap]m)', '([AP]M)', '(\d{2})', '(\d{2})', '(\d{4})'); + $date_regex_replacements = array('(\d{2})', '(\d{2})', '(\d{2})', '(\d{2})', '(\d{2})', '([ap]m)', '([AP]M)', '(\d{2})', '(\d{2})', '(\d{4})'); $custom_pattern = str_replace($date_entities, $date_regex_replacements, $format); if (!preg_match("#$custom_pattern#", $date, $value_matches)) { return FALSE; } - + if (!preg_match_all("/(\w)/", $format, $entity_matches)) { return FALSE; } @@ -269,26 +261,26 @@ break; case 'H': case 'h': - $results['hour'] = $value; + $results['hour'] = $value; break; case 'm': - $results['month'] = $value; + $results['month'] = $value; break; case 'i': - $results['minute'] = $value; + $results['minute'] = $value; break; case 'a': case 'A': - $results['meridiem'] = $value_matches[$index]; + $results['meridiem'] = $value_matches[$index]; break; case 's': - $results['second'] = $value; + $results['second'] = $value; break; case 'y': case 'Y': - $results['year'] = $value; + $results['year'] = $value; break; - } + } $index++; } if ((strncasecmp($results['meridiem'], "pm", 2) == 0) && ($results['hour'] <= 12)) { @@ -319,7 +311,7 @@ function scheduler_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { // Run $op == load for any user. if ($op == 'load') { - if (isset($node->nid) && $node->nid && variable_get('scheduler_'.$node->type, 0) == 1) { + if (isset($node->nid) && $node->nid && variable_get('scheduler_'. $node->type, 0) == 1) { $result = db_query('SELECT * FROM {scheduler} WHERE nid = %d', $node->nid); if ($result) { $row = db_fetch_array($result); @@ -338,8 +330,8 @@ switch ($op) { case 'view': if (isset($a4) && $a4 && isset($node->unpublish_on) && $node->unpublish_on) { - $unavailable_after = date ("d-M-Y H:i:s e", $node->unpublish_on); - drupal_set_html_head(''); + $unavailable_after = date("d-M-Y H:i:s e", $node->unpublish_on); + drupal_set_html_head(''); } break; case 'validate': @@ -351,9 +343,9 @@ // a value we have already converted. This is needed // because DRUPAL6 removed 'submit' and added 'presave' // and all this happens at different times. - + $date_format = variable_get('scheduler_date_format', SCHEDULER_DATE_FORMAT); - + if (isset($node->publish_on) && $node->publish_on && !is_numeric($node->publish_on)) { $publishtime = _scheduler_strtotime($node->publish_on); if ($publishtime === FALSE) { @@ -366,7 +358,7 @@ $node->publish_on = $publishtime; } } - + if (isset($node->unpublish_on) && $node->unpublish_on && !is_numeric($node->unpublish_on)) { $unpublishtime = _scheduler_strtotime($node->unpublish_on); if ($unpublishtime === FALSE) { @@ -383,7 +375,7 @@ if (isset($publishtime) && isset($unpublishtime) && $unpublishtime < $publishtime) { form_set_error('unpublish_on', t("The 'unpublish on' date must be later than the 'publish on' date.")); } - + // Right before we save the node, we need to check if a "publish on" value has been set. // If it has been set, we want to make sure the node is unpublished since it will be published at a later date if (isset($node->publish_on) && $node->publish_on != '' && is_numeric($node->publish_on) && $node->publish_on > time()) { @@ -399,7 +391,7 @@ case 'update': if (isset($node->nid) && $node->nid) { $exists = db_result(db_query('SELECT nid FROM {scheduler} WHERE nid = %d', $node->nid)); - + // if this node has already been scheduled, update its record if ($exists) { // only update database if we need to (un)publish this node at some date @@ -491,7 +483,7 @@ } /** - * Implementation of hook_theme() + * Implementation of hook_theme(). */ function scheduler_theme() { return array( Index: scheduler.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/Attic/scheduler.views.inc,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 scheduler.views.inc --- scheduler.views.inc 1 Nov 2008 16:32:03 -0000 1.1.2.2 +++ scheduler.views.inc 24 Aug 2009 22:55:13 -0000 @@ -1,15 +1,20 @@ 'nid', 'field' => 'nid', ); - + // description of the fields (table columns) $tables['scheduler']['publish_on'] = array( 'title' => t('Publish on'), @@ -42,6 +47,6 @@ 'handler' => 'views_handler_sort_date', ), ); - + return $tables; } \ No newline at end of file Index: translations/da.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/da.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 da.po --- translations/da.po 26 Jan 2009 18:23:59 -0000 1.1.2.1 +++ translations/da.po 24 Aug 2009 22:55:13 -0000 @@ -14,10 +14,6 @@ "X-Poedit-Language: Danish\n" "X-Poedit-Country: DENMARK\n" -#: scheduler.module:9 -msgid "A module to schedule node (un)publishing." -msgstr "Planlæg udgivelse af indholdselementer." - #: scheduler.module:21 msgid "schedule" msgstr "planlæg" Index: translations/de.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/de.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 de.po --- translations/de.po 26 Jan 2009 18:23:59 -0000 1.1.2.1 +++ translations/de.po 24 Aug 2009 22:55:14 -0000 @@ -22,10 +22,6 @@ "X-Poedit-Country: GERMANY\n" "X-Poedit-SourceCharset: utf-8\n" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "Ein Modul, um zu planen, wann Beiträge veröffentlicht oder verborgen werden." - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "Einfaches Cron-Steuerungsprogramm" Index: translations/fr.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/fr.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 fr.po --- translations/fr.po 27 Jan 2009 09:28:15 -0000 1.1.2.1 +++ translations/fr.po 24 Aug 2009 22:55:14 -0000 @@ -44,10 +44,6 @@ msgid "Date/time on which the article will be automatically unpublished" msgstr "Date/heure à laquelle l'article sera automatiquement dépublié" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "Un module pour planifier la (dé)publication des noeuds." - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "Gestionnaire de cron léger" Index: translations/hu.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/hu.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 hu.po --- translations/hu.po 26 Jan 2009 18:23:59 -0000 1.1.2.1 +++ translations/hu.po 24 Aug 2009 22:55:14 -0000 @@ -13,10 +13,6 @@ "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -#: scheduler.module:6 -msgid "A module to schedule node (un)publishing." -msgstr "Tartalmak megjelenésének és eltűnésének időzítése." - #: scheduler.module:12 msgid "schedule" msgstr "időzítés" Index: translations/ja.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/ja.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 ja.po --- translations/ja.po 26 Jan 2009 18:23:59 -0000 1.1.2.1 +++ translations/ja.po 24 Aug 2009 22:55:14 -0000 @@ -43,10 +43,6 @@ msgid "Date/time on which the article will be automatically unpublished" msgstr "記事を自動的に非掲載にする日付と時間。" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "ノードを掲載する (または非掲載にする) スケジュールを立てるモジュール。" - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "軽量なcronハンドラ" Index: translations/nl.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/nl.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 nl.po --- translations/nl.po 13 Jun 2009 06:43:59 -0000 1.1.2.1 +++ translations/nl.po 24 Aug 2009 22:55:14 -0000 @@ -43,10 +43,6 @@ msgid "Date/time on which the article will be automatically unpublished" msgstr "Datum en tijd waarop het artikel automatisch zal worden gedepubliceerd" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "Een module om te plannen waneer nodes worden ge(de)publiceerd." - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "Lichtgewicht cron handler" Index: translations/uk-ua.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/uk-ua.po,v retrieving revision 1.1.2.1 diff -u -r1.1.2.1 uk-ua.po --- translations/uk-ua.po 14 May 2009 21:39:24 -0000 1.1.2.1 +++ translations/uk-ua.po 24 Aug 2009 22:55:14 -0000 @@ -45,10 +45,6 @@ msgid "Date/time on which the article will be automatically unpublished" msgstr "Дата-час, коли стаття буде автоматично неопублікована" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "Модуль для планування часу публікації дописів" - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "Полегшене управління cron" Index: translations/uk.po =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/scheduler/translations/Attic/uk.po,v retrieving revision 1.1.2.2 diff -u -r1.1.2.2 uk.po --- translations/uk.po 14 May 2009 21:57:15 -0000 1.1.2.2 +++ translations/uk.po 24 Aug 2009 22:55:15 -0000 @@ -45,10 +45,6 @@ msgid "Date/time on which the article will be automatically unpublished" msgstr "Дата-час, коли стаття буде автоматично неопублікована" -#: scheduler.module:11 -msgid "A module to schedule when nodes are (un)published." -msgstr "Модуль для планування часу публікації дописів" - #: scheduler.module:28 msgid "Light weight cron handler" msgstr "Полегшене управління cron"