From fd48d4d81d878928fe6821d3808eb578cb5088b4 Mon Sep 17 00:00:00 2001 From: marijus Date: Fri, 17 Oct 2014 14:28:21 +0200 Subject: [PATCH 01/14] make lockview for photos work --- mod/photos.php | 4 ++-- view/tpl/photo_view.tpl | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 2b859b7f1..85bd47399 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -956,7 +956,7 @@ function photos_content(&$a) { $edit = array( 'edit' => t('Edit photo'), - 'id' => $ph[0]['id'], + 'id' => print_r($ph[0]), //['id'], 'rotatecw' => t('Rotate CW (right)'), 'rotateccw' => t('Rotate CCW (left)'), 'albums' => $albums['albums'], @@ -1114,7 +1114,7 @@ function photos_content(&$a) { $photo_tpl = get_markup_template('photo_view.tpl'); $o .= replace_macros($photo_tpl, array( - '$id' => $ph[0]['id'], + '$id' => $link_item['id'], //$ph[0]['id'], '$album' => $album_e, '$tools' => $tools, '$lock' => $lock, diff --git a/view/tpl/photo_view.tpl b/view/tpl/photo_view.tpl index 4a9c0dfe8..4961464dc 100755 --- a/view/tpl/photo_view.tpl +++ b/view/tpl/photo_view.tpl @@ -3,11 +3,21 @@

{{$album.1}}

From 7c4f55af9f8e28a761155eaf6d0d379b28d88f23 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sat, 18 Oct 2014 22:17:49 +0200 Subject: [PATCH 08/14] Oops, forgot one file --- include/datetime.php | 156 +++++++++++++++++++++++-------------------- 1 file changed, 84 insertions(+), 72 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 84ab1e2fa..3d0ae0404 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -134,7 +134,7 @@ function dob($dob) { $f = get_config('system','birthday_input_format'); if(! $f) $f = 'ymd'; - $o = datesel($f,'',1920,$y,true,$year,$month,$day); + $o = datesel($f,'dob',1920,$y,true,$year,$month,$day); return $o; } @@ -169,95 +169,107 @@ function datesel_format($f) { return $o; } +/** + * returns a date selector + * @param $format + * format string, e.g. 'ymd' or 'mdy'. Not currently supported + * @param $id + * id and name of datetimepicker (defaults to "datepicker") + * @param $ymin + * first year shown in selector dropdown + * @param $ymax + * last year shown in selector dropdown + * @param $allow_blank + * allow an empty response on any field. Not currently supported + * @param $y + * already selected year + * @param $m + * already selected month + * @param $d + * already selected day + */ +function datesel($format, $id, $ymin, $ymax, $allow_blank, $y, $m, $d) { + if($ymin > $ymax) list($ymin,$ymax) = array($ymax,$ymin); -// returns a date selector. -// $f = format string, e.g. 'ymd' or 'mdy' -// $pre = prefix (if needed) for HTML name and class fields -// $ymin = first year shown in selector dropdown -// $ymax = last year shown in selector dropdown -// $allow_blank = allow an empty response on any field -// $y = already selected year -// $m = already selected month -// $d = already selected day - - -function datesel($f,$pre,$ymin,$ymax,$allow_blank,$y,$m,$d) { + if($id == '') $id = 'datepicker'; $o = ''; - if(strlen($f)) { - for($z = 0; $z < strlen($f); $z ++) { - if($f[$z] === 'y') { + $dateformat = 'YYYY-MM-DD'; + $mindate = $ymin ? "new Date($ymin,1,1)" : ''; + $maxdate = $ymin ? "new Date($ymax,11,31)" : ''; // Yes, JS months really go from 0 to 11. + + $m = $m -1; // Because JavaScript month weirdness - $o .= " "; + $o .= "
"; + $o .= ""; return $o; } +/** + * returns a date selector + * @param $format + * format string, e.g. 'ymd' or 'mdy'. Not currently supported + * @param $id + * id and name of datetimepicker (defaults to "timepicker") + * @param $h + * already selected hour + * @param $m + * already selected minute + */ +function timesel($format,$id,$h,$m) { + if($id == '') $id = 'timepicker'; -function timesel($pre,$h,$m) { + $timeformat = 'HH:mm'; $o = ''; - $o .= " : "; + $o .= "
"; + $o .= ""; return $o; } +/** + * returns a datetime selector + * @param $format + * format string, e.g. 'ymd' or 'mdy'. Not currently supported + * @param $id + * id and name of datetimepicker (defaults to "datetimepicker") + * @param $ymin + * first year shown in selector dropdown + * @param $ymax + * last year shown in selector dropdown + * @param $allow_blank + * allow an empty response on any field. Not currently supported + * @param $y + * already selected year + * @param $m + * already selected month + * @param $d + * already selected day + * @param $h + * already selected hour + * @param $min + * already selected minute + */ +function datetimesel($format, $id, $ymin, $ymax, $allow_blank, $y, $m, $d, $h, $min) { + if($ymin > $ymax) list($ymin,$ymax) = array($ymax,$ymin); + if($id == '') $id = 'datetimepicker'; + $o = ''; + $dateformat = 'YYYY-MM-DD HH:mm'; + $mindate = $ymin ? "new Date($ymin,1,1)" : ''; + $maxdate = $ymin ? "new Date($ymax,11,31)" : ''; + + $defaultDate = ($y != 0 && $m != 0 && $d != 0) ? ", defaultDate: new Date($y, $m, $d, $h, $min)" : ''; - - + $o .= "
"; + $o .= ""; + return $o; +} // implements "3 seconds ago" etc. // based on $posted_date, (UTC). @@ -516,4 +528,4 @@ function update_birthdays() { } } } -} \ No newline at end of file +} From d9817779fbeaebf4b75c0670da7013bf4482b72b Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 08:33:18 +0200 Subject: [PATCH 09/14] 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(-) 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'])); From 519ef4850021c929764f1175a9aae569d1ae36a6 Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 10:47:42 +0200 Subject: [PATCH 10/14] Changes in the datetimesel api, prevent user from picking event end date earlier than start date --- include/datetime.php | 121 ++++++++++++++++++------------------------- mod/events.php | 4 +- 2 files changed, 53 insertions(+), 72 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 3d0ae0404..76c3ddb25 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -130,11 +130,12 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d function dob($dob) { list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d'); - $y = datetime_convert('UTC',date_default_timezone_get(),'now','Y'); $f = get_config('system','birthday_input_format'); if(! $f) $f = 'ymd'; - $o = datesel($f,'dob',1920,$y,true,$year,$month,$day); + + $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob'); + return $o; } @@ -173,101 +174,81 @@ function datesel_format($f) { * returns a date selector * @param $format * format string, e.g. 'ymd' or 'mdy'. Not currently supported + * @param $min + * unix timestamp of minimum date + * @param $max + * unix timestap of maximum date + * @param $default + * unix timestamp of default date * @param $id - * id and name of datetimepicker (defaults to "datepicker") - * @param $ymin - * first year shown in selector dropdown - * @param $ymax - * last year shown in selector dropdown - * @param $allow_blank - * allow an empty response on any field. Not currently supported - * @param $y - * already selected year - * @param $m - * already selected month - * @param $d - * already selected day + * id and name of datetimepicker (defaults to "datetimepicker") */ -function datesel($format, $id, $ymin, $ymax, $allow_blank, $y, $m, $d) { - if($ymin > $ymax) list($ymin,$ymax) = array($ymax,$ymin); - - if($id == '') $id = 'datepicker'; - - $o = ''; - - $dateformat = 'YYYY-MM-DD'; - $mindate = $ymin ? "new Date($ymin,1,1)" : ''; - $maxdate = $ymin ? "new Date($ymax,11,31)" : ''; // Yes, JS months really go from 0 to 11. - - $m = $m -1; // Because JavaScript month weirdness - - $defaultDate = ($y != 0 && $m != 0 && $d != 0) ? ", defaultDate: new Date($y,$m,$d)" : ''; - - $o .= "
"; - $o .= ""; - return $o; +function datesel($format, $min, $max, $default,$id = 'datepicker') { + return datetimesel($format,$min,$max,$default,$id,true,false); } /** * returns a date selector * @param $format * format string, e.g. 'ymd' or 'mdy'. Not currently supported - * @param $id - * id and name of datetimepicker (defaults to "timepicker") * @param $h * already selected hour * @param $m * already selected minute + * @param $id + * id and name of datetimepicker (defaults to "timepicker") */ -function timesel($format,$id,$h,$m) { - if($id == '') $id = 'timepicker'; - - $timeformat = 'HH:mm'; - - $o = ''; - $o .= "
"; - $o .= ""; - return $o; +function timesel($format,$h,$m,$id='timepicker') { + return datetimesel($format,mktime(),mktime(),mktime($h,$m),$id,false,true); } /** * returns a datetime selector * @param $format * format string, e.g. 'ymd' or 'mdy'. Not currently supported + * @param $min + * unix timestamp of minimum date + * @param $max + * unix timestap of maximum date + * @param $default + * unix timestamp of default date * @param $id * id and name of datetimepicker (defaults to "datetimepicker") - * @param $ymin - * first year shown in selector dropdown - * @param $ymax - * last year shown in selector dropdown - * @param $allow_blank - * allow an empty response on any field. Not currently supported - * @param $y - * already selected year - * @param $m - * already selected month - * @param $d - * already selected day - * @param $h - * already selected hour - * @param $min - * already selected minute + * @param $pickdate + * true to show date picker (default) + * @param $picktime + * true to show time picker (default) + * @param $minfrom + * set minimum date from picker with id $minfrom (none by default) + * @param $maxfrom + * set maximum date from picker with id $maxfrom (none by default) */ -function datetimesel($format, $id, $ymin, $ymax, $allow_blank, $y, $m, $d, $h, $min) { - if($ymin > $ymax) list($ymin,$ymax) = array($ymax,$ymin); - - if($id == '') $id = 'datetimepicker'; - +function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '') { $o = ''; - $dateformat = 'YYYY-MM-DD HH:mm'; - $mindate = $ymin ? "new Date($ymin,1,1)" : ''; - $maxdate = $ymin ? "new Date($ymax,11,31)" : ''; + $dateformat = ''; + if($pickdate) $dateformat .= 'YYYY-MM-DD'; + if($pickdate && $picktime) $dateformat .= ' '; + if($picktime) $dateformat .= 'HH:mm'; + + $mindate = $min ? "new Date($min*1000)" : ''; + $maxdate = $max ? "new Date($max*1000)" : ''; - $defaultDate = ($y != 0 && $m != 0 && $d != 0) ? ", defaultDate: new Date($y, $m, $d, $h, $min)" : ''; + $defaultDate = $default ? ", defaultDate: new Date($default*1000)" : ''; + + $pickers = ''; + if(!$pickdate) $pickers .= 'pickDate: false,'; + if(!$picktime) $pickers .= 'pickTime: false,'; + + $extra_js = ''; + if($minfrom != '') + $extra_js .= "\$('#$minfrom').on('dp.change',function (e) { \$('#$id').data('DateTimePicker').setMinDate(e.date); });"; + + if($maxfrom != '') + $extra_js .= "\$('#$maxfrom').on('dp.change',function (e) { \$('#$id').data('DateTimePicker').setMaxDate(e.date); });"; $o .= "
"; - $o .= ""; + $o .= ""; return $o; } 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:'), From a6c4ae186e9e9962ce9ea364a95b49b5e2cbc81d Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 11:09:51 +0200 Subject: [PATCH 11/14] Don't display date format, it's already in the placeholder text --- include/datetime.php | 30 ------------------------------ mod/events.php | 6 ------ mod/profiles.php | 2 +- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/include/datetime.php b/include/datetime.php index 76c3ddb25..fe0f29c7a 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -140,36 +140,6 @@ function dob($dob) { } -function datesel_format($f) { - - $o = ''; - - if(strlen($f)) { - for($x = 0; $x < strlen($f); $x ++) { - switch($f[$x]) { - case 'y': - if(strlen($o)) - $o .= '-'; - $o .= t('year'); - break; - case 'm': - if(strlen($o)) - $o .= '-'; - $o .= t('month'); - break; - case 'd': - if(strlen($o)) - $o .= '-'; - $o .= t('day'); - break; - default: - break; - } - } - } - return $o; -} - /** * returns a date selector * @param $format 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)'), diff --git a/mod/profiles.php b/mod/profiles.php index b23ae5cc5..14f24c5cf 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -626,7 +626,7 @@ logger('extra_fields: ' . print_r($extra_fields,true)); '$lbl_fullname' => t('Your Full Name:'), '$lbl_title' => t('Title/Description:'), '$lbl_gender' => t('Your Gender:'), - '$lbl_bd' => sprintf( t("Birthday \x28%s\x29:"),datesel_format($f)), + '$lbl_bd' => t("Birthday :"), '$lbl_address' => t('Street Address:'), '$lbl_city' => t('Locality/City:'), '$lbl_zip' => t('Postal/Zip Code:'), From fe877b68aafc4afc6f10d16f09976cb9fc4b1dca Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Sun, 19 Oct 2014 17:09:06 +0100 Subject: [PATCH 12/14] Seventy five people you won't believe contributed to RedMatrix! --- doc/credits.bb | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 doc/credits.bb diff --git a/doc/credits.bb b/doc/credits.bb new file mode 100644 index 000000000..264efb11a --- /dev/null +++ b/doc/credits.bb @@ -0,0 +1,77 @@ +[b]Credits[/b] + +Mike Macgirvin +Thomas Willingham +Fabio Comuni +Simon L'nu +marijus +Tobias Diekershoff +fabrixxm +tommy tomson +Simon +zottel +Christian Vogeley +jeroenpraat +Michael Vogel +erik +Zach Prezkuta +Paolo T +Michael Meer +Michael +Abinoam P. Marques Jr +Tobias Hößl +Alexander Kampmann +Olaf Conradi +Paolo Tacconi +tobiasd +Devlon Duthie +Zvi ben Yaakov (a.k.a rdc) +Alexandre Hannud Abdo +Olivier Migeot +Chris Case +Klaus Weidenbach +Michael Johnston +olivierm +Vasudev Kamath +pixelroot +Max Weller +duthied +Martin Schmitt +Sebastian Egbers +Erkan Yilmaz +sasiflo +Stefan Parviainen +Haakon Meland Eriksen +Oliver +Erik Lundin +habeascodice +sirius +23n +Charles +Tony Baldwin +Hauke Zuehl +Keith Fernie +toclimb +Daniel Frank +Matthew Exon +Michal Supler +Tobias Luther +U-SOUND\mike +mrjive +nostupidzone +tonnerkiller +Antoine G +Christian Drechsler +Ludovic Grossard +RedMatrixCanada +Stanislav Lechev [0xAF] +aweiher +bufalo1973 +dsp1986 +felixgilles +ike +maase2 +mycocham +ndurchx +pafcu +Simó Albert i Beltran From 6ee514579f85927e60fa5ebd2b89f97cbfe6544d Mon Sep 17 00:00:00 2001 From: Stefan Parviainen Date: Sun, 19 Oct 2014 21:08:53 +0200 Subject: [PATCH 13/14] Move registration button to before login in nav to avoid problems with mobile. In the long run a better fix should be found. --- view/tpl/nav.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index ac6cb1a9c..bc9d0ba37 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -47,6 +47,7 @@