Index: classes/tagCloud.class.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/searchcloud/classes/tagCloud.class.php,v retrieving revision 1.1 diff -u -r1.1 tagCloud.class.php --- classes/tagCloud.class.php 31 Jul 2008 18:43:25 -0000 1.1 +++ classes/tagCloud.class.php 2 Nov 2008 03:22:33 -0000 @@ -94,8 +94,12 @@ $this->_iMaxCount = $this->_aTermsCounts[count($this->_aTermsCounts)-1]; // apply the formula for each term: for ($i=0; $i_aTerms); $i++) { - $this->_aTerms[$i]['font_size'] = ((($this->_aTerms[$i]['count']-$this->_iMinCount)*($this->_iMaxFontSize-$this->_iMinFontSize))/($this->_iMaxCount-$this->_iMinCount))+$this->_iMinFontSize; - $this->_aTerms[$i]['font_size'] = intval($this->_aTerms[$i]['font_size']); + if (count($this->_aTerms) > 1) { + $this->_aTerms[$i]['font_size'] = intval(((($this->_aTerms[$i]['count']-$this->_iMinCount)*($this->_iMaxFontSize-$this->_iMinFontSize))/($this->_iMaxCount-$this->_iMinCount))+$this->_iMinFontSize); + } + else { + $this->_aTerms[$i]['font_size'] = $this->_iMinFontSize; + } } } //compute cloud html string: Index: searchcloud.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/searchcloud/searchcloud.info,v retrieving revision 1.1 diff -u -r1.1 searchcloud.info --- searchcloud.info 31 Jul 2008 18:43:24 -0000 1.1 +++ searchcloud.info 2 Nov 2008 03:22:33 -0000 @@ -1,6 +1,13 @@ name = Search Index Cloud description = "The module produces a tag cloud from stored search terms, based on term occurrences and various limits. The tag cloud is displayed in a dedicated block." -dependencies = search +dependencies[] = search version = "5.x-1.1" project = "searchcloud" -package = "Other" \ No newline at end of file +package = "Other" +; Information added by drupal.org packaging script on 2008-08-01 +version = "5.x-7.1-1" +project = "searchcloud" +datestamp = "1217583035" + + +core = 6.x \ No newline at end of file Index: searchcloud.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/searchcloud/searchcloud.install,v retrieving revision 1.1 diff -u -r1.1 searchcloud.install --- searchcloud.install 31 Jul 2008 18:43:24 -0000 1.1 +++ searchcloud.install 2 Nov 2008 03:22:33 -0000 @@ -51,16 +51,17 @@ * Implementation of hook_uninstall(). */ function searchcloud_uninstall() { + // Remove tables. + drupal_uninstall_schema('searchcloud'); + drupal_set_message(t('Beginning uninstallation of searchcloud module.')); // db: switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': - db_query("DROP TABLE {searchcloud}"); $success = TRUE; break; case 'pgsql': - db_query("DROP TABLE {searchcloud}"); $success = TRUE; break; default: Index: searchcloud.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/searchcloud/searchcloud.module,v retrieving revision 1.1 diff -u -r1.1 searchcloud.module --- searchcloud.module 31 Jul 2008 18:43:24 -0000 1.1 +++ searchcloud.module 21 Dec 2008 00:10:29 -0000 @@ -1,4 +1,6 @@ 'textfield', - '#title' => t('Minimum font size'), - '#default_value' => variable_get('searchcloud_min_font_size', 14), - '#description' => t('Enter the minimum font size in pixels.'), - '#size'=>2 - ); - $form['searchcloud_max_font_size'] = array( - '#type' => 'textfield', - '#title' => t('Maximum font size'), - '#default_value' => variable_get('searchcloud_max_font_size', 24), - '#description' => t('Enter the maximum font size in pixels.'), - '#size'=>2 - ); - $form['searchcloud_use_colors'] = array( - '#type' => 'checkbox', - '#title' => t('Use color tones'), - '#default_value' => variable_get('searchcloud_use_colors', 1), - '#description' => t('Check this if you want to use color tones on tags. Make sure the number of light&dark color tones is equal to the difference between maximum and minimum font size.') - ); - $form['searchcloud_light_colors'] = array( - '#type' => 'textarea', - '#title' => t('Light color tones'), - '#default_value' => variable_get('searchcloud_light_colors', "#00FFFF,#F0F8FF,#FFF0F5,#FFE4B5,#EEE8AA,#98FB98,#B0C4DE,#FF00FF,#0000CD,#FDF5E6"), - '#description' => t('Separate colors with commas, nothing else.'), - '#cols' => 60, - '#rows' => 2 - ); - $form['searchcloud_dark_colors'] = array( - '#type' => 'textarea', - '#title' => t('Dark color tones'), - '#default_value' => variable_get('searchcloud_dark_colors', "#0000FF,#FF0000,#00008B,#A52A2A,#FF00FF,#008000,#C71585,#8B4513,#008080,#2F4F4F"), - '#description' => t('Separate colors with commas, nothing else.'), - '#cols' => 60, - '#rows' => 2 - ); - $form['searchcloud_use_light_colors'] = array( - '#type' => 'checkbox', - '#title' => t('Use the light color tones'), - '#default_value' => variable_get('searchcloud_use_light_colors', 0), - '#description' => t('Check this if you want to use the light color tones on tags.') - ); - $form['searchcloud_ignored_words'] = array( - '#type' => 'textarea', - '#title' => t('Ignored words'), - '#default_value' => variable_get('searchcloud_ignored_words', "?,of,the,is,off,you,them,then,at,with,i,it,We,we"), - '#description' => t('Separate words with commas, nothing else.'), - '#cols' => 60, - '#rows' => 2 - ); - $form['searchcloud_ignored_chars'] = array( - '#type' => 'textarea', - '#title' => t('Ignored chars'), - '#default_value' => variable_get('searchcloud_ignored_chars', "?,!,.,~,@,#,$,%,^,&,*,(,),-,_,+,=,<,>,/,[,],{,},:,;,~,`"), - '#description' => t('Separate chars with commas, nothing else. (commas and quotes are ignored internally)'), - '#cols' => 60, - '#rows' => 2 - ); - $form['searchcloud_minimum_tag_length'] = array( - '#type' => 'textfield', - '#title' => t('Minimum tag length'), - '#default_value' => variable_get('searchcloud_minimum_tag_length', variable_get('minimum_word_size', 3)), - '#description' => t('The minimum char length of the word, for the generator to consider it.'), - '#size'=>3 - ); - $form['searchcloud_underline_links'] = array( - '#type' => 'checkbox', - '#title' => t('Underline links'), - '#default_value' => variable_get('searchcloud_underline_links', 0), - '#description' => t('Check this if you want the cloud links to appear underlined.') - ); - $form['searchcloud_tag_limit'] = array( - '#type' => 'textfield', - '#title' => t('Tag limit'), - '#default_value' => variable_get('searchcloud_tag_limit', 0), - '#description' => t('How many tags will the cloud show. "0" means no limit.'), - '#size'=>3 - ); - return system_settings_form($form); + $form['searchcloud_min_font_size'] = array( + '#type' => 'textfield', + '#title' => t('Minimum font size'), + '#default_value' => variable_get('searchcloud_min_font_size', 14), + '#description' => t('Enter the minimum font size in pixels.'), + '#size' => 2 + ); + $form['searchcloud_max_font_size'] = array( + '#type' => 'textfield', + '#title' => t('Maximum font size'), + '#default_value' => variable_get('searchcloud_max_font_size', 24), + '#description' => t('Enter the maximum font size in pixels.'), + '#size' => 2 + ); + $form['searchcloud_use_colors'] = array( + '#type' => 'checkbox', + '#title' => t('Use color tones'), + '#default_value' => variable_get('searchcloud_use_colors', 1), + '#description' => t('Check this if you want to use color tones on tags. Make sure the number of light&dark color tones is equal to the difference between maximum and minimum font size.') + ); + $form['searchcloud_light_colors'] = array( + '#type' => 'textarea', + '#title' => t('Light color tones'), + '#default_value' => variable_get('searchcloud_light_colors', "#00FFFF,#F0F8FF,#FFF0F5,#FFE4B5,#EEE8AA,#98FB98,#B0C4DE,#FF00FF,#0000CD,#FDF5E6"), + '#description' => t('Separate colors with commas, nothing else.'), + '#cols' => 60, + '#rows' => 2 + ); + $form['searchcloud_dark_colors'] = array( + '#type' => 'textarea', + '#title' => t('Dark color tones'), + '#default_value' => variable_get('searchcloud_dark_colors', "#0000FF,#FF0000,#00008B,#A52A2A,#FF00FF,#008000,#C71585,#8B4513,#008080,#2F4F4F"), + '#description' => t('Separate colors with commas, nothing else.'), + '#cols' => 60, + '#rows' => 2 + ); + $form['searchcloud_use_light_colors'] = array( + '#type' => 'checkbox', + '#title' => t('Use the light color tones'), + '#default_value' => variable_get('searchcloud_use_light_colors', 0), + '#description' => t('Check this if you want to use the light color tones on tags.') + ); + $form['searchcloud_ignored_words'] = array( + '#type' => 'textarea', + '#title' => t('Ignored words'), + '#default_value' => variable_get('searchcloud_ignored_words', "?,of,the,is,off,you,them,then,at,with,i,it,We,we"), + '#description' => t('Separate words with commas, nothing else.'), + '#cols' => 60, + '#rows' => 2 + ); + $form['searchcloud_ignored_chars'] = array( + '#type' => 'textarea', + '#title' => t('Ignored chars'), + '#default_value' => variable_get('searchcloud_ignored_chars', "?,!,.,~,@,#,$,%,^,&,*,(,),-,_,+,=,<,>,/,[,],{,},:,;,~,`"), + '#description' => t('Separate chars with commas, nothing else. (commas and quotes are ignored internally)'), + '#cols' => 60, + '#rows' => 2 + ); + $form['searchcloud_minimum_tag_length'] = array( + '#type' => 'textfield', + '#title' => t('Minimum tag length'), + '#default_value' => variable_get('searchcloud_minimum_tag_length', variable_get('minimum_word_size', 3)), + '#description' => t('The minimum char length of the word, for the generator to consider it.'), + '#size' => 3 + ); + $form['searchcloud_underline_links'] = array( + '#type' => 'checkbox', + '#title' => t('Underline links'), + '#default_value' => variable_get('searchcloud_underline_links', 0), + '#description' => t('Check this if you want the cloud links to appear underlined.') + ); + $form['searchcloud_tag_limit'] = array( + '#type' => 'textfield', + '#title' => t('Tag limit'), + '#default_value' => variable_get('searchcloud_tag_limit', 0), + '#description' => t('How many tags will the cloud show. "0" means no limit.'), + '#size' => 3 + ); + return system_settings_form($form); } /** * Implementation of hook_menu(). */ -function searchcloud_menu($may_cache) { +function searchcloud_menu() { $items = array(); - if ($may_cache) { - // - } - else { - $items[] = array( - 'path' => 'admin/settings/searchcloud', - 'title' => t('Search Index Cloud'), - 'description' => t('Configure color tones, ignored words & chars and more.'), - 'callback' => 'drupal_get_form', - 'callback arguments' => array('searchcloud_admin_settings'), - 'access' => user_access('administer site configuration') + $items['admin/settings/searchcloud'] = array( + 'title' => 'Search Index Cloud', + 'description' => 'Configure color tones, ignored words & chars and more.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('searchcloud_admin_settings'), + 'access arguments' => array('administer site configuration') ); - } return $items; } /** @@ -125,7 +121,8 @@ if (!empty($sSearchTerm)) { //check if the term exists, if not, add it, else increment its count: $rTermCheckQuery = db_query("SELECT * FROM {searchcloud} WHERE searchcloud_term='%s'", $sSearchTerm); - if (db_num_rows($rTermCheckQuery) > 0) { + $rTermCountQuery = db_result(db_query("SELECT COUNT(*) FROM {searchcloud} WHERE searchcloud_term='%s'", $sSearchTerm)); + if ($rTermCountQuery > 0) { // get the count, and add 1: $iSearchTermCount = (int)db_fetch_object($rTermCheckQuery)->searchcloud_count+1; // update the count: @@ -164,14 +161,15 @@ else { $rTermsQuery = db_query("SELECT * FROM {searchcloud}"); } - if (db_num_rows($rTermsQuery) > 0) { + $rTermsCountQuery = db_result(db_query("SELECT COUNT(*) FROM {searchcloud}")); + if ($rTermsCountQuery > 0) { // load the class: - require_once(drupal_get_path('module','searchcloud')."/classes/tagCloud.class.php"); + module_load_include('php', 'searchcloud', 'classes/tagCloud.class'); $aTerms = array(); while ($term = db_fetch_object($rTermsQuery)) { $aTerms[] = array( 'term'=>$term->searchcloud_term, - 'link'=>base_path()."search/node/".urlencode($term->searchcloud_term), + 'link'=>base_path()."?q=search/node/".urlencode($term->searchcloud_term), 'count'=>$term->searchcloud_count ); }