Author: jaimesuez
Date: 2010-04-13 17:38:42 +0200 (Tue, 13 Apr 2010)
New Revision: 29113

Added:
   plugins/sfReadOnlyWidgetsPlugin/LICENSE
   plugins/sfReadOnlyWidgetsPlugin/README
   plugins/sfReadOnlyWidgetsPlugin/lib/
   plugins/sfReadOnlyWidgetsPlugin/lib/widget/
   
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php
   
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php
   
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputTextReadOnly.class.php
   plugins/sfReadOnlyWidgetsPlugin/package.xml
   plugins/sfReadOnlyWidgetsPlugin/svn-commit.tmp
Log:
inii


Added: plugins/sfReadOnlyWidgetsPlugin/LICENSE
===================================================================
--- plugins/sfReadOnlyWidgetsPlugin/LICENSE                             (rev 0)
+++ plugins/sfReadOnlyWidgetsPlugin/LICENSE     2010-04-13 15:38:42 UTC (rev 
29113)
@@ -0,0 +1,5 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.

Added: plugins/sfReadOnlyWidgetsPlugin/README
===================================================================
--- plugins/sfReadOnlyWidgetsPlugin/README                              (rev 0)
+++ plugins/sfReadOnlyWidgetsPlugin/README      2010-04-13 15:38:42 UTC (rev 
29113)
@@ -0,0 +1,12 @@
+sfDoctrineAjaxFormPlugin
+========================
+
+The `sfDoctrineAjaxFormPlugin` is a symfony plugin for Diem CMS for 
relationships with
+embedded forms using Ajax.
+
+TODO
+----
+
+  * documentation
+  * many to many relationship
+  * make it work with symfony and not only with Diem

Added: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php
===================================================================
--- 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php
                             (rev 0)
+++ 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php
     2010-04-13 15:38:42 UTC (rev 29113)
@@ -0,0 +1,92 @@
+<?php
+
+class sfWidgetFormDoctrineChoiceReadOnly extends sfWidgetFormDoctrineChoice
+{
+
+  //para que no se borre los choices siempre
+  public function __construct($options = array(), $attributes = array())
+  {
+    if (!isset($options["choices"]))
+    {
+      $options['choices'] = array();
+    }
+
+    sfWidgetFormChoice::__construct($options, $attributes);
+  }
+  
+  protected function configure($options = array(), $attributes = array())
+  {
+    $this->addRequiredOption("form");
+    $this->addRequiredOption("column");
+    $this->addOption("translator_function", null);
+    $this->addOption("helper_for_function", null);
+    $this->addOption("translator_array", array());
+
+    $this->addOption("model", null);
+
+    parent::configure($options, $attributes);
+  }
+  
+  public function render($name, $value = null, $attributes = array(), $errors 
= array())
+  {
+    $form = $this->getOption("form");
+    $column = $this->getOption("column");
+    $translator_function = $this->getOption("translator_function");
+    $helper_for_function = $this->getOption("helper_for_function");
+    $translator_array = $this->getOption("translator_array");
+
+    if (!is_null($helper_for_function))
+    {
+      
sfApplicationConfiguration::getActive()->loadHelpers($helper_for_function);
+    }
+
+    if (!$form->isNew())
+    {
+      if (isset($form->getObject()->$column))
+      {
+        if (!is_null($translator_function))
+        {
+          return $translator_function($form->getObject()->$column);
+        }
+        elseif (count($translator_array) > 0)
+        {
+          return $translator_array[$form->getObject()->$column];
+        }
+        else
+        {
+          return $form->getObject()->$column;
+        }
+      }
+      else
+      {
+        return "No asignado";
+      }
+    }
+    else
+    {
+      return parent::render($name, $value, $attributes, $errors);
+    }
+  }
+  
+  public function getChoices()
+  {
+    //si se ingresaron choices los ponemos
+    if (count($this->options["choices"]) > 0)
+    {
+      if ($this->options["add_empty"])
+      {
+        return array(null => null) + $this->options["choices"];
+      }
+      else
+      {
+        return $this->options["choices"];
+      }
+    }
+
+    //si no se ingresaron los generamos igual que sfWidgetFormDoctrineChoice
+    else
+    {
+      return parent::getChoices();
+    }
+  }
+}
\ No newline at end of file


Property changes on: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php
___________________________________________________________________
Added: svn:executable
   + 

Added: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php
===================================================================
--- 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php
                              (rev 0)
+++ 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php
      2010-04-13 15:38:42 UTC (rev 29113)
@@ -0,0 +1,42 @@
+<?php
+
+class sfWidgetFormInputCheckboxReadOnly extends sfWidgetFormInputCheckbox
+{
+
+//para que no se borre los choices siempre
+//  public function __construct($options = array(), $attributes = array())
+//  {
+//    if (!isset($options["choices"]))
+//    {
+//      $options['choices'] = array();
+//    }
+//
+//    sfWidgetFormChoice::__construct($options, $attributes);
+//  }
+  protected function configure($options = array(), $attributes = array())
+  {
+    $this->addRequiredOption("form");
+    $this->addRequiredOption("column");
+
+    parent::configure($options, $attributes);
+  }
+  
+  public function render($name, $value = null, $attributes = array(), $errors 
= array())
+  {
+    $form = $this->getOption("form");
+    $column = $this->getOption("column");
+    $translator_array = array(
+        0 => '<span class="sf_admin_action_new sf_admin_action s16 
s16_cross"></span>',
+        1 => '<span class="sf_admin_action_new sf_admin_action s16 
s16_tick"></span>',
+    );
+
+    if (!$form->isNew())
+    {
+      return $translator_array[$form->getObject()->$column];
+    }
+    else
+    {
+      return parent::render($name, $value, $attributes, $errors);
+    }
+  }
+}
\ No newline at end of file


Property changes on: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php
___________________________________________________________________
Added: svn:executable
   + 

Added: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputTextReadOnly.class.php
===================================================================
--- 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputTextReadOnly.class.php
                          (rev 0)
+++ 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputTextReadOnly.class.php
  2010-04-13 15:38:42 UTC (rev 29113)
@@ -0,0 +1,26 @@
+<?php
+
+class sfWidgetFormInputTextReadOnly extends sfWidgetFormInputText
+{
+
+  protected function configure($options = array(), $attributes = array())
+  {
+    $this->addRequiredOption("form");
+
+    parent::configure($options, $attributes);
+  }
+  
+  public function render($name, $value = null, $attributes = array(), $errors 
= array())
+  {
+    $form = $this->getOption("form");
+
+    if (!$form->isNew())
+    {
+      return $value;
+    }
+    else
+    {
+      return parent::render($name, $value, $attributes, $errors);
+    }
+  }
+}
\ No newline at end of file


Property changes on: 
plugins/sfReadOnlyWidgetsPlugin/lib/widget/sfWidgetFormInputTextReadOnly.class.php
___________________________________________________________________
Added: svn:executable
   + 

Added: plugins/sfReadOnlyWidgetsPlugin/package.xml
===================================================================
--- plugins/sfReadOnlyWidgetsPlugin/package.xml                         (rev 0)
+++ plugins/sfReadOnlyWidgetsPlugin/package.xml 2010-04-13 15:38:42 UTC (rev 
29113)
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.9.0" version="2.0" 
xmlns="http://pear.php.net/dtd/package-2.0"; 
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+    http://pear.php.net/dtd/tasks-1.0.xsd
+    http://pear.php.net/dtd/package-2.0
+    http://pear.php.net/dtd/package-2.0.xsd";>
+ <name>sfReadOnlyWidgetsPlugin</name>
+ <uri>.</uri>
+ <summary>Widgets for ReadOnly</summary>
+ <description>Widgets for ReadOnly</description>
+ <lead>
+  <name>Jaime Suez</name>
+  <user>jaimesuez</user>
+  <email>[email protected]</email>
+  <active>yes</active>
+ </lead>
+ <date>2010-04-13</date>
+ <time>11:13:51</time>
+ <version>
+  <release>1.1</release>
+  <api>1.1</api>
+ </version>
+ <stability>
+  <release>stable</release>
+  <api>stable</api>
+ </stability>
+ <license 
uri="http://www.opensource.org/licenses/mit-license.html";>MIT</license>
+ <notes>
+initial release
+ </notes>
+ <contents>
+  <dir baseinstalldir="." name="/">
+   <file baseinstalldir="." md5sum="934a00f7f41d201b21cfa2e09f4478ef" 
name="lib/widget/sfWidgetFormDoctrineChoiceReadOnly.class.php" role="php" />
+   <file baseinstalldir="." md5sum="eb945e58cdfc6eeaa60a3a3ef03d89a9" 
name="lib/widget/sfWidgetFormInputCheckboxReadOnly.class.php" role="php" />
+   <file baseinstalldir="." md5sum="ffb65b94ec905ce0df21d677c6e2a403" 
name="lib/widget/sfWidgetFormInputTextReadOnly.class.php" role="php" />
+   <file baseinstalldir="." md5sum="1352be76f50e3f0d18a3ca0b3ddd6665" 
name="LICENSE" role="data"/>
+   <file baseinstalldir="." md5sum="41266c0910f343c50df2095fa58a1d09" 
name="README" role="data"/>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>5</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.0</min>
+   </pearinstaller>
+   <package>
+    <name>symfony</name>
+    <channel>pear.symfony-project.com</channel>
+    <min>1.2.0</min>
+    <max>1.5.0</max>
+    <exclude>1.5.0</exclude>
+   </package>
+  </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+  <release>
+   <version>
+    <release>1</release>
+    <api>1</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2010-04-13</date>
+   <license 
uri="http://www.opensource.org/licenses/mit-license.html";>MIT</license>
+   <notes>
+initial release
+   </notes>
+  </release>
+ </changelog>
+</package>

Added: plugins/sfReadOnlyWidgetsPlugin/svn-commit.tmp
===================================================================
--- plugins/sfReadOnlyWidgetsPlugin/svn-commit.tmp                              
(rev 0)
+++ plugins/sfReadOnlyWidgetsPlugin/svn-commit.tmp      2010-04-13 15:38:42 UTC 
(rev 29113)
@@ -0,0 +1,4 @@
+initial import
+--This line, and those below, will be ignored--
+
+A    .

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