Author: sid.gbf
Date: 2010-03-16 22:00:59 +0100 (Tue, 16 Mar 2010)
New Revision: 28572

Modified:
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/createAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/deleteAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/editAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/newAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/processFormAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/updateAction.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/lib/helper.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_footer.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/editSuccess.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/newSuccess.php
   
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
Log:
Improvements



Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/createAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/createAction.php
       2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/createAction.php
       2010-03-16 21:00:59 UTC (rev 28572)
@@ -1,7 +1,10 @@
   public function executeCreate(sfWebRequest $request)
   {
-    $this->form = $this->configuration->getForm();
-    $this-><?php echo $this->getSingularName() ?> = $this->form->getObject();
+    $this-><?php echo $this->getSingularName() ?> = 
$this->configuration->getForm()->getObject();
+    if($request->getParameter('culture')) {
+      $this-><?php echo $this->getSingularName() 
?>->setDefaultCulture($request->getParameter('culture'));
+    }
+    $this->form = $this->configuration->getForm($this-><?php echo 
$this->getSingularName() ?>);
 
     $this->processForm($request, $this->form);
 

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/deleteAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/deleteAction.php
       2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/deleteAction.php
       2010-03-16 21:00:59 UTC (rev 28572)
@@ -9,5 +9,8 @@
       $this->getUser()->setFlash('notice', 'The item was deleted 
successfully.');
     }
 
+    if($request->getParameter('culture', false)) {
+      $this->redirect('@<?php echo $this->getUrlForAction('list') 
?>?culture='.$request->getParameter('culture'));
+    }
     $this->redirect('@<?php echo $this->getUrlForAction('list') ?>');
   }

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/editAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/editAction.php
 2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/editAction.php
 2010-03-16 21:00:59 UTC (rev 28572)
@@ -1,5 +1,8 @@
   public function executeEdit(sfWebRequest $request)
   {
     $this-><?php echo $this->getSingularName() ?> = 
$this->getRoute()->getObject();
+    if($request->getParameter('culture')) {
+      $this-><?php echo $this->getSingularName() 
?>->setDefaultCulture($request->getParameter('culture'));
+    }
     $this->form = $this->configuration->getForm($this-><?php echo 
$this->getSingularName() ?>);
   }

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/newAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/newAction.php
  2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/newAction.php
  2010-03-16 21:00:59 UTC (rev 28572)
@@ -1,5 +1,9 @@
   public function executeNew(sfWebRequest $request)
   {
-    $this->form = $this->configuration->getForm();
-    $this-><?php echo $this->getSingularName() ?> = $this->form->getObject();
+    $this-><?php echo $this->getSingularName() ?> = 
$this->configuration->getForm()->getObject();
+    if($request->getParameter('culture')) {
+      $this-><?php echo $this->getSingularName() 
?>->setDefaultCulture($request->getParameter('culture'));
+    }
+    $this->form = $this->configuration->getForm($this-><?php echo 
$this->getSingularName() ?>);
+    //$this-><?php echo $this->getSingularName() ?> = $this->form->getObject();
   }

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/processFormAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/processFormAction.php
  2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/processFormAction.php
  2010-03-16 21:00:59 UTC (rev 28572)
@@ -27,12 +27,21 @@
       {
         $this->getUser()->setFlash('notice', $notice.' You can add another one 
below.');
 
+        if($request->getParameter('culture', false)) {
+          $this->redirect('@<?php echo $this->getUrlForAction('new') 
?>?culture='.$request->getParameter('culture'));
+        }
+
         $this->redirect('@<?php echo $this->getUrlForAction('new') ?>');
       }
       else
       {
         $this->getUser()->setFlash('notice', $notice);
 
+
+        if($request->getParameter('culture', false)) {
+          $this->redirect(array('sf_route' => '<?php echo 
$this->getUrlForAction('edit') ?>', 'sf_subject' => $<?php echo 
$this->getSingularName() ?>, 'culture' => $request->getParameter('culture')));
+        }
+
         $this->redirect(array('sf_route' => '<?php echo 
$this->getUrlForAction('edit') ?>', 'sf_subject' => $<?php echo 
$this->getSingularName() ?>));
       }
     }

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/updateAction.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/updateAction.php
       2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/parts/updateAction.php
       2010-03-16 21:00:59 UTC (rev 28572)
@@ -1,6 +1,9 @@
   public function executeUpdate(sfWebRequest $request)
   {
     $this-><?php echo $this->getSingularName() ?> = 
$this->getRoute()->getObject();
+    if($request->getParameter('culture')) {
+      $this-><?php echo $this->getSingularName() 
?>->setDefaultCulture($request->getParameter('culture'));
+    }
     $this->form = $this->configuration->getForm($this-><?php echo 
$this->getSingularName() ?>);
 
     $this->processForm($request, $this->form);

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/lib/helper.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/lib/helper.php
      2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/lib/helper.php
      2010-03-16 21:00:59 UTC (rev 28572)
@@ -8,10 +8,13 @@
  * @author     ##AUTHOR_NAME##
  * @version    SVN: $Id: helper.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
  */
-abstract class Base<?php echo ucfirst($this->getModuleName()) 
?>GeneratorHelper extends sfModelGeneratorHelper
+abstract class Base<?php echo ucfirst($this->getModuleName()) 
?>GeneratorHelper extends sfjQueryDoctrineModelGeneratorHelper
 {
   public function getUrlForAction($action)
   {
     return 'list' == $action ? '<?php echo $this->params['route_prefix'] ?>' : 
'<?php echo $this->params['route_prefix'] ?>_'.$action;
   }
+  public function getLanguages() {
+    return ProjectConfiguration::$languages;
+  }
 }

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form.php
 2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form.php
 2010-03-16 21:00:59 UTC (rev 28572)
@@ -1,10 +1,10 @@
-[?php use_helper('JavascriptBase', 'JavascriptAdmin'); ?]
+[?php use_helper('JavascriptBase', 'JavascriptAdmin', 'ExtendedUrl'); ?]
 [?php form_event_handlers($form); ?]
 [?php use_stylesheets_for_form($form) ?]
 [?php use_javascripts_for_form($form) ?]
 
 <div class="sf_admin_form">
-  [?php echo form_tag_for($form, '@<?php echo $this->params['route_prefix'] 
?>') ?]
+  [?php echo ext_form_tag_for($form, '@<?php echo 
$this->params['route_prefix'] ?>', (($sf_params->get('culture', 
false))?array('culture' => $sf_params->get('culture', false)):array())) ?]
     [?php echo $form->renderHiddenFields(false) ?]
 
     [?php if ($form->hasGlobalErrors()): ?]

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_footer.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_footer.php
  2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/_form_footer.php
  2010-03-16 21:00:59 UTC (rev 28572)
@@ -0,0 +1,15 @@
+<div style="text-align: right">
+  [?php if($sf_params->get('culture', false) && !$<?php echo 
$this->getSingularName() ?>->isNew()): ?]
+    [?php echo __('Alterar idioma:'); ?]
+    [?php $languages = $helper->getLanguages(); ?]
+    [?php foreach($languages as $culture => $language): ?]
+      [?php if($culture == $sf_params->get('culture')) continue; ?]
+[?php echo link_to2(
+    image_tag('cultures/'.$culture.'.png', array('title' => $language, 'alt' 
=> $language)),
+    $helper->getUrlForAction('edit'),
+    array('sf_subject' => $<?php echo $this->getSingularName() ?>, 'culture' 
=> $culture),
+    array('confirm' => __('As alterações não salvas serão perdidas. Trocar de 
idioma?'))
+    ) ?]
+    [?php endforeach; ?]
+  [?php endif; ?]
+</div>
\ No newline at end of file

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/editSuccess.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/editSuccess.php
   2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/editSuccess.php
   2010-03-16 21:00:59 UTC (rev 28572)
@@ -3,6 +3,8 @@
 
 <div id="sf_admin_container">
   <h1>[?php echo <?php echo $this->getI18NString('edit.title') ?> ?]</h1>
+  [?php if(substr_count(<?php echo $this->getI18NString('edit.title') ?>, 
'""')) echo '<em class="help">'.__('O titulo será exibido corretamente assim 
que forem salvos os dados obrigatórios').'</em>' ?]
+  
 
   [?php include_partial('<?php echo $this->getModuleName() ?>/flashes') ?]
 
@@ -15,6 +17,6 @@
   </div>
 
   <div id="sf_admin_footer">
-    [?php include_partial('<?php echo $this->getModuleName() ?>/form_footer', 
array('<?php echo $this->getSingularName() ?>' => $<?php echo 
$this->getSingularName() ?>, 'form' => $form, 'configuration' => 
$configuration)) ?]
+    [?php include_partial('<?php echo $this->getModuleName() ?>/form_footer', 
array('<?php echo $this->getSingularName() ?>' => $<?php echo 
$this->getSingularName() ?>, 'form' => $form, 'configuration' => 
$configuration, 'helper' => $helper)) ?]
   </div>
 </div>

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/newSuccess.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/newSuccess.php
    2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/data/generator/sfDoctrineModule/javascript/template/templates/newSuccess.php
    2010-03-16 21:00:59 UTC (rev 28572)
@@ -15,6 +15,6 @@
   </div>
 
   <div id="sf_admin_footer">
-    [?php include_partial('<?php echo $this->getModuleName() ?>/form_footer', 
array('<?php echo $this->getSingularName() ?>' => $<?php echo 
$this->getSingularName() ?>, 'form' => $form, 'configuration' => 
$configuration)) ?]
+    [?php include_partial('<?php echo $this->getModuleName() ?>/form_footer', 
array('<?php echo $this->getSingularName() ?>' => $<?php echo 
$this->getSingularName() ?>, 'form' => $form, 'configuration' => 
$configuration, 'helper' => $helper)) ?]
   </div>
 </div>

Modified: 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
===================================================================
--- 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
    2010-03-16 19:12:17 UTC (rev 28571)
+++ 
plugins/sfjQueryDoctrineAdminPlugin/tag/0.1/lib/helper/JavascriptAdminHelper.php
    2010-03-16 21:00:59 UTC (rev 28572)
@@ -50,19 +50,19 @@
     $type = 
(!is_null($field->getWidget()->getOption('type')))?$field->getWidget()->getOption('type'):get_class($field->getWidget());
     switch($type) {
       case 'sfWidgetFormDoctrineChoice': {
-        $command .= '    jQuery("#'.$field->renderId().'").change( function() 
{ reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n";
+        $command .= '    jQuery("#'.$field->renderId().'").change( function() 
{ reset_function(); update_values("#'.$field->renderId().'") } );' . "\r\n";
         break;
       }
       case 'text': {
-        $command .= '    jQuery("#'.$field->renderId().'").blur( function() { 
reset_function(); update_values("'.$field->renderId().'") } );' . "\r\n";
+        $command .= '    jQuery("#'.$field->renderId().'").blur( function() { 
reset_function(); update_values("#'.$field->renderId().'") } );' . "\r\n";
         break;
       }
       case 'datepicker': {
-        $command .= '    jQuery("#'.$field->renderId().'_temp").change( 
function() { reset_function(); update_values("'.$field->renderId().'") } );' . 
"\r\n";
+        $command .= '    jQuery("#'.$field->renderId().'_temp").change( 
function() { reset_function(); update_values("#'.$field->renderId().'") } );' . 
"\r\n";
         break;
       }
       case 'fckeditor': {
-        echo javascript_tag('function FCKeditor_OnComplete(editor) { 
editor.Events.AttachEvent("OnBlur", function(editor) { 
jQuery("#'.$field->renderId().'").val(editor.GetHTML()); reset_function(); 
update_values("'.$field->renderId().'"); }); }' . "\r\n");
+        echo javascript_tag('function FCKeditor_OnComplete(editor) { 
editor.Events.AttachEvent("OnBlur", function(editor) { 
jQuery("input[name=\''.$field->renderId().'\']").val(editor.GetHTML()); 
reset_function(); update_values("input[name=\''.$field->renderId().'\']"); }); 
}' . "\r\n");
         $command .= '//FCKEditor is Outsite :) ' . "\r\n";
         break;
       }
@@ -98,16 +98,16 @@
     return 'function update_values(fieldName) {
   var newValue = "";
   if(document.getElementById(fieldName+"_temp")) {
-    newValue = jQuery("#"+fieldName+"_temp").val();
-  } else if(jQuery("#"+fieldName).attr("nodeType") == 1) {
-   newValue = jQuery("#"+fieldName+" :selected").text();
+    newValue = jQuery(fieldName+"_temp").val();
+  } else if(jQuery(fieldName).attr("tagName") == "SELECT") {
+   newValue = jQuery(fieldName+" :selected").text();
   } else {
-    newValue = jQuery("#"+fieldName).val();
+    newValue = jQuery(fieldName).val();
   }
   if(newValue == null || newValue == "") {
-    newValue = jQuery("#"+fieldName+"_edit > .help").html();
+    newValue = jQuery(fieldName+"_edit > .help").html();
   }
-  jQuery("#"+fieldName+"_view > .help").html(newValue);
+  jQuery(fieldName+"_view > .help").html(newValue);
 
 }'."\r\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