Add page size and orientation options
This commit is contained in:
parent
38d24bc358
commit
d337b90fb8
10
action.php
10
action.php
@ -49,13 +49,21 @@ switch ($VARS['action']) {
|
|||||||
if (!$database->has('pub_permissions', ["permid" => $VARS['perm']])) {
|
if (!$database->has('pub_permissions', ["permid" => $VARS['perm']])) {
|
||||||
returnToSender('invalid_parameters');
|
returnToSender('invalid_parameters');
|
||||||
}
|
}
|
||||||
|
if (!$database->has('page_sizes', ["sizeid" => $VARS['size']])) {
|
||||||
|
returnToSender('invalid_parameters');
|
||||||
|
}
|
||||||
|
if (!is_numeric($VARS['landscape']) || ((int) $VARS['landscape'] !== 0 && (int) $VARS['landscape'] !== 1)) {
|
||||||
|
returnToSender('invalid_parameters');
|
||||||
|
}
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'pubname' => $VARS['name'],
|
'pubname' => $VARS['name'],
|
||||||
'pubdate' => date("Y-m-d H:i:s"),
|
'pubdate' => date("Y-m-d H:i:s"),
|
||||||
'styleid' => $VARS['style'],
|
'styleid' => $VARS['style'],
|
||||||
'columns' => $VARS['columns'],
|
'columns' => $VARS['columns'],
|
||||||
'permid' => $VARS['perm']
|
'permid' => $VARS['perm'],
|
||||||
|
'page_size' => $VARS['size'],
|
||||||
|
'landscape' => $VARS['landscape']
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($insert) {
|
if ($insert) {
|
||||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
@ -33,6 +33,7 @@ define("STRINGS", [
|
|||||||
"style" => "Style",
|
"style" => "Style",
|
||||||
"columns" => "Columns",
|
"columns" => "Columns",
|
||||||
"visibility" => "Visibility",
|
"visibility" => "Visibility",
|
||||||
|
"page size" => "Page Size",
|
||||||
"adding publication" => "Adding Publication",
|
"adding publication" => "Adding Publication",
|
||||||
"cloning publication" => "Copying {opub} <i class=\"fa fa-angle-right\"></i> {npub}",
|
"cloning publication" => "Copying {opub} <i class=\"fa fa-angle-right\"></i> {npub}",
|
||||||
"editing publication" => "Editing {pub}",
|
"editing publication" => "Editing {pub}",
|
||||||
@ -44,5 +45,9 @@ define("STRINGS", [
|
|||||||
"publication deleted" => "Publication deleted.",
|
"publication deleted" => "Publication deleted.",
|
||||||
"invalid pubid" => "Invalid publication ID.",
|
"invalid pubid" => "Invalid publication ID.",
|
||||||
"mailing lists" => "Mailing Lists",
|
"mailing lists" => "Mailing Lists",
|
||||||
"choose publication" => "Choose a publication to edit content."
|
"choose publication" => "Choose a publication to edit content.",
|
||||||
|
"page orientation" => "Page Orientation",
|
||||||
|
"portrait" => "Portrait",
|
||||||
|
"landscape" => "Landscape",
|
||||||
|
"page size and orientation" => "{size} ({orientation})"
|
||||||
]);
|
]);
|
@ -6,7 +6,7 @@ if (!defined("IN_NEWSPEN")) {
|
|||||||
if (is_numeric($VARS['pubid'])) {
|
if (is_numeric($VARS['pubid'])) {
|
||||||
if ($database->has('publications', ['pubid' => $VARS['pubid']])) {
|
if ($database->has('publications', ['pubid' => $VARS['pubid']])) {
|
||||||
$pub = $VARS['pubid'];
|
$pub = $VARS['pubid'];
|
||||||
$pubdata = $database->get("publications", ["pubname", "pubdate", "styleid", "columns"], ["pubid" => $pub]);
|
$pubdata = $database->get("publications", ["pubname", "pubdate", "styleid", "columns", "page_size", "landscape"], ["pubid" => $pub]);
|
||||||
} else {
|
} else {
|
||||||
die(lang("invalid parameters", false));
|
die(lang("invalid parameters", false));
|
||||||
}
|
}
|
||||||
@ -31,6 +31,12 @@ if (defined("EDIT_MODE") && EDIT_MODE == true) {
|
|||||||
.pub-content {
|
.pub-content {
|
||||||
<?php echo $pubcss; ?>
|
<?php echo $pubcss; ?>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<?php $pagesize = $database->get("page_sizes", ["sizewidth (width)", "sizeheight (height)"], ["sizeid" => $pubdata["page_size"]]); ?>
|
||||||
|
.pub-content {
|
||||||
|
max-width: <?php echo ($pubdata["landscape"] == 0 ? $pagesize["width"] : $pagesize["height"]); ?>;
|
||||||
|
min-height: <?php echo ($pubdata["landscape"] == 0 ? $pagesize["height"] : $pagesize["width"]); ?>;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style nonce="<?php echo $SECURE_NONCE; ?>" media="all">
|
<style nonce="<?php echo $SECURE_NONCE; ?>" media="all">
|
||||||
@ -85,10 +91,11 @@ $content = ob_get_clean();
|
|||||||
|
|
||||||
if (defined("HTML_ME") || !defined("IN_NEWSPEN")) {
|
if (defined("HTML_ME") || !defined("IN_NEWSPEN")) {
|
||||||
$contentcss = file_get_contents(__DIR__ . "/../static/css/content.css");
|
$contentcss = file_get_contents(__DIR__ . "/../static/css/content.css");
|
||||||
|
$title = htmlspecialchars($pubdata["pubname"] . " | " . date("Y-m-d", strtotime($pubdata["pubdate"])));
|
||||||
$content = "<!DOCTYPE html>\n"
|
$content = "<!DOCTYPE html>\n"
|
||||||
. "<meta charset=\"utf-8\">\n"
|
. "<meta charset=\"utf-8\">\n"
|
||||||
. "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
|
. "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
|
||||||
. "<title></title>\n"
|
. "<title>$title</title>\n"
|
||||||
. "<style nonce=\"$SECURE_NONCE\">$contentcss</style>\n"
|
. "<style nonce=\"$SECURE_NONCE\">$contentcss</style>\n"
|
||||||
. "$content";
|
. "$content";
|
||||||
// Credit: https://stackoverflow.com/a/709684
|
// Credit: https://stackoverflow.com/a/709684
|
||||||
|
@ -35,6 +35,9 @@ switch ($VARS['order'][0]['column']) {
|
|||||||
$order = ["columns" => $sortby];
|
$order = ["columns" => $sortby];
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
|
$order = ["sizename" => $sortby];
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
$order = ["permname" => $sortby];
|
$order = ["permname" => $sortby];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -47,6 +50,7 @@ if (!is_empty($VARS['search']['value'])) {
|
|||||||
"pubname[~]" => $VARS['search']['value'],
|
"pubname[~]" => $VARS['search']['value'],
|
||||||
"pubdate[~]" => $VARS['search']['value'],
|
"pubdate[~]" => $VARS['search']['value'],
|
||||||
"stylename[~]" => $VARS['search']['value'],
|
"stylename[~]" => $VARS['search']['value'],
|
||||||
|
"sizename[~]" => $VARS['search']['value'],
|
||||||
"permname[~]" => $VARS['search']['value']
|
"permname[~]" => $VARS['search']['value']
|
||||||
];
|
];
|
||||||
$where = $wherenolimit;
|
$where = $wherenolimit;
|
||||||
@ -61,7 +65,8 @@ if (!is_null($order)) {
|
|||||||
|
|
||||||
$pubs = $database->select('publications', [
|
$pubs = $database->select('publications', [
|
||||||
'[>]pub_styles' => ['styleid' => 'styleid'],
|
'[>]pub_styles' => ['styleid' => 'styleid'],
|
||||||
'[>]pub_permissions' => ['permid' => 'permid']
|
'[>]pub_permissions' => ['permid' => 'permid'],
|
||||||
|
'[>]page_sizes' => ['page_size' => 'sizeid']
|
||||||
], [
|
], [
|
||||||
'pubid',
|
'pubid',
|
||||||
'pubname',
|
'pubname',
|
||||||
@ -70,7 +75,10 @@ $pubs = $database->select('publications', [
|
|||||||
'stylename',
|
'stylename',
|
||||||
'columns',
|
'columns',
|
||||||
'permname',
|
'permname',
|
||||||
'publications.permid'
|
'publications.permid',
|
||||||
|
"page_size",
|
||||||
|
"sizename",
|
||||||
|
"landscape"
|
||||||
], $where);
|
], $where);
|
||||||
|
|
||||||
|
|
||||||
@ -99,6 +107,10 @@ for ($i = 0; $i < count($pubs); $i++) {
|
|||||||
}
|
}
|
||||||
$pubs[$i]["username"] = $usercache[$pubs[$i]['uid']]['name'];
|
$pubs[$i]["username"] = $usercache[$pubs[$i]['uid']]['name'];
|
||||||
}
|
}
|
||||||
|
$pubs[$i]["pagesize"] = lang2("page size and orientation", [
|
||||||
|
"size" => $pubs[$i]["sizename"],
|
||||||
|
"orientation" => ( $pubs[$i]["landscape"] == 0 ? lang("portrait", false) : lang("landscape", false) )
|
||||||
|
], false);
|
||||||
}
|
}
|
||||||
$out['pubs'] = $pubs;
|
$out['pubs'] = $pubs;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ $pubdata = [];
|
|||||||
if (is_numeric($VARS['pubid'])) {
|
if (is_numeric($VARS['pubid'])) {
|
||||||
if ($database->has('publications', ['pubid' => $VARS['pubid']])) {
|
if ($database->has('publications', ['pubid' => $VARS['pubid']])) {
|
||||||
$pub = $VARS['pubid'];
|
$pub = $VARS['pubid'];
|
||||||
$pubdata = $database->get("publications", ["pubname", "pubdate", "styleid", "columns"], ["pubid" => $pub]);
|
$pubdata = $database->get("publications", ["pubname", "pubdate", "styleid", "columns", "page_size", "landscape"], ["pubid" => $pub]);
|
||||||
} else {
|
} else {
|
||||||
header("Location: app.php?page=content&msg=invalid_pubid");
|
header("Location: app.php?page=content&msg=invalid_pubid");
|
||||||
die();
|
die();
|
||||||
@ -18,7 +18,7 @@ if (is_numeric($VARS['pubid'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($pub === false) {
|
if ($pub === false) {
|
||||||
$pubs = $database->select("publications", ["pubid", "pubname"], ["uid" => $_SESSION['uid']]);
|
$pubs = $database->select("publications", ["pubid", "pubname"], ["uid" => $_SESSION['uid'], "ORDER" => "pubname"]);
|
||||||
?>
|
?>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<label for="pubid"><?php lang("choose publication"); ?></label>
|
<label for="pubid"><?php lang("choose publication"); ?></label>
|
||||||
|
@ -8,7 +8,9 @@ $pubdata = [
|
|||||||
'pubdate' => '',
|
'pubdate' => '',
|
||||||
'styleid' => '',
|
'styleid' => '',
|
||||||
'columns' => '',
|
'columns' => '',
|
||||||
'permid' => ''
|
'permid' => '',
|
||||||
|
'page_size' => 1,
|
||||||
|
'landscape' => 0
|
||||||
];
|
];
|
||||||
|
|
||||||
$editing = false;
|
$editing = false;
|
||||||
@ -26,7 +28,9 @@ if (!is_empty($VARS['id'])) {
|
|||||||
'pubdate',
|
'pubdate',
|
||||||
'styleid',
|
'styleid',
|
||||||
'columns',
|
'columns',
|
||||||
'permid'
|
'permid',
|
||||||
|
'page_size',
|
||||||
|
'landscape'
|
||||||
], [
|
], [
|
||||||
'pubid' => $VARS['id']
|
'pubid' => $VARS['id']
|
||||||
])[0];
|
])[0];
|
||||||
@ -66,16 +70,45 @@ if (!is_empty($VARS['id'])) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-4">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="style"><i class="fa fa-star"></i> <?php lang('style'); ?></label>
|
||||||
|
<select name="style" class="form-control" required>
|
||||||
|
<?php
|
||||||
|
$styles = $database->select("pub_styles", ['styleid', 'stylename']);
|
||||||
|
foreach ($styles as $s) {
|
||||||
|
$si = $s['styleid'];
|
||||||
|
$sn = $s['stylename'];
|
||||||
|
$ss = $pubdata["styleid"] == $si ? " selected" : "";
|
||||||
|
echo "<option value=\"$si\"$ss>$sn</option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-8">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-xs-12 col-md-3">
|
<div class="col-xs-12 col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="style"><i class="fa fa-star"></i> <?php lang('style'); ?></label>
|
<label for="columns"><i class="fa fa-columns"></i> <?php lang('columns'); ?></label>
|
||||||
<select name="style" class="form-control" required>
|
<input type="number" class="form-control" id="columns" name="columns" placeholder="2" value="<?php echo $pubdata['columns']; ?>" required />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="size"><i class="fa fa-file-o"></i> <?php lang('page size'); ?></label>
|
||||||
|
<select name="size" class="form-control" required>
|
||||||
<?php
|
<?php
|
||||||
$styles = $database->select("pub_styles", ['styleid', 'stylename']);
|
$sizes = $database->select("page_sizes", ['sizeid', 'sizename', 'sizewidth', 'sizeheight']);
|
||||||
foreach ($styles as $s) {
|
foreach ($sizes as $s) {
|
||||||
$si = $s['styleid'];
|
$si = $s['sizeid'];
|
||||||
$sn = $s['stylename'];
|
$sn = $s['sizename'];
|
||||||
$ss = $pubdata["styleid"] == $si ? " selected" : "";
|
$ss = $pubdata["page_size"] == $si ? " selected" : "";
|
||||||
echo "<option value=\"$si\"$ss>$sn</option>\n";
|
echo "<option value=\"$si\"$ss>$sn</option>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -84,8 +117,11 @@ if (!is_empty($VARS['id'])) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-3">
|
<div class="col-xs-12 col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="columns"><i class="fa fa-columns"></i> <?php lang('columns'); ?></label>
|
<label for="landscape"><i class="fa fa-repeat"></i> <?php lang('page orientation'); ?></label>
|
||||||
<input type="number" class="form-control" id="columns" name="columns" placeholder="2" value="<?php echo $pubdata['columns']; ?>" required />
|
<select name="landscape" class="form-control" required>
|
||||||
|
<option value="0"<?php echo $pubdata["landscape"] == 0 ? " selected" : "" ?>><?php lang("portrait"); ?></option>
|
||||||
|
<option value="1"<?php echo $pubdata["landscape"] == 1 ? " selected" : "" ?>><?php lang("landscape"); ?></option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-3">
|
<div class="col-xs-12 col-md-3">
|
||||||
|
@ -16,8 +16,9 @@ redirectifnotloggedin();
|
|||||||
<th data-priority="1"><i class="fa fa-fw fa-font hidden-xs"></i> <?php lang('name'); ?></th>
|
<th data-priority="1"><i class="fa fa-fw fa-font hidden-xs"></i> <?php lang('name'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-calendar hidden-xs"></i> <?php lang('date'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-calendar hidden-xs"></i> <?php lang('date'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('author'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('author'); ?></th>
|
||||||
<th data-priority="3"><i class="fa fa-fw fa-star hidden-xs"></i> <?php lang('style'); ?></th>
|
<th data-priority="4"><i class="fa fa-fw fa-star hidden-xs"></i> <?php lang('style'); ?></th>
|
||||||
<th data-priority="3"><i class="fa fa-fw fa-columns hidden-xs"></i> <?php lang('columns'); ?></th>
|
<th data-priority="4"><i class="fa fa-fw fa-columns hidden-xs"></i> <?php lang('columns'); ?></th>
|
||||||
|
<th data-priority="3"><i class="fa fa-fw fa-file-o hidden-xs"></i> <?php lang('page size'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-eye hidden-xs"></i> <?php lang('visibility'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-eye hidden-xs"></i> <?php lang('visibility'); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -30,8 +31,9 @@ redirectifnotloggedin();
|
|||||||
<th data-priority="1"><i class="fa fa-fw fa-font hidden-xs"></i> <?php lang('name'); ?></th>
|
<th data-priority="1"><i class="fa fa-fw fa-font hidden-xs"></i> <?php lang('name'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-calendar hidden-xs"></i> <?php lang('date'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-calendar hidden-xs"></i> <?php lang('date'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('author'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-user hidden-xs"></i> <?php lang('author'); ?></th>
|
||||||
<th data-priority="3"><i class="fa fa-fw fa-star hidden-xs"></i> <?php lang('style'); ?></th>
|
<th data-priority="4"><i class="fa fa-fw fa-star hidden-xs"></i> <?php lang('style'); ?></th>
|
||||||
<th data-priority="3"><i class="fa fa-fw fa-columns hidden-xs"></i> <?php lang('columns'); ?></th>
|
<th data-priority="4"><i class="fa fa-fw fa-columns hidden-xs"></i> <?php lang('columns'); ?></th>
|
||||||
|
<th data-priority="3"><i class="fa fa-fw fa-file-o hidden-xs"></i> <?php lang('page size'); ?></th>
|
||||||
<th data-priority="2"><i class="fa fa-fw fa-eye hidden-xs"></i> <?php lang('visibility'); ?></th>
|
<th data-priority="2"><i class="fa fa-fw fa-eye hidden-xs"></i> <?php lang('visibility'); ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
|
|
||||||
.pub-content {
|
.pub-content {
|
||||||
border: 1px solid grey;
|
border: 1px solid grey;
|
||||||
max-width: 8.5in;
|
|
||||||
margin: 0px auto;
|
margin: 0px auto;
|
||||||
box-shadow: 5px 5px 15px -3px rgba(0,0,0,0.75);
|
box-shadow: 5px 5px 15px -3px rgba(0,0,0,0.75);
|
||||||
min-height: 11in;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tile {
|
.tile {
|
||||||
|
@ -46,6 +46,7 @@ var pubtable = $('#pubtable').DataTable({
|
|||||||
row.username,
|
row.username,
|
||||||
row.stylename,
|
row.stylename,
|
||||||
row.columns,
|
row.columns,
|
||||||
|
row.pagesize,
|
||||||
row.permname
|
row.permname
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user