From ae9e1fa688c90e128637b5c44cf4705287f6cfa1 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 15 Oct 2014 18:35:56 -0700 Subject: missing event permissions --- mod/events.php | 1 + 1 file changed, 1 insertion(+) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index c80d1dd39..d24f84d44 100755 --- a/mod/events.php +++ b/mod/events.php @@ -582,6 +582,7 @@ function events_content(&$a) { '$t_orig' => $t_orig, '$sh_text' => t('Share this event'), '$sh_checked' => $sh_checked, + '$permissions' => t('Permissions'), '$acl' => (($orig_event['event_xchan']) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $perm_defaults),false)), '$submit' => t('Submit') -- cgit v1.2.3 From 7e091c05a11cd9b24937dcf8a3bdcc318150ce8d Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sat, 18 Oct 2014 15:04:47 +0200 Subject: Initial stab at better general datetime picker --- mod/events.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index d24f84d44..337852170 100755 --- a/mod/events.php +++ b/mod/events.php @@ -18,18 +18,6 @@ function events_post(&$a) { $start_text = escape_tags($_REQUEST['start_text']); $finish_text = escape_tags($_REQUEST['finish_text']); - $startyear = intval($_POST['startyear']); - $startmonth = intval($_POST['startmonth']); - $startday = intval($_POST['startday']); - $starthour = intval($_POST['starthour']); - $startminute = intval($_POST['startminute']); - - $finishyear = intval($_POST['finishyear']); - $finishmonth = intval($_POST['finishmonth']); - $finishday = intval($_POST['finishday']); - $finishhour = intval($_POST['finishhour']); - $finishminute = intval($_POST['finishminute']); - $adjust = intval($_POST['adjust']); $nofinish = intval($_POST['nofinish']); @@ -560,18 +548,15 @@ function events_content(&$a) { '$placeholdercategory' => t('Categories (comma-separated list)'), '$category' => $category, '$s_text' => t('Event Starts:') . ' *', - '$bootstrap' => 1, '$stext' => $stext, '$ftext' => $ftext, '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), - '$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday), - '$s_tsel' => timesel('start',$shour,$sminute), + '$s_dsel' => datetimesel($f,'start_text',$syear+5,$syear,false,$syear,$smonth,$sday,$shour,$sminute), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datesel($f,'finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday), - '$f_tsel' => timesel('finish',$fhour,$fminute), + '$f_dsel' => datetimesel($f,'finish_text',$fyear+5,$fyear,false,$fyear,$fmonth,$fday,$fhour,$fminute), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), -- cgit v1.2.3 From d9817779fbeaebf4b75c0670da7013bf4482b72b Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 08:33:18 +0200 Subject: Give an error if event is supposed to end before it starts. Closes friendica/red#534 --- mod/events.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index 337852170..e5ae7c662 100755 --- a/mod/events.php +++ b/mod/events.php @@ -67,8 +67,10 @@ function events_post(&$a) { // and we'll waste a bunch of time responding to it. Time that // could've been spent doing something else. - if(strcmp($finish,$start) < 0) - $finish = $start; + if(strcmp($finish,$start) < 0) { + notice( t('Event can not end before it has started.') . EOL); + goaway($a->get_baseurl() . '/events/new'); + } $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); -- cgit v1.2.3 From 519ef4850021c929764f1175a9aae569d1ae36a6 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 10:47:42 +0200 Subject: Changes in the datetimesel api, prevent user from picking event end date earlier than start date --- mod/events.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index e5ae7c662..459ed05bb 100755 --- a/mod/events.php +++ b/mod/events.php @@ -554,11 +554,11 @@ function events_content(&$a) { '$ftext' => $ftext, '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), - '$s_dsel' => datetimesel($f,'start_text',$syear+5,$syear,false,$syear,$smonth,$sday,$shour,$sminute), + '$s_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$syear+5),mktime(),'start_text'), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datetimesel($f,'finish_text',$fyear+5,$fyear,false,$fyear,$fmonth,$fday,$fhour,$fminute), + '$f_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$fyear+5),mktime(),'finish_text',true,true,'start_text'), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), -- cgit v1.2.3 From a6c4ae186e9e9962ce9ea364a95b49b5e2cbc81d Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 11:09:51 +0200 Subject: Don't display date format, it's already in the placeholder text --- mod/events.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index 459ed05bb..86a2286b2 100755 --- a/mod/events.php +++ b/mod/events.php @@ -520,11 +520,6 @@ function events_content(&$a) { } } - - - $dateformat = datesel_format($f); - $timeformat = t('hour:minute'); - require_once('include/acl_selectors.php'); $perm_defaults = array( @@ -544,7 +539,6 @@ function events_content(&$a) { '$mid' => $mid, '$title' => t('Event details'), - '$format_desc' => sprintf( t('Format is %s %s.'),$dateformat,$timeformat), '$desc' => t('Starting date and Title are required.'), '$catsenabled' => $catsenabled, '$placeholdercategory' => t('Categories (comma-separated list)'), -- cgit v1.2.3 From c8666b90767e9ded1adfc81528d37d680dc99280 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Tue, 21 Oct 2014 18:28:17 +0200 Subject: If entered event info is not valid, let user try again with the old info still there. Closes friendica/red#648 --- mod/events.php | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'mod/events.php') diff --git a/mod/events.php b/mod/events.php index 86a2286b2..513899308 100755 --- a/mod/events.php +++ b/mod/events.php @@ -12,6 +12,8 @@ function events_post(&$a) { return; $event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0); + $event_hash = ((x($_POST,'event_hash')) ? $_POST['event_hash'] : ''); + $xchan = ((x($_POST,'xchan')) ? dbesc($_POST['xchan']) : ''); $uid = local_user(); @@ -67,19 +69,22 @@ function events_post(&$a) { // and we'll waste a bunch of time responding to it. Time that // could've been spent doing something else. - if(strcmp($finish,$start) < 0) { - notice( t('Event can not end before it has started.') . EOL); - goaway($a->get_baseurl() . '/events/new'); - } $summary = escape_tags(trim($_POST['summary'])); $desc = escape_tags(trim($_POST['desc'])); $location = escape_tags(trim($_POST['location'])); $type = 'event'; + $action = ($event_hash == '') ? 'new' : "event/" . $event_hash; + $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish"; + if(strcmp($finish,$start) < 0 && !$nofinish) { + notice( t('Event can not end before it has started.') . EOL); + goaway($onerror_url); + } + if((! $summary) || (! $start)) { notice( t('Event title and start time are required.') . EOL); - goaway($a->get_baseurl() . '/events/new'); + goaway($onerror_url); } $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0); @@ -450,6 +455,19 @@ function events_content(&$a) { $channel = $a->get_channel(); + // Passed parameters overrides anything found in the DB + if($mode === 'edit' || $mode === 'new') { + if(!x($orig_event)) $orig_event = array(); + // In case of an error the browser is redirected back here, with these parameters filled in with the previous values + if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish']; + if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust']; + if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary']; + if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description']; + if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location']; + if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start']; + if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish']; + } + if($mode === 'edit' || $mode === 'new') { $n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : ''); @@ -537,6 +555,7 @@ function events_content(&$a) { '$eid' => $eid, '$xchan' => $event_xchan, '$mid' => $mid, + '$event_hash' => $event_id, '$title' => t('Event details'), '$desc' => t('Starting date and Title are required.'), @@ -548,11 +567,11 @@ function events_content(&$a) { '$ftext' => $ftext, '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), - '$s_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$syear+5),mktime(),'start_text'), + '$s_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$syear+5),mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear),'start_text'), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$fyear+5),mktime(),'finish_text',true,true,'start_text'), + '$f_dsel' => datetimesel($f,mktime(),mktime(0,0,0,0,0,$fyear+5),mktime($fhour,$fminute,$fsecond,$fmonth,$fday,$fyear),'finish_text',true,true,'start_text'), '$a_text' => t('Adjust for viewer timezone'), '$a_checked' => $a_checked, '$d_text' => t('Description:'), -- cgit v1.2.3