Skip to content

Commit

Permalink
User interface for e-mail {$name}
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1081 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Sep 9, 2009
1 parent 2c76578 commit 1e55d47
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion adminer/include/adminer.inc.php
Expand Up @@ -236,13 +236,15 @@ function selectActionPrint() {


/** Print extra text in the end of a select form /** Print extra text in the end of a select form
* @param array fields holding e-mails * @param array fields holding e-mails
* @param array selectable columns
* @return null * @return null
*/ */
function selectEmailPrint($emailFields) { function selectEmailPrint($emailFields, $columns) {
} }


/** Process columns box in select /** Process columns box in select
* @param array selectable columns * @param array selectable columns
* @param array
* @return array (array(select_expressions), array(group_expressions)) * @return array (array(select_expressions), array(group_expressions))
*/ */
function selectColumnsProcess($columns, $indexes) { function selectColumnsProcess($columns, $indexes) {
Expand Down
2 changes: 1 addition & 1 deletion adminer/select.inc.php
Expand Up @@ -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"; 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"; echo "</form>\n";
} }
Expand Down
17 changes: 10 additions & 7 deletions editor/include/adminer.inc.php
Expand Up @@ -21,7 +21,7 @@ function database() {
function loginForm($username) { function loginForm($username) {
?> ?>
<table cellspacing="0"> <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"> <tr><th><?php echo lang('Password'); ?><td><input type="password" name="password">
</table> </table>
<?php <?php
Expand Down Expand Up @@ -181,14 +181,14 @@ function selectActionPrint() {
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
} }


function selectEmailPrint($emailFields) { function selectEmailPrint($emailFields, $columns) {
global $confirm; global $confirm;
if ($emailFields) { 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 '<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'>\n"; echo "<p>" . lang('From') . ": <input name='email_from' value='" . h($_POST["email_from"]) . "'>\n";
echo lang('Subject') . ": <input name='email_subject'>\n"; echo lang('Subject') . ": <input name='email_subject' value='" . h($_POST["email_subject"]) . "'>\n";
echo "<p><textarea name='email_message' rows='15' cols='60'></textarea>\n"; echo "<p><textarea name='email_message' rows='15' cols='60'>" . h($_POST["email_message"] . ($_POST["email_append"] ? '{$' . "$_POST[email_addition]}" : "")) . "</textarea><br>\n";
//! add UI for {$name} fields 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 "<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 "<input type='submit' name='email' value='" . lang('Send') . "'$confirm>\n";
echo "</div></fieldset>\n"; echo "</div></fieldset>\n";
Expand Down Expand Up @@ -252,6 +252,9 @@ function selectLengthProcess() {


function selectEmailProcess($where, $foreignKeys) { function selectEmailProcess($where, $foreignKeys) {
global $dbh; global $dbh;
if ($_POST["email_append"]) {
return true;
}
if ($_POST["email"]) { if ($_POST["email"]) {
$sent = 0; $sent = 0;
if ($_POST["all"] || $_POST["check"]) { if ($_POST["all"] || $_POST["check"]) {
Expand Down

0 comments on commit 1e55d47

Please sign in to comment.