Author: david
Date: Wed Sep  2 12:53:15 2009
New Revision: 3146

Log:
Use translation helper for broad term and deafult input field to blank.  Don't 
orphan term if the 'broad term' field is empty, but the term already has a 
parent and we are not updating the source culture (prevent accidently orphaning 
term when translating it).

Modified:
   trunk/apps/qubit/modules/term/actions/editAction.class.php
   trunk/apps/qubit/modules/term/templates/editSuccess.php

Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php  Wed Sep  2 
00:02:43 2009        (r3145)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php  Wed Sep  2 
12:53:15 2009        (r3146)
@@ -234,10 +234,15 @@
 
   public function updateParent()
   {
-    // If broad term field is empty then make term a child of the root term
+    // If broad term field is empty
     if (0 == strlen(trim($this->getRequestParameter('broad_term'))))
     {
-      $this->term->parentId = QubitTerm::ROOT_ID;
+      // Don't orphan term if it has a parent in the source culture
+      if ($this->getUser()->getCulture() == $this->term->sourceCulture)
+      {
+        // then make term a child of the root term
+        $this->term->parentId = QubitTerm::ROOT_ID;
+      }
 
       return $this;
     }

Modified: trunk/apps/qubit/modules/term/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/editSuccess.php     Wed Sep  2 
00:02:43 2009        (r3145)
+++ trunk/apps/qubit/modules/term/templates/editSuccess.php     Wed Sep  2 
12:53:15 2009        (r3146)
@@ -86,8 +86,11 @@
 
     <div class="form-item">
       <label for="display note"><?php echo __('broad term'); ?></label>
+      <?php if (strlen($sourceCultureValue = 
$parent->getName(array('sourceCulture' => true))) > 0 && $sf_user->getCulture() 
!= $term->getSourceCulture()): ?>
+        <div class="default-translation"><?php echo nl2br($sourceCultureValue) 
?></div>
+      <?php endif; ?>
       <div id="broadTermAutoComplete" style="padding-bottom:2em; width:95%">
-        <input id="broadTermAcInput" type="text" name="broad_term" 
value="<?php echo $parent->getName(array('sourceCulture' => true)) ?>" />
+        <input id="broadTermAcInput" type="text" name="broad_term" 
value="<?php echo $parent->getName() ?>" />
         <div id="broadTermAcList"></div>
       </div>
     </div>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to