Permalink
Browse files

User interface for e-mail {$name}

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1081 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent 2c76578 commit 1e55d4755ed4dce3f36c813521d64e84cc2be7a2 jakubvrana committed Sep 9, 2009
Showing with 14 additions and 9 deletions.
  1. +3 −1 adminer/include/adminer.inc.php
  2. +1 −1 adminer/select.inc.php
  3. +10 −7 editor/include/adminer.inc.php
@@ -236,13 +236,15 @@ function selectActionPrint() {
/** Print extra text in the end of a select form
* @param array fields holding e-mails
+ * @param array selectable columns
* @return null
*/
- function selectEmailPrint($emailFields) {
+ function selectEmailPrint($emailFields, $columns) {
}
/** Process columns box in select
* @param array selectable columns
+ * @param array
* @return array (array(select_expressions), array(group_expressions))
*/
function selectColumnsProcess($columns, $indexes) {
View
@@ -286,7 +286,7 @@
}
echo "<fieldset><legend>" . lang('CSV Import') . "</legend><div><input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'></div></fieldset>\n";
- $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'));
+ $adminer->selectEmailPrint(array_filter($email_fields, 'strlen'), $columns);
echo "</form>\n";
}
@@ -21,7 +21,7 @@ function database() {
function loginForm($username) {
?>
<table cellspacing="0">
-<tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="server" value="" /><input name="username" value="<?php echo h($username); ?>">
+<tr><th><?php echo lang('Username'); ?><td><input type="hidden" name="server" value=""><input name="username" value="<?php echo h($username); ?>">
<tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
</table>
<?php
@@ -181,14 +181,14 @@ function selectActionPrint() {
echo "</div></fieldset>\n";
}
- function selectEmailPrint($emailFields) {
+ function selectEmailPrint($emailFields, $columns) {
global $confirm;
if ($emailFields) {
- echo '<fieldset><legend><a href="#fieldset-email" onclick="return !toggle(\'fieldset-email\');">' . lang('E-mail') . "</a></legend><div id='fieldset-email' class='hidden'>\n";
- echo "<p>" . lang('From') . ": <input name='email_from'>\n";
- echo lang('Subject') . ": <input name='email_subject'>\n";
- echo "<p><textarea name='email_message' rows='15' cols='60'></textarea>\n";
- //! add UI for {$name} fields
+ echo '<fieldset><legend><a href="#fieldset-email" onclick="return !toggle(\'fieldset-email\');">' . lang('E-mail') . "</a></legend><div id='fieldset-email'" . ($_POST["email_append"] ? "" : " class='hidden'") . ">\n";
+ echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST["email_from"]) . "'>\n";
+ echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
+ echo "<p><textarea name='email_message' rows='15' cols='60'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
+ echo "<select name='email_addition'>" . optionlist($columns, $_POST["email_addition"]) . "</select> <input type='submit' name='email_append' value='" . lang('Insert') . "'>\n"; //! JavaScript
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : '<select name="email_field">' . optionlist($emailFields) . '</select> ');
echo "<input type='submit' name='email' value='" . lang('Send') . "'$confirm>\n";
echo "</div></fieldset>\n";
@@ -252,6 +252,9 @@ function selectLengthProcess() {
function selectEmailProcess($where, $foreignKeys) {
global $dbh;
+ if ($_POST["email_append"]) {
+ return true;
+ }
if ($_POST["email"]) {
$sent = 0;
if ($_POST["all"] || $_POST["check"]) {

0 comments on commit 1e55d47

Please sign in to comment.