Changeset:
b25e26ddf9af
https://sourceforge.net/p/mrbs/hg-code/ci/b25e26ddf9af163376107c61456fcca6bcbbd4e2
Author:
Campbell Morrison <[email protected]>
Date:
Sun Mar 19 19:27:05 2017 +0000
Log message:
Restructured and made the view_entry links line up.
diffstat:
web/css/mrbs.css.php | 27 ++++++-
web/view_entry.php | 181 +++++++++++++++++++++++++++++++++-----------------
2 files changed, 142 insertions(+), 66 deletions(-)
diffs (truncated from 316 to 300 lines):
diff -r b5c294306cad -r b25e26ddf9af web/css/mrbs.css.php
--- a/web/css/mrbs.css.php Sun Mar 19 18:45:58 2017 +0000
+++ b/web/css/mrbs.css.php Sun Mar 19 19:27:05 2017 +0000
@@ -1267,9 +1267,27 @@
/* ------------ VIEW_ENTRY.PHP ------------------*/
.view_entry #entry td:first-child {text-align: right; font-weight: bold;
padding-right: 1.0em}
-.view_entry div#view_entry_nav {margin-top: 1.0em}
-.view_entry #approve_buttons button {
+.view_entry div#view_entry_nav {
+ display: table;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+div#view_entry_nav > div {
+ display: table-row;
+}
+
+div#view_entry_nav > div > div {
+ display: table-cell;
+ padding: 0.5em 1em;
+}
+
+#view_entry_nav input[type="submit"] {
+ width: 100%;
+}
+
+.view_entry #approve_buttons form {
float: left;
margin-right: 2em;
}
@@ -1278,7 +1296,10 @@
float: left;
}
-.view_entry div#returl {margin-top: 1em}
+div#returl {
+ margin-bottom: 1em;
+}
+
#approve_buttons td {vertical-align: middle; padding-top: 1em}
#approve_buttons td#caption {text-align: left}
#approve_buttons td#note {padding-top: 0}
diff -r b5c294306cad -r b25e26ddf9af web/view_entry.php
--- a/web/view_entry.php Sun Mar 19 18:45:58 2017 +0000
+++ b/web/view_entry.php Sun Mar 19 19:27:05 2017 +0000
@@ -10,28 +10,28 @@
// Manadatory parameters
// action The form action attribute
// value The value of the button
-// inputs An array of hidden form inputs, each element indexed
-// by 'name' and 'value'
+// inputs An array of hidden form inputs
//
// Optional parameters
-// title a title
-function generate_button(array $params)
+// button_attributes An array of attributes to be used for the button.
+function generate_button(array $params, array $button_attributes=array())
{
$html = '';
+
+ $html .= "<form method=\"post\" action=\"" .
htmlspecialchars($params['action']) . "\">\n";
+
+ foreach ($params['inputs'] as $key => $value)
+ {
+ $html .= '<input type="hidden" name="' . htmlspecialchars($key) . '"' .
+ ' value="' . htmlspecialchars($value) . "\">\n";
+ }
- $form_id = uniqid();
-
- $html .= "<button form=\"$form_id\" value=\"" .
htmlspecialchars($params['value']) . '"';
- $html .= (isset($params['title'])) ? ' title="' .
htmlspecialchars($params['title']) . '"' : '';
- $html .= '>' . htmlspecialchars($params['value']) . "</button>\n";
-
- $html .= "<form id=\"$form_id\" method=\"post\" action=\"" .
htmlspecialchars($params['action']) . "\">\n";
-
- foreach ($params['inputs'] as $input)
+ $html .= '<input type="submit" value="' . htmlspecialchars($params['value'])
. '"';
+ foreach($button_attributes as $key => $value)
{
- $html .= '<input type="hidden" name="' . htmlspecialchars($input['name'])
. '"' .
- ' value="' . htmlspecialchars($input['value']) . "\">\n";
+ $html .= " $key=\"" . htmlspecialchars($value) . '"';
}
+ $html .= ">\n";
$html .= "</form>\n";
@@ -69,24 +69,26 @@
// Approve
$params = array('action' =>
"approve_entry_handler.php?id=$id&series=$series",
'value' => get_vocab('approve'),
- 'inputs' => array(array('name' => 'action', 'value' =>
'approve'),
- array('name' => 'returl', 'value' =>
$returl)));
+ 'inputs' => array('action' => 'approve',
+ 'returl' => $returl)
+ );
generate_button($params);
// Reject
$params = array('action' => "$this_page?id=$id&series=$series",
'value' => get_vocab('reject'),
- 'inputs' => array(array('name' => 'action', 'value' =>
'reject'),
- array('name' => 'returl', 'value' =>
$returl)));
+ 'inputs' => array('action' => 'reject',
+ 'returl' => $returl)
+ );
generate_button($params);
// More info
$params = array('action' => "$this_page?id=$id&series=$series",
'value' => get_vocab('more_info'),
- 'inputs' => array(array('name' => 'action', 'value' =>
'more_info'),
- array('name' => 'returl', 'value' =>
$returl)),
- 'title' => $info_title);
- generate_button($params);
+ 'inputs' => array('action' => 'more_info',
+ 'returl' => $returl)
+ );
+ generate_button($params, array('title' => $info_title));
echo "</td>\n";
echo "</tr>\n";
@@ -113,8 +115,9 @@
$params = array('action' =>
"approve_entry_handler.php?id=$id&series=$series",
'value' => get_vocab('remind_admin'),
- 'inputs' => array(array('name' => 'action', 'value' =>
'remind'),
- array('name' => 'returl', 'value' =>
"$this_page?id=$id&area=$area")));
+ 'inputs' => array('action' => 'remind',
+ 'returl' =>
"$this_page?id=$id&area=$area")
+ );
generate_button($params);
echo "</td>\n";
@@ -322,6 +325,7 @@
$returl .= "?year=$year&month=$month&day=$day&area=$area";
}
}
+
$link_returl = urlencode($returl); // for use in links
if (empty($series))
@@ -446,15 +450,26 @@
echo "<div>\n";
if (!$series)
{
- echo "<a href=\"edit_entry.php?id=$id&returl=$link_returl\">".
get_vocab("editentry") ."</a>";
+ echo "<div>\n";
+ $params = array('action' => 'edit_entry.php',
+ 'value' => get_vocab('editentry'),
+ 'inputs' => array(array('name' => 'id', 'value' => $id),
+ array('name' => 'returl', 'value' =>
$returl))
+ );
+ generate_button($params);
+ echo "</div>\n";
}
- if (!empty($repeat_id) && !$series && $repeats_allowed)
- {
- echo " - ";
- }
if ((!empty($repeat_id) || $series) && $repeats_allowed)
{
- echo "<a
href=\"edit_entry.php?id=$id&edit_type=series&day=$day&month=$month&year=$year&returl=$link_returl\">".get_vocab("editseries")."</a>";
+ echo "<div>\n";
+ $params = array('action' =>
"edit_entry.php?day=$day&month=$month&year=$year",
+ 'value' => get_vocab('editseries'),
+ 'inputs' => array('id' => $id,
+ 'edit_type' => 'series',
+ 'returl' => $returl)
+ );
+ generate_button($params);
+ echo "</div>\n";
}
echo "</div>\n";
@@ -462,15 +477,33 @@
echo "<div>\n";
if (!$series)
{
- echo "<a
href=\"del_entry.php?id=$id&series=0&returl=$link_returl\"
onclick=\"return
confirm('".get_vocab("confirmdel")."');\">".get_vocab("deleteentry")."</a>";
- }
- if (!empty($repeat_id) && !$series && $repeats_allowed)
- {
- echo " - ";
+ echo "<div>\n";
+ $params = array('action' => 'del_entry.php',
+ 'value' => get_vocab('deleteentry'),
+ 'inputs' => array('id' => $id,
+ 'series' => 0,
+ 'returl' => $returl)
+ );
+
+ $button_attributes = array('onclick' => "return confirm('" .
get_vocab("confirmdel") . "');");
+
+ generate_button($params, $button_attributes);
+ echo "</div>\n";
}
if ((!empty($repeat_id) || $series) && $repeats_allowed)
{
- echo "<a
href=\"del_entry.php?id=$id&series=1&day=$day&month=$month&year=$year&returl=$link_returl\"
onClick=\"return
confirm('".get_vocab("confirmdel")."');\">".get_vocab("deleteseries")."</a>";
+ echo "<div>\n";
+ $params = array('action' =>
"del_entry.php?day=$day&month=$month&year=$year",
+ 'value' => get_vocab('deleteseries'),
+ 'inputs' => array('id' => $id,
+ 'series' => 1,
+ 'returl' => $returl)
+ );
+
+ $button_attributes = array('onclick' => "return confirm('" .
get_vocab("confirmdel") . "');");
+
+ generate_button($params, $button_attributes);
+ echo "</div>\n";
}
echo "</div>\n";
}
@@ -479,15 +512,28 @@
echo "<div>\n";
if (!$series)
{
- echo "<a
href=\"edit_entry.php?id=$id&copy=1&returl=$link_returl\">".
get_vocab("copyentry") ."</a>";
- }
- if (!empty($repeat_id) && !$series && $repeats_allowed)
- {
- echo " - ";
- }
+ echo "<div>\n";
+ $params = array('action' => 'edit_entry.php',
+ 'value' => get_vocab('copyentry'),
+ 'inputs' => array('id' => $id,
+ 'copy' => 1,
+ 'returl' => $returl)
+ );
+ generate_button($params);
+ echo "</div>\n";
+ }
if ((!empty($repeat_id) || $series) && $repeats_allowed)
{
- echo "<a
href=\"edit_entry.php?id=$id&edit_type=series&day=$day&month=$month&year=$year&copy=1&returl=$link_returl\">".get_vocab("copyseries")."</a>";
+ echo "<div>\n";
+ $params = array('action' =>
"edit_entry.php?day=$day&month=$month&year=$year",
+ 'value' => get_vocab('copyseries'),
+ 'inputs' => array('id' => $id,
+ 'edit_type' => 'series',
+ 'copy' => 1,
+ 'returl' => $returl)
+ );
+ generate_button($params);
+ echo "</div>\n";
}
echo "</div>\n";
@@ -500,31 +546,40 @@
echo "<div>\n";
if (!$series)
{
- echo "<a
href=\"view_entry.php?action=export&id=$id&returl=$link_returl\">".
get_vocab("exportentry") ."</a>";
+ echo "<div>\n";
+ $params = array('action' => 'view_entry.php',
+ 'value' => get_vocab('exportentry'),
+ 'inputs' => array('id' => $id,
+ 'action' => 'export',
+ 'returl' => $returl)
+ );
+ generate_button($params);
+ echo "</div>\n";
}
- if (!empty($repeat_id) && !$series)
- {
- echo " - ";
- }
if (!empty($repeat_id) || $series)
{
- echo "<a
href=\"view_entry.php?action=export&id=$repeat_id&series=1&day=$day&month=$month&year=$year&returl=$link_returl\">".get_vocab("exportseries")."</a>";
+ echo "<div>\n";
+ $params = array('action' =>
"view_entry.php?day=$day&month=$month&year=$year",
+ 'value' => get_vocab('exportseries'),
+ 'inputs' => array('id' => $repeat_id,
+ 'action' => 'export',
+ 'series' => 1,
+ 'returl' => $returl)
+ );
+ generate_button($params);
+ echo "</div>\n";
}
echo "</div>\n";
}
- ?>
- <div id="returl">
- <?php
- if (isset($HTTP_REFERER)) //remove the link if displayed from an email
- {
- ?>
- <a href="<?php echo htmlspecialchars($HTTP_REFERER) ?>"><?php echo
get_vocab("returnprev") ?></a>
- <?php
- }
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits