From b857a49bfeecc91eaa5a09c9b9ded5b84516bc6e Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 9 Jun 2011 21:23:45 -0700 Subject: [PATCH] event publish --- mod/events.php | 35 +++++++++++++++++-------- view/event_form.tpl | 5 ++++ view/event_head.tpl | 62 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 10 deletions(-) create mode 100644 view/event_head.tpl diff --git a/mod/events.php b/mod/events.php index c22038215d..052c0ef603 100644 --- a/mod/events.php +++ b/mod/events.php @@ -2,6 +2,7 @@ require_once('include/datetime.php'); require_once('include/event.php'); +require_once('include/items.php'); function events_post(&$a) { @@ -44,18 +45,27 @@ function events_post(&$a) { } - $desc = escape_tags($_POST['desc']); - $location = escape_tags($_POST['location']); + $desc = escape_tags(trim($_POST['desc'])); + $location = escape_tags(trim($_POST['location'])); $type = 'event'; - $str_group_allow = perms2str($_POST['group_allow']); - $str_contact_allow = perms2str($_POST['contact_allow']); - $str_group_deny = perms2str($_POST['group_deny']); - $str_contact_deny = perms2str($_POST['contact_deny']); + if((! $desc) || (! $start)) { + notice('Event description and start time are required.'); + goaway($a->get_baseurl() . '/events/new'); + } + $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0); - // until publishing is ready - $str_contact_allow = '<' . local_user() . '>'; + if($share) { + $str_group_allow = perms2str($_POST['group_allow']); + $str_contact_allow = perms2str($_POST['contact_allow']); + $str_group_deny = perms2str($_POST['group_deny']); + $str_contact_deny = perms2str($_POST['contact_deny']); + } + else { + $str_contact_allow = '<' . local_user() . '>'; + $str_group_allow = $str_contact_deny = $str_group_deny = ''; + } if($event_id) { $r = q("UPDATE `event` SET @@ -158,7 +168,7 @@ function events_post(&$a) { q("UPDATE `item` SET `plink` = '%s', `event-id` = %d WHERE `uid` = %d AND `id` = %d LIMIT 1", dbesc($a->get_baseurl() . '/display/' . $owner_record['nickname'] . '/' . $item_id), intval($event['id']), - intval($local_user()), + intval(local_user()), intval($item_id) ); proc_run('php',"include/notifier.php","tag","$item_id"); @@ -265,7 +275,7 @@ function events_content(&$a) { } if($mode === 'edit' || $mode === 'new') { - $htpl = get_markup_template('profed_head.tpl'); + $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array('$baseurl' => $a->get_baseurl())); $tpl = get_markup_template('event_form.tpl'); @@ -274,6 +284,8 @@ function events_content(&$a) { $month = datetime_convert('UTC', date_default_timezone_get(), 'now', 'm'); $day = datetime_convert('UTC', date_default_timezone_get(), 'now', 'd'); + require_once('include/acl_selectors.php'); + $o .= replace_macros($tpl,array( '$post' => $a->get_baseurl() . '/events', '$e_text' => t('Event details'), @@ -292,6 +304,9 @@ function events_content(&$a) { '$d_orig' => '', '$l_text' => t('Location:'), '$l_orig' => '', + '$sh_text' => t('Share this event'), + '$sh_checked' => '', + '$acl' => populate_acl($a->user,false), '$submit' => t('Submit') )); diff --git a/view/event_form.tpl b/view/event_form.tpl index 7449f845af..6401f16d08 100644 --- a/view/event_form.tpl +++ b/view/event_form.tpl @@ -29,6 +29,11 @@ $f_dsel $f_tsel
$l_text
+
$sh_text
+
+ +$acl + diff --git a/view/event_head.tpl b/view/event_head.tpl new file mode 100644 index 0000000000..4e50631316 --- /dev/null +++ b/view/event_head.tpl @@ -0,0 +1,62 @@ + + +