diff --git a/include/ajax.draft.php b/include/ajax.draft.php index 37df05f77be8841300f27835e45be0537af7abd5..0caaeeb7bb497cbd06ca7a4e83b860f16232ec0b 100644 --- a/include/ajax.draft.php +++ b/include/ajax.draft.php @@ -256,7 +256,7 @@ class DraftAjaxAPI extends AjaxController { $sql = 'SELECT distinct f.id, COALESCE(a.type, f.ft) FROM '.FILE_TABLE .' f LEFT JOIN '.ATTACHMENT_TABLE.' a ON (a.file_id = f.id) - WHERE (a.`type` IN (\'C\', \'F\', \'T\') OR f.ft = \'L\') + WHERE (a.`type` IN (\'C\', \'F\', \'T\', \'P\') OR f.ft = \'L\') AND f.`type` LIKE \'image/%\''; if (!($res = db_query($sql))) Http::response(500, 'Unable to lookup files'); @@ -267,6 +267,7 @@ class DraftAjaxAPI extends AjaxController { 'F' => 'FAQ Articles', 'T' => 'Email Templates', 'L' => 'Logos', + 'P' => 'Pages', ); while (list($id, $type) = db_fetch_row($res)) { $f = AttachmentFile::lookup($id); diff --git a/include/class.page.php b/include/class.page.php index c6e6329d57fb869f8668291ee9116f1ace4d90c1..f0ada9a6c077dfa1099a55d64867a82cb294c501 100644 --- a/include/class.page.php +++ b/include/class.page.php @@ -70,7 +70,7 @@ class Page { return $this->ht['body']; } function getBodyWithImages() { - return Format::viewableImages($this->getBody()); + return Format::viewableImages($this->getBody(), ROOT_PATH.'image.php'); } function getNotes() { diff --git a/include/staff/pages.inc.php b/include/staff/pages.inc.php index 6afc4dc6cee4f822b5d49d09040fbb1077a9d7a9..34a3fa2f9d2ca062b285400e398a2ffc756598a4 100644 --- a/include/staff/pages.inc.php +++ b/include/staff/pages.inc.php @@ -9,7 +9,8 @@ $sql='SELECT page.id, page.isactive, page.name, page.created, page.updated, ' .' WHERE 1 '; $sortOptions=array( 'name'=>'page.name', 'status'=>'page.isactive', - 'created'=>'page.created', 'updated'=>'page.updated'); + 'created'=>'page.created', 'updated'=>'page.updated', + 'type'=>'page.type'); $orderWays=array('DESC'=>'DESC','ASC'=>'ASC'); $sort=($_REQUEST['sort'] && $sortOptions[strtolower($_REQUEST['sort'])])?strtolower($_REQUEST['sort']):'name'; @@ -62,8 +63,9 @@ else <thead> <tr> <th width="7"> </th> - <th width="380"><a <?php echo $name_sort; ?> href="pages.php?<?php echo $qstr; ?>&sort=name">Name</a></th> - <th width="120"><a <?php echo $status_sort; ?> href="pages.php?<?php echo $qstr; ?>&sort=status">Status</a></th> + <th width="300"><a <?php echo $name_sort; ?> href="pages.php?<?php echo $qstr; ?>&sort=name">Name</a></th> + <th width="90"><a <?php echo $type_sort; ?> href="pages.php?<?php echo $qstr; ?>&sort=type">Type</a></th> + <th width="110"><a <?php echo $status_sort; ?> href="pages.php?<?php echo $qstr; ?>&sort=status">Status</a></th> <th width="150" nowrap><a <?php echo $created_sort; ?>href="pages.php?<?php echo $qstr; ?>&sort=created">Date Added</a></th> <th width="150" nowrap><a <?php echo $updated_sort; ?>href="pages.php?<?php echo $qstr; ?>&sort=updated">Last Updated</a></th> </tr> @@ -86,6 +88,7 @@ else <?php echo $sel?'checked="checked"':''; ?>> </td> <td> <a href="pages.php?id=<?php echo $row['id']; ?>"><?php echo Format::htmlchars($row['name']); ?></a></td> + <td class="faded"><?php echo $row['type']; ?></td> <td> <?php echo $row['isactive']?'Active':'<b>Disabled</b>'; ?> <?php echo $inuse?'<em>(in-use)</em>':''; ?> diff --git a/scp/pages.php b/scp/pages.php index ee3af72dbe8d296200dd87f79d4acd8f420dff45..87b260d2371b259162a95b980b610e8d2e035799 100644 --- a/scp/pages.php +++ b/scp/pages.php @@ -28,8 +28,9 @@ if($_POST) { $msg='Page added successfully'; // Attach inline attachments from the editor if (isset($_POST['draft_id']) - && ($draft = Draft::lookup($_POST['draft_id']))) - $c->attachments->upload( + && ($draft = Draft::lookup($_POST['draft_id'])) + && ($page = Page::lookup($pageId))) + $page->attachments->upload( $draft->getAttachmentIds($_POST['response']), true); Draft::deleteForNamespace('page'); } elseif(!$errors['err'])