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']])) {
|
||||
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 = [
|
||||
'pubname' => $VARS['name'],
|
||||
'pubdate' => date("Y-m-d H:i:s"),
|
||||
'styleid' => $VARS['style'],
|
||||
'columns' => $VARS['columns'],
|
||||
'permid' => $VARS['perm']
|
||||
'permid' => $VARS['perm'],
|
||||
'page_size' => $VARS['size'],
|
||||
'landscape' => $VARS['landscape']
|
||||
];
|
||||
|
||||
if ($insert) {
|
||||
|
BIN
database.mwb
BIN
database.mwb
Binary file not shown.
@ -33,6 +33,7 @@ define("STRINGS", [
|
||||
"style" => "Style",
|
||||
"columns" => "Columns",
|
||||
"visibility" => "Visibility",
|
||||
"page size" => "Page Size",
|
||||
"adding publication" => "Adding Publication",
|
||||
"cloning publication" => "Copying {opub} <i class=\"fa fa-angle-right\"></i> {npub}",
|
||||
"editing publication" => "Editing {pub}",
|
||||
@ -44,5 +45,9 @@ define("STRINGS", [
|
||||
"publication deleted" => "Publication deleted.",
|
||||
"invalid pubid" => "Invalid publication ID.",
|
||||
"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 ($database->has('publications', ['pubid' => $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 {
|
||||
die(lang("invalid parameters", false));
|
||||
}
|
||||
@ -31,6 +31,12 @@ if (defined("EDIT_MODE") && EDIT_MODE == true) {
|
||||
.pub-content {
|
||||
<?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 nonce="<?php echo $SECURE_NONCE; ?>" media="all">
|
||||
@ -85,10 +91,11 @@ $content = ob_get_clean();
|
||||
|
||||
if (defined("HTML_ME") || !defined("IN_NEWSPEN")) {
|
||||
$contentcss = file_get_contents(__DIR__ . "/../static/css/content.css");
|
||||
$title = htmlspecialchars($pubdata["pubname"] . " | " . date("Y-m-d", strtotime($pubdata["pubdate"])));
|
||||
$content = "<!DOCTYPE html>\n"
|
||||
. "<meta charset=\"utf-8\">\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"
|
||||
. "$content";
|
||||
// Credit: https://stackoverflow.com/a/709684
|
||||
|
@ -35,6 +35,9 @@ switch ($VARS['order'][0]['column']) {
|
||||
$order = ["columns" => $sortby];
|
||||
break;
|
||||
case 7:
|
||||
$order = ["sizename" => $sortby];
|
||||
break;
|
||||
case 8:
|
||||
$order = ["permname" => $sortby];
|
||||
break;
|
||||
}
|
||||
@ -47,6 +50,7 @@ if (!is_empty($VARS['search']['value'])) {
|
||||
"pubname[~]" => $VARS['search']['value'],
|
||||
"pubdate[~]" => $VARS['search']['value'],
|
||||
"stylename[~]" => $VARS['search']['value'],
|
||||
"sizename[~]" => $VARS['search']['value'],
|
||||
"permname[~]" => $VARS['search']['value']
|
||||
];
|
||||
$where = $wherenolimit;
|
||||
@ -61,7 +65,8 @@ if (!is_null($order)) {
|
||||
|
||||
$pubs = $database->select('publications', [
|
||||
'[>]pub_styles' => ['styleid' => 'styleid'],
|
||||
'[>]pub_permissions' => ['permid' => 'permid']
|
||||
'[>]pub_permissions' => ['permid' => 'permid'],
|
||||
'[>]page_sizes' => ['page_size' => 'sizeid']
|
||||
], [
|
||||
'pubid',
|
||||
'pubname',
|
||||
@ -70,7 +75,10 @@ $pubs = $database->select('publications', [
|
||||
'stylename',
|
||||
'columns',
|
||||
'permname',
|
||||
'publications.permid'
|
||||
'publications.permid',
|
||||
"page_size",
|
||||
"sizename",
|
||||
"landscape"
|
||||
], $where);
|
||||
|
||||
|
||||
@ -99,6 +107,10 @@ for ($i = 0; $i < count($pubs); $i++) {
|
||||
}
|
||||
$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;
|
||||
|
||||
|
@ -10,7 +10,7 @@ $pubdata = [];
|
||||
if (is_numeric($VARS['pubid'])) {
|
||||
if ($database->has('publications', ['pubid' => $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 {
|
||||
header("Location: app.php?page=content&msg=invalid_pubid");
|
||||
die();
|
||||
@ -18,7 +18,7 @@ if (is_numeric($VARS['pubid'])) {
|
||||
}
|
||||
|
||||
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">
|
||||
<label for="pubid"><?php lang("choose publication"); ?></label>
|
||||
|
@ -8,7 +8,9 @@ $pubdata = [
|
||||
'pubdate' => '',
|
||||
'styleid' => '',
|
||||
'columns' => '',
|
||||
'permid' => ''
|
||||
'permid' => '',
|
||||
'page_size' => 1,
|
||||
'landscape' => 0
|
||||
];
|
||||
|
||||
$editing = false;
|
||||
@ -26,7 +28,9 @@ if (!is_empty($VARS['id'])) {
|
||||
'pubdate',
|
||||
'styleid',
|
||||
'columns',
|
||||
'permid'
|
||||
'permid',
|
||||
'page_size',
|
||||
'landscape'
|
||||
], [
|
||||
'pubid' => $VARS['id']
|
||||
])[0];
|
||||
@ -66,7 +70,9 @@ if (!is_empty($VARS['id'])) {
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-3">
|
||||
<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>
|
||||
@ -82,12 +88,42 @@ if (!is_empty($VARS['id'])) {
|
||||
</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="form-group">
|
||||
<label for="columns"><i class="fa fa-columns"></i> <?php lang('columns'); ?></label>
|
||||
<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
|
||||
$sizes = $database->select("page_sizes", ['sizeid', 'sizename', 'sizewidth', 'sizeheight']);
|
||||
foreach ($sizes as $s) {
|
||||
$si = $s['sizeid'];
|
||||
$sn = $s['sizename'];
|
||||
$ss = $pubdata["page_size"] == $si ? " selected" : "";
|
||||
echo "<option value=\"$si\"$ss>$sn</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="landscape"><i class="fa fa-repeat"></i> <?php lang('page orientation'); ?></label>
|
||||
<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 class="col-xs-12 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="perm"><i class="fa fa-eye"></i> <?php lang('visibility'); ?></label>
|
||||
|
@ -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="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="3"><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-star hidden-xs"></i> <?php lang('style'); ?></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>
|
||||
</tr>
|
||||
</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="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="3"><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-star hidden-xs"></i> <?php lang('style'); ?></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>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
@ -6,10 +6,8 @@
|
||||
|
||||
.pub-content {
|
||||
border: 1px solid grey;
|
||||
max-width: 8.5in;
|
||||
margin: 0px auto;
|
||||
box-shadow: 5px 5px 15px -3px rgba(0,0,0,0.75);
|
||||
min-height: 11in;
|
||||
}
|
||||
|
||||
.tile {
|
||||
|
@ -46,6 +46,7 @@ var pubtable = $('#pubtable').DataTable({
|
||||
row.username,
|
||||
row.stylename,
|
||||
row.columns,
|
||||
row.pagesize,
|
||||
row.permname
|
||||
]);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user