[drupal-devel] [feature] I added few error messages

drumm drupal-devel at drupal.org
Wed Aug 10 01:33:10 UTC 2005


Issue status update for 
http://drupal.org/node/27695
Post a follow up: 
http://drupal.org/project/comments/add/27695

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  kubaZygmunt
 Updated by:   drumm
-Status:       patch (code needs review)
+Status:       patch (code needs work)

forgot to change the status


And two small indentation problems:


+        taxonomy_vocabulary_validate($edit);
+          if (!form_get_errors()) {
and


-  $form .= form_textarea(t('Synonyms'), 'synonyms', implode("\n",
taxonomy_get_synonyms($edit['tid'])), 60, 5, t('Synonyms [1] of this
term, one synonym per line.', array('%help-url' =>
url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));
+	$synonyms = (isset($edit['synonyms'])) ? $edit['synonyms'] :
implode("\n",taxonomy_get_synonyms($edit['tid']));
+  $form .= form_textarea(t('Synonyms'), 'synonyms', $synonyms, 60, 5,
t('Synonyms [2] of this term, one synonym per line.', array('%help-url'
=> url('admin/help/taxonomy', NULL, NULL, 'synonyms'))));[1]
http://drupal.org/%help-url
[2] http://drupal.org/%help-url




drumm



Previous comments:
------------------------------------------------------------------------

Thu, 28 Jul 2005 16:13:23 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/taxonomy_3.module (52.92 KB)

During writing my test for Drupaltest I saw that we don't have error
messages in taxonomy module, so you can add taxonomy with empty name!!
:)
I've added something which prevent from this




------------------------------------------------------------------------

Thu, 28 Jul 2005 16:22:05 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/taxonomy_10.patch (5.24 KB)

I added diff patch




------------------------------------------------------------------------

Fri, 29 Jul 2005 07:17:59 +0000 : Dries

Please resubmit without tabs and proper coding conventions.  Thanks.




------------------------------------------------------------------------

Fri, 29 Jul 2005 17:06:45 +0000 : Steven

Putting all these tests into separate functions is a bit too much IMO.




------------------------------------------------------------------------

Sun, 31 Jul 2005 11:51:28 +0000 : kubaZygmunt

Attachment: http://drupal.org/files/issues/taxonomy.module.patch.txt (7.04 KB)

Ok, I've updated these functions, improved my style and changed a little
code which prevents from deleting voc. and terms after changing name to
0.


1.
Changing name to '0' (single number) causes that the condition:

<?php
if ($edit['vid'] && $edit['name'])
?>


will fail.


2. There was an error in taxonomy_del_term() function which gives
error/warning message.




------------------------------------------------------------------------

Wed, 10 Aug 2005 01:02:59 +0000 : drumm

After deleting a forum (which is internally stored as a term) I get two
messages:


    * Deleted term fdgfd.
    * The forum 0 has been updated.


The forum was named "fdgfd." I think that deleting terms needs to
return the same status and name array as the other operations and not
call drupal_set_message(). This is needed so modules built on taxonomy
such as forum and image can fully override the terminology used. And
this also separates the model and controller layers.


This becomes problematic quickly since the delete function is recursive
and the return type does not currently have room to store information
about multiple deleted terms. I think deleting terms should not be
recursive and any child terms should have their parent set to the
deleted term's parent. I think this would be easier to code and makes
this action more forgiving for users.







More information about the drupal-devel mailing list