diff --git a/action.php b/action.php index 099a8bf..142f933 100644 --- a/action.php +++ b/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) { diff --git a/database.mwb b/database.mwb index 6586cb0..e746a1d 100644 Binary files a/database.mwb and b/database.mwb differ diff --git a/lang/en_us.php b/lang/en_us.php index cae72f0..a42202e 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -33,6 +33,7 @@ define("STRINGS", [ "style" => "Style", "columns" => "Columns", "visibility" => "Visibility", + "page size" => "Page Size", "adding publication" => "Adding Publication", "cloning publication" => "Copying {opub} {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})" ]); \ No newline at end of file diff --git a/lib/gencontent.php b/lib/gencontent.php index 0bde18e..d360a61 100644 --- a/lib/gencontent.php +++ b/lib/gencontent.php @@ -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 { } + + get("page_sizes", ["sizewidth (width)", "sizeheight (height)"], ["sizeid" => $pubdata["page_size"]]); ?> + .pub-content { + max-width: ; + min-height: ; + } \n" . "$content"; // Credit: https://stackoverflow.com/a/709684 diff --git a/lib/getpubtable.php b/lib/getpubtable.php index 88e1aea..3b705e8 100644 --- a/lib/getpubtable.php +++ b/lib/getpubtable.php @@ -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; diff --git a/pages/content.php b/pages/content.php index 56f683b..9a2c53f 100644 --- a/pages/content.php +++ b/pages/content.php @@ -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"]); ?>
diff --git a/pages/editpub.php b/pages/editpub.php index c433c5f..ccac842 100644 --- a/pages/editpub.php +++ b/pages/editpub.php @@ -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,16 +70,45 @@ if (!is_empty($VARS['id'])) {
+
+
+
+
+ + +
+
+
+ +
+
+
+
+
+ + +
+
- - select("pub_styles", ['styleid', 'stylename']); - foreach ($styles as $s) { - $si = $s['styleid']; - $sn = $s['stylename']; - $ss = $pubdata["styleid"] == $si ? " selected" : ""; + $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 "\n"; } ?> @@ -84,8 +117,11 @@ if (!is_empty($VARS['id'])) {
- - + +
diff --git a/pages/home.php b/pages/home.php index 4bd6cff..3f3e608 100644 --- a/pages/home.php +++ b/pages/home.php @@ -16,8 +16,9 @@ redirectifnotloggedin(); - - + + + @@ -30,8 +31,9 @@ redirectifnotloggedin(); - - + + + diff --git a/static/css/content.css b/static/css/content.css index 47c30c0..9e5b13e 100644 --- a/static/css/content.css +++ b/static/css/content.css @@ -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 { diff --git a/static/js/home.js b/static/js/home.js index 5ff5322..3712688 100644 --- a/static/js/home.js +++ b/static/js/home.js @@ -46,6 +46,7 @@ var pubtable = $('#pubtable').DataTable({ row.username, row.stylename, row.columns, + row.pagesize, row.permname ]); });