Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Updated to new versions of Nymph and Tilmeld.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed May 15, 2018
1 parent 81aad12 commit 2c535da
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 163 deletions.
6 changes: 5 additions & 1 deletion .babelrc
Expand Up @@ -4,6 +4,10 @@
"stage-3"
],
"plugins": [
"transform-es2015-modules-umd"
["transform-es2015-modules-umd", {
"globals": {
"nymph-client": "NymphClient"
}
}]
]
}
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"name": "sciactive/umailphp",
"description": "A PHP email templating system.",
"description": "An email templating system for Nymph.",
"version": "2.3.0",
"time": "2018-04-23",
"homepage": "http://umailphp.org/",
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "umailphp",
"version": "2.3.0",
"description": "PHP email templating system.",
"description": "An email templating system for Nymph.",
"main": "lib/umailphp.js",
"browser": "src/umailphp.js",
"directories": {
Expand All @@ -15,6 +15,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"files": [
"conf",
"lib",
"src",
"setup"
Expand All @@ -35,13 +36,13 @@
},
"homepage": "https://github.com/sciactive/umailphp#readme",
"dependencies": {
"nymph-client": "^4.0.0-beta.1",
"nymph-client": "^4.0.0-beta.6",
"pform": "^3.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-preset-env": "^1.6.1",
"babel-preset-env": "^1.7.0",
"babel-preset-stage-3": "^6.24.1"
}
}
43 changes: 10 additions & 33 deletions setup/instructions.html
Expand Up @@ -2,66 +2,43 @@
<h2 style="margin-top: 0;">Email Instructions <small>Some help for setting up this awesome email system.</small></h2>
</div>
<div>
Welcome to uMailPHP. This program handles email templates. It can be a
little tricky to set up, so read through these instructions carefully.
Welcome to uMailPHP. This program handles email templates. It can be a little tricky to set up, so read through these instructions carefully.
</div>
<div class="page-header">
<h3>How It Works</h3>
</div>
To use uMailPHP to its full potential, you must first know how it works.
This system constructs emails using three parts:
uMailPHP constructs emails using three parts:
<ul>
<li>The template.</li>
<li>The mail definition.</li>
<li>An optional custom redefinition called a rendition.</li>
</ul>
<p>
The <strong>template</strong> is used for each email that is sent. It
provides the basic layout of the email. Any number of templates can be
defined, but only the first one that is enabled will be used. If you don't
define your own template, a default one will be used.
The <strong>template</strong> is used for each email that is sent. It provides the basic layout of the email. If you don't specify a template when sending an email, the first one that is enabled will be used. If you haven't defined any templates, a default one will be used.
</p>
<p>
The <strong>mail definition</strong> is provided by a class responsible for
initiating the email. It provides the main content of the email. So, for
example, the mail definition of an email sent when a new user registers
would pertain to the user and provide their information in the body of the
email. Whereas, the definition of an email sent when a user makes an online
purchase would provide information about the purchase and a receipt.
The <strong>mail definition</strong> is a PHP class responsible for initiating the email. It provides the main content of the email. For example, the mail definition of an email sent when a new user registers would pertain to the user and may have their information in the body of the email. The definition of an email sent when a user makes a purchase could provide information about the purchase and a receipt.
</p>
<p>
A <strong>rendition</strong>, when defined, is used in place of the mail
definition to construct the body of the email. It can be created through
this GUI to customize the email's content.
A <strong>rendition</strong> is stored in the database. When defined, it's used in place of the mail definition to construct the body of the email. It can be created through the setup GUI, rather than hard coded to customize the email's content.
</p>
<div class="page-header">
<h3>How To Customize</h3>
</div>
<p>
The two ways you can customize the emails are by creating templates and
renditions. When you create a template, you can design the overall look and
design of all emails. When you create a rendition, you can customize a
single type of email (like a new user registration email).
The two ways you can customize the emails are by creating templates and renditions. When you create a template, you can design the overall look and design of all emails. When you create a rendition, you can customize a single type of email (like a new user registration email).
</p>
<h4>Macros</h4>
<p>
The content in an email almost always includes variables, such as the
recipient's name, which are handled by macros. A macro is just the name of a
variable surrounded by hash symbols (e.g. #to_name#). This text is replaced
by the correct value before the email is sent.
The content in an email almost always includes variables, such as the recipient's name, which are handled by macros. A macro is just the name of a variable surrounded by hash symbols (e.g. #to_name#). This text is replaced before the email is sent.
</p>
<p>
There are universal macros, which can be used in any template, definition,
or rendition. Also, there are macros specific to a mail definition. For
example, the definition of an email sent when a user changes an appointment
with a customer may have macros called #old_date# and #new_date#. When you
create a rendition to customize the email, you can use these macros.
There are universal macros, which can be used in any template, definition, or rendition. Also, there are macros specific to a mail definition. For example, the definition of an email sent when a user changes an appointment with a customer could have macros called #old_date# and #new_date#. When you create a rendition to customize the email, you can use these macros.
</p>
<div class="well">
<p>
<span class="label label-warning">Heads Up</span>
When you format a macro, edit the macro string as a whole. If you want
to bold it, change the whole string, including the hash symbols.
When you format a macro, edit the macro string as a whole. If you want to bold it, change the whole string, including the hash symbols.
</p>
<div class="row">
<div class="col-sm-6">
Expand All @@ -71,4 +48,4 @@ <h4>Macros</h4>
<pre style="font-size: 1.2em; font-weight: normal;"><span class="label label-danger">Wrong</span> #<strong>to_name</strong>#, #old_<em>date#</em></pre>
</div>
</div>
</div>
</div>
32 changes: 16 additions & 16 deletions setup/setup.php
Expand Up @@ -60,27 +60,27 @@
<script src="<?php echo htmlspecialchars($baseURL); ?>lib/Entities/Template.js"></script>
<script src="<?php echo htmlspecialchars($baseURL); ?>lib/umailphp.js"></script>

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="<?php echo htmlspecialchars($sciactiveBaseURL); ?>pform/css/pform.css">
<link rel="stylesheet" href="<?php echo htmlspecialchars($sciactiveBaseURL); ?>pform/css/pform-bootstrap.css">

<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/codemirror.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/codemirror.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/css/css.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/javascript/javascript.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/xml/xml.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/fold/xml-fold.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/matchtags.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/matchbrackets.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/closetag.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/closebrackets.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/codemirror.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/codemirror.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/css/css.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/javascript/javascript.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/xml/xml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/mode/htmlmixed/htmlmixed.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/fold/xml-fold.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/matchtags.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/matchbrackets.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/closetag.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/4.11.0/addon/edit/closebrackets.min.js"></script>
<script src="https://rawgithub.com/angular-ui/ui-codemirror/bower/ui-codemirror.min.js"></script>

<script src="<?php echo htmlspecialchars($baseURL); ?>setup/setupApp.js"></script>
Expand Down
12 changes: 2 additions & 10 deletions src/Entities/Rendition.js
Expand Up @@ -6,22 +6,14 @@ export class Rendition extends Entity {
constructor (id) {
super(id);
this.data.enabled = true;
this.data.ac_other = 1;
}

// === Instance Methods ===

isReady (...args) {
return this.serverCall('ready', args);
this.data.acOther = 1;
}
}

// === Static Properties ===

Rendition.etype = 'umailphp_rendition';
// The name of the server class
Rendition.class = 'uMailPHP\\Entities\\Rendition';

Rendition.class = '\\uMailPHP\\Entities\\Rendition';

Nymph.setEntityClass(Rendition.class, Rendition);

Expand Down
27 changes: 1 addition & 26 deletions src/Entities/Rendition.php
Expand Up @@ -17,7 +17,7 @@ public function __construct($id = 0) {
}
// Defaults.
$this->enabled = true;
$this->ac_other = 1;
$this->acOther = 1;
}

/**
Expand All @@ -36,29 +36,4 @@ class_exists('\Tilmeld\Tilmeld')
}
return parent::save();
}

/**
* Print a form to edit the rendition.
* @return module The form's module.
*/
public function printForm() {
$module = new module('com_mailer', 'rendition/form', 'content');
$module->entity = $this;

return $module;
}

/**
* Determine if this rendition is ready to use.
*
* This function will check the conditions of the rendition.
*
* @return bool True if the rendition is ready, false otherwise.
*/
public function ready() {
if (!$this->enabled) {
return false;
}
return true;
}
}

0 comments on commit 2c535da

Please sign in to comment.