Author: boutell
Date: 2010-02-02 17:06:53 +0100 (Tue, 02 Feb 2010)
New Revision: 27426

Modified:
   plugins/sfDoctrineActAsTaggablePlugin/trunk/
   plugins/sfDoctrineActAsTaggablePlugin/trunk/README
   plugins/sfDoctrineActAsTaggablePlugin/trunk/config/doctrine/schema.yml
   
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/task/taggableCleanTask.class.php
Log:
merged changes from punkave branch




Property changes on: plugins/sfDoctrineActAsTaggablePlugin/trunk
___________________________________________________________________
Modified: svn:ignore
   - package.xml

   + sfDoctrineActAsTaggablePlugin*tgz
package.xml


Modified: plugins/sfDoctrineActAsTaggablePlugin/trunk/README
===================================================================
--- plugins/sfDoctrineActAsTaggablePlugin/trunk/README  2010-02-02 15:50:00 UTC 
(rev 27425)
+++ plugins/sfDoctrineActAsTaggablePlugin/trunk/README  2010-02-02 16:06:53 UTC 
(rev 27426)
@@ -16,6 +16,23 @@
  * jQuery-based typeahead for tags (optional)
  * easy tags fixtures loading NOT YET
 
+## Upgrade Note ##
+
+Prior to my svn commit of 2009-08-03, the typeahead support inserted 
nonbreaking
+spaces, which some web browsers actually submitted even though they were part
+of plaintext elements. This has been fixed.
+
+You may have existing tag databases with what appear to be duplicate tags due
+to the existence of "Bob Smith" (with a normal space) and "Bob Smith"
+(with a nonbreaking space) side by side.
+
+The following MySQL command will clean this up:
+
+    update tagging set tag_id = 
+      (select id from tag where tag.name = 
+        trim(replace((select name from tag where tag.id = tag_id), 
+      char(160), ' ')));
+
 ## Philosophy of the stuff ##
 
  * taggable models must have a primary key
@@ -340,33 +357,37 @@
 element containing a `ul` element containing `li` elements, with the new,
 selectable tag suggestions being in `a` elements within those. 
 
-The rest of the tags are present as non-clickable text in each `li` because 
-this neatly lines up the new tag suggestion with the user's input. Just
-hide that text with `visibility: hidden`, NOT `display: none`. 
+The rest of the tags are present as non-clickable text in each `li` which makes
+it easy to reset the entire tag input field at one whack. Note that we now
+use `display: none` for the non-visible portion. 
 
 The right way to write your CSS depends on how your forms are structured.
-In our case, the label to the left of the input element is fixed at 120 pixels
-wide and the input element has a few pixels of padding, so this works great
-for our needs:
+The important thing is to hide the tag-spacer class:
 
-    span.tag-suggestions
-    {
-      display: block;
-      clear: both;
-      padding-top: 8px;
-      padding-left: 122px;
-    }
+.tag-suggestions.tag-spacer
+{
+  display: none;
+}
 
-    span.tag-suggestions li
-    {
-      visibility: hidden;
-    }
+We now recommend `display: none` rather than `visibility: hidden` because
+the latter works poorly if the tag string is long enough to cause an input 
element
+to wrap. It's better to simply display the suggestions at left below the
+input field. You might want to push `.tag-suggestions` over a bit with
+`padding-left`.
 
-    span.tag-suggestions a
-    {
-      visibility: visible;
-    }
+### Cleaning Up Orphan Tags ###
 
+Due to the limitations of foreign key relationships and the possibility of 
taggings pointing to many different tables, tags which no longer have any 
taggings are not automatically deleted from the database. Such orphan tags can 
be cleaned up easily with the `taggable:clean` Symfony task:
+
+    ./symfony taggable:clean
+
+Since this task is typically run from cron, it is silent by default unless 
something goes wrong. However, you can request verbose output:
+
+    ./symfony taggable:clean --verbose
+
+The `application`, `env`, and `connection` options are also supported.
+
+>>>>>>> .merge-right.r27425
 ## Plugin internals ##
 The plugin associates a parameterHolder to Propel objects, with 3 disjoin 
namespaces:
 

Modified: plugins/sfDoctrineActAsTaggablePlugin/trunk/config/doctrine/schema.yml
===================================================================
--- plugins/sfDoctrineActAsTaggablePlugin/trunk/config/doctrine/schema.yml      
2010-02-02 15:50:00 UTC (rev 27425)
+++ plugins/sfDoctrineActAsTaggablePlugin/trunk/config/doctrine/schema.yml      
2010-02-02 16:06:53 UTC (rev 27426)
@@ -16,13 +16,18 @@
       type:           string(100)
   indexes:
     name:
-      fields: name
+      # boutell: this needs to be an array not just a string.
+      # The Doctrine MySQL driver was either honoring or ignoring it.
+      # The SQLite driver throws an exception, and justly so. Same for
+      # the other three indexes here. The indexes on Tagging were
+      # set up correctly
+      fields: [name]
     triple1:
-      fields: triple_namespace
+      fields: [triple_namespace]
     triple2:
-      fields: triple_key
+      fields: [triple_key]
     triple3:
-      fields: triple_value
+      fields: [triple_value]
         
 Tagging:
   columns:
@@ -47,4 +52,4 @@
   attributes:
     # don't export constraints. This is necessary because multiple models can 
     #  join Tagging on taggable_id
-    export: [ all, constraints ] 
\ No newline at end of file
+    export: [ all, constraints ] 

Modified: 
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/task/taggableCleanTask.class.php
===================================================================
--- 
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/task/taggableCleanTask.class.php
    2010-02-02 15:50:00 UTC (rev 27425)
+++ 
plugins/sfDoctrineActAsTaggablePlugin/trunk/lib/task/taggableCleanTask.class.php
    2010-02-02 16:06:53 UTC (rev 27426)
@@ -13,6 +13,7 @@
       new sfCommandOption('application', null, 
sfCommandOption::PARAMETER_REQUIRED, 'The application name'),
       new sfCommandOption('env', null, sfCommandOption::PARAMETER_REQUIRED, 
'The environment', 'dev'),
       new sfCommandOption('connection', null, 
sfCommandOption::PARAMETER_REQUIRED, 'The connection name', 'doctrine'),
+      new sfCommandOption('verbose', null, sfCommandOption::PARAMETER_NONE, 
'Display more output', NULL),
       // add your own options here
     ));
 
@@ -34,7 +35,10 @@
     $connection = $databaseManager->getDatabase($options['connection'] ? 
$options['connection'] : null)->getConnection();
 
     $deleted = PluginTagTable::purgeOrphans();
-    $count = count($deleted);
-    echo "deleted $count orphan tags.\n";
+    if ($options['verbose'])
+    {
+      $count = count($deleted);
+      echo "deleted $count orphan tags.\n";      
+    }
   }
 }

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to