From 7101bbedcb7ca7a04a11ddb4f42be037bd8e54a8 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 5 May 2016 23:07:35 -0700 Subject: objectify comanche --- include/text.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index 66a49d4b5..a3826de49 100644 --- a/include/text.php +++ b/include/text.php @@ -2824,3 +2824,42 @@ function expand_acl($s) { return $ret; } + + +// When editing a webpage - a dropdown is needed to select a page layout +// On submit, the pdl_select value (which is the mid of an item with item_type = ITEM_TYPE_PDL) is stored in +// the webpage's resource_id, with resource_type 'pdl'. + +// Then when displaying a webpage, we can see if it has a pdl attached. If not we'll +// use the default site/page layout. + +// If it has a pdl we'll load it as we know the mid and pass the body through comanche_parser() which will generate the +// page layout from the given description + + +function pdl_selector($uid, $current="") { + $o = ''; + + $sql_extra = item_permissions_sql($uid); + + $r = q("select item_id.*, mid from item_id left join item on iid = item.id where item_id.uid = %d and item_id.uid = item.uid and service = 'PDL' $sql_extra order by sid asc", + intval($uid) + ); + + $arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r); + call_hooks('pdl_selector',$arr); + + $entries = $arr['entries']; + $current = $arr['current']; + + $o .= ''; + return $o; +} + -- cgit v1.2.3