diff -urNp ../moviereview/moviereview.info modules/moviereview/moviereview.info --- modules/moviereview/moviereview.info 1970-01-01 01:00:00.000000000 +0100 +++ modules/moviereview/moviereview.info 2007-02-23 11:35:22.000098000 +0100 @@ -0,0 +1,4 @@ +; $Id$ +name = Moviereview +description = Movie Review module allows users, with permission, to submit movie reviews. +version = 5.x-1.x-dev \ No newline at end of file diff -urNp ../moviereview/moviereview.install modules/moviereview/moviereview.install --- modules/moviereview/moviereview.install 1970-01-01 01:00:00.000000000 +0100 +++ modules/moviereview/moviereview.install 2007-02-23 11:35:42.000762000 +0100 @@ -0,0 +1,64 @@ + diff -urNp ../moviereview/moviereview.module modules/moviereview/moviereview.module --- modules/moviereview/moviereview.module 2006-09-12 05:52:30.000000000 +0200 +++ modules/moviereview/moviereview.module 2007-02-28 06:19:00.000009000 +0100 @@ -7,9 +7,9 @@ function moviereview_help($section = '') { $output = ''; switch ($section) { - case 'admin/help#review': + case 'admin/help/review': $output .= t('Movie Review module allows users, with permission, to submit movie reviews.'); - case 'admin/modules#description': + case 'admin/build/modules#description': $output .= t('Write and publish movie reviews.'); break; case 'node/add#moviereview': @@ -43,7 +43,13 @@ function moviereview_access($op, $node) } function moviereview_node_info() { - return array('moviereview' => array('name' => t('movie review'), 'base' => 'moviereview')); + return array( + 'moviereview' => array( + 'name' => t('Movie review'), + 'module' => 'moviereview', + 'description' => t('A movie review is a review of movies the user last saw.') + ) + ); } function moviereview_insert($node) { @@ -118,6 +124,7 @@ function moviereview_submit(&$node) { if (variable_get('teaser_length', 600)) { if ($node->body) { $node->teaser = check_markup(node_teaser($node->body), $node->format); + drupal_set_message($node->teaser); } else { $node->teaser = check_markup(node_teaser($node->review), $node->format); @@ -134,10 +141,10 @@ function moviereview_validate(&$node) { if (isset($node->review)) { $word_count = count(explode(' ', $node->review)); if ($word_count < variable_get('minimum_moviereview_size', 0)) { - $error['review'] = theme('error', t('The body of your movie review is too short. You are required to enter at least %minimum_word_count words, but you\'ve only entered %word_count.', array('%minimum_word_count' => variable_get('minimum_moviereview_size', 0), '%word_count' => $word_count))); + form_set_error('review', t('The body of your movie review is too short. You are required to enter at least @minimum_word_count words, but you\'ve only entered @word_count.', array('@minimum_word_count' => variable_get('minimum_moviereview_size', 0), '@word_count' => $word_count))); } else if (!$node->review) { - $error['review'] = theme('error', t('You are required to enter text for your movie review.')); + form_set_error('review', t('You are required to enter text for your movie review.')); } } return $error; @@ -145,12 +152,11 @@ function moviereview_validate(&$node) { function moviereview_form(&$node) { $op = arg(1); - $edit = $_POST['edit']; + $edit = $_POST; //if (function_exists('taxonomy_node_form')) { // $output .= implode('', taxonomy_node_form('moviereview', $node)); //} - if ($edit['numactors']) { // It's a preview ... if ($edit['moviereview_more_actors'] == 1) { @@ -171,7 +177,7 @@ function moviereview_form(&$node) { elseif(!$node->numactors) { // Just created review, start with one author. $node->numactors = 5; - } + } // if ($edit['moviereview_more_actors'] == 1) { // $node->numactors = $node->numactors + 5; @@ -470,49 +476,42 @@ function moviereview_menu($may_cache) { $items = array(); if ($may_cache) { - $items[] = array('path' => 'node/add/moviereview', - 'title' => t('movie review'), - 'access' => user_access('create moviereviews'), - 'callback' => 'node_page'); $items[] = array('path' => 'moviereview', - 'title' => t('movie reviews'), + 'title' => t('Movie Reviews'), 'access' => user_access('access content'), 'callback' => 'moviereview_page', - 'type' => MENU_SUGGESTED_ITEM); + 'type' => MENU_SUGGESTED_ITEM + ); + $items[] = array( + 'path' => 'admin/settings/moviereview', + 'title' => t('Moviereview settings'), + 'description' => t('Alter the global settings of Moviereview'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('moviereview_admin_settings'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); } else { if ($css = variable_get('moviereview_css', drupal_get_path('module', 'moviereview') .'/moviereview.css')) { - //add stylesheet - drupal_add_link(array( - 'href'=>$css, - 'rel'=>'stylesheet', - 'type'=>'text/css') - ); + //add stylesheet + drupal_add_css($css); } } return $items; } -function moviereview_settings() { - if (!file_check_location(variable_get('moviereview_css', base_path() . drupal_get_path('module', 'moviereview') .'/moviereview.css'))) { - $error['moviereview_css'] = theme('error', t('File does not exist, or is not readable.')); - } - - $form['moviereview_settings'] = array( - '#type' => 'fieldset', - '#title' => t('Moviereview settings'), - ); - - $form['moviereview_settings']['moviereview_css'] = array( +function moviereview_admin_settings() { + $form['moviereview_css'] = array( '#type' => 'textfield', '#title' => t('Style sheet'), - '#default_value' => variable_get('moviereview_css', base_path() . drupal_get_path('module', 'moviereview') .'/moviereview.css'), + '#default_value' => variable_get('moviereview_css', ''), '#size' => 70, '#maxlength' => 255, '#description' => t("Specify the relative path to your moviereview style sheet. The style sheet specified here will be used to style your moviereview pages. If you prefer to style your moviereview pages in your theme, you can leave this field blank. ". $error['moviereview_css']), ); - $form['moviereview_settings']['moviereview_detail'] = array( + $form['moviereview_detail'] = array( '#type' => 'radios', '#title' => t('Details to collect'), '#default_value' => variable_get('moviereview_detail', 0), @@ -520,7 +519,7 @@ function moviereview_settings() { '#description' => t('Details you would like to collect about the movies as freeform text.'), ); - $form['moviereview_settings']['moviereview_help'] = array( + $form['moviereview_help'] = array( '#type' => 'textarea', '#title' => t('Explanation or submission guidelines'), '#default_value' => variable_get('moviereview_help', ''), @@ -536,8 +535,8 @@ function moviereview_settings() { '#options' => drupal_map_assoc(array(0, 10, 25, 50, 75, 100, 125, 150, 175, 200, 500, 1000)), '#description' => t('The minimum number of words a movie review must have to be considered valid. This can be useful to prevent submissions that do not meet the site\'s standards, such as short test posts.'), ); - - return $form; + + return system_settings_form($form); } function moviereview_page() { @@ -575,32 +574,32 @@ function theme_moviereview_list() { $actors = $actor->actor; } - if ($title) { - $output = t('Title: %title', array('%title' => $node->title)) .'
'; + if ($node->title) { + $output = t('Title: @title', array('@title' => $node->title)) .'
'; } if ($node->movietitle) { - $output .= t('Movie Title: %movietitle', array('%movietitle' => $node->movietitle)) .'
'; + $output .= t('Movie Title: @movietitle', array('@movietitle' => $node->movietitle)) .'
'; } if ($actors) { - $output .= t('%tag: %actors', array('%tag' => format_plural($count, 'Cast', 'Cast'), '%actors' => $actors)) .'
'; + $output .= t('@tag: @actors', array('@tag' => format_plural($count, 'Cast', 'Cast'), '@actors' => $actors)) .'
'; } if ($node->director) { - $output .= t('Directed by: %director', array('%director' => $node->director)) .'
'; + $output .= t('Directed by: @director', array('@director' => $node->director)) .'
'; } if ($node->releaseyear) { - $output .= t('Year: %releaseyear', array('%releaseyear' => $node->releaseyear)) .'
'; + $output .= t('Year: @releaseyear', array('@releaseyear' => $node->releaseyear)) .'
'; } if ($node->runtime) { - $output .= t('Runtime: %runtime', array('%runtime' => $node->runtime)) .'
'; + $output .= t('Runtime: @runtime', array('@runtime' => $node->runtime)) .'
'; } //if ($node->imdb) { // $output .= t('Imdb: %imdb', array('%imdb' => $node->imdb)) .'
'; //} if ($node->rating) { - $output .= t('Rating: %rating', array('%rating' => $node->rating)) .'
'; + $output .= t('Rating: @rating', array('@rating' => $node->rating)) .'
'; } if ($node->price) { - $output .= t('Price: %price', array('%price' => $node->price)) .'
'; + $output .= t('Price: @price', array('@price' => $node->price)) .'
'; } if ($node->cover) { $cover = ""; @@ -610,7 +609,7 @@ function theme_moviereview_list() { } $rows[] = array($cover, array('data' => l($node->title, "node/$node->nid", array('title' => t('View this posting.'))) ."

$output", 'colspan' => '3', 'valign' => 'top')); - } + } if (!$rows) { $rows[] = array(array('data' => t('No movie reviews available.'), 'colspan' => '4')); @@ -630,28 +629,36 @@ function theme_moviereview_list() { return theme('table', $header, $rows); } -function moviereview_view(&$node, $teaser = FALSE, $page = FALSE) { - global $theme; - + +function moviereview_view($node, $teaser, $page) { if ($page) { $breadcrumb = array(); $breadcrumb[] = array('path' => 'moviereview', title => t('movie review')); $breadcrumb[] = array('path' => $_GET['q']); menu_set_location($breadcrumb); } + $node = node_prepare($node, $teaser); - // Allows themes to override how the review should look like, - // but we cannot depend on the theme() functions, since we - // need to pass the node by reference! - $themefunction = "{$theme}_moviereview_content"; - if (!function_exists($themefunction)) { - $themefunction = "theme_moviereview_content"; + if( !$teaser ) + { + $node->content['header'] = array( "#value" => theme('moviereview_header', $node ), "#weight" => -2 ); + if( $node->body ) { + $node->content['body']["#value"] = " +
\n + ". t('Synopsis') ."
+ ". $node->body ."\n +

\n"; + } + $node->content['footer'] = array( "#value" => theme('moviereview_content', $node ), "#weight" => 2 ); } - $themefunction($node, $main, $page); + + return $node; } -function theme_moviereview_content(&$node, $main = 0, $page = 0) { + + +function theme_moviereview_header($node) { $output = "
\n"; $output .= ""; $output .= ""; @@ -720,15 +727,13 @@ function theme_moviereview_content(&$nod $output .= ""; $output .= ""; $output .= "
 
 
"; + $output .= " \n"; // end of header + return $output; +} +function theme_moviereview_content($node) { - $output .= " \n"; // end of header - if($node->body) { - $output .= "
\n"; - $output .= " ". t('Synopsis') ."
\n"; - $output .= " ". check_markup($node->body, $node->format) ."\n"; - $output .= "

\n"; - } + $output = ""; if($node->location) { $output .= "
\n"; $output .= " ". t('Location') ."
\n"; @@ -761,6 +766,6 @@ function theme_moviereview_content(&$nod $output .= "
\n"; } $output .= "
"; // end of moviereview - - $node->body = $output; + + return $output; } \ No newline at end of file diff -urNp ../moviereview/moviereview.mysql modules/moviereview/moviereview.mysql --- ../moviereview/moviereview.mysql 2006-05-29 01:34:48.000000000 +0200 +++ modules/moviereview/moviereview.mysql 1970-01-01 01:00:00.000000000 +0100 @@ -1,40 +0,0 @@ -CREATE TABLE moviereview ( - nid int(10) unsigned NOT NULL default '0', - movietitle varchar(255) NOT NULL default '', - releaseyear char(4) NOT NULL default '', - tvseries int(1) NOT NULL default '0', - cover varchar(255) NOT NULL default '', - genre varchar(255) NOT NULL default '', - director varchar(255) NOT NULL default '', - writer varchar(255) NOT NULL default '', - runtime varchar(255) NOT NULL default '0', - country varchar(255) NOT NULL default '', - language varchar(255) NOT NULL default '', - imdb varchar(255) NOT NULL default '', - media varchar(255) NOT NULL default '', - price varchar(255) NOT NULL default '', - rating int(1) NOT NULL default '0', - review text, - location text, - PRIMARY KEY (nid), - KEY movietitle (movietitle) -); - -CREATE TABLE moviereview_actors ( - aid int(10) unsigned NOT NULL auto_increment, - nid int(10) unsigned NOT NULL default '0', - actor varchar(255) NOT NULL default '', - weight tinyint(4) default '0', - KEY aid (aid), - KEY nid (nid) -); - -CREATE TABLE moviereview_links ( - lid int(10) unsigned NOT NULL auto_increment, - nid int(10) unsigned NOT NULL default '0', - movielink varchar(255) NOT NULL default '', - description varchar(255) NOT NULL default '', - weight tinyint(4) default '0', - KEY lid (lid), - KEY nid (nid) -); \ No newline at end of file diff -urNp ../moviereview/update.mysql modules/moviereview/update.mysql --- modules/moviereview/update.mysql 2006-05-29 01:34:48.000000000 +0200 +++ modules/moviereview/update.mysql 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -ALTER TABLE `moviereview` CHANGE COLUMN `release` `releaseyear` CHAR(4) NOT NULL default ''; \ No newline at end of file