Author: fizyk
Date: 2010-03-24 21:02:42 +0100 (Wed, 24 Mar 2010)
New Revision: 28770

Modified:
   plugins/sfForkedDoctrineApplyPlugin/trunk/README
   plugins/sfForkedDoctrineApplyPlugin/trunk/i18n/pl/messages.xml
   
plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php
   
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/actions.class.php
   
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/components.class.php
Log:
moved all sfApply actions to the sfApplyActionsLibrary class, to allow override 
of actions. It wasn't possible before, as symfony would generate HTTP 404 
response for all non overriden actions before.


Modified: plugins/sfForkedDoctrineApplyPlugin/trunk/README
===================================================================
--- plugins/sfForkedDoctrineApplyPlugin/trunk/README    2010-03-24 18:56:24 UTC 
(rev 28769)
+++ plugins/sfForkedDoctrineApplyPlugin/trunk/README    2010-03-24 20:02:42 UTC 
(rev 28770)
@@ -74,7 +74,7 @@
 
 All you need to do is to enable sfApply module in your settings.yml file:
 
-**apps/<APPLICATION>/config/settings.yml**
+**apps/APPLICATION/config/settings.yml**
 
     all:
       .settings:
@@ -83,7 +83,7 @@
 
 and set up routes for your app:
 
-**apps/<APPLICATION>/config/routing.yml**
+**apps/APPLICATION/config/routing.yml**
 
     apply:
       url:  /user/new
@@ -118,7 +118,7 @@
 [day 16](http://www.symfony-project.org/jobeet/1_4/Doctrine/en/16) of Jobeet 
tutorial,
 and set up your from credentials in app.yml
 
-**apps/<APPLICATION>/config/app.yml**
+**apps/APPLICATION/config/app.yml**
 
     sfApplyPlugin:
             from:
@@ -129,7 +129,7 @@
 You should also turn on i18n engine, as this plugin, like the project it rooted
 from is fully internationalised:
 
-**apps/<APPLICATION>/config/settings.yml**
+**apps/APPLICATION/config/settings.yml**
 
     all:
       .settings:

Modified: plugins/sfForkedDoctrineApplyPlugin/trunk/i18n/pl/messages.xml
===================================================================
--- plugins/sfForkedDoctrineApplyPlugin/trunk/i18n/pl/messages.xml      
2010-03-24 18:56:24 UTC (rev 28769)
+++ plugins/sfForkedDoctrineApplyPlugin/trunk/i18n/pl/messages.xml      
2010-03-24 20:02:42 UTC (rev 28770)
@@ -366,6 +366,22 @@
         <source>You may change your password using the form below.</source>
         <target>Możesz zmienić swoje hasło za pomocą poniższego.</target>
       </trans-unit>
+      <trans-unit id="55" approved="yes">
+        <source>Remember</source>
+        <target>Zapamiętaj</target>
+      </trans-unit>
+      <trans-unit id="56" approved="yes">
+        <source>Forgot your password?</source>
+        <target>Zapomniałeś hasła?</target>
+      </trans-unit>
+      <trans-unit id="57" approved="yes">
+        <source>The username and/or password is invalid.</source>
+        <target>Hasło, oraz/lub nazwa użytkownika są nieprawidłowe.</target>
+      </trans-unit>
+      <trans-unit id="58" approved="yes">
+        <source>Login</source>
+        <target>Login</target>
+      </trans-unit>
     </body>
   </file>
 </xliff>

Modified: 
plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php
===================================================================
--- 
plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php
        2010-03-24 18:56:24 UTC (rev 28769)
+++ 
plugins/sfForkedDoctrineApplyPlugin/trunk/lib/action/sfApplyActionsLibrary.class.php
        2010-03-24 20:02:42 UTC (rev 28770)
@@ -8,7 +8,182 @@
  */
 class sfApplyActionsLibrary extends sfActions
 {
+    //When user is applying for new account
+    public function executeApply(sfRequest $request)
+    {
+        $this->form = $this->newForm('sfApplyApplyForm');
 
+        //Code below is used when user is sending his application!
+        if( $request->isMethod('post') )
+        {
+            //Extracting parameters from sent sfApplyApply form
+            $this->form->bind($request->getParameter('sfApplyApply'));
+            if ($this->form->isValid())
+            {
+                $guid = "n" . self::createGuid();
+                $this->form->setValidate($guid);
+                $this->form->save();
+                try
+                {
+                    //Extracting object and sending creating verification mail
+                    $profile = $this->form->getObject();
+                    $this->sendVerificationMail($profile);
+                    return 'After';
+                }
+                catch (Exception $e)
+                {
+                    //Cleaning after possible exception thrown in 
::sendVerificationMail() method
+                    $profile = $this->form->getObject();
+                    $user = $profile->getUser();
+                    $user->delete();
+                    // You could re-throw $e here if you want to
+                    // make it available for debugging purposes
+                    return 'MailerError';
+                }
+            }
+        }
+    }
+
+    //Processes reset requests
+    public function executeResetRequest(sfRequest $request)
+    {
+        $user = $this->getUser();
+
+        if ($user->isAuthenticated())
+        {
+            $this->redirect( 'sfApply/reset' );
+//            $guardUser = $this->getUser()->getGuardUser();
+//            $this->forward404Unless($guardUser);
+//            return $this->resetRequestBody($guardUser);
+        }
+        else
+        {
+            $this->form = $this->newForm('sfApplyResetRequestForm');
+            if ($request->isMethod('post'))
+            {
+                
$this->form->bind($request->getParameter('sfApplyResetRequest'));
+                if ($this->form->isValid())
+                {
+                    // The form matches unverified users, but 
retrieveByUsername does not, so
+                    // use an explicit query. We'll special-case the 
unverified users in
+                    // resetRequestBody
+
+                    $username_or_email = 
$this->form->getValue('username_or_email');
+                    if (strpos($username_or_email, '@') !== false)
+                    {
+                        $user = 
Doctrine::getTable('sfGuardUser')->createQuery('u')->
+                                innerJoin('u.Profile p')->where('p.email = ?', 
$username_or_email)->
+                                fetchOne();
+
+                    }
+                    else
+                    {
+                        $user = 
Doctrine::getTable('sfGuardUser')->createQuery('u')->
+                                where('username = ?', 
$username_or_email)->fetchOne();
+                    }
+                    return $this->resetRequestBody($user);
+                }
+            }
+        }
+    }
+
+    public function executeConfirm(sfRequest $request)
+    {
+        $validate = $this->request->getParameter('validate');
+        // 0.6.3: oops, this was in sfGuardUserProfilePeer in my application
+        // and therefore never got shipped with the plugin until I built
+        // a second site and spotted it!
+
+        // Note that this only works if you set foreignAlias and
+        // foreignType correctly
+        $sfGuardUser = Doctrine_Query::create()->
+        from("sfGuardUser u")->
+        innerJoin("u.Profile p with p.validate = ?", $validate)->
+        fetchOne();
+        if (!$sfGuardUser)
+        {
+            return 'Invalid';
+        }
+        $type = self::getValidationType($validate);
+        if (!strlen($validate))
+        {
+            return 'Invalid';
+        }
+        $profile = $sfGuardUser->getProfile();
+        $profile->setValidate(null);
+        $profile->save();
+        if ($type == 'New')
+        {
+            $sfGuardUser->setIsActive(true);
+            $sfGuardUser->save();
+            $this->getUser()->signIn($sfGuardUser);
+        }
+        if ($type == 'Reset')
+        {
+            $this->getUser()->setAttribute('sfApplyReset', 
$sfGuardUser->getId());
+            return $this->redirect('sfApply/reset');
+        }
+    }
+
+    public function executeReset(sfRequest $request)
+    {
+        //won't present this page to users that are not authenticated or 
haven't got confirmation code
+        if( !$this->getUser()->isAuthenticated() && 
!$this->getUser()->getAttribute('sfApplyReset', false)  )
+        {
+            $this->redirect( '@sf_guard_signin' );
+        }
+        $this->form = $this->newForm('sfApplyResetForm');
+        if ($request->isMethod('post'))
+        {
+            $this->form->bind($request->getParameter('sfApplyReset'));
+            if ($this->form->isValid())
+            {
+                //This got fixed (0.9.1), so if user is authenticated, and 
requests password change, we're still getting his id.
+                $this->id = ( $this->getUser()->isAuthenticated() ) ? 
$this->getUser()->getGuardUser()->getId() : 
$this->getUser()->getAttribute('sfApplyReset', false);
+                $this->forward404Unless($this->id);
+                $this->sfGuardUser = 
Doctrine::getTable('sfGuardUser')->find($this->id);
+                $this->forward404Unless($this->sfGuardUser);
+                $sfGuardUser = $this->sfGuardUser;
+                $sfGuardUser->setPassword($this->form->getValue('password'));
+                $sfGuardUser->save();
+                $this->getUser()->signIn($sfGuardUser);
+                $this->getUser()->setAttribute('sfApplyReset', null);
+                return 'After';
+            }
+        }
+        if( $this->getUser()->isAuthenticated() )
+        {
+            return 'Logged';
+        }
+    }
+
+    public function executeResetCancel()
+    {
+        $this->getUser()->setAttribute('sfApplyReset', null);
+        return $this->redirect(sfConfig::get('app_sfApplyPlugin_after', 
'@homepage'));
+    }
+
+    public function executeSettings(sfRequest $request)
+    {
+        // sfApplySettingsForm inherits from sfApplyApplyForm, which
+        // inherits from sfGuardUserProfile. That minimizes the amount
+        // of duplication of effort. If you want, you can use a different
+        // form class. I suggest inheriting from sfApplySettingsForm and
+        // making further changes after calling parent::configure() from
+        // your own configure() method.
+
+        $profile = $this->getUser()->getProfile();
+        $this->form = $this->newForm('sfApplySettingsForm', $profile);
+        if ($request->isMethod('post'))
+        {
+            $this->form->bind($request->getParameter('sfApplySettings'));
+            if ($this->form->isValid())
+            {
+                $this->form->save();
+                return $this->redirect('@homepage');
+            }
+        }
+    }
     /**
      * gets From information for email. may throw Exception.
      * @return array

Modified: 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/actions.class.php
===================================================================
--- 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/actions.class.php
 2010-03-24 18:56:24 UTC (rev 28769)
+++ 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/actions.class.php
 2010-03-24 20:02:42 UTC (rev 28770)
@@ -11,180 +11,5 @@
 
 class sfApplyActions extends sfApplyActionsLibrary
 {
-    //When user is applying for new account
-    public function executeApply(sfRequest $request)
-    {
-        $this->form = $this->newForm('sfApplyApplyForm');
-
-        //Code below is used when user is sending his application!
-        if( $request->isMethod('post') )
-        {
-            //Extracting parameters from sent sfApplyApply form
-            $this->form->bind($request->getParameter('sfApplyApply'));
-            if ($this->form->isValid())
-            {
-                $guid = "n" . self::createGuid();
-                $this->form->setValidate($guid);
-                $this->form->save();
-                try
-                {
-                    //Extracting object and sending creating verification mail
-                    $profile = $this->form->getObject();
-                    $this->sendVerificationMail($profile);
-                    return 'After';
-                }
-                catch (Exception $e)
-                {
-                    //Cleaning after possible exception thrown in 
::sendVerificationMail() method
-                    $profile = $this->form->getObject();
-                    $user = $profile->getUser();
-                    $user->delete();
-                    // You could re-throw $e here if you want to
-                    // make it available for debugging purposes
-                    return 'MailerError';
-                }
-            }
-        }
-    }
-
-    //Processes reset requests
-    public function executeResetRequest(sfRequest $request)
-    {
-        $user = $this->getUser();
-
-        if ($user->isAuthenticated())
-        {
-            $this->redirect( 'sfApply/reset' );
-//            $guardUser = $this->getUser()->getGuardUser();
-//            $this->forward404Unless($guardUser);
-//            return $this->resetRequestBody($guardUser);
-        }
-        else
-        {
-            $this->form = $this->newForm('sfApplyResetRequestForm');
-            if ($request->isMethod('post'))
-            {
-                
$this->form->bind($request->getParameter('sfApplyResetRequest'));
-                if ($this->form->isValid())
-                {
-                    // The form matches unverified users, but 
retrieveByUsername does not, so
-                    // use an explicit query. We'll special-case the 
unverified users in
-                    // resetRequestBody
-
-                    $username_or_email = 
$this->form->getValue('username_or_email');
-                    if (strpos($username_or_email, '@') !== false)
-                    {
-                        $user = 
Doctrine::getTable('sfGuardUser')->createQuery('u')->
-                                innerJoin('u.Profile p')->where('p.email = ?', 
$username_or_email)->
-                                fetchOne();
-
-                    }
-                    else
-                    {
-                        $user = 
Doctrine::getTable('sfGuardUser')->createQuery('u')->
-                                where('username = ?', 
$username_or_email)->fetchOne();
-                    }
-                    return $this->resetRequestBody($user);
-                }
-            }
-        }
-    }
-
-    public function executeConfirm(sfRequest $request)
-    {
-        $validate = $this->request->getParameter('validate');
-        // 0.6.3: oops, this was in sfGuardUserProfilePeer in my application
-        // and therefore never got shipped with the plugin until I built
-        // a second site and spotted it!
-
-        // Note that this only works if you set foreignAlias and
-        // foreignType correctly
-        $sfGuardUser = Doctrine_Query::create()->
-        from("sfGuardUser u")->
-        innerJoin("u.Profile p with p.validate = ?", $validate)->
-        fetchOne();
-        if (!$sfGuardUser)
-        {
-            return 'Invalid';
-        }
-        $type = self::getValidationType($validate);
-        if (!strlen($validate))
-        {
-            return 'Invalid';
-        }
-        $profile = $sfGuardUser->getProfile();
-        $profile->setValidate(null);
-        $profile->save();
-        if ($type == 'New')
-        {
-            $sfGuardUser->setIsActive(true);
-            $sfGuardUser->save();
-            $this->getUser()->signIn($sfGuardUser);
-        }
-        if ($type == 'Reset')
-        {
-            $this->getUser()->setAttribute('sfApplyReset', 
$sfGuardUser->getId());
-            return $this->redirect('sfApply/reset');
-        }
-    }
-
-    public function executeReset(sfRequest $request)
-    {
-        //won't present this page to users that are not authenticated or 
haven't got confirmation code
-        if( !$this->getUser()->isAuthenticated() && 
!$this->getUser()->getAttribute('sfApplyReset', false)  )
-        {
-            $this->redirect( '@sf_guard_signin' );
-        }
-        $this->form = $this->newForm('sfApplyResetForm');
-        if ($request->isMethod('post'))
-        {
-            $this->form->bind($request->getParameter('sfApplyReset'));
-            if ($this->form->isValid())
-            {
-                //This got fixed (0.9.1), so if user is authenticated, and 
requests password change, we're still getting his id.
-                $this->id = ( $this->getUser()->isAuthenticated() ) ? 
$this->getUser()->getGuardUser()->getId() : 
$this->getUser()->getAttribute('sfApplyReset', false);
-                $this->forward404Unless($this->id);
-                $this->sfGuardUser = 
Doctrine::getTable('sfGuardUser')->find($this->id);
-                $this->forward404Unless($this->sfGuardUser);
-                $sfGuardUser = $this->sfGuardUser;
-                $sfGuardUser->setPassword($this->form->getValue('password'));
-                $sfGuardUser->save();
-                $this->getUser()->signIn($sfGuardUser);
-                $this->getUser()->setAttribute('sfApplyReset', null);
-                return 'After';
-            }
-        }
-        if( $this->getUser()->isAuthenticated() )
-        {
-            return 'Logged';
-        }
-    }
-
-    public function executeResetCancel()
-    {
-        $this->getUser()->setAttribute('sfApplyReset', null);
-        return $this->redirect(sfConfig::get('app_sfApplyPlugin_after', 
'@homepage'));
-    }
-
-    public function executeSettings(sfRequest $request)
-    {
-        // sfApplySettingsForm inherits from sfApplyApplyForm, which
-        // inherits from sfGuardUserProfile. That minimizes the amount
-        // of duplication of effort. If you want, you can use a different
-        // form class. I suggest inheriting from sfApplySettingsForm and
-        // making further changes after calling parent::configure() from
-        // your own configure() method.
-
-        $profile = $this->getUser()->getProfile();
-        $this->form = $this->newForm('sfApplySettingsForm', $profile);
-        if ($request->isMethod('post'))
-        {
-            $this->form->bind($request->getParameter('sfApplySettings'));
-            if ($this->form->isValid())
-            {
-                $this->form->save();
-                return $this->redirect('@homepage');
-            }
-        }
-    }
+    
 }
\ No newline at end of file

Modified: 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/components.class.php
===================================================================
--- 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/components.class.php
      2010-03-24 18:56:24 UTC (rev 28769)
+++ 
plugins/sfForkedDoctrineApplyPlugin/trunk/modules/sfApply/actions/components.class.php
      2010-03-24 20:02:42 UTC (rev 28770)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * sfApply actions.
  *
@@ -9,12 +8,10 @@
  * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
  */
 
-// Autoloader can't find this
-require_once(dirname(__FILE__).'/../lib/BasesfApplyComponents.class.php');
 
 class sfApplyComponents extends sfComponents
 {
-     public function executeLogin()
+    public function executeLogin()
     {
         $this->loggedIn = $this->getUser()->isAuthenticated();
         if (!$this->loggedIn)

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