diff --git a/include/datetime.php b/include/datetime.php
index e27f54e09..ea98f01fe 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -213,7 +213,7 @@ function dob($dob) {
* @return string Parsed HTML output.
*/
function datesel($format, $min, $max, $default, $id = 'datepicker') {
- return datetimesel($format,$min,$max,$default,$id,true,false, '','');
+ return datetimesel($format,$min,$max,$default,'',$id,true,false, '','');
}
/**
@@ -231,7 +231,7 @@ function datesel($format, $min, $max, $default, $id = 'datepicker') {
* @return string Parsed HTML output.
*/
function timesel($format, $h, $m, $id='timepicker') {
- return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),$id,false,true);
+ return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),'',$id,false,true);
}
/**
@@ -262,7 +262,7 @@ function timesel($format, $h, $m, $id='timepicker') {
* @todo Once browser support is better this could probably be replaced with
* native HTML5 date picker.
*/
-function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
+function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
// First day of the week (0 = Sunday)
$firstDay = get_pconfig(local_user(),'system','first_day_of_week');
@@ -284,7 +284,7 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
$minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
$maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
- $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : '';
+ $input_text = $default ? date($dateformat, $default->getTimestamp()) : '';
$defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
$pickers = '';
@@ -294,9 +294,9 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
$extra_js = '';
$pickers .= ",dayOfWeekStart: ".$firstDay.",lang:'".$lang."'";
if($minfrom != '')
- $extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
+ $extra_js .= "\$('#id_$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
if($maxfrom != '')
- $extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
+ $extra_js .= "\$('#id_$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#id_$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
$readable_format = $dateformat;
$readable_format = str_replace('Y','yyyy',$readable_format);
@@ -305,10 +305,13 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic
$readable_format = str_replace('H','HH',$readable_format);
$readable_format = str_replace('i','MM',$readable_format);
- $o .= "
";
- $o .= '
';
+ $tpl = get_markup_template('field_input.tpl');
+ $o .= replace_macros($tpl,array(
+ '$field' => array($id, $label, $input_text, '', (($required) ? '*' : ''), 'placeholder="' . $readable_format . '"'),
+ ));
+
$o .= "";
return $o;
diff --git a/mod/events.php b/mod/events.php
index 633aaf0c1..e4526ac59 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -67,9 +67,9 @@ function events_post(&$a) {
$action = ($event_id == '') ? 'new' : "event/" . $event_id;
$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) {
+ if(strcmp($finish,$start) < 0 && !$nofinish) {
notice( t('Event can not end before it has started.') . EOL);
- if(intval($_REQUEST['preview'])) {
+ if(intval($_REQUEST['preview'])) {
echo( t('Event can not end before it has started.'));
killme();
}
@@ -455,6 +455,7 @@ function events_content(&$a) {
'$baseurl' => $a->get_baseurl(),
'$tabs' => $tabs,
'$title' => t('Events'),
+ '$view' => t('View'),
'$new_event'=> array($a->get_baseurl().'/events/new',t('Create New Event'),'',''),
'$previus' => array($a->get_baseurl()."/events/$prevyear/$prevmonth",t('Previous'),'',''),
'$next' => array($a->get_baseurl()."/events/$nextyear/$nextmonth",t('Next'),'',''),
@@ -462,6 +463,11 @@ function events_content(&$a) {
'$events' => $events,
+ "today" => t("today"),
+ "month" => t("month"),
+ "week" => t("week"),
+ "day" => t("day"),
+
));
@@ -555,11 +561,11 @@ function events_content(&$a) {
'$title' => t('Event details'),
'$desc' => t('Starting date and Title are required.'),
'$s_text' => t('Event Starts:') . ' * ',
- '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true),
+ '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),t('Event Starts:'),'start_text',true,true,'','',true),
'$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,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text'),
+ '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),t('Event Finishes:'),'finish_text',true,true,'start_text'),
'$a_text' => t('Adjust for viewer timezone'),
'$a_checked' => $a_checked,
'$d_text' => t('Description:'),
@@ -568,11 +574,17 @@ function events_content(&$a) {
'$l_orig' => $l_orig,
'$t_text' => t('Title:') . ' * ',
'$t_orig' => $t_orig,
+ '$summary' => array('summary', t('Title:'), $t_orig, '', '*'),
'$sh_text' => t('Share this event'),
+ '$share' => array('share', t('Share this event'), $sh_checked, ''),
'$sh_checked' => $sh_checked,
+ '$nofinish' => array('nofinish', t('Finish date/time is not known or not relevant'), $n_checked),
+ '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked),
'$preview' => t('Preview'),
'$acl' => $acl,
- '$submit' => t('Submit')
+ '$submit' => t('Submit'),
+ '$basic' => t("Basic"),
+ '$advanced' => t("Advanced")
));
diff --git a/view/templates/event_form.tpl b/view/templates/event_form.tpl
index 1c065477b..de8de44e8 100644
--- a/view/templates/event_form.tpl
+++ b/view/templates/event_form.tpl
@@ -12,24 +12,15 @@
-{{$s_text}}
{{$s_dsel}}
-{{$f_text}}
{{$f_dsel}}
-
+{{include file="field_checkbox.tpl" field=$nofinish}}
- {{$n_text}}
+{{include file="field_checkbox.tpl" field=$adjust}}
-
-
- {{$a_text}}
-
-
-
-{{$t_text}}
-
+{{include file="field_input.tpl" field=$summary}}
{{$d_text}}
@@ -41,8 +32,9 @@
- {{$sh_text}}
-
+{{if ! $eid}}
+{{include file="field_checkbox.tpl" field=$share}}
+{{/if}}
{{$acl}}
diff --git a/view/templates/event_head.tpl b/view/templates/event_head.tpl
index de5ad6070..01c69b8b3 100644
--- a/view/templates/event_head.tpl
+++ b/view/templates/event_head.tpl
@@ -21,6 +21,14 @@
$('#event-edit-preview').val(0);
}
+ // disable the input for the finish date if it is not available
+ function enableDisableFinishDate() {
+ if( $('#id_nofinish').is(':checked'))
+ $('#id_finish_text').prop("disabled", true);
+ else
+ $('#id_finish_text').prop("disabled", false);
+ }
+
$(document).ready(function() {
$('#events-calendar').fullCalendar({
@@ -152,9 +160,9 @@
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
- $('#event-share-checkbox').change(function() {
+ $('#id_share').change(function() {
- if ($('#event-share-checkbox').is(':checked')) {
+ if ($('#id_share').is(':checked')) {
$('#acl-wrapper').show();
}
else {
@@ -175,6 +183,11 @@
}).trigger('change');
+ // disable the finish time input if the user disable it
+ $('#id_nofinish').change(function() {
+ enableDisableFinishDate()
+ }).trigger('change');
+
});
diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css
index dc892c60b..bfce21a65 100644
--- a/view/theme/frio/css/style.css
+++ b/view/theme/frio/css/style.css
@@ -163,6 +163,15 @@ a#item-delete-selected {
.btn-link:focus, .btn-link:hover {
color: #23527c;
}
+.btn-eventnav, btn-eventnav:hover {
+ font-size: 16px;
+ background: none;
+ background-color: transparent;
+ padding: 0 14px;
+}
+.btn-separator {
+ border-left: 1px solid #777;
+}
/*.btn-info {
background: #6fdbe8;
color: #fff!important;
@@ -1760,8 +1769,8 @@ ul.dropdown-menu li:hover {
.contacts-content-wrapper, .suggest-content-wrapper, .common-content-wrapper,
.allfriends-content-wrapper, .match-content-wrapper, .dirfind-content-wrapper,
.directory-content-wrapper, .manage-content-wrapper, .notes-content-wrapper,
-.events-content-wrapper, .message-content-wrapper, .apps-content-wrapper,
-.notifications-content-wrapper, .admin-content-wrapper, .group-content-wrapper {
+.message-content-wrapper, .apps-content-wrapper, .notifications-content-wrapper,
+.admin-content-wrapper, .group-content-wrapper {
min-height: calc(100vh - 150px);
padding: 15px;
padding-bottom: 20px;
@@ -1960,6 +1969,78 @@ ul li:hover .contact-wrapper a.contact-action-link:hover {
clear: both;
}
+/* Events page */
+#fc-header {
+ margin-top: 20px;
+ margin-bottom: 10px;
+}
+#fc-header-left,
+#fc-header-right,
+#event-calendar-title {
+ display: inline-block;
+}
+#fc-title {
+ margin: 0;
+ padding-left: 20px;
+
+}
+#fc-header-right {
+ margin-top: -4px;
+}
+#event-calendar-title {
+ vertical-align: middle;
+}
+a#event-calendar-views {
+ padding: 6px 9px;
+ font-size: 14px
+}
+tr.fc-first,
+tr.fc-first th {
+ border-left: none;
+ border-right: none;
+ border-top: none;
+}
+td.fc-day {
+ border-left: none;
+ border-right: none;
+ padding: 0 6px;
+}
+#events-calendar .fc-grid .fc-day-number {
+ float: left;
+ font-size: 0.9em;
+}
+.event-wrapper .event-owner {
+ margin-bottom: 15px;
+}
+.event-wrapper .event-owner img {
+ display: block;
+}
+.event-owner img {
+ margin-right: 5px;
+ height: 48px;
+ width: 48;
+ border-radius: 3px;
+}
+.event-wrapper .vevent {
+ margin-left: 0;
+ margin-right: 0;
+ box-shadow: 1.5px 0 0 0 rgba(0, 0, 0, .1) inset;
+}
+.event-wrapper .event-buttons {
+ margin-top: 15px;
+}
+#event-form-wrapper {
+ padding-top: 5px;
+}
+#event-edit-form-wrapper {
+ padding-top: 15px;
+}
+#event-nav a {
+ color: #555;
+}
+#event-edit-form-wrapper #event-edit-time {
+ padding: 10px 0;
+}
/* Profiles Page */
.profile-listing-table {
display: table;
diff --git a/view/theme/frio/js/event.js b/view/theme/frio/js/event.js
new file mode 100644
index 000000000..c6a3541f6
--- /dev/null
+++ b/view/theme/frio/js/event.js
@@ -0,0 +1,124 @@
+$(document).ready(function() {
+ // go to the permissions tab if the checkbox is checked
+ $('body').on("change", "#id_share", function() {
+
+ if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) {
+ $('#acl-wrapper').show();
+ $("a#event-perms-lnk").parent("li").show();
+ toggleEventNav("a#event-perms-lnk");
+ eventAclActive();
+ }
+ else {
+ $('#acl-wrapper').hide();
+ $("a#event-perms-lnk").parent("li").hide();
+ }
+ }).trigger('change');
+
+ // disable the finish time input if the user disable it
+ $('body').on("change", "#id_nofinish", function() {
+ enableDisableFinishDate()
+ }).trigger('change');
+
+ // js for the permission sextion
+ $('#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');
+
+ // Change the event nav menu.tabs on click
+ $("body").on("click", "#event-nav > li > a", function(e){
+ e.preventDefault();
+ toggleEventNav(this);
+ });
+
+ // this is experimental. We maybe can make use of it to inject
+ // some js code while the event modal opens
+ //$('body').on('show.bs.modal', function () {
+ // enableDisableFinishDate();
+ //});
+
+ // clear some elements (e.g. the event-preview container) when
+ // selecting a event nav link so it don't appear more than once
+ $('body').on("click", "#event-nav a", function(e) {
+ $("#event-preview").empty();
+ e.preventDefault();
+ });
+
+});
+
+// Load the html of the actual event and incect the output to the
+// event-edit section
+function doEventPreview() {
+ $('#event-edit-preview').val(1);
+ $.post('events',$('#event-edit-form').serialize(), function(data) {
+ $("#event-preview").append(data);
+ });
+ $('#event-edit-preview').val(0);
+}
+
+
+// this function load the content of the edit url into a modal
+function eventEdit(url) {
+ var char = qOrAmp(url);
+ url = url + char + 'mode=none';
+
+ $.get(url, function(data) {
+ $("#modal-body").empty();
+ $("#modal-body").append(data);
+ }).done(function() {
+ loadModalTitle();
+ });
+}
+
+// the following functions show/hide the specific event-edit content
+// in dependence of the selected nav
+function eventAclActive() {
+ $("#event-edit-wrapper, #event-preview, #event-desc-wrapper").hide();
+ $("#event-acl-wrapper").show();
+}
+
+
+function eventPreviewActive() {
+ $("#event-acl-wrapper, #event-edit-wrapper, #event-desc-wrapper").hide();
+ $("#event-preview").show();
+ doEventPreview();
+}
+
+function eventEditActive() {
+ $("#event-acl-wrapper, #event-preview, #event-desc-wrapper").hide();
+ $("#event-edit-wrapper").show();
+
+ //make sure jot text does have really the active class (we do this because there are some
+ // other events which trigger jot text
+ toggleEventNav($("#event-edit-lnk"));
+}
+
+function eventDescActive() {
+ $("#event-edit-wrapper, #event-preview, #event-acl-wrapper").hide();
+ $("#event-desc-wrapper").show();
+}
+
+// Give the active "event-nav" list element the class "active"
+function toggleEventNav (elm) {
+ // select all li of #event-nav and remove the active class
+ $(elm).closest("#event-nav").children("li").removeClass("active");
+ // add the active class to the parent of the link which was selected
+ $(elm).parent("li").addClass("active");
+}
+
+
+
+// disable the input for the finish date if it is not available
+function enableDisableFinishDate() {
+ if( $('#id_nofinish').is(':checked'))
+ $('#id_finish_text').prop("disabled", true);
+ else
+ $('#id_finish_text').prop("disabled", false);
+}
diff --git a/view/theme/frio/js/modal.js b/view/theme/frio/js/modal.js
index fcaaadcc7..0279b1c72 100644
--- a/view/theme/frio/js/modal.js
+++ b/view/theme/frio/js/modal.js
@@ -158,13 +158,22 @@ Dialog._load = function(url) {
*/
function loadModalTitle() {
// clear the text of the title
- //$("#modal-title").empty();
+ $("#modal-title").empty();
// hide the first element with the class "heading" of the modal body
$("#modal-body .heading").first().hide();
+ var title = "";
+
// get the text of the first element with "heading" class
- var title = $("#modal-body .heading").first().text();
+ title = $("#modal-body .heading").first().text();
+
+ // for event modals we need some speacial handling
+ if($("#modal-body .event-wrapper .event-summary").length) {
+ title = ' ';
+ var eventsum = $("#modal-body .event-wrapper .event-summary").text();
+ title = title + eventsum;
+ }
// and append it to modal title
if (title!=="") {
diff --git a/view/theme/frio/js/theme.js b/view/theme/frio/js/theme.js
index 8babb0805..f2537f487 100644
--- a/view/theme/frio/js/theme.js
+++ b/view/theme/frio/js/theme.js
@@ -505,4 +505,3 @@ String.prototype.rtrim = function() {
var trimmed = this.replace(/\s+$/g, '');
return trimmed;
};
-
diff --git a/view/theme/frio/templates/event.tpl b/view/theme/frio/templates/event.tpl
new file mode 100644
index 000000000..32e740581
--- /dev/null
+++ b/view/theme/frio/templates/event.tpl
@@ -0,0 +1,26 @@
+
+
+{{foreach $events as $event}}
+
+{{/foreach}}
diff --git a/view/theme/frio/templates/event_form.tpl b/view/theme/frio/templates/event_form.tpl
new file mode 100644
index 000000000..97892d186
--- /dev/null
+++ b/view/theme/frio/templates/event_form.tpl
@@ -0,0 +1,178 @@
+
+
+
+
\ No newline at end of file
diff --git a/view/theme/frio/templates/event_head.tpl b/view/theme/frio/templates/event_head.tpl
new file mode 100644
index 000000000..a44fd30be
--- /dev/null
+++ b/view/theme/frio/templates/event_head.tpl
@@ -0,0 +1,155 @@
+
+
+
+
+
+
+
+{{if $editselect != 'none'}}
+
+
diff --git a/view/theme/frio/templates/events-js.tpl b/view/theme/frio/templates/events-js.tpl
new file mode 100644
index 000000000..9e46b5c48
--- /dev/null
+++ b/view/theme/frio/templates/events-js.tpl
@@ -0,0 +1,49 @@
+
+ {{$tabs}}
+ {{include file="section_title.tpl" title=$title}}
+
+ {{* The link to create a new event *}}
+
+
+ {{* We create our own fullcallendar header (with title & calendar view *}}
+
+
+ {{* This is the container where the fullCalendar is inserted through js *}}
+
+
diff --git a/view/theme/frost/js/theme.js b/view/theme/frost/js/theme.js
index fc1bb643c..038f83e0e 100644
--- a/view/theme/frost/js/theme.js
+++ b/view/theme/frost/js/theme.js
@@ -70,9 +70,9 @@ $(document).ready(function() {
return false;
});*/
- $('#event-share-checkbox').change(function() {
+ $('#id_share').change(function() {
- if ($('#event-share-checkbox').is(':checked')) {
+ if ($('#id_share').is(':checked')) {
$('#acl-wrapper').show();
}
else {
diff --git a/view/theme/frost/templates/event_form.tpl b/view/theme/frost/templates/event_form.tpl
index 43f2a782f..27631d9f7 100644
--- a/view/theme/frost/templates/event_form.tpl
+++ b/view/theme/frost/templates/event_form.tpl
@@ -12,24 +12,15 @@
-{{$s_text}}
{{$s_dsel}}
-{{$f_text}}
{{$f_dsel}}
-
+{{include file="field_checkbox.tpl" field=$nofinish}}
- {{$n_text}}
+{{include file="field_checkbox.tpl" field=$adjust}}
-
-
- {{$a_text}}
-
-
-
-{{$t_text}}
-
+{{include file="field_input.tpl" field=$summary}}
{{$d_text}}
@@ -40,8 +31,9 @@
- {{$sh_text}}
-
+{{if ! $eid}}
+{{include file="field_checkbox.tpl" field=$share}}
+{{/if}}
{{$acl}}
diff --git a/view/theme/quattro/templates/event_form.tpl b/view/theme/quattro/templates/event_form.tpl
index 098b57850..484fe6744 100644
--- a/view/theme/quattro/templates/event_form.tpl
+++ b/view/theme/quattro/templates/event_form.tpl
@@ -10,23 +10,23 @@
- {{include file="field_custom.tpl" field=array('start_text', $s_text, $s_dsel, "")}}
- {{include file="field_custom.tpl" field=array('finish_text', $f_text, $f_dsel, "")}}
+ {{$s_dsel}}
- {{include file="field_checkbox.tpl" field=array('nofinish', $n_text, $n_checked, "")}}
- {{include file="field_checkbox.tpl" field=array('adjust', $a_text, $a_checked, "")}}
+ {{$f_dsel}}
+
+ {{include file="field_checkbox.tpl" field=$nofinish}}
+
+ {{include file="field_checkbox.tpl" field=$adjust}}
- {{include file="field_input.tpl" field=array('summary', $t_text, $t_orig, "")}}
+ {{include file="field_input.tpl" field=$summary}}
{{include file="field_textarea.tpl" field=array('desc', $d_text, $d_orig, "")}}
{{include file="field_textarea.tpl" field=array('location', $l_text, $l_orig, "")}}
-
- {{$sh_text}}
-
-
-
+ {{if ! $eid}}
+ {{include file="field_checkbox.tpl" field=$share}}
+ {{/if}}
{{$acl}}
diff --git a/view/theme/vier/templates/event_form.tpl b/view/theme/vier/templates/event_form.tpl
index 4f3240de8..0507c36aa 100644
--- a/view/theme/vier/templates/event_form.tpl
+++ b/view/theme/vier/templates/event_form.tpl
@@ -13,24 +13,15 @@
-{{$s_text}}
{{$s_dsel}}
-{{$f_text}}
{{$f_dsel}}
-
+{{include file="field_checkbox.tpl" field=$nofinish}}
- {{$n_text}}
+{{include file="field_checkbox.tpl" field=$adjust}}
-
-
- {{$a_text}}
-
-
-
-{{$t_text}}
-
+{{include file="field_input.tpl" field=$summary}}
{{$d_text}}
@@ -61,8 +52,9 @@
- {{$sh_text}}
-
+{{if ! $eid}}
+{{include file="field_checkbox.tpl" field=$share}}
+{{/if}}
{{$acl}}