Many changes related to forms and CSS
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 1 Jun 2012 19:46:48 +0000 (21:46 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Fri, 1 Jun 2012 19:46:48 +0000 (21:46 +0200)
14 files changed:
apps/companyfront/modules/company/templates/_form.php
apps/companyfront/modules/office/templates/_formCustomOffice.php
apps/companyfront/modules/sfGuardAuth/templates/_signin_form.php
apps/companyfront/modules/sfGuardAuth/templates/signinSuccess.php [new file with mode: 0644]
apps/companyfront/modules/user/templates/_form.php
apps/userfront/modules/register/templates/_form.php
apps/userfront/modules/register/templates/indexSuccess.php
apps/userfront/modules/sfGuardAuth/templates/_signin_form.php
apps/userfront/modules/sfGuardAuth/templates/signinSuccess.php [new file with mode: 0644]
apps/userfront/modules/user/templates/_form.php
lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardUserForm.class.php
lib/widget/WidgetFormSchemaFormatterCustom.class.php [new file with mode: 0644]
web/css/inadminpanel/niceforms-default.css
web/css/inadminpanel/style.css

index 9b6d065..66cb305 100644 (file)
@@ -5,19 +5,70 @@
 <?php if (!$form->getObject()->isNew()): ?>
 <input type="hidden" name="sf_method" value="put" />
 <?php endif; ?>
+  <fieldset>
+  <legend><?php echo __('LOGO AND CIF') ?></legend>
   <table>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <?php echo $form->renderHiddenFields(false) ?>
-          &nbsp;<a href="<?php echo url_for('company/index') ?>"><?php echo __('Back to list') ?></a>
-          <input type="submit" value=<?php echo __('Update') ?> />
-        </td>
-      </tr>
-    </tfoot>
     <tbody>
-      <?php echo $form->renderGlobalErrors(false) ?>
-      <?php echo $form ?>
+            <?php echo $form['company_logo']->renderRow(array('class' => 'required')) ?>
+            <?php echo $form['company_cif']->renderRow(array('class' => 'required')) ?>
     </tbody>
   </table>
+  <fieldset>
+  <legend><?php echo __('INTERNATIONALIZATION') ?></legend>
+  <table id="rounded-cornergus">
+  <thead>
+    <tr>
+        <th> </th>
+        <th scope="col" class="rounded-companygus"><?php echo __('Language') ?></th>
+        <th scope="col" class="roundedgus"><?php echo __('Company Name') ?></th>
+        <th scope="col" class="rounded-q4gus"><?php echo __('Remove') ?></th>
+    </tr>
+  </thead>
+  <tbody>
+    <?php if (isset($form['new'])): ?>
+    <tr>
+    <td><?php echo __('New Entry:') ?></td>
+    <td>
+        <?php echo $form['new']['language_id']->render(array('class' => 'validate-selection')) ?>
+    </td>
+    <td>
+        <?php echo $form['new']['company_name']->render(array('class' => 'required')) ?>
+        <?php echo $form['new']['id'] ?>
+    </td>
+    <td>
+    </td>
+    </tr>
+    <?php endif; ?>
+    <?php foreach ($form['CompanyDescription'] as $companyDescription): ?>
+    <tr>
+    <td><?php echo __('Current Entry:') ?></td>
+    <td>
+        <?php echo $companyDescription['language_id']->render(array('class' => 'validate-selection')) ?>
+    </td>
+    <td>
+        <?php echo $companyDescription['company_name']->render(array('class' => 'required')) ?>
+    </td>
+    <td>
+        <?php echo $companyDescription['delete'] ?>
+        <?php echo $companyDescription['id'] ?>
+    </td>
+    </tr>
+    <?php endforeach; ?>
+  </tbody>
+  </table>
+  <?php echo $form->renderHiddenFields(false) ?>
+  </fieldset>
+  </fieldset>
+  <table align="right">
+        <tbody>
+            <tr>
+            <td>
+                <a href="<?php echo url_for('company/index') ?>" class="bt_red"><strong><?php echo __('Back') ?></strong></a>
+            </td>
+            <td>
+                <input type="submit" value="<?php echo __('Update') ?>" class="NFButton">
+            </td>
+            </tr>
+        </tbody>
+    </table>
 </form>
index b4110bc..c887f9e 100644 (file)
@@ -5,21 +5,30 @@
 <?php if (!$form->getObject()->isNew()): ?>
 <input type="hidden" name="sf_method" value="put" />
 <?php endif; ?>
+  <fieldset>
+  <legend><?php echo __('OFFICE') ?></legend>
   <table>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <?php echo $form->renderHiddenFields(false) ?>
-          &nbsp;<a href="<?php echo url_for('office/index?page='.$page.'&sort='.$sort) ?>"><?php echo __('Back to list') ?></a>
-          <?php if (!$form->getObject()->isNew()): ?>
-            &nbsp;<?php echo link_to('Delete', 'office/delete?id='.$form->getObject()->getId().'&page='.$page.'&sort='.$sort, array('method' => 'delete', 'confirm' => 'Are you sure?')) ?>
-          <?php endif; ?>
-          <input type="submit" value=<?php echo __('Save') ?> />
-        </td>
-      </tr>
-    </tfoot>
+    <tbody> 
+        <?php echo $form->renderGlobalErrors() ?>
+        <?php echo $form->renderHiddenFields(false) ?>
+        <?php echo $form['city_id']->renderRow(array('class' => 'validate-selection')) ?>
+        <?php echo $form['office_street_address']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['office_zip']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['longitude']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['latitude']->renderRow(array('class' => 'required')) ?>
     <tbody>
-        <?php echo $form ?>
-    </tbody>
   </table>
+  </fieldset>
+  <table align="right">
+        <tbody>
+            <tr>
+            <td>
+                <a href="<?php echo url_for('office/index?page='.$page.'&sort='.$sort) ?>" class="bt_red"><strong><?php echo __('Back to list') ?></strong></a>
+            </td>
+            <td>
+                <input type="submit" value="<?php echo __('Save') ?>" class="NFButton">
+            </td>
+            </tr>
+        </tbody>
+   </table>
 </form>
index b13e241..536c623 100644 (file)
@@ -1,25 +1,37 @@
 <?php use_helper('I18N') ?>
 
 <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post" class="niceform">
+  <fieldset>
+  <legend>SIGN IN</legend>
   <table>
     <tbody>
-      <?php echo $form ?>
+        <?php echo $form->renderGlobalErrors() ?>
+        <?php echo $form->renderHiddenFields(false) ?>
+        <?php echo $form['username']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['password']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['remember']->renderRow()?>
     </tbody>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <input type="submit" value="<?php echo __('Log In', null, 'sf_guard') ?>" />
-          
-          <?php $routes = $sf_context->getRouting()->getRoutes() ?>
-          <?php if (isset($routes['sf_guard_forgot_password'])): ?>
-            <a href="<?php echo url_for('@sf_guard_forgot_password') ?>"><?php echo __('Forgot your password?', null, 'sf_guard') ?></a>
-          <?php endif; ?>
+  </table>
+  </fieldset>
+  <table align="right">
+    <tbody>
+            <tr>
+            <td>
+                <input type="submit" value="<?php echo __('Log In', null, 'sf_guard') ?>" class="NFButton"/>
+            </td>
+            <td>
+                <?php $routes = $sf_context->getRouting()->getRoutes() ?>
+                <?php if (isset($routes['sf_guard_forgot_password'])): ?>
+                    <a href="<?php echo url_for('@sf_guard_forgot_password') ?>"><?php echo __('Forgot your password?', null, 'sf_guard') ?></a>
+                <?php endif; ?>
+
+                <?php if (isset($routes['register_index'])): ?>
+                    &nbsp; <a href="<?php echo url_for('@register_index') ?>" class="bt_red"><strong><?php echo __('Want to register?', null, 'sf_guard') ?></strong></a>
+                <?php endif; ?>
+            </td>
+            </tr>
+        </tbody>
 
-          <?php if (isset($routes['register_index'])): ?>
-            &nbsp; <a href="<?php echo url_for('@register_index') ?>"><?php echo __('Want to register?', null, 'sf_guard') ?></a>
-          <?php endif; ?>
-        </td>
-      </tr>
-    </tfoot>
   </table>
+
 </form>
diff --git a/apps/companyfront/modules/sfGuardAuth/templates/signinSuccess.php b/apps/companyfront/modules/sfGuardAuth/templates/signinSuccess.php
new file mode 100644 (file)
index 0000000..58d4ad9
--- /dev/null
@@ -0,0 +1,4 @@
+<?php use_helper('I18N') ?>
+<h1><?php echo __('Log In or Register', null, 'sf_guard') ?></h1>
+
+<?php include_partial('signin_form', array('form' => $form)) ?>
index 926b112..dcc849f 100644 (file)
@@ -5,21 +5,29 @@
 <?php if (!$form->getObject()->isNew()): ?>
 <input type="hidden" name="sf_method" value="put" />
 <?php endif; ?>
+  <fieldset>
+  <legend><?php echo __('YOUR DATA') ?></legend>
   <table>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <?php echo $form->renderHiddenFields(false) ?>
-          &nbsp;<a href="<?php echo url_for('user/index') ?>"><?php echo __('Back') ?></a>
-          <input type="submit" value="<?php echo __('Save') ?>" />
-        </td>
-      </tr>
-    </tfoot>
     <tbody>
-      <?php echo $form->renderGlobalErrors() ?>
-      <tr>
-          <?php echo $form ?>
-      </tr>
+         <?php echo $form->renderGlobalErrors() ?>
+         <?php echo $form['first_name']->renderRow(array('class' => 'required')) ?>
+         <?php echo $form['last_name']->renderRow(array('class' => 'required')) ?>
+         <?php echo $form['email_address']->renderRow(array('class' => 'required')) ?>
+         <?php echo $form['language_id']->renderRow(array('class' => 'validate-selection')) ?>
+         <?php echo $form->renderHiddenFields(false) ?>
     </tbody>
   </table>
+  </fieldset>
+  <table align="right">
+        <tbody>
+            <tr>
+            <td>
+                <a href="<?php echo url_for('user/index') ?>" class="bt_red"><strong><?php echo __('Back') ?></strong></a>
+            </td>
+            <td>
+                <input type="submit" value="<?php echo __('Save') ?>" class="NFButton">
+            </td>
+            </tr>
+        </tbody>
+   </table>
 </form>
index b4f9ba0..addfecf 100644 (file)
@@ -1,14 +1,31 @@
 <?php use_helper('I18N') ?>
 
 <form action="<?php echo url_for('@register_index') ?>" method="post">
+  <fieldset>
+  <legend><?php echo __('REGISTER', null, 'sf_guard') ?></legend>
   <table>
-    <?php echo $form ?>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <input type="submit" name="register" value="<?php echo __('Register', null, 'sf_guard') ?>" />
+    <tbody>
+        <?php echo $form->renderGlobalErrors() ?>
+        <?php echo $form->renderHiddenFields(false) ?>
+        <?php echo $form['first_name']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['last_name']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['email_address']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['username']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['password']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['password_again']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['language_id']->renderRow(array('class' => 'validate-selection')) ?>
+        <?php echo $form['captcha']->RenderRow() ?>
+    </tbody>
+  </table>
+  </fieldset>
+  <table align="right">
+    <tbody>
+        <tr>
+        <td>
+        <input type="submit" name="register" value="<?php echo __('Register', null, 'sf_guard') ?>" class="NFButton"/>
         </td>
-      </tr>
-    </tfoot>
+        <tr>
+    <tbody>
   </table>
 </form>
+
index f756829..8072abc 100644 (file)
@@ -1,4 +1,4 @@
 <?php use_helper('I18N') ?>
-<h1><?php echo __('Register', null, 'sf_guard') ?></h1>
+<h1></h1>
 
 <?php include_partial('form', array('form' => $form)) ?>
index b13e241..536c623 100644 (file)
@@ -1,25 +1,37 @@
 <?php use_helper('I18N') ?>
 
 <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post" class="niceform">
+  <fieldset>
+  <legend>SIGN IN</legend>
   <table>
     <tbody>
-      <?php echo $form ?>
+        <?php echo $form->renderGlobalErrors() ?>
+        <?php echo $form->renderHiddenFields(false) ?>
+        <?php echo $form['username']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['password']->renderRow(array('class' => 'required')) ?>
+        <?php echo $form['remember']->renderRow()?>
     </tbody>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <input type="submit" value="<?php echo __('Log In', null, 'sf_guard') ?>" />
-          
-          <?php $routes = $sf_context->getRouting()->getRoutes() ?>
-          <?php if (isset($routes['sf_guard_forgot_password'])): ?>
-            <a href="<?php echo url_for('@sf_guard_forgot_password') ?>"><?php echo __('Forgot your password?', null, 'sf_guard') ?></a>
-          <?php endif; ?>
+  </table>
+  </fieldset>
+  <table align="right">
+    <tbody>
+            <tr>
+            <td>
+                <input type="submit" value="<?php echo __('Log In', null, 'sf_guard') ?>" class="NFButton"/>
+            </td>
+            <td>
+                <?php $routes = $sf_context->getRouting()->getRoutes() ?>
+                <?php if (isset($routes['sf_guard_forgot_password'])): ?>
+                    <a href="<?php echo url_for('@sf_guard_forgot_password') ?>"><?php echo __('Forgot your password?', null, 'sf_guard') ?></a>
+                <?php endif; ?>
+
+                <?php if (isset($routes['register_index'])): ?>
+                    &nbsp; <a href="<?php echo url_for('@register_index') ?>" class="bt_red"><strong><?php echo __('Want to register?', null, 'sf_guard') ?></strong></a>
+                <?php endif; ?>
+            </td>
+            </tr>
+        </tbody>
 
-          <?php if (isset($routes['register_index'])): ?>
-            &nbsp; <a href="<?php echo url_for('@register_index') ?>"><?php echo __('Want to register?', null, 'sf_guard') ?></a>
-          <?php endif; ?>
-        </td>
-      </tr>
-    </tfoot>
   </table>
+
 </form>
diff --git a/apps/userfront/modules/sfGuardAuth/templates/signinSuccess.php b/apps/userfront/modules/sfGuardAuth/templates/signinSuccess.php
new file mode 100644 (file)
index 0000000..58d4ad9
--- /dev/null
@@ -0,0 +1,4 @@
+<?php use_helper('I18N') ?>
+<h1><?php echo __('Log In or Register', null, 'sf_guard') ?></h1>
+
+<?php include_partial('signin_form', array('form' => $form)) ?>
index 926b112..cdae39c 100644 (file)
@@ -5,21 +5,30 @@
 <?php if (!$form->getObject()->isNew()): ?>
 <input type="hidden" name="sf_method" value="put" />
 <?php endif; ?>
+  <fieldset>
+  <legend><?php echo __('YOUR DATA') ?></legend>
   <table>
-    <tfoot>
-      <tr>
-        <td colspan="2">
-          <?php echo $form->renderHiddenFields(false) ?>
-          &nbsp;<a href="<?php echo url_for('user/index') ?>"><?php echo __('Back') ?></a>
-          <input type="submit" value="<?php echo __('Save') ?>" />
-        </td>
-      </tr>
-    </tfoot>
     <tbody>
       <?php echo $form->renderGlobalErrors() ?>
-      <tr>
-          <?php echo $form ?>
-      </tr>
+      <?php echo $form['first_name']->renderRow(array('class' => 'required')) ?>
+      <?php echo $form['last_name']->renderRow(array('class' => 'required')) ?>
+      <?php echo $form['email_address']->renderRow(array('class' => 'required')) ?>
+      <?php echo $form['language_id']->renderRow(array('class' => 'validate-selection')) ?>
     </tbody>
   </table>
+  </fieldset>
+   <?php echo $form->renderHiddenFields(false) ?>
+   &nbsp;
+    <table align="right">
+        <tbody>
+            <tr>
+            <td>
+                <a href="<?php echo url_for('user/index') ?>" class="bt_red"><strong><?php echo __('Back') ?></strong></a>
+            </td>
+            <td>
+                <input type="submit" value="<?php echo __('Save') ?>" class="NFButton">
+            </td>
+            </tr>
+        </tbody>
+    </table>
 </form>
index 79cd4a7..ed0d748 100644 (file)
@@ -21,5 +21,6 @@ class sfGuardUserForm extends PluginsfGuardUserForm
 
     $this->validatorSchema['language_id'] = new sfValidatorDoctrineChoice(array('model'    => $this->getRelatedModelName('Language'),
                                                                                 'required' => true));
+
   }
 }
diff --git a/lib/widget/WidgetFormSchemaFormatterCustom.class.php b/lib/widget/WidgetFormSchemaFormatterCustom.class.php
new file mode 100644 (file)
index 0000000..e4fc07d
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+class WidgetFormSchemaFormatterCustom extends sfWidgetFormSchemaFormatterTable
+{
+     protected
+    // this says to surround our element with a div of class "form-row".
+    // then print out the error, label, form field, help text, and finally the hidden fields
+    // new lines () are included for readable html
+
+    /*$rowFormat           = "<div class=\"form-row\">
+                            %error%
+                            %label%%field%
+                            %help%
+                            %hidden_fields%
+                            </div>",
+    // this defines the exact format of the above %help%. This says to wrap it in a div of class form_helper.
+    // The %help% in this case defines that actual help text (if any) that's given
+    $helpFormat      = '<div class="form_helper">%help%</div>',
+    // Certain errors do not pertain to any specific widget. In these cases, the errors are printed on their own row
+    // This defines the format of how to set up that row
+    $errorRowFormat  = "<div>%errors%</div>",
+    // this is the wrapper always uses around errors.
+    $errorListFormatInARow     = "  <ul class=\"error_list\">%errors%  </ul>",
+    // This defines how to print the actual error in normal situations
+    $errorRowFormatInARow      = "    <li>%error%</li>",
+    // This defines how to print the actual error in situations where the error does not belong to a specific widget - is printed at the top of the form
+    $namedErrorRowFormatInARow = "    <li>%name%: %error%</li>",
+    // We didn't cover it, but you can embed forms inside other forms.
+    // When you do, the following is used to "wrap" your form. In the table example, this is a <table> </table> value.
+    $decoratorFormat = "<div>%content%</div>";*/
+    protected
+        $rowFormat       = "<tr>\n  <th>%label%</th>\n  <td>%error%%field%%help%%hidden_fields%</td>\n</tr>\n",
+        $errorRowFormat  = "<tr><td colspan=\"2\">\n%errors%</td></tr>\n",
+        $helpFormat      = '<br />%help%',
+        $decoratorFormat = "<table>\n  %content%</table>";
+}
index 87cf912..d7498c1 100644 (file)
@@ -11,9 +11,7 @@ width:600px;
 float:left;
 clear:both;
 }
-fieldset { border:none; clear:both;}
-label {font-size:11px; font-weight:bold; color:#666;}
-label a{font-size:11px; font-weight:bold; color:#666;}
+label a{font-size:11px; font-weight:bold; color:#666666;}
 dl {clear:both; width:600px;}
 dl.submit {clear:both; width:500px; text-align:center; padding:0 0 0 90px;}
 
@@ -95,4 +93,8 @@ line-height:32px;
 /*Hidden*/
 .NFhidden {opacity:0; z-index:-1; position:relative;}
 /*Safari*/
-select, input, textarea, button {outline:none; resize:none;}
+/*select, input, textarea, button {
+outline:none;
+background:url(/images/inadminpanel/img/input.gif) repeat-x scroll 0 0;
+resize:none;
+}*/
index 87da282..e254b8e 100644 (file)
@@ -456,3 +456,86 @@ margin-right: 2px;
 border: 1px solid #f3f3f3;
 color: #ccc;
 }
+.form-row
+{
+  clear: both;
+  padding: 10px;
+  border-bottom: 1px solid #bbf;
+  background-color: #fff;
+}
+label
+{
+  float: left;
+  color: #666666;
+  padding: 8px;
+  line-height: 25px;
+  font-size: 12px;
+  width: 150px;
+  font-weight: normal;
+}
+div.form_helper {
+    clear: both;
+    color: #333;
+    font-style: italic;
+}
+.error_list {
+    color: #ff0000;
+}
+#rounded-cornergus
+{
+margin:0px;
+width:550px;
+text-align: left;
+border-collapse: collapse;
+}
+#rounded-cornergus thead th.rounded-companygus
+{
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus thead th.rounded-q4gus
+{
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus th
+{
+padding: 8px;
+font-weight: normal;
+font-size: 13px;
+color: #666666;
+border: 1px solid #95E0EF;
+}
+#rounded-cornergus td
+{
+padding: 8px;
+border: 1px solid #95E0EF;
+color: #666666;
+}
+input.required {
+background-color: #F3FCFE;
+border-color: #95E0EF;
+border-style: solid;
+border-width: 1px 1px 1px 2px;
+float: left;
+height: 28px;
+padding: 5px 0 0 2px;
+width: 300px;
+}
+select.validate-selection{
+width:90px;
+height:28px;
+border: 1px solid #95E0EF;
+background-color:#f3fcfe;
+border-left-width:2px;
+padding:4px 2px 3px 2px;
+float:left;
+}
+fieldset{
+border: 1px solid #EBEBEB;
+margin: 0 10px 10px;
+padding: 15px 10px;
+}
+legend{
+background-color: #0FCDF6;
+color: #FFFFFF;
+padding: 2px 5px;
+}