Author: jaimesuez
Date: 2010-04-20 03:45:35 +0200 (Tue, 20 Apr 2010)
New Revision: 29216
Modified:
plugins/sfDoctrineAjaxFormPlugin/lib/widget/sfWidgetFormDinamicEmbeddedForm.class.php
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_add_embedded_form_default.php
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_default.php
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_table.php
Log:
EMBEDDED FORMS:
DISTINTOS LAYOUTS
Cuadriculado
Credenciales y opcional las acciones: hide, unlink y delte
Modified:
plugins/sfDoctrineAjaxFormPlugin/lib/widget/sfWidgetFormDinamicEmbeddedForm.class.php
===================================================================
---
plugins/sfDoctrineAjaxFormPlugin/lib/widget/sfWidgetFormDinamicEmbeddedForm.class.php
2010-04-19 19:50:43 UTC (rev 29215)
+++
plugins/sfDoctrineAjaxFormPlugin/lib/widget/sfWidgetFormDinamicEmbeddedForm.class.php
2010-04-20 01:45:35 UTC (rev 29216)
@@ -61,15 +61,20 @@
$this->addOption('partial',
"ajax_form/autocomplete_with_embedded_forms_default");
$this->addOption('create_partial', "ajax_form/add_embedded_form_default");
- $this->addOption('credentials', false);
$this->addOption('unset', array());
$this->addOption('thumbnail', null);
$this->addOption('create_text', null);
+ $this->addOption('initial_embedded', 0);
$this->addOption('with_hide', true);
- $this->addOption('initial_embedded', 0);
+ $this->addOption('with_unlink', true);
+ $this->addOption('with_delete', true);
+ $this->addOption('unlink_credentials', false);
+ $this->addOption('delete_credentials', false);
+
+
//se dejan opcionales estas opciones del autocompleter normal (eran
requeridas)
$this->addOption('url',
sfContext::getInstance()->getController()->genUrl('ajax_form/autocomplete?' .
'widget_model=' . module_to_class($options['widget_model']) .
@@ -97,12 +102,15 @@
$form_module_relation = $this->getOption('form_module_relation');
$foreign_type = $this->getOption('foreign_type');
$columns = $this->getOption('columns');
- $credentials = $this->getOption('credentials');
+ $unlink_credentials = $this->getOption('unlink_credentials');
+ $delete_credentials = $this->getOption('delete_credentials');
$partial = $this->getOption('partial');
$create_partial = $this->getOption('create_partial');
$thumbnail = $this->getOption('thumbnail');
$create_text = $this->getOption('create_text');
$with_hide = $this->getOption('with_hide');
+ $with_unlink = $this->getOption('with_unlink');
+ $with_delete = $this->getOption('with_delete');
$initial_embedded = $this->getOption('initial_embedded');
$hide = $form[$embedded_name]->count() >= $number_embedded ?
'$("#autocomplete_' . $module . '_form_' . $widget_name . '").hide(); $("#img_'
. $module . '_form_' . $widget_name . '").hide();' : '';
@@ -158,11 +166,14 @@
'form_module_relation' => $form_module_relation,
'foreign_type' => $foreign_type,
'columns' => $columns,
- 'credentials' => $credentials,
+ 'unlink_credentials' => $unlink_credentials,
+ 'delete_credentials' => $delete_credentials,
'thumbnail' => $thumbnail,
"create_text" => $create_text,
'create_partial' => $create_partial,
"with_hide" => $with_hide,
+ "with_unlink" => $with_unlink,
+ "with_delete" => $with_delete,
"initial_embedded" => $initial_embedded,
));
}
Modified:
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_add_embedded_form_default.php
===================================================================
---
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_add_embedded_form_default.php
2010-04-19 19:50:43 UTC (rev 29215)
+++
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_add_embedded_form_default.php
2010-04-20 01:45:35 UTC (rev 29216)
@@ -12,11 +12,11 @@
if ($id_related_object > 0 && $with_hide == true)
{
- $with_undo = true;
+ $with_hide = true;
}
else
{
- $with_undo = false;
+ $with_hide = false;
}
?>
@@ -24,7 +24,7 @@
<!--############################### 100% igual, refactorizar
################################## -->
<!--############################### PARTIAL DEL LINK AL FORMULARIO (solo si
existe el objeto y no es nuevo) ################################## -->
-<?php if ($with_undo): ?>
+<?php if ($with_hide): ?>
<div id="<?php echo $embedded_name ?>_related_object_form_name_<?php echo
$number ?>"
class="<?php echo $embedded_name ?>_related_object_form_new_<?php echo
$number ?> content">
<a id="<?php echo $embedded_name ?>_related_object_form_link_<?php echo
$number ?>" style="font-weight:bold;"
@@ -44,7 +44,7 @@
<!--############################### PARTIAL DEL FORMULARIO
################################## -->
-<div class="sf_admin_form_field_<?php echo $embedded_name ?>" style="<?php
echo $with_undo ? "display:none" : "" ?>"
+<div class="sf_admin_form_field_<?php echo $embedded_name ?>" style="<?php
echo $with_hide ? "display:none" : "" ?>"
id="<?php echo $embedded_name ?>_related_object_form_new_<?php echo
$number ?>">
<?php echo $form[$embedded_name][$number]->renderError() ?>
@@ -54,7 +54,7 @@
<!-- La clase del link es el id del objeto que tiene que deshacer -->
- <?php if ($with_undo): ?>
+ <?php if ($with_hide): ?>
<?php echo
_tag("a#{$embedded_name}_related_object_form_hide_{$number}.{$embedded_name}_related_object_form_new_{$number}.s16_arrow_down
title=Ocultar", 'Ocultar') ?>
<?php endif ?>
<?php echo
_tag("a#{$embedded_name}_related_object_form_undo_{$number}.{$embedded_name}_related_object_form_new_{$number}.s16_undo
title=Deshacer", 'Deshacer') ?>
Modified:
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_default.php
===================================================================
---
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_default.php
2010-04-19 19:50:43 UTC (rev 29215)
+++
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_default.php
2010-04-20 01:45:35 UTC (rev 29216)
@@ -13,9 +13,9 @@
<?php if ($is_autocomplete): ?>
<img style="display:none" src="/sfDoctrinePlugin/images/delete.png"
id="<?php echo $module ?>_form_<?php echo $widget_name ?>_delete" />
<?php endif ?>
- <?php if ($form[$embedded_name]->count() < $number_embedded): ?>
- <a id="<?php echo $module ?>_form_<?php echo $widget_name ?>_crear"
style="cursor:pointer;"><?php echo is_null($create_text) ? "Crear $widget_name"
: $create_text ?></a>
- <?php endif ?>
+ <a id="<?php echo $module ?>_form_<?php echo $widget_name ?>_crear"
style="cursor:pointer;<?php echo $form[$embedded_name]->count() <
$number_embedded ? "" : "display:none;"?>">
+ <?php echo is_null($create_text) ? "Crear $widget_name" : $create_text ?>
+ </a>
</div>
<!--############################### LINKS A OBJETOS RELACIONADOS Y EMBEDDED
FORMS ################################## -->
@@ -64,12 +64,15 @@
<!-- si no hay errores ponemos botones: hide, unlink y delete -->
<?php if ($embedded['id']->getValue() > 0): ?>
<?php if ($with_hide): ?>
- <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_hide_{$embedded['id']->getValue()}.s16_arrow_down
title=Ocultar", 'Ocultar') ?>
+ <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_hide_{$embedded['id']->getValue()}.s16_arrow_down",
'Ocultar') ?>
<?php endif ?>
- <?php if (!$credentials ||
sfContext::getInstance()->getUser()->hasCredential($credentials)): ?>
- <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_unlink_{$embedded['id']->getValue()}.s21_unlink
title=Quitar asociación", 'Quitar asociación') ?>
- <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_delete_{$embedded['id']->getValue()}.s16.s16_delete
title=Borrar", 'Borrar') ?>
+ <?php if ($with_unlink &&
sfContext::getInstance()->getUser()->hasCredential($unlink_credentials,
false)): ?>
+ <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_unlink_{$embedded['id']->getValue()}.s21_unlink",
'Quitar asociación') ?>
<?php endif ?>
+ <?php if ($with_delete &&
sfContext::getInstance()->getUser()->hasCredential($delete_credentials,
false)): ?>
+ <?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_delete_{$embedded['id']->getValue()}.s16.s16_delete",
'Borrar') ?>
+ <?php endif ?>
+
<?php else: ?>
<!-- si hay errores ponemos boton: undo -->
@@ -107,7 +110,6 @@
'form_module_relation' => $form_module_relation,
'foreign_type' => $foreign_type,
'columns' => $columns,
- 'credentials' => $credentials,
'thumbnail' => $thumbnail,
'create_partial' => $create_partial,
"create_text" => $create_text,
Modified:
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_table.php
===================================================================
---
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_table.php
2010-04-19 19:50:43 UTC (rev 29215)
+++
plugins/sfDoctrineAjaxFormPlugin/modules/ajax_form/templates/_autocomplete_with_embedded_forms_table.php
2010-04-20 01:45:35 UTC (rev 29216)
@@ -52,8 +52,10 @@
<td>
<!-- si no hay errores ponemos botones: unlink y delete -->
<?php if ($embedded['id']->getValue() > 0): ?>
- <?php if (!$credentials ||
sfContext::getInstance()->getUser()->hasCredential($credentials)): ?>
+ <?php if ($with_unlink &&
sfContext::getInstance()->getUser()->hasCredential($unlink_credentials,
false)): ?>
<?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_unlink_{$embedded['id']->getValue()}.s21_unlink
title=Quitar asociación", '') ?>
+ <?php endif ?>
+ <?php if ($with_delete &&
sfContext::getInstance()->getUser()->hasCredential($delete_credentials,
false)): ?>
<?php echo
_tag("a#{$module}_form_{$widget_name}_related_object_form_delete_{$embedded['id']->getValue()}.s16.s16_delete
title=Borrar", '') ?>
<?php endif ?>
<?php else: ?>
@@ -82,7 +84,6 @@
'form_module_relation' => $form_module_relation,
'foreign_type' => $foreign_type,
'columns' => $columns,
- 'credentials' => $credentials,
'thumbnail' => $thumbnail,
'create_partial' => $create_partial,
"create_text" => $create_text,
--
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.