Calendar
Site Infrastructure / Calendar

[view modes: view]
[edit modes: edit setup]

[begin mode view]

[end mode view]

[begin mode setup]
[
form(_id, "setup_submit", list(
	list("text", "title", _title, "Title"),
	list("text", "subtitle", _subtitle, "Subtitle"),
	list("numeric", "priority", _priority, "Priority"),
	list("numeric", "parent", _parent, "Parent"),
	list("numeric", "template", _template, "Template"),
	list("permissions", "permissions", _permissions, "Permissions"),
	list("user", "author", _author, "Author"),
	list("group", "group", _group, "Group"),
	list("textarea", "body", _body, "Body")
));
]
[end mode setup]

[begin mode edit]
<h2>Calendar configuration</h2>
[
form(_id, "edit_submit", list(
	list("text", "title", _title, "Name", "The name of this calendar."),
	list("text", "syntax", _this.syntax, "Syntax", "The syntax of this calendar. Use cycle names separated by spaces."),
	list("@", "", _select(_this.default, children("option", _id), "default"), "Default Cycle", "The cycle to display by default."),
	list("numeric", "offset", _this.offset, "Offset", "The number of days since the beginning of history on which this calendar begins."),
	list("numeric", "day_length", _this.day_length, "Day Length", "The number of Earth days that pass in each of the calendar's days. (Required for On This Day)"),
	list("numeric", "day_offset", _this.day_offset, "Day Offset", "The number of Earth days since January 1, 1970 until the start of this calendar. (Required for On This Day)")
));
]
<h2>Cycles</h2>
[
	children("abbr", _id);
]
<h2>Add new cycle</h2>
[
form(_id, "add_cycle", list(
	list("text", "title", "", "Name", "The name of the cycle to add (e.g. 'Month')"),
	list("checkbox", "unit", "", "Atomic?", "Check this box if the cycle contains no smaller divisions. For example, Months and Weeks on the Gregorian calendar are atomic, but Years contain Months.")
));
]
[end mode edit]

[begin mode add_cycle]

[end mode add_cycle]

[begin mode edit_submit]
[
_title = _params.title;
_this.syntax = _params.syntax;
_this.default = _params.default;
_this.offset = _params.offset;
_this.day_length = _params.day_length;
_this.day_offset = _params.day_offset;

refresh_to({./?id=[_id]&mode=view}, 1);
]
<h1>Edit complete</h1>
<a href="/?id=[_id]">Done! Go back to viewing it now.</a><br><br>
<a href="/?id=[_id]&mode=edit">Or go back to editing it instead.</a>

[end mode edit_submit]

[begin mode setup_submit]

[end mode setup_submit]