Made some updates.

git-svn-id: http://svn.cleancode.org/svn/pickles@37 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
Josh Sherman 2008-08-18 03:01:00 +00:00
parent 66338a66bb
commit 68b925b213
7 changed files with 38 additions and 55 deletions

View file

@ -11,40 +11,4 @@ function __autoload($class) {
}
}
class Pickles extends Object {
/*
protected $config = null;
private $controller = null;
public function __construct($site, $controller = 'Web') {
parent::__construct();
new Controller($controller);
}
*/
}
/*
if (Config::getSession() && !isset($_SESSION)) {
session_start();
}
// Use the FCKeditor instead of textareas
// @todo add a wrapper for these two
if (Config::getFCKEditor()) {
require_once JLIB_PATH . 'common/static/fckeditor/fckeditor.php';
}
// Load up MagpieRSS is so desired
if (Config::getMagpieRSS()) {
require_once JLIB_PATH . '/var/www/josh/common/contrib/magpierss/rss_fetch.inc';
}
//Request::load();
*/
?>

View file

@ -29,7 +29,7 @@ class Controller extends Object {
if ($this->config->get('disabled')) {
exit("<h2><em>{$_SERVER['SERVER_NAME']} is currently down for maintenance</em></h2>");
}
// Grab the passed in model or use the default
$name = isset($_REQUEST['model']) ? str_replace('-', '_', $_REQUEST['model']) : $this->config->get('navigation', 'default');

View file

@ -24,11 +24,23 @@ class Mail {
$prefix = isset($defaults['prefix']) ? $defaults['prefix'] : null;
}
$subject = str_replace("\n", '', (isset($prefix) ? "[{$prefix}] " : '') . $_REQUEST['subject']);
if (isset($defaults['subject'])) {
$subject = $defaults['subject'];
}
else {
$subject = str_replace("\n", '', (isset($prefix) ? "[{$prefix}] " : '') . $_REQUEST['subject']);
}
if (mail($to, $subject, stripslashes($_REQUEST['message']), "From: {$_REQUEST['email']}\r\n")) {
if (isset($_REQUEST['name'])) {
$from = "{$_REQUEST['name']} <{$_REQUEST['email']}>";
}
else {
$from = $_REQUEST['email'];
}
if (mail($to, $subject, stripslashes($_REQUEST['message']), "From: {$from}\r\n")) {
$type = 'success';
$message = 'Message sent successfully';
$message = isset($defaults['response']) ? $defaults['response'] : 'Message sent successfully';
}
else {
$type = 'error';
@ -36,7 +48,7 @@ class Mail {
}
$return = array(
'type' => $type,
'type' => $type,
'message' => $message
);

View file

@ -65,7 +65,10 @@ class Viewer_Smarty extends Viewer_Common {
// Pass all of our controller values to Smarty
$smarty->assign('navigation', $navigation);
$smarty->assign('section', $this->model->get('section'));
$smarty->assign('action', $this->model->get('action')); // @todo rename me to event
$smarty->assign('model', $this->model->get('name'));
$smarty->assign('action', $this->model->get('action')); // @todo rename me to event...
$smarty->assign('event', $this->model->get('action')); // but it almost seems like we don't need these anymore at all
// Thanks to new naming conventions
$smarty->assign('admin', $this->config->get('admin', 'sections'));
$smarty->assign('template', '../templates/' . $this->model->get('name') . '.tpl'); //$template);

View file

@ -18,7 +18,8 @@
</sections>
</admin>
<contact>
<prefix>RN</prefix>
<subject>Ribbon Nutrition Contact Request</subject>
<response>Thank you. A member of our staff will respond to your message as soon as possible.</response>
<recipients>
<recipient>joshsherman@gmail.com</recipient>
</recipients>

View file

@ -1,10 +1,13 @@
.center { text-align: center; }
.left { text-align: left; }
.right { text-align: right; }
.top { vertical-align: top; }
.middle { vertical-align: middle; }
.bottom { vertical-align: bottom; }
.nowrap { white-space: nowrap; }
.bold { font-weight: bold; }
.italic { font-style: italic; }
.clear { clear: both; }
.center { text-align: center }
.left { text-align: left }
.right { text-align: right }
.top { vertical-align: top }
.middle { vertical-align: middle }
.bottom { vertical-align: bottom }
.nowrap { white-space: nowrap }
.bold { font-weight: bold }
.italic { font-style: italic }
.clear { clear: both }
.underline { text-decoration: underline }
.float-left { float: left }
.float-right { float: right }

View file

@ -14,7 +14,7 @@ function getForm(form) {
case 'textarea':
// Check if it's required
if (element.title == 'required' && element.value == '') {
alert('Error: The ' + element.name + ' field is required.');
alert('Error: The ' + element.name.replace('_', ' ') + ' field is required.');
element.focus();
return false;
}
@ -60,7 +60,7 @@ function createRequest() {
function ajaxSubmit(form) {
var params = '';
if (params = getForm(form)) {
createRequest();
request.open(form.method, form.action, true);