Author: gimler
Date: 2010-01-14 16:53:08 +0100 (Thu, 14 Jan 2010)
New Revision: 26640

Modified:
   
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/templates/_nested_set_list.php
Log:
sfJqueryTreeDoctrineManagerPlugin: format and fix display waiting notice

Modified: 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/templates/_nested_set_list.php
===================================================================
--- 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/templates/_nested_set_list.php
  2010-01-14 15:43:12 UTC (rev 26639)
+++ 
plugins/sfJqueryTreeDoctrineManagerPlugin/trunk/modules/sfJqueryTreeDoctrineManager/templates/_nested_set_list.php
  2010-01-14 15:53:08 UTC (rev 26640)
@@ -9,17 +9,13 @@
             elseif ($record->getNode()->getLevel() < $prevLevel) echo 
str_repeat('</ul></li>', $prevLevel - $record->getNode()->getLevel()); ?>
             <li id ="phtml_<?php echo $record->id ?>" class="open">
                 <a href="#"><ins>&nbsp;</ins><?php echo $record->$field;?></a> 
-            <?php $prevLevel = $record->getNode()->getLevel();
-        endforeach; ?>
+            <?php $prevLevel = $record->getNode()->getLevel(); ?>
+        <?php endforeach; ?>
 
-        
-        
-        
-        
-        
         </ul>
     </div>
 <?php endif;?>
+
 <?php echo javascript_tag();?>
 $(function () { 
 
@@ -31,12 +27,12 @@
             onrename : function (NODE, TREE_OBJ, RB) {
                 $('.error').remove();
                 $('.notice').remove();
-                                                               
$('.nested_set_manager_holder').before('<div class="waiting"><?php echo 
__('Sending data to server.');?></div>');
                 if (TREE_OBJ.get_text(NODE) == 'New folder'){
                     $('.nested_set_manager_holder').before('<div 
class="error">"'+TREE_OBJ.get_text(NODE)+'" <?php echo __('is not a valid 
name');?></div>');
                     $.tree.focused().rename();
                 }
                 else {
+                    $('.nested_set_manager_holder').before('<div 
class="waiting"><?php echo __('Sending data to server.');?></div>');
                     if (NODE.id == ''){ // happen if creation of a new node
                         $.ajax({
                             type: "POST",
@@ -44,11 +40,11 @@
                             dataType : 'json',
                             data : 'model=<?php echo $model;?>&root=<?php echo 
$root;?>&field=<?php echo 
$field;?>&value='+TREE_OBJ.get_text(NODE)+'&parent_id=' + 
TREE_OBJ.parent(NODE).attr('id').replace('phtml_',''),
                             complete : function(){ 
-                                                                               
                                $('.waiting').remove();
-                                                                               
                          },
-                                                                               
                                success : function (data, textStatus) {
+                                $('.waiting').remove();
+                            },
+                            success : function (data, textStatus) {
                                 $('.nested_set_manager_holder').before('<div 
class="notice"><?php echo __('The item was created successfully.');?></div>');
-                                                                               
                                                
$(NODE).attr('id','phtml_'+data.id);
+                                $(NODE).attr('id','phtml_'+data.id);
                             },
                             error : function (data, textStatus) {
                                 $('.nested_set_manager_holder').before('<div 
class="error"><?php echo __('Error while creating the item.');?></div>');
@@ -56,20 +52,17 @@
                             }
 
                         });
-                        
-                        
                     }
                     else { // happen when renaming an existing node
-                        
                         $.ajax({
                             type: "POST",
                             url : '<?php echo 
url_for('sfJqueryTreeDoctrineManager/Edit_field');?>',
                             dataType : 'json',
                             data : 'model=<?php echo $model;?>&field=<?php 
echo $field;?>&value='+TREE_OBJ.get_text(NODE)+'&id=' + 
NODE.id.replace('phtml_',''),
                             complete : function(){ 
-                                                                               
                                $('.waiting').remove();
-                                                                               
                          },
-                                                                               
                                success : function (data, textStatus) {
+                                $('.waiting').remove();
+                            },
+                            success : function (data, textStatus) {
                                 $('.nested_set_manager_holder').before('<div 
class="notice"><?php echo __('The item was renamed successfully.');?></div>');
                             },
                             error : function (data, textStatus) {
@@ -77,31 +70,30 @@
                                 $.tree.rollback(RB);
                             }
                         });
- 
                     }
                 }
-                       },
-            
+            },
+
             ondblclk : function (NODE, TREE_OBJ){
                 $('.error').remove();
                 $('.notice').remove();
                 $.tree.focused().rename();
             },
-            
+
             onmove: function(NODE, REF_NODE, TYPE, TREE_OBJ, RB){
                 $('.error').remove();
                 $('.notice').remove();
                 $('.nested_set_manager_holder').before('<div 
class="waiting"><?php echo __('Sending data to server.');?></div>');
-                                                                       
+                                    
                 $.ajax({
                     type: "POST",
                     url : '<?php echo 
url_for('sfJqueryTreeDoctrineManager/Move');?>',
                     dataType : 'json',
                     data : 'model=<?php echo $model;?>&id=' + 
NODE.id.replace('phtml_','') +'&to_id=' + REF_NODE.id.replace('phtml_','') + 
'&movetype=' + TYPE, 
                     complete : function(){ 
-                                                                               
$('.waiting').remove();
-                                                                         },
-                                                                               
success : function (data, textStatus) {
+                        $('.waiting').remove();
+                    },
+                    success : function (data, textStatus) {
                         $('.nested_set_manager_holder').before('<div 
class="notice"><?php echo __('The item was moved successfully.');?></div>');
                     },
                     error : function (data, textStatus) {
@@ -109,12 +101,8 @@
                         $.tree.rollback(RB);
                     }
                 });
-                
-                
-                
-                    
-                    
             },
+
             ondelete: function(NODE, TREE_OBJ, RB){
                 $('.error').remove();
                 $('.notice').remove();
@@ -125,9 +113,9 @@
                     dataType : 'json',
                     data : 'model=<?php echo $model;?>&id=' + 
NODE.id.replace('phtml_','') , 
                     complete : function(){ 
-                                                                               
$('.waiting').remove();
-                                                                         },
-                                                                               
success : function (data, textStatus) {
+                        $('.waiting').remove();
+                    },
+                    success : function (data, textStatus) {
                         $('.nested_set_manager_holder').before('<div 
class="notice"><?php echo __('The item was deleted successfully.');?></div>');
                     },
                     error : function (data, textStatus) {

-- 
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