Skip to content

Commit

Permalink
Merge branch 'layout'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfman2000 committed Dec 25, 2009
2 parents 9f07498 + 15442bf commit 04c76a6
Show file tree
Hide file tree
Showing 35 changed files with 471 additions and 36 deletions.
2 changes: 2 additions & 0 deletions apps/frontend/config/app.yml
Expand Up @@ -16,3 +16,5 @@ all:
max_salt_char: 126
min_oregano_length: 32
max_oregano_length: 32
max_subject_length: 50
min_email_length: 20
2 changes: 1 addition & 1 deletion apps/frontend/config/routing.yml
Expand Up @@ -100,7 +100,7 @@ contact_post:
class: sfRequestRoute
param:
module: contact
action: send
action: validate
requirements:
sf_method: [POST]

Expand Down
3 changes: 3 additions & 0 deletions apps/frontend/modules/base/templates/downloadError.php
@@ -1,3 +1,6 @@
<?php slot('title', "Base Edit Download Error — Pump Pro Edits");
slot('h2', '<h2 class="error_list">Download Error</h2>'); ?>

<p>It looks like you tried to download a base edit file improperly.</p>

<p>You can get the base edit files
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/modules/base/templates/indexSuccess.php
@@ -1,5 +1,6 @@
<?php
slot('title', "Base Edit Files Page $page — Pump Pro Edits");
slot('h2', "<h2>Base Edits</h2>");
?>
<h2>Base Edit Files</h2>
<p>
Expand Down
5 changes: 3 additions & 2 deletions apps/frontend/modules/confirm/templates/indexSuccess.php
@@ -1,7 +1,8 @@
<?php slot('title', 'Confirm your account — Pump Pro Edits'); ?>
<?php slot('title', 'Confirm your account — Pump Pro Edits');
slot('h2', "<h2>Confirm your Account</h2>"); ?>
<p>You are almost able to submit edits and contribute to the website!</p>
<p>Just fill in the form below with your password. If you came to this page
through the navigation links instead of your email message, you will have to
enter your confirmation code as well.</p>

<?php include_partial('confirm/form', array('form' => $form)) ?>
<?php include_partial('confirm/form', array('form' => $form)) ?>
4 changes: 2 additions & 2 deletions apps/frontend/modules/confirm/templates/validateError.php
@@ -1,5 +1,5 @@
<?php slot('title', 'Registration Failure — Pump Pro Edits') ?>
<h2>Error!</h2>
<?php slot('title', 'Confirmation Failure — Pump Pro Edits');
slot('h2', '<h2 class="error_list">Confirmation Error!</h2>'); ?>
<?php if (isset($data)): ?>
<p>There was a problem with processing the data.</p>
<ul class="error_list">
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/modules/confirm/templates/validateSuccess.php
@@ -1,5 +1,5 @@
<?php slot('title', 'Account Confirmed — Pump Pro Edits'); ?>
<h2>Success!</h2>
<?php slot('title', 'Account Confirmed — Pump Pro Edits');
slot('h2', '<h2 class="success_list">Account Confirmed!</h2>') ?>

<p>You have confirmed your account. You are now logged in, able
to start submitting edits for everyone to see. ☺</p>
Expand Down
45 changes: 44 additions & 1 deletion apps/frontend/modules/contact/actions/actions.class.php
Expand Up @@ -17,6 +17,49 @@ class contactActions extends sfActions
*/
public function executeIndex(sfWebRequest $request)
{
$this->forward('default', 'module');
$user = $this->getUser();
if ($user->isAuthenticated())
{
$def = array('name' => $user->getAttribute('name'), 'email' => $user->getAttribute('email'));
$this->form = new ContactForm($def);
}
else
{
$this->form = new ContactForm();
}
}

public function executeValidate(sfWebRequest $request)
{
$this->form = new ContactForm();
$this->form->bind($request->getParameter('validate'));
if ($this->form->isValid())
{
// We can immediately send the email.
$body = $this->form->getValue('content');
$subject = $this->form->getValue('subject');
$name = $this->form->getValue('name');
$email = $this->form->getValue('email');

try
{
$cm = new ContactMessage($email, $name, $subject, $body);
$this->getMailer()->send($cm);
}
catch (Swift_RfcComplianceException $e)
{
$this->getResponse()->setStatusCode(409);
$this->data = array('The mailer is down: please email directly!');
$this->noshow = 1;
$this->subj = $subject;
$this->body = $body;
return sfView::ERROR;
}
}
else
{
$this->getResponse()->setStatusCode(409);
return sfView::ERROR;
}
}
}
8 changes: 8 additions & 0 deletions apps/frontend/modules/contact/config/view.yml
@@ -0,0 +1,8 @@
indexSuccess:
stylesheets: [contact.css]

validateSuccess:
stylesheets: [contact.css]

validateError:
stylesheets: [contact.css]
4 changes: 4 additions & 0 deletions apps/frontend/modules/contact/templates/_form.php
@@ -0,0 +1,4 @@
<?php
$params['form'] = $form;
$params['route'] = '@contact_post';
include_partial("global/form_base", $params);
11 changes: 11 additions & 0 deletions apps/frontend/modules/contact/templates/indexSuccess.php
@@ -0,0 +1,11 @@
<?php slot('title', 'Contact the Webmaster — Pump Pro Edits');
slot('h2', '<h2>Contact the Webmaster</h2>'); ?>

<p>If you need to reach the web master for any reason, you have
two easy ways of doing so. Those familiar with sending email
through client programs such as Apple's Mail or Mozilla Thunderbird
can <a href="mailto:jafelds@gmail.com">email me directly.</a> A
form alternative is also provided below. Use whichever is convenient
for you.</p>

<?php include_partial("contact/form", array('form' => $form)) ?>
30 changes: 30 additions & 0 deletions apps/frontend/modules/contact/templates/validateError.php
@@ -0,0 +1,30 @@
<?php slot('title', 'Contact Failure — Pump Pro Edits');
slot('h2', '<h2 class="error_list">Contact Error!</h2>');
if (isset($data)): ?>
<p>There was a problem with processing the data.</p>
<ul class="error_list">
<?php foreach ($data as $d): ?>
<li><?php echo $d ?></li>
<?php endforeach; ?>
</ul>
<?php if(isset($noshow)): ?>
<p>You will have to send a manual email. To make it easier
for you, just copy and paste the subject and message body
once you <a href="mailto:jafelds@gmail.com">click the email
link</a>.</p>
<pre>
<?php echo $subj ?>



<?php echo $body ?>
</pre>
<?php else: ?>
<p>Please check your data for typos and try again.</p>
<?php include_partial("contact/form", array('form' => $form));
endif;
else: ?>
<p>The errors are listed inside the form.</p>
<p>Please check the form and try again.</p>
<?php include_partial("contact/form", array('form' => $form));
endif;
6 changes: 6 additions & 0 deletions apps/frontend/modules/contact/templates/validateSuccess.php
@@ -0,0 +1,6 @@
<?php slot('title', "Email Sent — Pump Pro Edits");
slot('h2', '<h2 class="success_list">Email Sent!</h2>'); ?>

<p>An email has been sent to the webmaster. He'll get back to you
as soon as possible. Thank you for using Pump Pro Edits.</p>

4 changes: 4 additions & 0 deletions apps/frontend/modules/edits/templates/indexSuccess.php
@@ -0,0 +1,4 @@
<?php slot('title', 'Edits — Pump Pro Edits');
slot('h2', "<h2>Edits</h2>"); ?>

<p>Proper content to come soon.</p>
4 changes: 4 additions & 0 deletions apps/frontend/modules/help/templates/indexSuccess.php
@@ -0,0 +1,4 @@
<?php slot('title', "Account Help — Pump Pro Edits");
slot('h2', "<h2>Account Help</h2>"); ?>

<p>Proper content to come soon.</p>
5 changes: 3 additions & 2 deletions apps/frontend/modules/login/templates/indexSuccess.php
@@ -1,3 +1,4 @@
<?php slot('title', 'Log In — Pump Pro Edits'); ?>
<p>Log in here.</p>
<?php slot('title', 'Log In — Pump Pro Edits');
slot('h2', "<h2>Log In</h2>"); ?>
<p>Use the form below to log in and be able to submit edits.</p>
<?php include_partial("login/form", array('form' => $form));
6 changes: 3 additions & 3 deletions apps/frontend/modules/login/templates/validateError.php
@@ -1,6 +1,6 @@
<?php slot('title', 'Login Failure — Pump Pro Edits') ?>
<h2>Error!</h2>
<?php if (isset($data)): ?>
<?php slot('title', 'Login Failure — Pump Pro Edits');
slot('h2', '<h2 class="error_list">Log In Error!</h2>');
if (isset($data)): ?>
<p>There was a problem with processing the data.</p>
<ul class="error_list">
<?php foreach ($data as $d): ?>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/modules/login/templates/validateSuccess.php
@@ -1,5 +1,5 @@
<?php slot('title', 'Logged In — Pump Pro Edits'); ?>
<h2>Success!</h2>
<?php slot('title', 'Logged In — Pump Pro Edits');
slot('h2', '<h2 class="success_list">Logged In!</h2>'); ?>

<p>You are now logged in. Have fun contributing edits! ☺</p>

6 changes: 3 additions & 3 deletions apps/frontend/modules/logout/templates/indexSuccess.php
@@ -1,3 +1,3 @@
<?php slot('title', 'Logged Out — Pump Pro Edits'); ?>
<h2>Success!</h2>
<p>You have logged out successfully.</p>
<?php slot('title', 'Logged Out — Pump Pro Edits');
slot('h2', '<h2 class="success_list">Logged Out!</h2>'); ?>
<p>You have logged out successfully.</p>
3 changes: 2 additions & 1 deletion apps/frontend/modules/ppehome/templates/indexSuccess.php
@@ -1 +1,2 @@
<p>This is a test.</p>
<p>This is a temporary entry page until I can come up with
something better. I may need some help in that regard.</p>
2 changes: 2 additions & 0 deletions apps/frontend/modules/register/templates/indexSuccess.php
@@ -1,3 +1,5 @@
<?php slot('title', 'Register here — Pump Pro Edits');
slot('h2', '<h2>Register here</h2>'); ?>
<p> To be able to upload edits and access some member only
exclusive portions of the website, you will have to register.
It is easy to do: just fill out the form below, and reply
Expand Down
6 changes: 3 additions & 3 deletions apps/frontend/modules/register/templates/validateError.php
@@ -1,6 +1,6 @@
<?php slot('title', 'Registration Failure — Pump Pro Edits') ?>
<h2>Error!</h2>
<?php if (isset($data)): ?>
<?php slot('title', 'Registration Failure — Pump Pro Edits');
slot('h2', '<h2 class="error_list">Registration Error!</h2>');
if (isset($data)): ?>
<p>There was a problem with processing the data.</p>
<ul class="error_list">
<?php foreach ($data as $d): ?>
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/modules/register/templates/validateSuccess.php
@@ -1,4 +1,5 @@
<h2>Success!</h2>
<?php slot('title', "Registration Almost Done — Pump Pro Edits");
slot('h2', '<h2 class="success_list">Almost there!</h2>'); ?>

<p>An email confirmation message has been sent to your email address.
Make sure to read it and follow the instructions to get confirmed!</p>
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/modules/stats/templates/indexSuccess.php
@@ -1,5 +1,5 @@
<?php slot('title', 'Edit Stat Getter — Pump Pro Edits'); ?>
<h2>Get Edit's Stats</h2>
<?php slot('title', 'Edit Stat Getter — Pump Pro Edits');
slot('h2', "<h2>Get Edit's Stats</h2>"); ?>
<p>
Do you need to quickly get stats on an edit without uploading
the edit file itself? If so, use the form below.
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/modules/stats/templates/validateError.php
@@ -1,4 +1,5 @@
<?php slot('title', 'Edit Parse Failure — Pump Pro Edits') ?>
<?php slot('title', 'Edit Parse Failure — Pump Pro Edits');
slot('h2', '<h2 class="error_list">Edit Parse Failure!</h2>'); ?>

<p>Are you sure you submitted an edit? Double check and try again.</p>

Expand Down
6 changes: 2 additions & 4 deletions apps/frontend/modules/thanks/templates/indexSuccess.php
@@ -1,7 +1,5 @@
<?php
slot('title', 'Credits / Thanks — Pump Pro Edits')
?>
<h2>Credits and Thanks</h2>
<?php slot('title', 'Credits / Thanks — Pump Pro Edits');
slot('h2', '<h2>Credits and Thanks</h2>'); ?>
<p>
Let it be known that I don't try to be selfish. There are many people
and places that I have to thank here.
Expand Down
10 changes: 6 additions & 4 deletions apps/frontend/templates/layout.php
Expand Up @@ -7,15 +7,17 @@
<title><?php include_slot('title', 'Pump Pro Edits') ?></title>
<link rel="shortcut icon" href="/favicon.ico" />
<?php include_stylesheets();
if (browser_detection(7) == "ie"):

endif;
if (browser_detection(7) == "ie"): ?>
<script type="text/javascript" src="js/IE8.js"></script>
<script type="text/javascript" src="js/ie_html5.js"></script>
<?php endif;
include_javascripts(); ?>
</head>
<body>
<header><h1><?php echo link_to('Pump Pro Edits', '@homepage') ?></h1></header>
<article>
<?php echo $sf_content ?>
<?php include_slot('h2', '<h2>Welcome!</h2>');
echo $sf_content ?>
</article>
<?php $authin = $sf_user->isAuthenticated() ? "in" : "out"; ?>
<nav>
Expand Down
7 changes: 5 additions & 2 deletions lib/PPEUser.class.php
Expand Up @@ -7,8 +7,10 @@ public function signIn($credentials, $id)
$this->setAuthenticated(true);
$this->addCredentials($credentials);
$this->setAttribute('id', $id);
$this->setAttribute('name', Doctrine::getTable('PPE_User_User')
->getNameByID($id));
$userT = Doctrine::getTable('PPE_User_User');
$row = $userT->getAuthByID($id);
$this->setAttribute('name', $row['name']);
$this->setAttribute('email', $row['email']);
}

public function signOut()
Expand All @@ -17,5 +19,6 @@ public function signOut()
$this->clearCredentials();
$this->getAttributeHolder()->remove('id');
$this->getAttributeHolder()->remove('user');
$this->getAttributeHolder()->remove('email');
}
}
12 changes: 12 additions & 0 deletions lib/email/ContactMessage.class.php
@@ -0,0 +1,12 @@
<?php

class ContactMessage extends BaseMessage
{
public function __construct($from, $name, $subject, $body)
{
parent::__construct("PPEdits Contact Form - " . $subject, $body);
$this->setFrom(array('jafelds@gmail.com' => 'Jason "Wolfman2000" Felds'));
$this->setBcc(array('jafelds@gmail.com' => 'Jason "Wolfman2000" Felds'));
$this->setReplyTo(array($from => $name));
}
}
53 changes: 53 additions & 0 deletions lib/form/ContactForm.class.php
@@ -0,0 +1,53 @@
<?php

class ContactForm extends sfForm
{
public function configure()
{
parent::configure();

$max_em = sfConfig::get('app_max_email_length');
$pieces['name'] = new sfWidgetFormInput();
$unreq['maxlength'] = $max_em;
$pieces['email'] = new sfWidgetFormInput(array(), $unreq);
$max_sb = sfConfig::get('app_max_subject_length');
$unreq['maxlength'] = $max_sb;
$pieces['subject'] = new sfWidgetFormInput(array(), $unreq);
$pieces['content'] = new sfWidgetFormTextarea();

$this->setWidgets($pieces);

$decorator = new myWidgetFormSchemaFormatterDList($this->getWidgetSchema());
$this->widgetSchema->addFormFormatter('dlist', $decorator);
$this->widgetSchema->setFormFormatterName('dlist');
$this->widgetSchema->setNameFormat('validate[%s]');

$tmp2['required'] = "You must supply a name.";

$val['name'] = new sfValidatorString(array(), $tmp2);

$tmp1['max_length'] = $max_em;
$tmp2['required'] = "You must supply an email address.";
$tmp2['max_length'] = "Your email address must be at most $max_em characters.";
$tmp2['invalid'] = "The email address is not in a valid form.";

$val['email'] = new sfValidatorEmail($tmp1, $tmp2);

$tmp2['required'] = "You must supply a subject.";
$tmp1['max_length'] = $max_sb;
$tmp2['max_length'] = "The subject can't be more than $max_sb characters.";

$val['subject'] = new sfValidatorString($tmp1, $tmp2);

$tmp1['max_length'] = null;
$min_ct = sfConfig::get('app_min_email_length');
$tmp1['min_length'] = $min_ct;
$tmp2['min_length'] = "The email is too short. Add actual sentences.";
$tmp2['required'] = "You must supply the message.";

$val['content'] = new sfValidatorString($tmp1, $tmp2);

$this->setValidators($val);

}
}
8 changes: 8 additions & 0 deletions lib/model/doctrine/PPE_User_UserTable.class.php
Expand Up @@ -57,6 +57,14 @@ public function getConfirmedByID($id)
return $q['is_confirmed'];
}

/* Name and email address */
public function getAuthByID($id)
{
return $this->createQuery('a')->select('name, email')
->where('id = ?', $id)
->fetchOne(array(), Doctrine::HYDRATE_ARRAY);
}

public function getNameByID($id)
{
$q = $this->createQuery('a')->select('name')->where('id = ?', $id)
Expand Down

0 comments on commit 04c76a6

Please sign in to comment.