frio: events - adapt changes to the templates of the other themes

This commit is contained in:
rabuzarus 2016-06-17 10:33:12 +02:00
parent 8b4c416713
commit c99da380cf
12 changed files with 247 additions and 189 deletions

View File

@ -576,6 +576,7 @@ function events_content(&$a) {
'$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),

View File

@ -12,24 +12,15 @@
<input type="hidden" name="uri" value="{{$uri}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}}
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}}
<div id="event-datetime-break"></div>
{{include file="field_checkbox.tpl" field=$nofinish}}
<input type="checkbox" name="nofinish" value="1" id="event-nofinish-checkbox" {{$n_checked}} /> <div id="event-nofinish-text">{{$n_text}}</div>
{{include file="field_checkbox.tpl" field=$adjust}}
<div id="event-nofinish-break"></div>
<input type="checkbox" name="adjust" value="1" id="event-adjust-checkbox" {{$a_checked}} /> <div id="event-adjust-text">{{$a_text}}</div>
<div id="event-adjust-break"></div>
<div id="event-summary-text">{{$t_text}}</div>
<input type="text" id="event-summary" name="summary" value="{{$t_orig|escape:'html'}}" />
{{include file="field_input.tpl" field=$summary}}
<div id="event-desc-text">{{$d_text}}</div>
@ -41,8 +32,9 @@
<div id="event-location-break"></div>
<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>
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
{{$acl}}

View File

@ -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
$('body').change("#id_nofinish", function() {
enableDisableFinishDate()
}).trigger('change');
});
</script>

View File

@ -153,7 +153,7 @@ 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();

View File

@ -11,7 +11,7 @@
<div class="event-buttons pull-right">
{{if $event.item.plink}}<a href="{{$event.plink.0}}" title="{{$event.plink.1}}" target="_blank" class="btn "><i class="fa fa-external-link" aria-hidden="true"></i></a>{{/if}}
{{if $event.edit}}<a href="{{$event.edit.0}}" title="{{$event.edit.1}}" class="btn"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}
{{if $event.edit}}<a onclick="eventEdit('{{$event.edit.0}}')" title="{{$event.edit.1}}" class="btn"><i class="fa fa-pencil" aria-hidden="true"></i></a>{{/if}}
</div>
<div class="clear"></div>
</div>

View File

@ -1,17 +1,21 @@
<h3 class="heading">{{$title}}</h3>
<div id="event-form-wrapper">
<h3 class="heading">{{$title}}</h3>
{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}}
<ul id="event-nav" class="nav nav-tabs hidden-xs event-nav" role="menubar" data-tabs="tabs">
{{* The event edit navigation menu (text input, permissions, preview, filebrowser) *}}
<ul id="event-nav" class="nav nav-tabs event-nav" role="menubar" data-tabs="tabs">
{{* Mark the first list entry as active because it is the first which is active after opening
the modal. Changing of the activity status is done by js in event_head.tpl *}}
<li class="active" role="menuitem"><a id="event-edit-lnk" onclick="eventEditActive(); return false;">Text</a></li>
{{if $acl}}<li role="menuitem" {{if !$sh_checked}} style="display: none"{{/if}}><a id="event-perms-lnk" onclick="eventAclActive();return false;">Permissions</a></li>{{/if}}
{{if $preview}}<li role="menuitem"><a id="event-preview-lnk" onclick="eventPreviewActive();return false;">{{$preview}}</a></li>{{/if}}
{{* commented out because it isn't implemented yet
<li role="menuitem"><a id="event-preview-link" onclick="fbrowserActive(); return false;"> Browser </a></li>
</ul>
*}}
</ul>
<form id="event-edit-form" action="{{$post}}" method="post" >
<div id="event-edit-form-wrapper">
<form id="event-edit-form" action="{{$post}}" method="post" >
<input type="hidden" name="event_id" value="{{$eid}}" />
<input type="hidden" name="cid" value="{{$cid}}" />
@ -38,11 +42,13 @@
<div id="event-desc-text"><b>{{$d_text}}</b></div>
<textarea id="comment-edit-text-desc" class="form-control" name="desc" >{{$d_orig}}</textarea>
<ul id="event-desc-text-edit-bb" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet
<li>
<a class="icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="desc">
<i class="fa fa-picture-o"></i>
</a>
</li>
*}}
<li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="desc">
<i class="fa fa-link"></i>
@ -82,11 +88,13 @@
<div id="event-location-text"><b>{{$l_text}}</b></div>
<textarea id="comment-edit-text-loc" class="form-control" name="location">{{$l_orig}}</textarea>
<ul id="comment-tools-loc" class="comment-edit-bb comment-icon-list nav nav-pills hidden-xs pull-left">
{{* commented out because it isn't implemented yet
<li>
<a class="icon" style="cursor: pointer;" title="{{$edimg|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="img" data-id="loc">
<i class="fa fa-picture-o"></i>
</a>
</li>
*}}
<li>
<a class="icon bb-url" style="cursor: pointer;" title="{{$edurl|escape:'html'}}" data-role="insert-formatting" data-comment=" " data-bbcode="url" data-id="loc">
<i class="fa fa-link"></i>
@ -122,18 +130,33 @@
<div class="clear"></div>
</div>
<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>
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
<input id="event-edit-preview" type="submit" name="preview" value="{{$preview|escape:'html'}}" onclick="doEventPreview(); return false;" />
<input id="event-submit" type="submit" name="submit" value="{{$submit|escape:'html'}}" />
<div class="pull-right" >
<button id="event-submit" type="submit" name="submit" class="btn btn-primary" value="{{$submit|escape:'html'}}">{{$submit}}</button>
</div>
<div class="clear"></div>
</div>
<div id="event-acl-wrapper" style="display: none">
{{$acl}}
</div>
<div id="event-preview" style="display: none"></div>
<div class="clear"></div>
</form>
</form>
</div>
</div>
<script>
$(document).ready( function() {
// disable finish date input if it isn't available
enableDisableFinishDate();
// load bbcode autocomplete for the description textarea
$('#comment-edit-text-desc, #comment-edit-text-loc').bbco_autocomplete('bbcode');
});
</script>

View File

@ -5,16 +5,18 @@
<script>
// loads the event into a modal
function showEvent(eventid) {
addToModal('{{$baseurl}}/events/?id='+eventid);
}
// 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) {
$.colorbox({ html: data });
$("#event-preview").append(data);
});
$('#event-edit-preview').val(0);
}
@ -22,10 +24,11 @@
function changeView(action, viewName) {
$('#events-calendar').fullCalendar(action, viewName);
var view = $('#events-calendar').fullCalendar('getView');
$('#title').text(view.title);
$('#fc-title').text(view.title);
}
$(document).ready(function() {
// start the fullCalendar
$('#events-calendar').fullCalendar({
firstDay: {{$i18n.firstDay}},
monthNames: ['{{$i18n.January}}','{{$i18n.February}}','{{$i18n.March}}','{{$i18n.April}}','{{$i18n.May}}','{{$i18n.June}}','{{$i18n.July}}','{{$i18n.August}}','{{$i18n.September}}','{{$i18n.October}}','{{$i18n.November}}','{{$i18n.December}}'],
@ -159,9 +162,10 @@
$("#comment-edit-text-desc").bbco_autocomplete('bbcode');
{{/if}}
$('body').change("#event-share-checkbox", function() {
// go to the permissions tab if the checkbox is checked
$('body').change("#id_share", function() {
if ($('#event-share-checkbox').is(':checked') && !( $('#event-share-checkbox').attr("disabled"))) {
if ($('#id_share').is(':checked') && !( $('#id_share').attr("disabled"))) {
$('#acl-wrapper').show();
$("a#event-perms-lnk").parent("li").show();
toggleEventNav("a#event-perms-lnk");
@ -173,7 +177,12 @@
}
}).trigger('change');
// disable the finish time input if the user disable it
$('body').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() {
@ -186,12 +195,26 @@
}).trigger('change');
// Event nav menu.
$("body").on("click", "#event-nav li a", function(e){
// 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();
});
});
</script>
@ -200,18 +223,19 @@
// the following functions show/hide the specific event-edit content
// in dependence of the selected nav
function eventAclActive() {
$("#event-edit-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide();
$("#event-edit-wrapper, #event-preview").hide();
$("#event-acl-wrapper").show();
}
function previewActive() {
$(".modal-body #profile-jot-wrapper, .modal-body #profile-jot-acl-wrapper,.modal-body #jot-fbrowser-wrapper").hide();
preview_post();
function eventPreviewActive() {
$("#event-acl-wrapper, #event-edit-wrapper").hide();
$("#event-preview").show();
doEventPreview();
}
function eventEditActive() {
$("#event-acl-wrapper, .modal-body #jot-preview-content, .modal-body #jot-fbrowser-wrapper").hide();
$("#event-acl-wrapper, #event-preview").hide();
$("#event-edit-wrapper").show();
//make sure jot text does have really the active class (we do this because there are some
@ -226,4 +250,25 @@
// add the active class to the parent of the link which was selected
$(elm).parent("li").addClass("active");
}
// 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();
});
}
// 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);
}
</script>

View File

@ -1,7 +1,7 @@
<div class="generic-page-wrapper">
{{$tabs}}
{{include file="section_title.tpl" title=$title}}
<div id="new-event-link"><a href="{{$new_event.0}}" >{{$new_event.1}}</a></div>
<div id="new-event-link"><a onclick="addToModal('{{$new_event.0}}')" >{{$new_event.1}}</a></div>
<div id="fc-header">

View File

@ -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 {

View File

@ -12,24 +12,15 @@
<input type="hidden" name="uri" value="{{$uri}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}}
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}}
<div id="event-datetime-break"></div>
{{include file="field_checkbox.tpl" field=$nofinish}}
<input type="checkbox" name="nofinish" value="1" id="event-nofinish-checkbox" {{$n_checked}} /> <div id="event-nofinish-text">{{$n_text}}</div>
{{include file="field_checkbox.tpl" field=$adjust}}
<div id="event-nofinish-break"></div>
<input type="checkbox" name="adjust" value="1" id="event-adjust-checkbox" {{$a_checked}} /> <div id="event-adjust-text">{{$a_text}}</div>
<div id="event-adjust-break"></div>
<div id="event-summary-text">{{$t_text}}</div>
<input type="text" id="event-summary" name="summary" value="{{$t_orig}}" />
{{include file="field_input.tpl" field=$summary}}
<div id="event-desc-text">{{$d_text}}</div>
@ -40,8 +31,9 @@
<textarea id="event-location-textarea" rows="10" cols="70" name="location">{{$l_orig}}</textarea>
<br />
<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>
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
{{$acl}}

View File

@ -10,23 +10,23 @@
<input type="hidden" name="uri" value="{{$uri}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
{{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}}
<hr>
{{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, "")}}
<hr>
<div class='field checkbox' id='div_id_share'>
<label for='id_share'>{{$sh_text}}</label>
<input type="checkbox" name='share' id='id_share' aria-describedby='share_tip' value="1" {{$sh_checked}}>
</div>
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
{{$acl}}

View File

@ -13,24 +13,15 @@
<input type="hidden" name="uri" value="{{$uri}}" />
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}}
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}}
<div id="event-datetime-break"></div>
{{include file="field_checkbox.tpl" field=$nofinish}}
<input type="checkbox" name="nofinish" value="1" id="event-nofinish-checkbox" {{$n_checked}} /> <div id="event-nofinish-text">{{$n_text}}</div>
{{include file="field_checkbox.tpl" field=$adjust}}
<div id="event-nofinish-break"></div>
<input type="checkbox" name="adjust" value="1" id="event-adjust-checkbox" {{$a_checked}} /> <div id="event-adjust-text">{{$a_text}}</div>
<div id="event-adjust-break"></div>
<div id="event-summary-text">{{$t_text}}</div>
<input type="text" size="65" id="event-summary" name="summary" value="{{$t_orig|escape:'html'}}" />
{{include file="field_input.tpl" field=$summary}}
<div id="event-desc-text">{{$d_text}}</div>
@ -61,8 +52,9 @@
<div id="event-location-break"></div>
<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>
{{if ! $eid}}
{{include file="field_checkbox.tpl" field=$share}}
{{/if}}
{{$acl}}