CVS edit link for vasi1186

Hello,

My name is Vasi CHINDRIS and I am a Drupal developer for about 2 years. Recently, I had to implement a feature in a project that would generate tags from certain text input fields of a content type. This is the main idea of the module that I want to share on drupal.org. It's name is "Node Tags Generator". It's main feature, as I said before, is to generate tags from the text that a user enters in certain text input fields of a node. The fields that can be used are: title, body and any other cck field that is a textfield or a textarea.
The module has an administration page from where the admin can set up for each combination of ("node type", "category that represents tags") what fields of the "node type" should be used to generate the tags in "category that represents tags". Also, the admin can decide on which forms (add and/or edit) the tags should be generated. For example: if I make a tags category and assign it to the page node type, then assign some cck fields to the page content type, I can choose that the tags to be generated on the add form, but not on edit form. In this case, when the user will add a new node, he will not see the input field for tags, but when he edits the node, he will be able also to edit the tags.
The module uses a list with stop words, that will be eliminated from the text that is entered by the user, so that words like "the", "is", "a" etc. are not considered. I took the list of words from here: http://members.unine.ch/jacques.savoy/clef/index.html and I used the English, French, German and Italian stop words.
Until now I didn't find any other module that can do this thing and I consider it useful because of at least 2 reasons:
1) The process of creating new nodes with tags becomes a bit faster, because the user does not have to enter data also for the tags field.
2) From my experience, many times the users do not consider tagging their content when possible, or introduce a small number or words (because usually the tag field is at the end of the forms and the user wants to finish the process as quickly as possible). Also, being generated from the content itself, the tags may have a stronger bound with the node that is created.
Currently, I have implemented the module for the versions 5 and 6 of Drupal. I have tested them on versions 5.20 and 6.16 and I plan to not add any new feature for the current version of the module. I will fix only the bugs in them.

Comments

vasi1186’s picture

Issue tags: +taxonomy, +tags
StatusFileSize
new10.84 KB
new10.29 KB
vasi1186’s picture

Status: Postponed (maintainer needs more info) » Needs review
avpaderno’s picture

Status: Needs review » Needs work
Issue tags: -taxonomy, -tags +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review your code, pointing out what needs to be changed.

The module description reminds me of http://drupal.org/project/int_meta. We review a module / theme per applicant; let us know which one you want reviewed.

vasi1186’s picture

Status: Needs work » Needs review

Hi,

thanks for your fast response!. I had a look over the http://drupal.org/project/int_meta module and from what I have seen in the description, the module is capable of generating metatags that are usually useful for SEO. Now, the tags that my module generates are not this kind of tags. They are in fact taxonomy terms in the end. You can use these tags to create for example a tag cloud, with tagadelic module from what I remember... It's the same thing as if you would assign a taxonomy to a content type, a taxonomy that generates terms from a comma separated string (it has the "tags" flag on). Just that these terms are generated from the data entered by the user.
But the decision if this module brings something new to the Drupal community is yours, so if you think that this module should be reviewed, then I would want to be reviewed the module for Drupal 6.
A demo page can be found here: http://drupaldemos.net/?q=node/3
Regards,

Vasi CHINDRIS.

dawehner’s picture

Status: Needs review » Needs work

	return array('administer node tags generator');

Please use spaces instead of tabs.

vasi1186’s picture

Status: Needs work » Needs review
StatusFileSize
new10.91 KB

Hi,

I replaced the tabs with spaces and I attached the new module.

Regards,

Vasi.

avpaderno’s picture

Assigned: Unassigned » avpaderno

I will review the code within 6 days; for sure, I will not review it in the next 2 days.

avpaderno’s picture

Status: Needs review » Needs work
  1. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how the code should be formatted.
  2. The content of the file node_tags_generator.stopwords.inc doesn't seem to be UTF-8. Considering the file contains accented words, that could be a problem (PS: abbiomo is not an Italian word).
  3.     case 'presave':{
          require_once("node_tags_generator.stopwords.inc");
    

    That code is looking for the file in the Drupal root directory. There is a Drupal function that should be used in such cases.

  4. /**
     * Implementation of hook_install
     *
     */
    function node_tags_generator_install(){
      //ensure that the weight of the module is bigger than the weight of the taxonomy module
      switch ($GLOBALS['db_type']) {
        case 'mysql':
        case 'mysqli': {
            $taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name='taxonomy'"));
            db_query("UPDATE {system} SET weight=%d WHERE name='node_tags_generator'", $taxonomy_weight+1);
          break;
        }
        case 'pgsql':{
            $taxonomy_weight = db_result(db_query("SELECT weight FROM {system} WHERE name='taxonomy'"));
            db_query("UPDATE {system} SET weight=%d WHERE name='node_tags_generator'", $taxonomy_weight+1);
          break;
        }
      }
    }
    

    The code is still in style Drupal 5; apart that, the queries are the same.

  5. function node_tags_generator_form_alter(&$form, &$form_state, $form_id){
      if (strpos($form_id, "_node_form") !== FALSE){
    

    That condition is not enough to verify if the form is the node form (there could be other forms with an ID ending in _node_form.

  6. Strings used in the user interface should be in sentence case.
  7.   if (!module_exists('taxonomy')){
        return t('Taxonomy module must be enabled in order to use this module.');
      }
    

    That code is useless; as the module requires taxonomy.module, it cannot be enabled without to enable first taxonomy.module.

  8. Settings that depend on the content type are added to the content type editing form.
vasi1186’s picture

ok, thank you very much, I will review the code and submit a better version.

avpaderno’s picture

Status: Needs work » Closed (won't fix)
avpaderno’s picture

Component: Miscellaneous » new project application
Assigned: avpaderno » Unassigned
Issue summary: View changes
Status: Closed (won't fix) » Closed (duplicate)
Related issues: +#1068290: [D6] OG Invite Link