aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-09 21:23:45 -0700
committerFriendika <info@friendika.com>2011-06-09 21:23:45 -0700
commitb857a49bfeecc91eaa5a09c9b9ded5b84516bc6e (patch)
tree452fb8eb35e20d5107d692530e17fdfafa92e728
parent8aaf55c1e6216f1221569e7087bcdd1000124d5f (diff)
downloadvolse-hubzilla-b857a49bfeecc91eaa5a09c9b9ded5b84516bc6e.tar.gz
volse-hubzilla-b857a49bfeecc91eaa5a09c9b9ded5b84516bc6e.tar.bz2
volse-hubzilla-b857a49bfeecc91eaa5a09c9b9ded5b84516bc6e.zip
event publish
-rw-r--r--mod/events.php35
-rw-r--r--view/event_form.tpl5
-rw-r--r--view/event_head.tpl62
3 files changed, 92 insertions, 10 deletions
diff --git a/mod/events.php b/mod/events.php
index c22038215..052c0ef60 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 7449f845a..6401f16d0 100644
--- a/view/event_form.tpl
+++ b/view/event_form.tpl
@@ -29,6 +29,11 @@ $f_dsel $f_tsel
<div id="event-location-text">$l_text</div>
<textarea id="event-location-textarea" name="location">$l_orig</textarea>
+<input type="checkbox" name="share" value="1" id="event-share-checkbox" $sh_checked /> <div id="event-share-text">$sh_text</div>
+<div id="event-share-break"></div>
+
+$acl
+
<input id="event-submit" type="submit" name="submit" value="$submit" />
</form>
diff --git a/view/event_head.tpl b/view/event_head.tpl
new file mode 100644
index 000000000..4e5063131
--- /dev/null
+++ b/view/event_head.tpl
@@ -0,0 +1,62 @@
+<script language="javascript" type="text/javascript"
+ src="$baseurl/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
+ <script language="javascript" type="text/javascript">
+
+
+tinyMCE.init({
+ theme : "advanced",
+ mode : "textareas",
+ plugins : "bbcode,paste",
+ theme_advanced_buttons1 : "bold,italic,underline,undo,redo,link,unlink,image,forecolor,formatselect,code",
+ theme_advanced_buttons2 : "",
+ theme_advanced_buttons3 : "",
+ theme_advanced_toolbar_location : "top",
+ theme_advanced_toolbar_align : "center",
+ theme_advanced_blockformats : "blockquote,code",
+ paste_text_sticky : true,
+ entity_encoding : "raw",
+ add_unload_trigger : false,
+ remove_linebreaks : false,
+ force_p_newlines : false,
+ force_br_newlines : true,
+ forced_root_block : '',
+ content_css: "$baseurl/view/custom_tinymce.css",
+ theme_advanced_path : false,
+ setup : function(ed) {
+ ed.onInit.add(function(ed) {
+ ed.pasteAsPlainText = true;
+ });
+ }
+
+});
+
+
+$(document).ready(function() {
+
+ $('#event-share-checkbox').change(function() {
+
+ if ($('#event-share-checkbox').is(':checked')) {
+ $('#acl-wrapper').show();
+ }
+ else {
+ $('#acl-wrapper').hide();
+ }
+ }).trigger('change');
+
+
+ $('#contact_allow, #contact_deny, #group_allow, #group_deny').change(function() {
+ var selstr;
+ $('#contact_allow option:selected, #contact_deny option:selected, #group_allow option:selected, #group_deny option:selected').each( function() {
+ selstr = $(this).text();
+ $('#jot-public').hide();
+ });
+ if(selstr == null) {
+ $('#jot-public').show();
+ }
+
+ }).trigger('change');
+
+});
+
+</script>
+