You are here

function date_update_5201 in Date 6

Same name and namespace in other branches
  1. 5.2 date/date.install \date_update_5201()

Get rid of jscalendar popup and use jQuery popup instead.

Return value

unknown

File

date/date.install, line 245

Code

function date_update_5201() {
  date_install_load();
  $ret = array();
  if (db_result(db_query("SELECT COUNT(*) FROM {" . content_instance_tablename() . "} WHERE widget_type = 'date_js'"))) {
    $result = db_query("SELECT field_name, widget_type, widget_settings from {" . content_instance_tablename() . "} where widget_type = 'date_js'");
    while ($widget = db_fetch_array($result)) {

      // Change the format to one date_popup can use.
      $widget_settings = unserialize($widget['widget_settings']);
      $widget_settings['input_format'] = DATE_FORMAT_DATETIME;
      $widget_settings['input_format_custom'] = '';
      db_query("UPDATE {" . content_instance_tablename() . "} SET widget_type = 'date_popup', widget_settings = '%s' WHERE field_name = '%s'", serialize($widget_settings), $widget['field_name']);
    }
  }
  content_clear_type_cache();
  return $ret;
}