forked from leftypol/leftypol
Add staff application theme, calendar theme and ukko4 theme
This commit is contained in:
parent
f0d73f9952
commit
22bbc4147e
19 changed files with 899 additions and 0 deletions
191
templates/themes/calendar/calendar.html
Normal file
191
templates/themes/calendar/calendar.html
Normal file
|
@ -0,0 +1,191 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" media="screen" href="/stylesheets/style.css">
|
||||
<meta charset="utf-8">
|
||||
{% if config.meta_keywords %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes">
|
||||
<link rel='stylesheet' href='/stylesheets/fullcalendar.min.css' />
|
||||
<script type='text/javascript'>
|
||||
var active_page = "news";
|
||||
</script>
|
||||
<title>{{ settings.title }}</title>
|
||||
{% include 'header.html' %}
|
||||
<script src='/js/moment.min.js'></script>
|
||||
<script src='/js/fullcalendar.min.js'></script>
|
||||
</head>
|
||||
<body class="8chan vichan {% if mod %}is-moderator{% else %}is-not-moderator{% endif %}" data-stylesheet="{% if config.default_stylesheet.1 != '' %}{{ config.default_stylesheet.1 }}{% else %}default{% endif %}">
|
||||
<div class="bar top">
|
||||
{{ boardlist.top }}
|
||||
</div>
|
||||
<header>
|
||||
<h1 class="glitch" data-text="{{ settings.title }}"> {{ settings.title }}</h1>
|
||||
<div class="subtitle">{{ settings.subtitle }}</div>
|
||||
</header>
|
||||
<div class="ban">
|
||||
<div id='calendar'></div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<footer>
|
||||
<p class="unimportant" style="margin-top:20px;text-align:center;">- <a href="http://tinyboard.org/">Tinyboard</a> +
|
||||
<a href='https://int.vichan.net/devel/'>vichan</a> +
|
||||
<a href='https://github.com/lainchan/lainchan'>lainchan</a> {{ config.version }} -
|
||||
<br><a href="http://tinyboard.org/">Tinyboard</a> Copyright © 2010-2014 Tinyboard Development Group
|
||||
<br><a href="https://engine.vichan.net/">vichan</a> Copyright © 2012-2016 vichan-devel
|
||||
<br><a href="https://github.com/lainchan/lainchan">lainchan</a> Copyright © 2014-2017 lainchan Administration</p>
|
||||
</footer>
|
||||
<div class="pages"></div>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function() {
|
||||
|
||||
var calendar = $('#calendar').fullCalendar({
|
||||
editable: true,
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
right: 'month,agendaWeek,agendaDay'
|
||||
},
|
||||
|
||||
events: "calendarpost.php",
|
||||
|
||||
eventRender: function(event, element, view) {
|
||||
if (event.allDay === 'true') {
|
||||
event.allDay = true;
|
||||
} else {
|
||||
event.allDay = false;
|
||||
}
|
||||
element.find('.fc-title').append("<br/>" + event.description);
|
||||
element.css('background-color',event.color);
|
||||
},
|
||||
selectable: true,
|
||||
selectHelper: true,
|
||||
select: function(start, end, allDay) {
|
||||
var title = prompt('Event Title:');
|
||||
var description = prompt('Event Description:');
|
||||
var url = prompt("Event URL");
|
||||
var color = prompt("Event Color");
|
||||
var starttime = prompt("Event Start Time");
|
||||
var endtime = prompt("Event End Time");
|
||||
if (title) {
|
||||
var startmoment = moment(start);
|
||||
var endmoment = moment(end);
|
||||
var start = startmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
var end = endmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
if (starttime && endtime){
|
||||
var starttimemoment = moment(starttime,'HH:mm');
|
||||
var endtimemoment = moment(endtime,'HH:mm');
|
||||
startmoment.hour(starttimemoment.hour());
|
||||
startmoment.minute(starttimemoment.minute());
|
||||
endmoment.hour(endtimemoment.hour());
|
||||
endmoment.minute(endtimemoment.minute());
|
||||
endmoment.subtract(1, "days");
|
||||
allday = false;
|
||||
start = startmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
end = endmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
$.ajax({
|
||||
url: 'calendarpost.php',
|
||||
data: 'type=add&title='+ title+'&description='+ description +'&start='+ start +'&end='+ end + '&url='+url+'&color='+color,
|
||||
type: "POST",
|
||||
success: function(json) {
|
||||
alert('Added Successfully');
|
||||
}
|
||||
});
|
||||
calendar.fullCalendar('renderEvent',
|
||||
{
|
||||
title: title,
|
||||
description: description,
|
||||
start: start,
|
||||
end: end,
|
||||
allDay: allDay,
|
||||
url: url,
|
||||
color:color,
|
||||
},
|
||||
true
|
||||
);
|
||||
}
|
||||
calendar.fullCalendar('unselect');
|
||||
},
|
||||
|
||||
editable: true,
|
||||
eventDrop: function(event, delta) {
|
||||
var startmoment = moment(start);
|
||||
var endmoment = moment(end);
|
||||
var start = startmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
var end = endmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
var starttime = prompt("Event Start Time");
|
||||
var endtime = prompt("Event End Time");
|
||||
if (starttime && endtime){
|
||||
var starttimemoment = moment(starttime,'HH:mm');
|
||||
var endtimemoment = moment(endtime,'HH:mm');
|
||||
startmoment.hour(starttimemoment.hour());
|
||||
startmoment.minute(starttimemoment.minute());
|
||||
endmoment.hour(endtimemoment.hour());
|
||||
endmoment.minute(endtimemoment.minute());
|
||||
allday = false;
|
||||
endmoment.subtract(1, "days");
|
||||
start = startmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
end = endmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
$.ajax({
|
||||
url: 'calendarpost.php',
|
||||
data: 'type=update&title='+ event.title+'&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id ,
|
||||
type: "POST",
|
||||
success: function(json) {
|
||||
alert("Updated Successfully");
|
||||
}
|
||||
});
|
||||
},
|
||||
eventClick: function(event) {
|
||||
var decision = confirm("Do you really want to do that?");
|
||||
if (decision) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: 'calendarpost.php',
|
||||
data: "type=delete&id=" + event.id,
|
||||
success: function(json) {
|
||||
$('#calendar').fullCalendar('removeEvents', event.id);
|
||||
alert("Updated Successfully");}
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
eventResize: function(event) {
|
||||
var startmoment = moment(start);
|
||||
var endmoment = moment(end);
|
||||
var start = moment(start).format('YYYY-MM-DD HH:mm:ss');
|
||||
var end = moment(end).format('YYYY-MM-DD HH:mm:ss');
|
||||
var starttime = prompt("Event Start Time");
|
||||
var endtime = prompt("Event End Time");
|
||||
if (starttime && endtime){
|
||||
var starttimemoment = moment(starttime,'HH:mm');
|
||||
var endtimemoment = moment(endtime,'HH:mm');
|
||||
startmoment.hour(starttimemoment.hour());
|
||||
startmoment.minute(starttimemoment.minute());
|
||||
endmoment.hour(endtimemoment.hour());
|
||||
endmoment.minute(endtimemoment.minute());
|
||||
allday = false;
|
||||
endmoment.subtract(1, "days");
|
||||
start = startmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
end = endmoment.format('YYYY-MM-DD HH:mm:ss');
|
||||
}
|
||||
$.ajax({
|
||||
url: 'calendarpost.php',
|
||||
data: 'type=update&title='+ event.title+ '&description='+ event.description + '&start='+ start +'&end='+ end +'&id='+ event.id ,
|
||||
type: "POST",
|
||||
success: function(json) {
|
||||
alert("Updated Successfully");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">{% raw %}
|
||||
ready();
|
||||
{% endraw %}</script>
|
||||
</body>
|
||||
</html>
|
53
templates/themes/calendar/calendarpost.php
Normal file
53
templates/themes/calendar/calendarpost.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
require '/var/www/html/inc/functions.php';
|
||||
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
if ($method == 'POST') {
|
||||
// Method is POST
|
||||
$type = $_POST['type'];
|
||||
switch ($type) {
|
||||
case "add":
|
||||
$title = $_POST['title'];
|
||||
$description = $_POST['description'];
|
||||
$start = $_POST['start'];
|
||||
$end = $_POST['end'];
|
||||
$url = $_POST['url'];
|
||||
$color = $_POST['color'];
|
||||
$query = prepare("INSERT INTO calendar_events (title, description, start, end,url,color) VALUES (:title,:description, :start, :end,:url, :color )");
|
||||
$query->bindValue(':title', $title);
|
||||
$query->bindValue(':description', $description);
|
||||
$query->bindValue(':start', $start);
|
||||
$query->bindValue(':end', $end);
|
||||
$query->bindValue(':url', $url);
|
||||
$query->bindValue(':color', $color);
|
||||
$query->execute() or error(db_error($query));
|
||||
break;
|
||||
case "delete":
|
||||
$id = $_POST['id'];
|
||||
$query = query("DELETE from calendar_events WHERE id = :id") or error(db_error());
|
||||
break;
|
||||
case "update":
|
||||
$id = $_POST['id'];
|
||||
$title = $_POST['title'];
|
||||
$description = $_POST['description'];
|
||||
$start = $_POST['start'];
|
||||
$end = $_POST['end'];
|
||||
$query = prepare(" UPDATE calendar_events SET title = :title, description = :description, start = :start, end = :end, url = :url, color =:color WHERE id = :id");
|
||||
$query->bindValue(':id', $id);
|
||||
$query->bindValue(':title', $title);
|
||||
$query->bindValue(':description', $description);
|
||||
$query->bindValue(':start', $start);
|
||||
$query->bindValue(':end', $end);
|
||||
$query->bindValue(':url', $url);
|
||||
$query->bindValue(':color', $color);
|
||||
$query->execute() or error(db_error($query));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
} elseif ($method == 'GET') {
|
||||
// Method is GET
|
||||
$query = query("SELECT * FROM calendar_events ORDER BY id") or error(db_error());
|
||||
echo json_encode($query->fetchAll(PDO::FETCH_ASSOC));
|
||||
}
|
||||
|
||||
?>
|
36
templates/themes/calendar/info.php
Normal file
36
templates/themes/calendar/info.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
$theme = Array();
|
||||
|
||||
// Theme name
|
||||
$theme['name'] = 'Calendar';
|
||||
// Description (you can use Tinyboard markup here)
|
||||
$theme['description'] = 'Calendar theme.';
|
||||
$theme['version'] = 'v0.0.1';
|
||||
|
||||
// Theme configuration
|
||||
$theme['config'] = Array();
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Site title',
|
||||
'name' => 'title',
|
||||
'type' => 'text'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Slogan',
|
||||
'name' => 'subtitle',
|
||||
'type' => 'text',
|
||||
'comment' => '(optional)'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'File',
|
||||
'name' => 'file',
|
||||
'type' => 'text',
|
||||
'default' => $config['file_index'],
|
||||
'comment' => '(eg. "index.html")'
|
||||
);
|
||||
|
||||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'calendar_build';
|
||||
|
40
templates/themes/calendar/theme.php
Normal file
40
templates/themes/calendar/theme.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
require 'info.php';
|
||||
|
||||
function calendar_build($action, $settings, $board) {
|
||||
// Possible values for $action:
|
||||
// - all (rebuild everything, initialization)
|
||||
// - news (news has been updated)
|
||||
// - boards (board list changed)
|
||||
|
||||
Calendar::build($action, $settings);
|
||||
}
|
||||
|
||||
// Wrap functions in a class so they don't interfere with normal Tinyboard operations
|
||||
class Calendar {
|
||||
public static function build($action, $settings) {
|
||||
global $config;
|
||||
|
||||
if ($action == 'all' || $action == 'news')
|
||||
file_write($config['dir']['home'] . $settings['file'], Calendar::htmlpage($settings));
|
||||
file_write($config['dir']['home'] . "calendarpost.php", Calendar::phppage($settings));
|
||||
}
|
||||
|
||||
// Build staff application page
|
||||
public static function htmlpage($settings) {
|
||||
global $config;
|
||||
|
||||
return Element('themes/calendar/calendar.html', Array(
|
||||
'settings' => $settings,
|
||||
'config' => $config,
|
||||
'boardlist' => createBoardlist()
|
||||
));
|
||||
}
|
||||
public static function phppage($settings) {
|
||||
global $config;
|
||||
$page = file_get_contents('templates/themes/calendar/calendarpost.php');
|
||||
return $page;
|
||||
}
|
||||
};
|
||||
|
||||
?>
|
BIN
templates/themes/calendar/thumb.png
Normal file
BIN
templates/themes/calendar/thumb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
Loading…
Add table
Add a link
Reference in a new issue