Skip to content
Browse files

A lot of feedback from the custmz-project

  • Loading branch information...
1 parent cad6bf2 commit be3b46d574d80ac3a562596a2c791257ec299963 @tijsverkoyen tijsverkoyen committed
View
2 VERSION.md
@@ -1 +1 @@
-3
+3.5
View
3 cache/locale/en.php
@@ -20,6 +20,9 @@
$err['GeneralError'] = 'Something went wrong.';
$err['GeneralFormError'] = 'Something went wrong, please check the highlighted fields.';
$err['InvalidModule'] = 'Sorry, this module can not be found.';
+$err['InvalidRecord'] = 'Sorry, this item can not be found.';
+$err['JPGGIFAndPNGOnly'] = 'Only jp(e)g, gif or png-files are allowed.';
+$err['UrlIsInvalid'] = 'This is an invalid url.';
// init var
$lbl = array();
View
0 cache/config/.gitignore → cache/logs/.gitignore 100755 → 100644
File renamed without changes.
View
3 composer.json
@@ -3,7 +3,8 @@
"description": "This is the SumoCoders mini-framework, it should allow you to build applications without much hasle.",
"license": "MIT",
"require": {
- "spoon/library": "1.3.*",
+ "spoon/library": "dev-master",
+ "swiftmailer/swiftmailer": "v4.3.0",
"monolog/monolog": "1.3.1"
}
}
View
6 core/classes/form.php
@@ -22,10 +22,7 @@ class SiteForm extends SpoonForm
*/
public function __construct($name, $action = null, $method = 'post', $useToken = false)
{
- // no acion provided?
$action = ($action === null) ? '/' . trim((string) $_SERVER['REQUEST_URI'], '/') : (string) $action;
-
- // call parent
parent::__construct($name, $action, $method, $useToken);
}
@@ -40,10 +37,7 @@ public function __construct($name, $action = null, $method = 'post', $useToken =
*/
public function addButton($name, $value, $type = null, $class = 'inputButton btn')
{
- // add element
$this->add(new SpoonFormButton($name, $value, $type, $class));
-
- // return the element
return $this->getField($name);
}
View
29 core/classes/site.php
@@ -380,4 +380,33 @@ public static function getUTCTimestamp(SpoonFormDate $date, SpoonFormTime $time
// make and return timestamp
return mktime($hour, $minute, 0, $month, $day, $year);
}
+ /**
+ * Send a mail
+ *
+ * @param $subject
+ * @param $from
+ * @param $to
+ * @param $body
+ * @return int
+ */
+ public static function sendMail(
+ $subject,
+ $from,
+ $to,
+ $body
+ )
+ {
+ $transport = Swift_SmtpTransport::newInstance(MAIL_SERVER, MAIL_PORT)
+ ->setUsername(MAIL_USERNAME)
+ ->setPassword(MAIL_PASSWORD);
+ $mailer = Swift_Mailer::newInstance($transport);
+
+ // create the message
+ $message = Swift_Message::newInstance($subject);
+ $message->setFrom($from);
+ $message->setTo($to);
+ $message->setBody($body);
+
+ return $mailer->send($message, $failures);
+ }
}
View
20 core/layout/templates/error.tpl
@@ -1,16 +1,12 @@
{include:'{$CORE_PATH}/layout/templates/head.tpl'}
-{include:'{$CORE_PATH}/layout/templates/header.tpl'}
-
-<div id="content" class="container-fluid">
- <section id="{$MODULE}" class="{$ACTION} row-fluid">
- <div class="span12">
- <div class="alert alert-error">
- {$error}
+ <div id="content" class="container-fluid">
+ <section id="{$MODULE}" class="{$ACTION} row-fluid">
+ <div class="span12">
+ <div class="alert alert-error">
+ {$error}
+ </div>
</div>
- </div>
- </section>
-
- {include:'{$CORE_PATH}/layout/templates/footer.tpl'}
-</div>
+ </section>
+ </div>
</body>
</html>
View
5 core/layout/templates/head.tpl
@@ -3,7 +3,10 @@
<head>
<meta charset="utf-8">
- <title>{$SITE_DEFAULT_TITLE}</title>
+ <title>
+ {option:pageTitle}{$pageTitle}{/option:pageTitle}
+ {option:!pageTitle}{$SITE_DEFAULT_TITLE}{/option:!pageTitle}
+ </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
View
1 files/.gitignore
@@ -1 +1,2 @@
+*
!.gitignore
View
28 modules/users/actions/edit.php
@@ -92,6 +92,15 @@ private function loadForm()
}
/**
+ * Parse the form
+ */
+ private function parse()
+ {
+ $this->frm->parse($this->tpl);
+ $this->tpl->assign('item', $this->item->toArray());
+ }
+
+ /**
* Validate the form
*
* @return void
@@ -111,7 +120,6 @@ private function validateForm()
// set properties
$this->item->name = $this->frm->getField('name')->getValue();
$this->item->email = $this->frm->getField('email')->getValue();
- $this->item->type = $this->frm->getField('type')->getValue();
if($this->frm->getField('password')->isFilled())
{
@@ -119,13 +127,29 @@ private function validateForm()
$this->item->rawPassword = $this->frm->getField('password')->getValue();
}
+ if($this->currentUser->isAdmin)
+ {
+ $this->item->type = $this->frm->getField('type')->getValue();
+ }
+
// save
$this->item->save();
+ if($this->currentUser->isAdmin)
+ {
+ // redirect
+ $this->redirect(
+ $this->url->buildUrl(
+ 'index', null, null,
+ array('report' => 'edited', 'var' => $this->item->name, 'id' => $this->item->id)
+ )
+ );
+ }
+
// redirect
$this->redirect(
$this->url->buildUrl(
- 'index', null, null,
+ 'edit', null, $this->item->id,
array('report' => 'edited', 'var' => $this->item->name, 'id' => $this->item->id)
)
);
View
2 modules/users/layout/templates/add.tpl
@@ -16,7 +16,7 @@
{/option:formAddHasError}
{form:add}
- <div class="form-horizontal">
+ <div class="form">
<div class="control-group{option:txtEmailError} error{/option:txtEmailError}">
<label for="email" class="control-label">{$lblEmail|ucfirst}<abbr title="{$msgRequired}">*</abbr></label>
<div class="controls">
View
19 modules/users/layout/templates/edit.tpl
@@ -9,6 +9,11 @@
<h2>{$msgUsersEdit|sprintf:{$item.name}}</h2>
</header>
+ {option:report}
+ <div class="alert alert-success">
+ {$report}
+ </div>
+ {/option:report}
{option:formEditHasError}
<div class="alert alert-error">
{$errGeneralFormError}
@@ -16,7 +21,7 @@
{/option:formEditHasError}
{form:edit}
- <div class="form-horizontal">
+ <div class="form">
<div class="control-group{option:txtEmailError} error{/option:txtEmailError}">
<label for="email" class="control-label">{$lblEmail|ucfirst}<abbr title="{$msgRequired}">*</abbr></label>
<div class="controls">
@@ -35,12 +40,14 @@
{$txtPassword} {$txtPasswordError}
</div>
</div>
- <div class="control-group{option:ddmTypeError} error{/option:ddmTypeError}">
- <label for="type" class="control-label">{$lblType|ucfirst}<abbr title="{$msgRequired}">*</abbr></label>
- <div class="controls">
- {$ddmType} {$ddmTypeError}
+ {option:currentUser.isAdmin}
+ <div class="control-group{option:ddmTypeError} error{/option:ddmTypeError}">
+ <label for="type" class="control-label">{$lblType|ucfirst}<abbr title="{$msgRequired}">*</abbr></label>
+ <div class="controls">
+ {$ddmType} {$ddmTypeError}
+ </div>
</div>
- </div>
+ {/option:currentUser.isAdmin}
<div class="form-actions">
<input type="submit" class="btn btn-primary" name="ok" value="{$lblEdit|ucfirst}">

0 comments on commit be3b46d

Please sign in to comment.
Something went wrong with that request. Please try again.