Internationalisation of events/Move events to the navigation bar

This commit is contained in:
Michael Vogel 2015-09-27 14:00:15 +02:00
parent 1c19bcd322
commit c33957a6e9
4 changed files with 85 additions and 12 deletions

View file

@ -138,6 +138,8 @@ function nav_info(&$a) {
elseif(get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY) elseif(get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY)
$nav['community'] = array('community', t('Community'), "", t('Conversations on the network')); $nav['community'] = array('community', t('Community'), "", t('Conversations on the network'));
$nav['events'] = Array('events', t('Events'), "", t('Events and Calendar'));
$nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory')); $nav['directory'] = array($gdirpath, t('Directory'), "", t('People directory'));
$nav['about'] = Array('friendica', t('Information'), "", t('Information about this friendica instance')); $nav['about'] = Array('friendica', t('Information'), "", t('Information about this friendica instance'));

View file

@ -184,9 +184,60 @@ function events_content(&$a) {
if( feature_enabled(local_user(), 'richtext') ) if( feature_enabled(local_user(), 'richtext') )
$editselect = 'textareas'; $editselect = 'textareas';
// First day of the week (0 = Sunday)
// To-Do: Needs to be configurable
$firstDay = 0;
$i18n = array(
"firstDay" => $firstDay,
"Sun" => t("Sun"),
"Mon" => t("Mon"),
"Tue" => t("Tue"),
"Wed" => t("Wed"),
"Thu" => t("Thu"),
"Fri" => t("Fri"),
"Sat" => t("Sat"),
"Sunday" => t("Sunday"),
"Monday" => t("Monday"),
"Tuesday" => t("Tuesday"),
"Wednesday" => t("Wednesday"),
"Thursday" => t("Thursday"),
"Friday" => t("Friday"),
"Saturday" => t("Saturday"),
"Jan" => t("Jan"),
"Feb" => t("Feb"),
"Mar" => t("Mar"),
"Apr" => t("Apr"),
"May" => t("May"),
"Jun" => t("Jun"),
"Jul" => t("Jul"),
"Aug" => t("Aug"),
"Sep" => t("Sept"),
"Oct" => t("Oct"),
"Nov" => t("Nov"),
"Dec" => t("Dec"),
"January" => t("January"),
"February" => t("February"),
"March" => t("March"),
"April" => t("April"),
"May" => t("May"),
"June" => t("June"),
"July" => t("July"),
"August" => t("August"),
"September" => t("September"),
"October" => t("October"),
"November" => t("November"),
"December" => t("December"),
"today" => t("today"),
"month" => t("month"),
"week" => t("week"),
"day" => t("day"),
);
$htpl = get_markup_template('event_head.tpl'); $htpl = get_markup_template('event_head.tpl');
$a->page['htmlhead'] .= replace_macros($htpl,array( $a->page['htmlhead'] .= replace_macros($htpl,array(
'$baseurl' => $a->get_baseurl(), '$baseurl' => $a->get_baseurl(),
'$i18n' => $i18n,
'$editselect' => $editselect '$editselect' => $editselect
)); ));

View file

@ -1,7 +1,7 @@
<link rel='stylesheet' type='text/css' href='{{$baseurl}}/library/fullcalendar/fullcalendar.css' /> <link rel='stylesheet' type='text/css' href='{{$baseurl}}/library/fullcalendar/fullcalendar.css' />
<script language="javascript" type="text/javascript" <script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script> src="{{$baseurl}}/library/fullcalendar/fullcalendar.min.js"></script>
<script> <script>
function showEvent(eventid) { function showEvent(eventid) {
@ -12,18 +12,33 @@
} }
); );
} }
function doEventPreview() { function doEventPreview() {
$('#event-edit-preview').val(1); $('#event-edit-preview').val(1);
$.post('events',$('#event-edit-form').serialize(), function(data) { $.post('events',$('#event-edit-form').serialize(), function(data) {
$.colorbox({ html: data }); $.colorbox({ html: data });
}); });
$('#event-edit-preview').val(0); $('#event-edit-preview').val(0);
} }
$(document).ready(function() { $(document).ready(function() {
$('#events-calendar').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}}'],
monthNamesShort: ['{{$i18n.Jan}}','{{$i18n.Feb}}','{{$i18n.Mar}}','{{$i18n.Apr}}','{{$i18n.May}}','{{$i18n.Jun}}','{{$i18n.Jul}}','{{$i18n.Aug}}','{{$i18n.Sep}}','{{$i18n.Oct}}','{{$i18n.Nov}}','{{$i18n.Dec}}'],
dayNames: ['{{$i18n.Sunday}}','{{$i18n.Monday}}','{{$i18n.Tuesday}}','{{$i18n.Wednesday}}','{{$i18n.Thursday}}','{{$i18n.Friday}}','{{$i18n.Saturday}}'],
dayNamesShort: ['{{$i18n.Sun}}','{{$i18n.Mon}}','{{$i18n.Tue}}','{{$i18n.Wed}}','{{$i18n.Thu}}','{{$i18n.Fri}}','{{$i18n.Sat}}'],
buttonText: {
prev: "<span class='fc-text-arrow'>&lsaquo;</span>",
next: "<span class='fc-text-arrow'>&rsaquo;</span>",
prevYear: "<span class='fc-text-arrow'>&laquo;</span>",
nextYear: "<span class='fc-text-arrow'>&raquo;</span>",
today: '{{$i18n.today}}',
month: '{{$i18n.month}}',
week: '{{$i18n.week}}',
day: '{{$i18n.day}}'
},
events: '{{$baseurl}}/events/json/', events: '{{$baseurl}}/events/json/',
header: { header: {
left: 'prev,next today', left: 'prev,next today',
@ -34,7 +49,7 @@
eventClick: function(calEvent, jsEvent, view) { eventClick: function(calEvent, jsEvent, view) {
showEvent(calEvent.id); showEvent(calEvent.id);
}, },
loading: function(isLoading, view) { loading: function(isLoading, view) {
if(!isLoading) { if(!isLoading) {
$('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); }); $('td.fc-day').dblclick(function() { window.location.href='/events/new?start='+$(this).data('date'); });
} }
@ -91,7 +106,7 @@
{{if $editselect != 'none'}} {{if $editselect != 'none'}}
<script language="javascript" type="text/javascript" <script language="javascript" type="text/javascript"
src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script> src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js"></script>
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
@ -123,7 +138,7 @@
} }
}); });
{{else}} {{else}}
<script language="javascript" type="text/javascript"> <script language="javascript" type="text/javascript">
{{/if}} {{/if}}

View file

@ -19,6 +19,11 @@
<span id="net-update" class="nav-notify"></span> <span id="net-update" class="nav-notify"></span>
</li> </li>
{{/if}} {{/if}}
{{if $nav.events}}
<li role="menuitem" id="nav-events-link" class="nav-menu {{$sel.events}}">
<a accesskey="e" class="{{$nav.events.2}}" href="{{$nav.events.0}}" title="{{$nav.events.3}}" >{{$nav.events.1}}</a>
</li>
{{/if}}
{{if $nav.community}} {{if $nav.community}}
<li role="menuitem" id="nav-community-link" class="nav-menu {{$sel.community}}"> <li role="menuitem" id="nav-community-link" class="nav-menu {{$sel.community}}">
<a accesskey="c" class="{{$nav.community.2}}" href="{{$nav.community.0}}" title="{{$nav.community.3}}" >{{$nav.community.1}}</a> <a accesskey="c" class="{{$nav.community.2}}" href="{{$nav.community.0}}" title="{{$nav.community.3}}" >{{$nav.community.1}}</a>