aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-28 16:39:43 -0700
committerfriendica <info@friendica.com>2013-08-28 16:39:43 -0700
commit95fcf773be12a9307eeefe7f392277bf44036946 (patch)
treefe0b535f95e24e2c5ca627bd526946960c28f97b
parente8cd3b70407b4c33d82d21cc3a470b2a58852e4f (diff)
downloadvolse-hubzilla-95fcf773be12a9307eeefe7f392277bf44036946.tar.gz
volse-hubzilla-95fcf773be12a9307eeefe7f392277bf44036946.tar.bz2
volse-hubzilla-95fcf773be12a9307eeefe7f392277bf44036946.zip
right - here's how we're going to link comanche with webpages
-rwxr-xr-xboot.php2
-rw-r--r--include/comanche.php48
-rw-r--r--version.inc2
3 files changed, 50 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index d3226c804..e8d6d2020 100755
--- a/boot.php
+++ b/boot.php
@@ -462,7 +462,7 @@ define ( 'ITEM_UNPUBLISHED', 0x0020);
define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
define ( 'ITEM_DELAYED_PUBLISH', 0x0080);
define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED
-
+define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche
/**
* Item Flags
*/
diff --git a/include/comanche.php b/include/comanche.php
new file mode 100644
index 000000000..33e93d2c9
--- /dev/null
+++ b/include/comanche.php
@@ -0,0 +1,48 @@
+<?php /** @file */
+
+require_once('include/security.php');
+
+// 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_restrict = ITEM_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 = '';
+
+ // You can use anybody's Comanche layouts on this site that haven't been protected in some way
+
+ $sql_extra = item_permissions_sql($uid);
+
+ // By default order by title (therefore at this time pdl's need a unique title across this system),
+ // though future work may allow categorisation
+ // based on taxonomy terms
+
+ $r = q("select title, mid from item where (item_restrict & %d) $sql_extra order by title",
+ intval(ITEM_PDL)
+ );
+
+ $arr = array('channel_id' => $uid, 'current' => $current, 'entries' => $r);
+ call_hooks('pdl_selector',$arr);
+
+ $entries = $arr['entries'];
+ $current = $arr['current'];
+
+ $o .= "<select name=\"pdl_select\" id=\"pdl_select\" size=\"1\" >";
+ $entries[] = array('title' => t('Default'), 'mid' => '');
+ foreach($entries as $selection) {
+ $selected = (($selection == $current) ? ' selected="selected" ' : '');
+ $o .= "<option value=\"{$selection['mid']}\" $selected >{$selection['title']}</option>";
+ }
+
+ $o .= '</select>';
+ return $o;
+}
+
diff --git a/version.inc b/version.inc
index 9f3318c88..6733945d4 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-08-27.418
+2013-08-28.419