Index: banner.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/banner/banner.install,v retrieving revision 1.9 diff -u -p -r1.9 banner.install --- banner.install 10 Dec 2006 20:59:30 -0000 1.9 +++ banner.install 12 Dec 2006 08:36:34 -0000 @@ -15,7 +15,7 @@ function banner_install() { target VARCHAR(8) NOT NULL DEFAULT '', workflow TINYINT UNSIGNED NOT NULL DEFAULT '0', mode TINYINT UNSIGNED NOT NULL DEFAULT '0', - content TEXT, + banner_content TEXT, cache TEXT, -- notifications @@ -60,7 +60,7 @@ function banner_install() { target varchar(8) NOT NULL DEFAULT '', workflow smallint NOT NULL DEFAULT '0', mode smallint NOT NULL DEFAULT '0', - content text NOT NULL DEFAULT '', + banner_content text NOT NULL DEFAULT '', cache text NOT NULL DEFAULT '', notify_day smallint NOT NULL DEFAULT '0', @@ -139,3 +139,17 @@ function banner_uninstall() { variable_del('banner_renewal_message'); variable_del('banner_notify_failed'); } + +function banner_update_1() { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {banner} CHANGE content banner_content TEXT"); + break; + case 'pgsql': + $ret[] = update_sql("ALTER TABLE {banner} RENAME content TO banner_content"); + break; + } + return $ret; +} Index: banner.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/banner/banner.module,v retrieving revision 1.72 diff -u -p -r1.72 banner.module --- banner.module 10 Dec 2006 21:40:36 -0000 1.72 +++ banner.module 12 Dec 2006 08:29:14 -0000 @@ -505,25 +505,25 @@ function banner_validate(&$node, $form) } break; case BANNER_TEXT: - if (empty($node->content)) { - form_set_error('content', t('You need to enter the banner text in the content field to use the selected mode.')); + if (empty($node->banner_content)) { + form_set_error('banner_content', t('You need to enter the banner text in the content field to use the selected mode.')); } break; case BANNER_JAVASCRIPT: - if (empty($node->content)) { - form_set_error('content', t('You need to enter the script in the content field to use the selected mode.')); + if (empty($node->banner_content)) { + form_set_error('banner_content', t('You need to enter the script in the content field to use the selected mode.')); } break; case BANNER_REMOTE: - if (valid_url($node->content, TRUE)) { + if (valid_url($node->banner_content, TRUE)) { // FIXME: check that remote image exists! // FIXME: only do this if allow_url_fopen = On - if (!(list($node->width, $node->height) = getimagesize($node->content))) { + if (!(list($node->width, $node->height) = getimagesize($node->banner_content))) { drupal_set_message(t('Could not determine size of remote image.'), 'error'); } } else { - form_set_error('content', t('You need to enter a valid URL in the content field to use the selected mode.')); + form_set_error('banner_content', t('You need to enter a valid URL in the content field to use the selected mode.')); } break; } @@ -1065,7 +1065,7 @@ function _banner_get_fields() { 'target' => '', 'workflow' => 0, 'mode' => 0, - 'content' => '', + 'banner_content' => '', 'cache' => '', // notifications @@ -1189,7 +1189,7 @@ function _banner_get_struct() { $banners[$node->nid]->views_week_max = $node->views_week_max; $banners[$node->nid]->views_max = $node->views_max; if ($node->mode == BANNER_JAVASCRIPT) { - $banners[$node->nid]->html = $node->content; + $banners[$node->nid]->html = $node->banner_content; } else { $banners[$node->nid]->html = "document.write('".str_replace(array("'", "\n", "\r"), array("\"", " ", " "), _banner_view($node))."');"; @@ -1680,10 +1680,10 @@ function _banner_form_banner($node) { '#options' => _banner_get_mode_options(), '#description' => t('Choose the desired mode for this banner. See the banner help for a description of the available modes.', array('%url' => url('admin/help/banner'))), ); - $form['content'] = array( + $form['banner_content'] = array( '#type' => 'textarea', '#title' => t('Content'), - '#default_value' => $node->content, + '#default_value' => $node->banner_content, '#rows' => 8, '#description' => t('Enter the ad content. This can either be text, javascript or the URL of a remote image. If you are adding a text ad, the following placeholders are available: %url and %target, which are replaced with the banner URL and the banner target respectively (these placeholders can also be used in uploaded text banners). If no %url placeholder is present, a link to the banner URL will be added after the banner text.'), ); @@ -1951,7 +1951,7 @@ function theme_banner_view_remote($node) $url_attr['target'] = $node->target; } - $output = l(theme('banner_image', $node->content, $img_attr), 'banner/'. $node->nid, $url_attr, NULL, NULL, FALSE, TRUE); + $output = l(theme('banner_image', $node->banner_content, $img_attr), 'banner/'. $node->nid, $url_attr, NULL, NULL, FALSE, TRUE); return $output; } @@ -1967,20 +1967,20 @@ function theme_banner_view_remote($node) function theme_banner_view_text($node) { $output = ''; - if (strpos($node->content, '%url')) { + if (strpos($node->banner_content, '%url')) { // %url present in content, replace with banner link and target $replace = array( '%url' => check_url(url('banner/'. $node->nid)), '%target' => $node->target != '_none' ? $node->target : '_self', ); - $output .= strtr($node->content, $replace); + $output .= strtr($node->banner_content, $replace); } else { // no %url in content, add link at the end $attr = array( 'target' => $node->target != '_none' ? $node->target : '_self', ); - $output .= $node->content .' '; + $output .= $node->banner_content .' '; $output .= l(t('»'), 'banner/'. $node->nid, $attr, NULL, NULL, FALSE, TRUE); }