fix merge conflicts

This commit is contained in:
Georg Ehrke 2011-12-03 17:25:17 +01:00
commit 361d4ac13b
68 changed files with 1769 additions and 571 deletions

1
.gitignore vendored
View file

@ -43,3 +43,4 @@ nbproject
# WebFinger
.well-known
/.buildpath

View file

@ -117,7 +117,7 @@ class Sabre_VObject_Reader {
//$result = preg_match('/(?P<name>[A-Z0-9-]+)(?:;(?P<parameters>^(?<!:):))(.*)$/',$line,$matches);
$token = '[A-Z0-9-\.]+';
$token = '[A-Z0-9-\/\.]+';
$parameters = "(?:;(?P<parameters>([^:^\"]|\"([^\"]*)\")*))?";
$regex = "/^(?P<name>$token)$parameters:(?P<value>.*)$/i";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 742 B

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -1,9 +1,4 @@
/* @group Base */
select.chzn-select {
visibility: hidden;
height: 28px !important;
min-height: 28px !important;
}
.chzn-container {
font-size: 13px;
position: relative;
@ -60,9 +55,21 @@ select.chzn-select {
white-space: nowrap;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
-moz-binding: url('/xml/ellipsis.xml#ellipsis');
text-overflow: ellipsis;
}
.chzn-container-single .chzn-single abbr {
display: block;
position: absolute;
right: 26px;
top: 8px;
width: 12px;
height: 13px;
font-size: 1px;
background: url(chosen-sprite.png) right top no-repeat;
}
.chzn-container-single .chzn-single abbr:hover {
background-position: right -11px;
}
.chzn-container-single .chzn-single div {
-webkit-border-radius: 0 4px 4px 0;
-moz-border-radius : 0 4px 4px 0;
@ -94,18 +101,19 @@ select.chzn-select {
}
.chzn-container-single .chzn-search {
padding: 3px 4px;
position: relative;
margin: 0;
white-space: nowrap;
}
.chzn-container-single .chzn-search input {
background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: #fff url('chosen-sprite.png') no-repeat 100% -22px;
background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
margin: 1px 0;
padding: 4px 20px 4px 5px;
outline: 0;
@ -123,6 +131,11 @@ select.chzn-select {
}
/* @end */
.chzn-container-single-nosearch .chzn-search input {
position: absolute;
left: -9000px;
}
/* @group Multi Chosen */
.chzn-container-multi .chzn-choices {
background-color: #fff;
@ -197,18 +210,18 @@ select.chzn-select {
.chzn-container-multi .chzn-choices .search-choice .search-choice-close {
display: block;
position: absolute;
right: 5px;
top: 6px;
width: 8px;
height: 9px;
right: 3px;
top: 4px;
width: 12px;
height: 13px;
font-size: 1px;
background: url(chosen-sprite.png) right top no-repeat;
}
.chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
background-position: right -9px;
background-position: right -11px;
}
.chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
background-position: right -9px;
background-position: right -11px;
}
/* @end */
@ -226,6 +239,7 @@ select.chzn-select {
padding: 0;
}
.chzn-container .chzn-results li {
display: none;
line-height: 80%;
padding: 7px 7px 8px;
margin: 0;
@ -233,6 +247,7 @@ select.chzn-select {
}
.chzn-container .chzn-results .active-result {
cursor: pointer;
display: list-item;
}
.chzn-container .chzn-results .highlighted {
background: #3875d7;
@ -247,6 +262,7 @@ select.chzn-select {
}
.chzn-container .chzn-results .no-results {
background: #f4f4f4;
display: list-item;
}
.chzn-container .chzn-results .group-result {
cursor: default;
@ -309,6 +325,18 @@ select.chzn-select {
}
/* @end */
/* @group Disabled Support */
.chzn-disabled {
cursor: default;
opacity:0.5 !important;
}
.chzn-disabled .chzn-single {
cursor: default;
}
.chzn-disabled .chzn-choices .search-choice .search-choice-close {
cursor: default;
}
/* @group Right to Left */
.chzn-rtl { direction:rtl;text-align: right; }
.chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }
@ -327,14 +355,14 @@ select.chzn-select {
.chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; }
.chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
.chzn-rtl .chzn-search input {
background: url('chosen-sprite.png') no-repeat -38px -20px, #ffffff;
background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('chosen-sprite.png') no-repeat -38px -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, #ffffff;
background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
background: url('chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
background: url('chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
padding: 4px 5px 4px 20px;
}
/* @end */

View file

@ -1 +1 @@
0.9.1
0.9.5

View file

@ -1,7 +1,7 @@
// Chosen, a Select Box Enhancer for jQuery and Protoype
// by Patrick Filler for Harvest, http://getharvest.com
//
// Version 0.9
// Version 0.9.5
// Full source at https://github.com/harvesthq/chosen
// Copyright (c) 2011 Harvest http://getharvest.com
@ -16,18 +16,22 @@
root = this;
$ = jQuery;
$.fn.extend({
chosen: function(data, options) {
chosen: function(options) {
if ($.browser === "msie" && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
return this;
}
return $(this).each(function(input_field) {
if (!($(this)).hasClass("chzn-done")) {
return new Chosen(this, data, options);
return new Chosen(this, options);
}
});
}
});
Chosen = (function() {
function Chosen(elmn) {
function Chosen(form_field, options) {
this.form_field = form_field;
this.options = options != null ? options : {};
this.set_default_values();
this.form_field = elmn;
this.form_field_jq = $(this.form_field);
this.is_multiple = this.form_field.multiple;
this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
@ -40,22 +44,28 @@
this.click_test_action = __bind(function(evt) {
return this.test_active_click(evt);
}, this);
this.activate_action = __bind(function(evt) {
return this.activate_field(evt);
}, this);
this.active_field = false;
this.mouse_on_container = false;
this.results_showing = false;
this.result_highlighted = null;
this.result_single_selected = null;
return this.choices = 0;
this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
this.disable_search_threshold = this.options.disable_search_threshold || 0;
this.choices = 0;
return this.results_none_found = this.options.no_results_text || "No results match";
};
Chosen.prototype.set_up_html = function() {
var container_div, dd_top, dd_width, sf_width;
this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
this.container_id += "_chzn";
this.f_width = this.form_field_jq.width();
this.f_width = this.form_field_jq.outerWidth();
this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
container_div = $("<div />", {
id: this.container_id,
"class": "chzn-container " + (this.is_rtl ? ' chzn-rtl' : void 0),
"class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
style: 'width: ' + this.f_width + 'px;'
});
if (this.is_multiple) {
@ -66,6 +76,9 @@
this.form_field_jq.hide().after(container_div);
this.container = $('#' + this.container_id);
this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
this.container.addClass("chzn-container-single-nosearch");
}
this.dropdown = this.container.find('div.chzn-drop').first();
dd_top = this.container.height();
dd_width = this.f_width - get_side_border_padding(this.dropdown);
@ -92,8 +105,11 @@
return this.set_tab_index();
};
Chosen.prototype.register_observers = function() {
this.container.click(__bind(function(evt) {
return this.container_click(evt);
this.container.mousedown(__bind(function(evt) {
return this.container_mousedown(evt);
}, this));
this.container.mouseup(__bind(function(evt) {
return this.container_mouseup(evt);
}, this));
this.container.mouseenter(__bind(function(evt) {
return this.mouse_enter(evt);
@ -101,8 +117,8 @@
this.container.mouseleave(__bind(function(evt) {
return this.mouse_leave(evt);
}, this));
this.search_results.click(__bind(function(evt) {
return this.search_results_click(evt);
this.search_results.mouseup(__bind(function(evt) {
return this.search_results_mouseup(evt);
}, this));
this.search_results.mouseover(__bind(function(evt) {
return this.search_results_mouseover(evt);
@ -129,30 +145,52 @@
return this.search_field.focus(__bind(function(evt) {
return this.input_focus(evt);
}, this));
} else {
return this.selected_item.focus(__bind(function(evt) {
return this.activate_field(evt);
}, this));
}
};
Chosen.prototype.container_click = function(evt) {
if (evt && evt.type === "click") {
evt.stopPropagation();
}
if (!this.pending_destroy_click) {
if (!this.active_field) {
if (this.is_multiple) {
this.search_field.val("");
}
$(document).click(this.click_test_action);
this.results_show();
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
evt.preventDefault();
this.results_toggle();
Chosen.prototype.search_field_disabled = function() {
this.is_disabled = this.form_field_jq.attr('disabled');
if (this.is_disabled) {
this.container.addClass('chzn-disabled');
this.search_field.attr('disabled', true);
if (!this.is_multiple) {
this.selected_item.unbind("focus", this.activate_action);
}
return this.activate_field();
return this.close_field();
} else {
return this.pending_destroy_click = false;
this.container.removeClass('chzn-disabled');
this.search_field.attr('disabled', false);
if (!this.is_multiple) {
return this.selected_item.bind("focus", this.activate_action);
}
}
};
Chosen.prototype.container_mousedown = function(evt) {
var target_closelink;
if (!this.is_disabled) {
target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
if (evt && evt.type === "mousedown") {
evt.stopPropagation();
}
if (!this.pending_destroy_click && !target_closelink) {
if (!this.active_field) {
if (this.is_multiple) {
this.search_field.val("");
}
$(document).click(this.click_test_action);
this.results_show();
} else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
evt.preventDefault();
this.results_toggle();
}
return this.activate_field();
} else {
return this.pending_destroy_click = false;
}
}
};
Chosen.prototype.container_mouseup = function(evt) {
if (evt.target.nodeName === "ABBR") {
return this.results_reset(evt);
}
};
Chosen.prototype.mouse_enter = function() {
@ -164,7 +202,7 @@
Chosen.prototype.input_focus = function(evt) {
if (!this.active_field) {
return setTimeout((__bind(function() {
return this.container_click();
return this.container_mousedown();
}, this)), 50);
}
};
@ -235,9 +273,13 @@
this.choice_build(data);
} else if (data.selected && !this.is_multiple) {
this.selected_item.find("span").text(data.text);
if (this.allow_single_deselect) {
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
}
}
}
}
this.search_field_disabled();
this.show_search_field_default();
this.search_field_scale();
this.search_results.html(content);
@ -252,7 +294,7 @@
}
};
Chosen.prototype.result_add_option = function(option) {
var classes;
var classes, style;
if (!option.disabled) {
option.dom_id = this.container_id + "_o_" + option.array_index;
classes = option.selected && this.is_multiple ? [] : ["active-result"];
@ -262,7 +304,11 @@
if (option.group_array_index != null) {
classes.push("group-option");
}
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
if (option.classes !== "") {
classes.push(option.classes);
}
style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
} else {
return "";
}
@ -353,12 +399,12 @@
return this.search_field.removeClass("default");
}
};
Chosen.prototype.search_results_click = function(evt) {
Chosen.prototype.search_results_mouseup = function(evt) {
var target;
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
if (target.length) {
this.result_highlight = target;
return this.result_select();
return this.result_select(evt);
}
};
Chosen.prototype.search_results_mouseover = function(evt) {
@ -391,8 +437,12 @@
};
Chosen.prototype.choice_destroy_link_click = function(evt) {
evt.preventDefault();
this.pending_destroy_click = true;
return this.choice_destroy($(evt.target));
if (!this.is_disabled) {
this.pending_destroy_click = true;
return this.choice_destroy($(evt.target));
} else {
return evt.stopPropagation;
}
};
Chosen.prototype.choice_destroy = function(link) {
this.choices -= 1;
@ -403,18 +453,29 @@
this.result_deselect(link.attr("rel"));
return link.parents('li').first().remove();
};
Chosen.prototype.result_select = function() {
Chosen.prototype.results_reset = function(evt) {
this.form_field.options[0].selected = true;
this.selected_item.find("span").text(this.default_text);
this.show_search_field_default();
$(evt.target).remove();
this.form_field_jq.trigger("change");
if (this.active_field) {
return this.results_hide();
}
};
Chosen.prototype.result_select = function(evt) {
var high, high_id, item, position;
if (this.result_highlight) {
high = this.result_highlight;
high_id = high.attr("id");
this.result_clear_highlight();
high.addClass("result-selected");
if (this.is_multiple) {
this.result_deactivate(high);
} else {
this.search_results.find(".result-selected").removeClass("result-selected");
this.result_single_selected = high;
}
high.addClass("result-selected");
position = high_id.substr(high_id.lastIndexOf("_") + 1);
item = this.results_data[position];
item.selected = true;
@ -423,18 +484,23 @@
this.choice_build(item);
} else {
this.selected_item.find("span").first().text(item.text);
if (this.allow_single_deselect) {
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
}
}
if (!(evt.metaKey && this.is_multiple)) {
this.results_hide();
}
this.results_hide();
this.search_field.val("");
this.form_field_jq.trigger("change");
return this.search_field_scale();
}
};
Chosen.prototype.result_activate = function(el) {
return el.addClass("active-result").show();
return el.addClass("active-result");
};
Chosen.prototype.result_deactivate = function(el) {
return el.removeClass("active-result").hide();
return el.removeClass("active-result");
};
Chosen.prototype.result_deselect = function(pos) {
var result, result_data;
@ -530,17 +596,18 @@
return _results;
};
Chosen.prototype.winnow_results_set_highlight = function() {
var do_high;
var do_high, selected_results;
if (!this.result_highlight) {
do_high = this.search_results.find(".active-result").first();
if (do_high) {
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
if (do_high != null) {
return this.result_do_highlight(do_high);
}
}
};
Chosen.prototype.no_results = function(terms) {
var no_results_html;
no_results_html = $('<li class="no-results">No results match "<span></span>"</li>');
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
no_results_html.find("span").first().html(terms);
return this.search_results.append(no_results_html);
};
@ -611,7 +678,7 @@
case 13:
evt.preventDefault();
if (this.results_showing) {
return this.result_select();
return this.result_select(evt);
}
break;
case 27:
@ -623,6 +690,8 @@
case 38:
case 40:
case 16:
case 91:
case 17:
break;
default:
return this.results_search();
@ -758,7 +827,9 @@
html: option.innerHTML,
selected: option.selected,
disabled: group_disabled === true ? group_disabled : option.disabled,
group_array_index: group_position
group_array_index: group_position,
classes: option.className,
style: option.style.cssText
});
} else {
this.parsed.push({

File diff suppressed because one or more lines are too long

9
3rdparty/when/MIT-LICENSE.txt vendored Normal file
View file

@ -0,0 +1,9 @@
License
Copyright (c) 2010 Thomas Planer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

725
3rdparty/when/When.php vendored Executable file
View file

@ -0,0 +1,725 @@
<?php
/**
* Name: When
* Author: Thomas Planer <tplaner@gmail.com>
* Location: http://github.com/tplaner/When
* Created: September 2010
* Description: Determines the next date of recursion given an iCalendar "rrule" like pattern.
* Requirements: PHP 5.3+ - makes extensive use of the Date and Time library (http://us2.php.net/manual/en/book.datetime.php)
*/
class When
{
protected $frequency;
protected $start_date;
protected $try_date;
protected $end_date;
protected $gobymonth;
protected $bymonth;
protected $gobyweekno;
protected $byweekno;
protected $gobyyearday;
protected $byyearday;
protected $gobymonthday;
protected $bymonthday;
protected $gobyday;
protected $byday;
protected $gobysetpos;
protected $bysetpos;
protected $suggestions;
protected $count;
protected $counter;
protected $goenddate;
protected $interval;
protected $wkst;
protected $valid_week_days;
protected $valid_frequency;
/**
* __construct
*/
public function __construct()
{
$this->frequency = null;
$this->gobymonth = false;
$this->bymonth = range(1,12);
$this->gobymonthday = false;
$this->bymonthday = range(1,31);
$this->gobyday = false;
// setup the valid week days (0 = sunday)
$this->byday = range(0,6);
$this->gobyyearday = false;
$this->byyearday = range(0,366);
$this->gobysetpos = false;
$this->bysetpos = range(1,366);
$this->gobyweekno = false;
// setup the range for valid weeks
$this->byweekno = range(0,54);
$this->suggestions = array();
// this will be set if a count() is specified
$this->count = 0;
// how many *valid* results we returned
$this->counter = 0;
// max date we'll return
$this->end_date = new DateTime('9999-12-31');
// the interval to increase the pattern by
$this->interval = 1;
// what day does the week start on? (0 = sunday)
$this->wkst = 0;
$this->valid_week_days = array('SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA');
$this->valid_frequency = array('SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY');
}
/**
* @param DateTime|string $start_date of the recursion - also is the first return value.
* @param string $frequency of the recrusion, valid frequencies: secondly, minutely, hourly, daily, weekly, monthly, yearly
*/
public function recur($start_date, $frequency = "daily")
{
try
{
if(is_object($start_date))
{
$this->start_date = clone $start_date;
}
else
{
// timestamps within the RFC have a 'Z' at the end of them, remove this.
$start_date = trim($start_date, 'Z');
$this->start_date = new DateTime($start_date);
}
$this->try_date = clone $this->start_date;
}
catch(Exception $e)
{
throw new InvalidArgumentException('Invalid start date DateTime: ' . $e);
}
$this->freq($frequency);
return $this;
}
public function freq($frequency)
{
if(in_array(strtoupper($frequency), $this->valid_frequency))
{
$this->frequency = strtoupper($frequency);
}
else
{
throw new InvalidArgumentException('Invalid frequency type.');
}
return $this;
}
// accepts an rrule directly
public function rrule($rrule)
{
// strip off a trailing semi-colon
$rrule = trim($rrule, ";");
$parts = explode(";", $rrule);
foreach($parts as $part)
{
list($rule, $param) = explode("=", $part);
$rule = strtoupper($rule);
$param = strtoupper($param);
switch($rule)
{
case "FREQ":
$this->frequency = $param;
break;
case "UNTIL":
$this->until($param);
break;
case "COUNT":
$this->count($param);
break;
case "INTERVAL":
$this->interval($param);
break;
case "BYDAY":
$params = explode(",", $param);
$this->byday($params);
break;
case "BYMONTHDAY":
$params = explode(",", $param);
$this->bymonthday($params);
break;
case "BYYEARDAY":
$params = explode(",", $param);
$this->byyearday($params);
break;
case "BYWEEKNO":
$params = explode(",", $param);
$this->byweekno($params);
break;
case "BYMONTH":
$params = explode(",", $param);
$this->bymonth($params);
break;
case "BYSETPOS":
$params = explode(",", $param);
$this->bysetpos($params);
break;
case "WKST":
$this->wkst($param);
break;
}
}
return $this;
}
//max number of items to return based on the pattern
public function count($count)
{
$this->count = (int)$count;
return $this;
}
// how often the recurrence rule repeats
public function interval($interval)
{
$this->interval = (int)$interval;
return $this;
}
// starting day of the week
public function wkst($day)
{
switch($day)
{
case 'SU':
$this->wkst = 0;
break;
case 'MO':
$this->wkst = 1;
break;
case 'TU':
$this->wkst = 2;
break;
case 'WE':
$this->wkst = 3;
break;
case 'TH':
$this->wkst = 4;
break;
case 'FR':
$this->wkst = 5;
break;
case 'SA':
$this->wkst = 6;
break;
}
return $this;
}
// max date
public function until($end_date)
{
try
{
if(is_object($end_date))
{
$this->end_date = clone $end_date;
}
else
{
// timestamps within the RFC have a 'Z' at the end of them, remove this.
$end_date = trim($end_date, 'Z');
$this->end_date = new DateTime($end_date);
}
}
catch(Exception $e)
{
throw new InvalidArgumentException('Invalid end date DateTime: ' . $e);
}
return $this;
}
public function bymonth($months)
{
if(is_array($months))
{
$this->gobymonth = true;
$this->bymonth = $months;
}
return $this;
}
public function bymonthday($days)
{
if(is_array($days))
{
$this->gobymonthday = true;
$this->bymonthday = $days;
}
return $this;
}
public function byweekno($weeks)
{
$this->gobyweekno = true;
if(is_array($weeks))
{
$this->byweekno = $weeks;
}
return $this;
}
public function bysetpos($days)
{
$this->gobysetpos = true;
if(is_array($days))
{
$this->bysetpos = $days;
}
return $this;
}
public function byday($days)
{
$this->gobyday = true;
if(is_array($days))
{
$this->byday = array();
foreach($days as $day)
{
$len = strlen($day);
$as = '+';
// 0 mean no occurence is set
$occ = 0;
if($len == 3)
{
$occ = substr($day, 0, 1);
}
if($len == 4)
{
$as = substr($day, 0, 1);
$occ = substr($day, 1, 1);
}
if($as == '-')
{
$occ = '-' . $occ;
}
else
{
$occ = '+' . $occ;
}
$day = substr($day, -2, 2);
switch($day)
{
case 'SU':
$this->byday[] = $occ . 'SU';
break;
case 'MO':
$this->byday[] = $occ . 'MO';
break;
case 'TU':
$this->byday[] = $occ . 'TU';
break;
case 'WE':
$this->byday[] = $occ . 'WE';
break;
case 'TH':
$this->byday[] = $occ . 'TH';
break;
case 'FR':
$this->byday[] = $occ . 'FR';
break;
case 'SA':
$this->byday[] = $occ . 'SA';
break;
}
}
}
return $this;
}
public function byyearday($days)
{
$this->gobyyearday = true;
if(is_array($days))
{
$this->byyearday = $days;
}
return $this;
}
// this creates a basic list of dates to "try"
protected function create_suggestions()
{
switch($this->frequency)
{
case "YEARLY":
$interval = 'year';
break;
case "MONTHLY":
$interval = 'month';
break;
case "WEEKLY":
$interval = 'week';
break;
case "DAILY":
$interval = 'day';
break;
case "HOURLY":
$interval = 'hour';
break;
case "MINUTELY":
$interval = 'minute';
break;
case "SECONDLY":
$interval = 'second';
break;
}
$month_day = $this->try_date->format('j');
$month = $this->try_date->format('n');
$year = $this->try_date->format('Y');
$timestamp = $this->try_date->format('H:i:s');
if($this->gobysetpos)
{
if($this->try_date == $this->start_date)
{
$this->suggestions[] = clone $this->try_date;
}
else
{
if($this->gobyday)
{
foreach($this->bysetpos as $_pos)
{
$tmp_array = array();
$_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year)));
foreach($_mdays as $_mday)
{
$date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp);
$occur = ceil($_mday / 7);
$day_of_week = $date_time->format('l');
$dow_abr = strtoupper(substr($day_of_week, 0, 2));
// set the day of the month + (positive)
$occur = '+' . $occur . $dow_abr;
$occur_zero = '+0' . $dow_abr;
// set the day of the month - (negative)
$total_days = $date_time->format('t') - $date_time->format('j');
$occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr;
$day_from_end_of_month = $date_time->format('t') + 1 - $_mday;
if(in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday))
{
$tmp_array[] = clone $date_time;
}
}
if($_pos > 0)
{
$this->suggestions[] = clone $tmp_array[$_pos - 1];
}
else
{
$this->suggestions[] = clone $tmp_array[count($tmp_array) + $_pos];
}
}
}
}
}
elseif($this->gobyyearday)
{
foreach($this->byyearday as $_day)
{
if($_day >= 0)
{
$_day--;
$_time = strtotime('+' . $_day . ' days', mktime(0, 0, 0, 1, 1, $year));
$this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp);
}
else
{
$year_day_neg = 365 + $_day;
$leap_year = $this->try_date->format('L');
if($leap_year == 1)
{
$year_day_neg = 366 + $_day;
}
$_time = strtotime('+' . $year_day_neg . ' days', mktime(0, 0, 0, 1, 1, $year));
$this->suggestions[] = new Datetime(date('Y-m-d', $_time) . ' ' . $timestamp);
}
}
}
// special case because for years you need to loop through the months too
elseif($this->gobyday && $interval == "year")
{
foreach($this->bymonth as $_month)
{
// this creates an array of days of the month
$_mdays = range(1, date('t',mktime(0,0,0,$_month,1,$year)));
foreach($_mdays as $_mday)
{
$date_time = new DateTime($year . '-' . $_month . '-' . $_mday . ' ' . $timestamp);
// get the week of the month (1, 2, 3, 4, 5, etc)
$week = $date_time->format('W');
if($date_time >= $this->start_date && in_array($week, $this->byweekno))
{
$this->suggestions[] = clone $date_time;
}
}
}
}
elseif($interval == "day")
{
$this->suggestions[] = clone $this->try_date;
}
elseif($interval == "week")
{
$this->suggestions[] = clone $this->try_date;
if($this->gobyday)
{
$week_day = $this->try_date->format('w');
$days_in_month = $this->try_date->format('t');
$overflow_count = 1;
$_day = $month_day;
$run = true;
while($run)
{
$_day++;
if($_day <= $days_in_month)
{
$tmp_date = new DateTime($year . '-' . $month . '-' . $_day . ' ' . $timestamp);
}
else
{
//$tmp_month = $month+1;
$tmp_date = new DateTime($year . '-' . $month . '-' . $overflow_count . ' ' . $timestamp);
$tmp_date->modify('+1 month');
$overflow_count++;
}
$week_day = $tmp_date->format('w');
if($this->try_date == $this->start_date)
{
if($week_day == $this->wkst)
{
$this->try_date = clone $tmp_date;
$this->try_date->modify('-7 days');
$run = false;
}
}
if($week_day != $this->wkst)
{
$this->suggestions[] = clone $tmp_date;
}
else
{
$run = false;
}
}
}
}
elseif($this->gobyday || $interval == "month")
{
$_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year)));
foreach($_mdays as $_mday)
{
$date_time = new DateTime($year . '-' . $month . '-' . $_mday . ' ' . $timestamp);
// get the week of the month (1, 2, 3, 4, 5, etc)
$week = $date_time->format('W');
if($date_time >= $this->start_date && in_array($week, $this->byweekno))
{
$this->suggestions[] = clone $date_time;
}
}
}
elseif($this->gobymonth)
{
foreach($this->bymonth as $_month)
{
$date_time = new DateTime($year . '-' . $_month . '-' . $month_day . ' ' . $timestamp);
if($date_time >= $this->start_date)
{
$this->suggestions[] = clone $date_time;
}
}
}
else
{
$this->suggestions[] = clone $this->try_date;
}
if($interval == "month")
{
$this->try_date->modify('last day of ' . $this->interval . ' ' . $interval);
}
else
{
$this->try_date->modify($this->interval . ' ' . $interval);
}
}
protected function valid_date($date)
{
$year = $date->format('Y');
$month = $date->format('n');
$day = $date->format('j');
$year_day = $date->format('z') + 1;
$year_day_neg = -366 + $year_day;
$leap_year = $date->format('L');
if($leap_year == 1)
{
$year_day_neg = -367 + $year_day;
}
// this is the nth occurence of the date
$occur = ceil($day / 7);
$week = $date->format('W');
$day_of_week = $date->format('l');
$dow_abr = strtoupper(substr($day_of_week, 0, 2));
// set the day of the month + (positive)
$occur = '+' . $occur . $dow_abr;
$occur_zero = '+0' . $dow_abr;
// set the day of the month - (negative)
$total_days = $date->format('t') - $date->format('j');
$occur_neg = '-' . ceil(($total_days + 1)/7) . $dow_abr;
$day_from_end_of_month = $date->format('t') + 1 - $day;
if(in_array($month, $this->bymonth) &&
(in_array($occur, $this->byday) || in_array($occur_zero, $this->byday) || in_array($occur_neg, $this->byday)) &&
in_array($week, $this->byweekno) &&
(in_array($day, $this->bymonthday) || in_array(-$day_from_end_of_month, $this->bymonthday)) &&
(in_array($year_day, $this->byyearday) || in_array($year_day_neg, $this->byyearday)))
{
return true;
}
else
{
return false;
}
}
// return the next valid DateTime object which matches the pattern and follows the rules
public function next()
{
// check the counter is set
if($this->count !== 0)
{
if($this->counter >= $this->count)
{
return false;
}
}
// create initial set of suggested dates
if(count($this->suggestions) === 0)
{
$this->create_suggestions();
}
// loop through the suggested dates
while(count($this->suggestions) > 0)
{
// get the first one on the array
$try_date = array_shift($this->suggestions);
// make sure the date doesn't exceed the max date
if($try_date > $this->end_date)
{
return false;
}
// make sure it falls within the allowed days
if($this->valid_date($try_date) === true)
{
$this->counter++;
return $try_date;
}
else
{
// we might be out of suggested days, so load some more
if(count($this->suggestions) === 0)
{
$this->create_suggestions();
}
}
}
}
}

View file

@ -51,7 +51,7 @@ $modules[] =array(
'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files'));
$modules[] =array(
'status' => OC_Helper::canExecute("ldap_bind") ? 'ok' : 'error',
'status' => function_exists("ldap_bind") ? 'ok' : 'error',
'part'=> 'php-ldap',
'modules'=> array('user_ldap'),
'message'=> $l->t('The php-ldap module is needed connect to your ldap server'));

View file

@ -56,6 +56,9 @@ function getURLMetadata($url) {
}
$metadata['url'] = $url;
if (!function_exists('curl_init')){
return $metadata;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@ -66,4 +69,4 @@ function getURLMetadata($url) {
$metadata['title'] = htmlspecialchars_decode(@$match[1]);
return $metadata;
}
}

View file

@ -34,7 +34,14 @@ if($errarr){
OC_JSON::error();
exit;
}
$vcalendar = Sabre_VObject_Reader::read($data['calendardata']);
$vcalendar = OC_Calendar_Object::parse($data['calendardata']);
$last_modified = $vcalendar->VEVENT->__get('LAST-MODIFIED');
if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){
OC_JSON::error(array('modified'=>true));
exit;
}
OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
if ($data['calendarid'] != $cal) {

View file

@ -26,7 +26,7 @@ if($calendar['userid'] != OC_User::getUser()){
echo $l10n->t('Wrong calendar');
exit;
}
$object = Sabre_VObject_Reader::read($data['calendardata']);
$object = OC_Calendar_Object::parse($data['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
@ -63,9 +63,16 @@ foreach($categories as $category){
}
$repeat = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
$description = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
$last_modified = $vevent->__get('LAST-MODIFIED');
if ($last_modified){
$lastmodified = $last_modified->getDateTime()->format('U');
}else{
$lastmodified = 0;
}
$tmpl = new OC_Template('calendar', 'part.editevent');
$tmpl->assign('id', $id);
$tmpl->assign('lastmodified', $lastmodified);
$tmpl->assign('calendar_options', $calendar_options);
$tmpl->assign('category_options', $category_options);
$tmpl->assign('repeat_options', $repeat_options);

View file

@ -6,42 +6,79 @@
* See the COPYING-README file.
*/
require_once ("../../../lib/base.php");
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
require_once ('../../../lib/base.php');
require_once('../../../3rdparty/when/When.php');
function addoutput($event, $vevent, $return_event){
$return_event['id'] = (int)$event['id'];
$return_event['title'] = $event['summary'];
$return_event['description'] = isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'';
$last_modified = $vevent->__get('LAST-MODIFIED');
if ($last_modified){
$lastmodified = $last_modified->getDateTime()->format('U');
}else{
$lastmodified = 0;
}
$return_event['lastmodified'] = (int)$lastmodified;
return $return_event;
}
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$start = DateTime::createFromFormat('U', $_GET['start']);
$end = DateTime::createFromFormat('U', $_GET['end']);
$events = OC_Calendar_Object::allInPeriod($_GET['calendar_id'], $start, $end);
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$return = array();
foreach($events as $event)
{
$object = Sabre_VObject_Reader::read($event['calendardata']);
foreach($events as $event){
$object = OC_Calendar_Object::parse($event['calendardata']);
$vevent = $object->VEVENT;
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$return_event = array();
$start_dt = $dtstart->getDateTime();
$start_dt->setTimezone(new DateTimeZone($user_timezone));
$end_dt = $dtend->getDateTime();
$end_dt->setTimezone(new DateTimeZone($user_timezone));
$return_event = array();
$return_event['id'] = $event['id'];
$return_event['title'] = $event['summary'];
$return_event['description'] = isset($vevent->DESCRIPTION)?$vevent->DESCRIPTION->value:'';
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
$return_event['allDay'] = false;
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE)
{
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
$return_event['allDay'] = true;
$end_dt->modify('-1 sec');
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
}else{
$return_event['allDay'] = false;
}
//Repeating Events
if($event['repeating'] == 1){
$duration = (double) $end_dt->format('U') - (double) $start_dt->format('U');
$r = new When();
$r->recur((string) $start_dt->format('Ymd\THis'))->rrule((string) $vevent->RRULE);
while($result = $r->next()){
if($result->format('U') > $_GET['end']){
break;
}
if($return_event['allDay'] == true){
$return_event['start'] = $result->format('Y-m-d');
$return_event['end'] = date('Y-m-d', $result->format('U') + $duration--);
}else{
$return_event['start'] = $result->format('Y-m-d H:i:s');
$return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration);
}
$return[] = addoutput($event, $vevent, $return_event);
}
}else{
$return_event = array();
if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){
$return_event['allDay'] = true;
$return_event['start'] = $start_dt->format('Y-m-d');
$end_dt->modify('-1 sec');
$return_event['end'] = $end_dt->format('Y-m-d');
}else{
$return_event['start'] = $start_dt->format('Y-m-d H:i:s');
$return_event['end'] = $end_dt->format('Y-m-d H:i:s');
$return_event['allDay'] = false;
}
$return[] = addoutput($event, $vevent, $return_event);
}
$return[] = $return_event;
}
OC_JSON::encodedPrint($return);
?>

View file

@ -0,0 +1,39 @@
<?php
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
function make_array_out_of_xml ($xml){
$returnarray = array();
$xml = (array)$xml ;
foreach ($xml as $property => $value){
$value = (array)$value;
if(!isset($value[0])){
$returnarray[$property] = make_array_out_of_xml($value);
}else{
$returnarray[$property] = trim($value[0]);
}
}
return $returnarray;
}
require_once ("../../../lib/base.php");
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
$l = new OC_L10N('calendar');
$lat = $_GET['lat'];
$long = $_GET['long'];
$geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat . '&lng=' . $long);
//Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License
$geoxml = simplexml_load_string($geolocation);
$geoarray = make_array_out_of_xml($geoxml);
if(isset($geoarray['timezone']['timezoneId']) && $geoarray['timezone']['timezoneId'] != ''){
OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']);
$message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']);
OC_JSON::success($message);
}else{
OC_JSON::error();
}
?>

View file

@ -22,9 +22,15 @@ $delta = new DateInterval('P0D');
$delta->d = $_POST['dayDelta'];
$delta->i = $_POST['minuteDelta'];
$vcalendar = Sabre_VObject_Reader::read($data['calendardata']);
$vcalendar = OC_Calendar_Object::parse($data['calendardata']);
$vevent = $vcalendar->VEVENT;
$last_modified = $vevent->__get('LAST-MODIFIED');
if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){
OC_JSON::error();
exit;
}
$dtstart = $vevent->DTSTART;
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$start_type = $dtstart->getDateType();
@ -50,4 +56,4 @@ $dtstamp->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
$vevent->DTSTAMP = $dtstamp;
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
OC_JSON::success();
OC_JSON::success(array('lastmodified'=>(int)$now->format('U')));

View file

@ -15,39 +15,35 @@ if(!OC_USER::isLoggedIn()) {
}
OC_JSON::checkAppEnabled('calendar');
if (!isset($_POST['start'])){
OC_JSON::error();
die;
}
$start = $_POST['start'];
$end = $_POST['end'];
$allday = $_POST['allday'];
if (!$end){
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', '60');
$end = $start + ($duration * 60);
}
$start = new DateTime('@'.$start);
$end = new DateTime('@'.$end);
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone));
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
$startday = substr($_GET['d'], 0, 2);
$startmonth = substr($_GET['d'], 2, 2);
$startyear = substr($_GET['d'], 4, 4);
$allday = $_GET['t'] == 'allday';
if(!$allday){
$starthour = substr($_GET['t'], 0, 2);
$startminutes = substr($_GET['t'], 2, 2);
}else{
$starthour = '00';
$startminutes = '00';
}
$datetimestamp = mktime($starthour, $startminutes, 0, $startmonth, $startday, $startyear);
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60");
$datetimestamp = $datetimestamp + ($duration * 60);
$endmonth = date("m", $datetimestamp);
$endday = date("d", $datetimestamp);
$endyear = date("Y", $datetimestamp);
$endtime = date("G", $datetimestamp);
$endminutes = date("i", $datetimestamp);
$tmpl = new OC_Template('calendar', 'part.newevent');
$tmpl->assign('calendar_options', $calendar_options);
$tmpl->assign('category_options', $category_options);
$tmpl->assign('startdate', $startday . '-' . $startmonth . '-' . $startyear);
$tmpl->assign('starttime', $starthour . ':' . $startminutes);
$tmpl->assign('enddate', $endday . '-' . $endmonth . '-' . $endyear);
$tmpl->assign('endtime', ($endtime <= 9 ? '0' : '') . $endtime . ':' . $endminutes);
$tmpl->assign('startdate', $start->format('d-m-Y'));
$tmpl->assign('starttime', $start->format('H:i'));
$tmpl->assign('enddate', $end->format('d-m-Y'));
$tmpl->assign('endtime', $end->format('H:i'));
$tmpl->assign('allday', $allday);
$tmpl->printpage();
?>

View file

@ -22,9 +22,15 @@ $delta = new DateInterval('P0D');
$delta->d = $_POST['dayDelta'];
$delta->i = $_POST['minuteDelta'];
$vcalendar = Sabre_VObject_Reader::read($data['calendardata']);
$vcalendar = OC_Calendar_Object::parse($data['calendardata']);
$vevent = $vcalendar->VEVENT;
$last_modified = $vevent->__get('LAST-MODIFIED');
if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){
OC_JSON::error();
exit;
}
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
$end_type = $dtend->getDateType();
$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
@ -40,4 +46,4 @@ $dtstamp->setDateTime($now, Sabre_VObject_Element_DateTime::UTC);
$vevent->DTSTAMP = $dtstamp;
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
OC_JSON::success();
OC_JSON::success(array('lastmodified'=>$now->format('U')));

View file

@ -21,3 +21,5 @@ OC_App::addNavigationEntry( array(
'name' => $l->t('Calendar')));
OC_App::registerPersonal('calendar', 'settings');
require_once('apps/calendar/lib/search.php');

View file

@ -24,8 +24,6 @@
#listview #events {width:25em;padding: 4px;}
#listview #events .day {width:auto;padding-left:10px;border-bottom: 2px solid #EEEEEE;text-align:left;}
#sysbox{display: none;}
.actions {height: 33px; min-width: 800px;}
.controls {min-width: 800px;}
.center {text-align: center;}
@ -99,3 +97,31 @@ button.category{margin:0 3px;}
{
cursor: pointer;
}
.tipsy-event .tipsy-inner{
background-color:#0098E4;
border:2px solid #1d2d44;
max-width:400px;
padding:0;
}
.tipsy-event .tipsy-arrow-s{
border-top-color:#1d2d44;
}
.tipsy-event .tipsy-arrow-n{
border-bottom-color:#1d2d44;
}
.tipsy-event .summary,
.tipsy-event .timespan,
.tipsy-event .description{
padding:0 8px;
}
.tipsy-event .summary{
background-color:#1d2d44;
font-size:1.2em;
font-weight:bold;
text-align:left;
padding:0 8px 2px;
}
.tipsy-event .description{
line-height:1.2;
margin-bottom:4px;
}

View file

@ -13,7 +13,7 @@ OC_Util::checkAppEnabled('calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
if( count($calendars) == 0){
OC_Calendar_Calendar::addCalendar(OC_User::getUser(),'Default calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
}
$eventSources = array();
foreach($calendars as $calendar){
@ -32,6 +32,9 @@ if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'mont
OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar');
OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null){
OC_UTIL::addScript('calendar', 'geo');
}
OC_Util::addScript('calendar', 'calendar');
OC_Util::addStyle('calendar', 'style');
OC_Util::addScript('', 'jquery.multiselect');

View file

@ -10,6 +10,8 @@ Calendar={
space:' ',
UI:{
startEventDialog:function(){
$('.tipsy').remove();
$('#calendar_holder').fullCalendar('unselect');
Calendar.UI.lockTime();
$( "#from" ).datepicker({
dateFormat : 'dd-mm-yy'
@ -31,36 +33,16 @@ Calendar={
}
});
},
newEvent:function(date, allDay, jsEvent, view){
var dayofmonth = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
var hour = date.getHours();
var min = date.getMinutes();
if(dayofmonth <= 9){
dayofmonth = '0' + dayofmonth;
}
month++;
if(month <= 9){
month = '0' + month;
}
if(hour <= 9){
hour = '0' + hour;
}
if(min <= 9){
min = '0' + min;
}
var date = String(dayofmonth) + String(month) + String(year);
if (allDay){
var time = 'allday';
}else{
var time = String(hour) + String(min);
newEvent:function(start, end, allday){
start = Math.round(start.getTime()/1000);
if (end){
end = Math.round(end.getTime()/1000);
}
if($('#event').dialog('isOpen') == true){
// TODO: save event
$('#event').dialog('destroy').remove();
}else{
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php') + '?d=' + date + '&t=' + time, Calendar.UI.startEventDialog);
$('#dialog_holder').load(OC.filePath('calendar', 'ajax', 'neweventform.php'), {start:start, end:end, allday:allday?1:0}, Calendar.UI.startEventDialog);
}
},
editEvent:function(calEvent, jsEvent, view){
@ -91,27 +73,27 @@ Calendar={
$.post(url, post,
function(data){
if(data.status == "error"){
var output = "Missing fields: <br />";
var output = missing_field + ": <br />";
if(data.title == "true"){
output = output + "Title<br />";
output = output + missing_field_title + "<br />";
}
if(data.cal == "true"){
output = output + "Calendar<br />";
output = output + missing_field_calendar + "<br />";
}
if(data.from == "true"){
output = output + "From Date<br />";
output = output + missing_field_fromdate + "<br />";
}
if(data.fromtime == "true"){
output = output + "From Time<br />";
output = output + missing_field_fromtime + "<br />";
}
if(data.to == "true"){
output = output + "To Date<br />";
output = output + missing_field_todate + "<br />";
}
if(data.totime == "true"){
output = output + "To Time<br />";
output = output + missing_field_totime + "<br />";
}
if(data.endbeforestart == "true"){
output = "The event ends before it starts!";
output = output + missing_field_startsbeforeends + "!<br/>";
}
if(data.dberror == "true"){
output = "There was a database fail!";
@ -125,22 +107,28 @@ Calendar={
},"json");
},
moveEvent:function(event, dayDelta, minuteDelta, allDay, revertFunc){
$.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0},
$('.tipsy').remove();
$.post(OC.filePath('calendar', 'ajax', 'moveevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, allDay: allDay?1:0, lastmodified: event.lastmodified},
function(data) {
if (data.status == 'success'){
event.lastmodified = data.lastmodified;
console.log("Event moved successfully");
}else{
revertFunc();
$('#calendar_holder').fullCalendar('refetchEvents');
}
});
},
resizeEvent:function(event, dayDelta, minuteDelta, revertFunc){
$.post(OC.filePath('calendar', 'ajax', 'resizeevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta},
$('.tipsy').remove();
$.post(OC.filePath('calendar', 'ajax', 'resizeevent.php'), { id: event.id, dayDelta: dayDelta, minuteDelta: minuteDelta, lastmodified: event.lastmodified},
function(data) {
if (data.status == 'success'){
event.lastmodified = data.lastmodified;
console.log("Event resized successfully");
}else{
revertFunc();
$('#calendar_holder').fullCalendar('refetchEvents');
}
});
},
@ -148,32 +136,20 @@ Calendar={
$("#advanced_options").css("display", "block");
$("#advanced_options_button").css("display", "none");
},
createEventPopup:function(event, e, view){
var popup = $(this).data('popup');
if (!popup){
popup = $(document.createElement('div'));
$(this).data('popup', popup).append(popup);
popup.addClass('popup')
popup.addClass('event_popup')
.html(Calendar.UI.getEventPopupText(event));
}
popup.css('left', -(popup.width() - $(this).width())/2)
.show();
},
hideEventPopup:function(){
$(this).data('popup').hide();
},
getEventPopupText:function(event){
if (event.allDay){
var timespan = $.fullCalendar.formatDates(event.start, event.end, t('calendar', "MMMM d[ yyyy]{ '&#8212;'[ MMMM][ d] yyyy}"));
var timespan = $.fullCalendar.formatDates(event.start, event.end, 'ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}', {monthNamesShort: monthNamesShort, monthNames: monthNames, dayNames: dayNames, dayNamesShort: dayNamesShort}); //t('calendar', "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}")
}else{
var timespan = $.fullCalendar.formatDates(event.start, event.end, t('calendar', "HH:mm[ MMMM d yyyy]{ '&#8212;' HH:mm MMMM d yyyy}"));
var timespan = $.fullCalendar.formatDates(event.start, event.end, 'ddd d MMMM[ yyyy] ' + defaulttime + '{ -[ ddd d MMMM yyyy]' + defaulttime + '}', {monthNamesShort: monthNamesShort, monthNames: monthNames, dayNames: dayNames, dayNamesShort: dayNamesShort}); //t('calendar', "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}")
// Tue 18 October 2011 08:00 - 16:00
}
return '<span class="timespan">' + timespan + '</span>'
+ ' '
+ '<span class="summary">' + event.title + '</span>'
+ '<span class="description">' + event.description + '</span>';
var html =
'<div class="summary">' + event.title + '</div>' +
'<div class="timespan">' + timespan + '</div>';
if (event.description){
html += '<div class="description">' + event.description + '</div>';
}
return html;
},
lockTime:function(){
if($('#allday_checkbox').is(':checked')) {
@ -201,6 +177,7 @@ Calendar={
//}
},
scrollCalendar:function(event){
$('.tipsy').remove();
var direction;
if(event.detail){
if(event.detail < 0){
@ -216,10 +193,17 @@ Calendar={
direction = 'down';
}
}
if(direction == 'down'){
var scroll = $(document).scrollTop(),
doc_height = $(document).height(),
win_height = $(window).height();
if(direction == 'down' && win_height == (doc_height - scroll)){
$('#calendar_holder').fullCalendar('next');
}else{
$(document).scrollTop(0);
event.preventDefault();
}else if (direction == 'top' && scroll == 0) {
$('#calendar_holder').fullCalendar('prev');
$(document).scrollTop(win_height);
event.preventDefault();
}
},
Calendar:{
@ -495,20 +479,20 @@ function ListView(element, calendar) {
}
}
$(document).ready(function(){
//Calendar.UI.initScroll();
Calendar.UI.initScroll();
$('#calendar_holder').fullCalendar({
header: false,
firstDay: 1,
editable: true,
defaultView: defaultView,
timeFormat: {
agenda: 'HH:mm{ - HH:mm}',
'': 'HH:mm'
agenda: agendatime,
'': defaulttime
},
titleFormat: {
list: 'yyyy/MMM/d dddd'
},
axisFormat: 'HH:mm',
axisFormat: defaulttime,
monthNames: monthNames,
monthNamesShort: monthNamesShort,
dayNames: dayNames,
@ -518,12 +502,25 @@ $(document).ready(function(){
$('#datecontrol_date').html(view.title);
$.get(OC.filePath('calendar', 'ajax', 'changeview.php') + "?v="+view.name);
},
dayClick: Calendar.UI.newEvent,
selectable: true,
selectHelper: true,
select: Calendar.UI.newEvent,
eventClick: Calendar.UI.editEvent,
eventDrop: Calendar.UI.moveEvent,
eventResize: Calendar.UI.resizeEvent,
eventMouseover: Calendar.UI.createEventPopup,
eventMouseout: Calendar.UI.hideEventPopup,
eventRender: function(event, element) {
element.tipsy({
className: 'tipsy-event',
opacity: 0.9,
gravity:$.fn.tipsy.autoBounds(150, 's'),
fade:true,
delayIn: 400,
html:true,
title:function() {
return Calendar.UI.getEventPopupText(event);
}
});
},
eventSources: eventSources
});
$('#oneweekview_radio').click(function(){

20
apps/calendar/js/geo.js Executable file
View file

@ -0,0 +1,20 @@
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$.getJSON(OC.filePath('calendar', 'ajax', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''),
function(data){
if (data.status == 'success'){
$('#notification').html(data.message);
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{
console.log('Can\'t set new timezone.');
}
});
});
}

View file

@ -1,7 +1,11 @@
../appinfo/app.php
../lib/object.php
../templates/calendar.php
../templates/part.editevent.php
../templates/part.eventinfo.php
../templates/part.newevent.php
../templates/part.choosecalendar.php
../js/calendar.js
../templates/part.choosecalendar.rowfields.php
../templates/part.editcalendar.php
../templates/part.editevent.php
../templates/part.eventform.php
../templates/part.import.php
../templates/part.newevent.php
../templates/settings.php

View file

@ -43,12 +43,14 @@ class OC_Calendar_Object{
public static function allInPeriod($id, $start, $end){
$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*calendar_objects WHERE calendarid = ?'
.' AND ((startdate >= ? AND startdate <= ? AND repeating = 0)'
.' OR (startdate <= ? AND enddate >= ? AND repeating = 1))' );
.' OR (enddate >= ? AND enddate <= ? AND repeating = 0)'
.' OR (startdate <= ? AND repeating = 1))' );
$start = self::getUTCforMDB($start);
$end = self::getUTCforMDB($end);
$result = $stmt->execute(array($id,
$start, $end,
$end, $start));
$start, $end,
$end));
$calendarobjects = array();
while( $row = $result->fetchRow()){
@ -307,6 +309,7 @@ class OC_Calendar_Object{
*/
public static function parse($data){
try {
Sabre_VObject_Reader::$elementMap['LAST-MODIFIED'] = 'Sabre_VObject_Element_DateTime';
$calendar = Sabre_VObject_Reader::read($data);
return $calendar;
} catch (Exception $e) {
@ -426,7 +429,7 @@ class OC_Calendar_Object{
$errarr['endbeforestart'] = 'true';
$errnum++;
}
if($fromday == $today && $frommonth == $tomonth && $fromyear == $toyear){
if(!$allday && $fromday == $today && $frommonth == $tomonth && $fromyear == $toyear){
list($tohours, $tominutes) = explode(':', $request['totime']);
list($fromhours, $fromminutes) = explode(':', $request['fromtime']);
if($tohours < $fromhours){
@ -481,9 +484,11 @@ class OC_Calendar_Object{
$categories = isset($request["categories"]) ? $request["categories"] : null;
$allday = isset($request["allday"]);
$from = $request["from"];
$fromtime = $request["fromtime"];
$to = $request["to"];
$totime = $request["totime"];
if (!$allday){
$fromtime = $request['fromtime'];
$totime = $request['totime'];
}
$description = $request["description"];
//$repeat = $request["repeat"];
/*switch($request["repeatfreq"]){
@ -525,7 +530,7 @@ class OC_Calendar_Object{
$dtstart->setDateTime($start, Sabre_VObject_Element_DateTime::DATE);
$dtend->setDateTime($end, Sabre_VObject_Element_DateTime::DATE);
}else{
$timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$timezone = new DateTimeZone($timezone);
$start = new DateTime($from.' '.$fromtime, $timezone);
$end = new DateTime($to.' '.$totime, $timezone);

View file

@ -0,0 +1,26 @@
<?php
class OC_Search_Provider_Calendar extends OC_Search_Provider{
function search($query){
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1);
if(count($calendars)==0 || !OC_App::isEnabled('calendar')){
//return false;
}
$results=array();
$searchquery=array();
if(substr_count($query, ' ') > 0){
$searchquery = explode(' ', $query);
}else{
$searchquery[] = $query;
}
foreach($calendars as $calendar){
$objects = OC_Calendar_Object::all($calendar['id']);
foreach($objects as $object){
if(substr_count(strtolower($object['summary']), strtolower($query)) > 0){//$name,$text,$link,$type
$results[]=new OC_Search_Result($object['summary'],'','#','Cal.');
}
}
}
return $results;
}
}
new OC_Search_Provider_Calendar();

33
apps/calendar/templates/calendar.php Normal file → Executable file
View file

@ -1,12 +1,24 @@
<script type='text/javascript'>
var defaultView = '<?php echo OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') ?>';
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
var allDayText = '<?php echo $l->t('All day') ?>';
</script>
<script type='text/javascript'>
var defaultView = '<?php echo OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') ?>';
var eventSources = <?php echo json_encode($_['eventSources']) ?>;
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>;
var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>;
var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>;
var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>;
var agendatime = '<?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}';
var defaulttime = '<?php echo ((int) OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>';
var allDayText = '<?php echo $l->t('All day') ?>';
var missing_field = '<?php echo $l->t('Missing fields') ?>';
var missing_field_title = '<?php echo $l->t('Title') ?>';
var missing_field_calendar = '<?php echo $l->t('Calendar') ?>';
var missing_field_fromdate = '<?php echo $l->t('From Date') ?>';
var missing_field_fromtime = '<?php echo $l->t('From Time') ?>';
var missing_field_todate = '<?php echo $l->t('To Date') ?>';
var missing_field_totime = '<?php echo $l->t('To Time') ?>';
var missing_field_startsbeforeends = '<?php echo $l->t('The event ends before it starts') ?>';
var missing_field_dberror = '<?php echo $l->t('There was a database fail') ?>';
var totalurl = '<?php echo OC_Helper::linkTo('apps/calendar', 'caldav.php', null, true); ?>/calendars';
</script>
<div id="controls">
<div>
<form>
@ -25,12 +37,13 @@ var allDayText = '<?php echo $l->t('All day') ?>';
<form>
<div id="datecontrol">
<input type="button" value="&nbsp;&lt;&nbsp;" id="datecontrol_left"/>
<span id="datecontrol_date"></span>
<span class="button" id="datecontrol_date"></span>
<input type="button" value="&nbsp;&gt;&nbsp;" id="datecontrol_right"/>
</div>
</form>
</div>
</div>
<div id="notification" style="display:none;"></div>
<div id="calendar_holder">
</div>
<!-- Dialogs -->

View file

@ -1,6 +1,7 @@
<div id="event" title="<?php echo $l->t("Edit an event");?>">
<form id="event_form">
<input type="hidden" name="id" value="<?php echo $_['id'] ?>">
<input type="hidden" name="lastmodified" value="<?php echo $_['lastmodified'] ?>">
<?php echo $this->inc("part.eventform"); ?>
<div style="width: 100%;text-align: center;color: #FF1D1D;" id="errorbox"></div>
<span id="actions">

View file

@ -68,11 +68,16 @@ foreach( $add as $propname){
}
$id = OC_Contacts_VCard::add($aid,$vcard->serialize());
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
$details = OC_Contacts_VCard::structureContact($vcard);
$name = $details['FN'][0]['value'];
$tmpl = new OC_Template('contacts','part.details');
$tmpl->assign('details',$details);
$tmpl->assign('id',$id);
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'id' => $id, 'name' => $name, 'page' => $page )));

View file

@ -70,6 +70,9 @@ $vcard->children[$line]->setValue($value);
// Add parameters
$postparameters = isset($_POST['parameters'])?$_POST['parameters']:array();
if ($vcard->children[$line]->name == 'TEL' && !array_key_exists('TYPE', $postparameters)){
$postparameters['TYPE']='';
}
for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
$name = $vcard->children[$line]->parameters[$i]->name;
if(array_key_exists($name,$postparameters)){
@ -77,7 +80,14 @@ for($i=0;$i<count($vcard->children[$line]->parameters);$i++){
unset($vcard->children[$line]->parameters[$i]);
}
else{
$vcard->children[$line]->parameters[$i]->value = $postparameters[$name];
unset($vcard->children[$line][$name]);
$values = $postparameters[$name];
if (!is_array($values)){
$values = array($values);
}
foreach($values as $value){
$vcard->children[$line]->add($name, $value);
}
}
unset($postparameters[$name]);
}
@ -94,7 +104,17 @@ $checksum = md5($vcard->children[$line]->serialize());
OC_Contacts_VCard::edit($id,$vcard->serialize());
$tmpl = new OC_Template('contacts','part.property');
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
if ($vcard->children[$line]->name == 'FN'){
$tmpl = new OC_Template('contacts','part.property.FN');
}
else{
$tmpl = new OC_Template('contacts','part.property');
}
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line],$line));
$page = $tmpl->fetchPage();

View file

@ -62,12 +62,14 @@ if(is_null($line)){
}
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
$tmpl = new OC_Template('contacts','part.setpropertyform');
$tmpl->assign('id',$id);
$tmpl->assign('checksum',$checksum);
$tmpl->assign('property',OC_Contacts_VCard::structureProperty($vcard->children[$line]));
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$page = $tmpl->fetchPage();
OC_JSON::success(array('data' => array( 'page' => $page )));

View file

@ -94,16 +94,14 @@ This stylesheet forms part of the Formtastic Rails Plugin
/* INPUTS
--------------------------------------------------------------------------------------------------*/
.formtastic .inputs {
overflow:hidden; /* clear containing floats */
}
.formtastic .input {
overflow:hidden; /* clear containing floats */
padding:0.5em 0; /* padding and negative margin juggling is for Firefox */
margin-top:-0.5em;
margin-bottom:1em;
}
.formtastic .input {
}
/* LEFT ALIGNED LABELS
--------------------------------------------------------------------------------------------------*/

View file

@ -3,16 +3,22 @@
#contacts_deletecard {position:absolute;top:15px;right:0;}
#contacts_details_list { list-style:none; }
#contacts_details_list li { overflow:hidden; }
#contacts_details_list li { overflow:visible; }
#contacts_details_list li p.contacts_property_name { width:25%; float:left;text-align:right;padding-right:0.3em;color:#666; }
#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%; overflow:hidden; }
#contacts_addproperty_button, #contacts_setproperty_button { margin-left:25%; }
#contacts_details_list li p.contacts_property_data, #contacts_details_list li ul.contacts_property_data { width:72%;float:left; }
#contacts_setproperty_button { margin-left:25%; }
.contacts_property_data ul, .contacts_property_data ol { list-style:none; }
.contacts_property_data ul, ol.contacts_property_data { list-style:none; }
.contacts_property_data li { overflow: hidden; }
.contacts_property_data li label { width:20%; float:left; text-align:right;padding-right:0.3em; }
.contacts_property_data input { float:left; }
.contacts_property_data li input { width:70%;overflow:hidden; }
.chzn-container { margin:3px 0 0; }
.chzn-container .chzn-choices { border-radius: 0.5em; }
.chzn-container.chzn-container-active .chzn-choices { border-bottom-left-radius: 0;border-bottom-right-radius: 0; }
.chzn-container .chzn-drop { border-bottom-left-radius: 0.5em;border-bottom-right-radius: 0.5em; }
/* Form setup ----------------------------------------------------------------*/
/* .forme {} */
/* .forme ul, .forme ol { list-style:none; } */

View file

@ -75,8 +75,14 @@ if( !is_null($id) || count($contacts)){
$details = OC_Contacts_VCard::structureContact($vcard);
}
$l10n = new OC_L10N('contacts');
$adr_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'ADR');
$phone_types = OC_Contacts_VCard::getTypesOfProperty($l10n, 'TEL');
// Process the template
$tmpl = new OC_Template( 'contacts', 'index', 'user' );
$tmpl->assign('adr_types',$adr_types);
$tmpl->assign('phone_types',$phone_types);
$tmpl->assign('addressbooks', $addressbooks);
$tmpl->assign('contacts', $contacts);
$tmpl->assign('details', $details );

View file

@ -64,6 +64,7 @@ $(document).ready(function(){
else{
$('#contacts_generic').clone().insertAfter($('#contacts_addpropertyform .contacts_property_name'));
}
$('#contacts_addpropertyform .contacts_property_data select').chosen();
});
$('#contacts_addpropertyform input[type="submit"]').live('click',function(){
@ -82,7 +83,8 @@ $(document).ready(function(){
$.getJSON('ajax/showaddcard.php',{},function(jsondata){
if(jsondata.status == 'success'){
$('#rightcontent').data('id','');
$('#rightcontent').html(jsondata.data.page);
$('#rightcontent').html(jsondata.data.page)
.find('select').chosen();
}
else{
alert(jsondata.data.message);
@ -108,10 +110,11 @@ $(document).ready(function(){
$('.contacts_property [data-use="edit"]').live('click',function(){
var id = $('#rightcontent').data('id');
var checksum = $(this).parents('li').first().data('checksum');
var checksum = $(this).parents('.contacts_property').first().data('checksum');
$.getJSON('ajax/showsetproperty.php',{'id': id, 'checksum': checksum },function(jsondata){
if(jsondata.status == 'success'){
$('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page);
$('.contacts_property[data-checksum="'+checksum+'"]').html(jsondata.data.page)
.find('select').chosen();
}
else{
alert(jsondata.data.message);
@ -148,10 +151,12 @@ $(document).ready(function(){
$('.contacts_property').live('mouseenter',function(){
$(this).find('span').show();
$(this).find('span[data-use]').show();
});
$('.contacts_property').live('mouseleave',function(){
$(this).find('span').hide();
$(this).find('span[data-use]').hide();
});
$('#contacts_addcardform select').chosen();
});

View file

@ -296,7 +296,13 @@ class OC_Contacts_VCard{
$property = new Sabre_VObject_Property( $name, $value );
$parameternames = array_keys($parameters);
foreach($parameternames as $i){
$property->parameters[] = new Sabre_VObject_Parameter($i,$parameters[$i]);
$values = $parameters[$i];
if (!is_array($values)){
$values = array($values);
}
foreach($values as $value){
$property->add($i, $value);
}
}
$vcard->add($property);
@ -352,7 +358,17 @@ class OC_Contacts_VCard{
$parameter->name = 'PREF';
$parameter->value = '1';
}
$temp['parameters'][$parameter->name] = $parameter->value;
if ($property->name == 'TEL' && $parameter->name == 'TYPE'){
if (isset($temp['parameters'][$parameter->name])){
$temp['parameters'][$parameter->name][] = $parameter->value;
}
else{
$temp['parameters'][$parameter->name] = array($parameter->value);
}
}
else{
$temp['parameters'][$parameter->name] = $parameter->value;
}
}
return $temp;
}

View file

@ -43,7 +43,7 @@
</li>
<li class="fragment">
<label for="tel_type"><?php echo $l->t('Type'); ?></label>
<select id="TEL" name="parameters[TEL][TYPE]" size="1">
<select id="TEL" name="parameters[TEL][TYPE][]" multiple="multiple">
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</li>

View file

@ -1,5 +1,5 @@
<?php if(array_key_exists('FN',$_['details'])): ?>
<p id="contacts_details_name"><?php echo $_['details']['FN'][0]['value']; ?></p>
<?php echo $this->inc('part.property.FN', array('property' => $_['details']['FN'][0])); ?>
<img class="svg action" id="contacts_deletecard" src="<?php echo image_path('', 'actions/delete.svg'); ?>" title="<?php echo $l->t('Delete contact');?>" />
<?php if(isset($_['details']['PHOTO'])): // Emails first ?>
@ -29,12 +29,12 @@
<select name="name" size="1">
<?php echo html_select_options($_['property_types'], 'EMAIL') ?>
</select>
<br>
<input id="contacts_addproperty_button" type="submit" value="<?php echo $l->t('Add'); ?>">
</p>
<p class="contacts_property_data" id="contacts_generic">
<input type="text" name="value" value="">
</p>
<br>
<input id="contacts_addproperty_button" type="submit" value="<?php echo $l->t('Add'); ?>">
</form>
<div id="contacts_addcontactsparts" style="display:none;">
<ul class="contacts_property_data" id="contacts_addresspart">
@ -75,7 +75,7 @@
</ul>
<p class="contacts_property_data" id="contacts_phonepart">
<input type="text" name="value" value="">
<select name="parameters[TYPE]" size="1">
<select name="parameters[TYPE][]" multiple="multiple" data-placeholder="<?php echo $l->t('Type') ?>">
<?php echo html_select_options($_['phone_types'], 'CELL') ?>
</select>
</p>

View file

@ -0,0 +1,9 @@
<p id="contacts_details_name" class="contacts_property" data-checksum="<?php echo $_['property']['checksum']; ?>">
<?php echo $_['property']['value']; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
</p>
<?php if (!isset($_['details'])): ?>
<script>
$('#leftcontent li.active a').text('<?php echo $_['property']['value']; ?>');
</script>
<?php endif ?>

View file

@ -23,8 +23,20 @@
<p class="contacts_property_name"><?php echo $l->t('Phone'); ?></p>
<p class="contacts_property_data">
<?php echo $_['property']['value']; ?>
<?php if(isset($_['property']['parameters']['TYPE'])): ?>
(<?php echo $l->t(ucwords(str_replace('cell','mobile',strtolower($_['property']['parameters']['TYPE'])))); ?>)
<?php if(isset($_['property']['parameters']['TYPE']) && !empty($_['property']['parameters']['TYPE'])): ?>
<?php
$types = array();
foreach($_['property']['parameters']['TYPE'] as $type):
if (isset($_['phone_types'][strtoupper($type)])){
$types[]=$_['phone_types'][strtoupper($type)];
}
else{
$types[]=$l->t(ucwords(strtolower($type)));
}
endforeach;
$label = join(' ', $types);
?>
(<?php echo $label; ?>)
<?php endif; ?>
<span style="display:none;" data-use="edit"><img class="svg action" src="<?php echo image_path('', 'actions/rename.svg'); ?>" /></span>
<span style="display:none;" data-use="delete"><img class="svg action" src="<?php echo image_path('', 'actions/delete.svg'); ?>" /></span>
@ -34,7 +46,16 @@
<?php echo $l->t('Address'); ?>
<?php if(isset($_['property']['parameters']['TYPE'])): ?>
<br>
(<?php echo $l->t(ucwords($_['property']['parameters']['TYPE'])); ?>)
<?php
$type = $_['property']['parameters']['TYPE'];
if (isset($_['adr_types'][strtoupper($type)])){
$label=$_['adr_types'][strtoupper($type)];
}
else{
$label=$l->t(ucwords(strtolower($type)));
}
?>
(<?php echo $label; ?>)
<?php endif; ?>
</p>
<p class="contacts_property_data">

View file

@ -1,8 +1,9 @@
<li class="contacts_property_edit" data-checksum="<?php echo $_['property']['checksum']; ?>">
<form id="contacts_setpropertyform">
<input type="hidden" name="checksum" value="<?php echo $_['property']['checksum']; ?>">
<input type="hidden" name="id" value="<?php echo $_['id']; ?>">
<?php if($_['property']['name']=='ADR'): ?>
<?php if($_['property']['name']=='FN'): ?>
<p class="contacts_property_data"><input id="fn" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<?php elseif($_['property']['name']=='ADR'): ?>
<p class="contacts_property_name"><label for="adr_pobox"><?php echo $l->t('Address'); ?></label></p>
<ol class="contacts_property_data" id="contacts_addresspart">
<li class="input">
@ -42,7 +43,10 @@
</ol>
<?php elseif($_['property']['name']=='TEL'): ?>
<p class="contacts_property_name"><label for="tel"><?php echo $l->t('Phone'); ?></label></p>
<p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<p class="contacts_property_data"><input id="tel" type="phone" name="value" value="<?php echo $_['property']['value'] ?>">
<select id="tel_type<?php echo $_['property']['checksum'] ?>" name="parameters[TYPE][]" multiple="multiple" data-placeholder="<?php echo $l->t('Type') ?>">
<?php echo html_select_options($_['phone_types'], isset($_['property']['parameters']['TYPE'])?$_['property']['parameters']['TYPE']:'') ?>
</select></p>
<?php elseif($_['property']['name']=='EMAIL'): ?>
<p class="contacts_property_name"><label for="email"><?php echo $l->t('Email'); ?></label></p>
<p class="contacts_property_data"><input id="email" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
@ -50,6 +54,5 @@
<p class="contacts_property_name"><label for="org"><?php echo $l->t('Organization'); ?></label></p>
<p class="contacts_property_data"><input id="org" type="text" name="value" value="<?php echo $_['property']['value']; ?>"></p>
<?php endif; ?>
<input id="contacts_setproperty_button" type="submit" value="<?php echo $l->t('Edit'); ?>">
<input id="contacts_setproperty_button" type="submit" value="<?php echo $l->t('Update'); ?>">
</form>
</li>

View file

@ -8,16 +8,16 @@
require_once('../../../lib/base.php');
OC_Util::checkAdminUser();
if(isset($_POST['s1name'])) OC_Config::setValue( 'external-site1name', $_POST['s1name'] );
if(isset($_POST['s1url'])) OC_Config::setValue( 'external-site1url', $_POST['s1url'] );
if(isset($_POST['s2name'])) OC_Config::setValue( 'external-site2name', $_POST['s2name'] );
if(isset($_POST['s2url'])) OC_Config::setValue( 'external-site2url', $_POST['s2url'] );
if(isset($_POST['s3name'])) OC_Config::setValue( 'external-site3name', $_POST['s3name'] );
if(isset($_POST['s3url'])) OC_Config::setValue( 'external-site3url', $_POST['s3url'] );
if(isset($_POST['s4name'])) OC_Config::setValue( 'external-site4name', $_POST['s4name'] );
if(isset($_POST['s4url'])) OC_Config::setValue( 'external-site4url', $_POST['s4url'] );
if(isset($_POST['s5name'])) OC_Config::setValue( 'external-site5name', $_POST['s5name'] );
if(isset($_POST['s5url'])) OC_Config::setValue( 'external-site5url', $_POST['s5url'] );
if(isset($_POST['s1name'])) OC_Appconfig::setValue( 'external','site1name', $_POST['s1name'] );
if(isset($_POST['s1url'])) OC_Appconfig::setValue( 'external','site1url', $_POST['s1url'] );
if(isset($_POST['s2name'])) OC_Appconfig::setValue( 'external','site2name', $_POST['s2name'] );
if(isset($_POST['s2url'])) OC_Appconfig::setValue( 'external','site2url', $_POST['s2url'] );
if(isset($_POST['s3name'])) OC_Appconfig::setValue( 'external','site3name', $_POST['s3name'] );
if(isset($_POST['s3url'])) OC_Appconfig::setValue( 'external','site3url', $_POST['s3url'] );
if(isset($_POST['s4name'])) OC_Appconfig::setValue( 'external','site4name', $_POST['s4name'] );
if(isset($_POST['s4url'])) OC_Appconfig::setValue( 'external','site4url', $_POST['s4url'] );
if(isset($_POST['s5name'])) OC_Appconfig::setValue( 'external','site5name', $_POST['s5name'] );
if(isset($_POST['s5url'])) OC_Appconfig::setValue( 'external','site5url', $_POST['s5url'] );
echo 'true';

View file

@ -25,13 +25,13 @@ OC_APP::registerAdmin('external','settings');
OC_App::register( array( 'order' => 70, 'id' => 'external', 'name' => 'External' ));
if(OC_Config::getValue( "external-site1name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site1name", '' )));
if(OC_Appconfig::getValue( "external","site1name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index1', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=1', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site1name", '' )));
if(OC_Config::getValue( "external-site2name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site2name", '' )));
if(OC_Appconfig::getValue( "external","site2name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index2', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=2', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site2name", '' )));
if(OC_Config::getValue( "external-site3name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site3name", '' )));
if(OC_Appconfig::getValue( "external","site3name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index3', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=3', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site3name", '' )));
if(OC_Config::getValue( "external-site4name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site4name", '' )));
if(OC_Appconfig::getValue( "external","site4name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index4', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=4', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site4name", '' )));
if(OC_Config::getValue( "external-site5name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Config::getValue( "external-site5name", '' )));
if(OC_Appconfig::getValue( "external","site5name", '' )<>'') OC_App::addNavigationEntry( array( 'id' => 'external_index5', 'order' => 80, 'href' => OC_Helper::linkTo( 'external', 'index.php' ).'?id=5', 'icon' => OC_Helper::imagePath( 'external', 'external.png' ), 'name' => OC_Appconfig::getValue( "external","site5name", '' )));

View file

@ -35,7 +35,7 @@ if(isset($_GET['id'])){
$id=$_GET['id'];
$id = (int) $id;
$url=OC_Config::getValue( "external-site".$id."url", '' );
$url=OC_Appconfig::getValue( "external","site".$id."url", '' );
OC_App::setActiveNavigationEntry( 'external_index'.$id );
$tmpl = new OC_Template( 'external', 'frame', 'user' );

View file

@ -6,17 +6,17 @@ OC_Util::addScript( "external", "admin" );
$tmpl = new OC_Template( 'external', 'settings');
$tmpl->assign('s1name',OC_Config::getValue( "external-site1name", '' ));
$tmpl->assign('s2name',OC_Config::getValue( "external-site2name", '' ));
$tmpl->assign('s3name',OC_Config::getValue( "external-site3name", '' ));
$tmpl->assign('s4name',OC_Config::getValue( "external-site4name", '' ));
$tmpl->assign('s5name',OC_Config::getValue( "external-site5name", '' ));
$tmpl->assign('s1name',OC_Appconfig::getValue( "external","site1name", '' ));
$tmpl->assign('s2name',OC_Appconfig::getValue( "external","site2name", '' ));
$tmpl->assign('s3name',OC_Appconfig::getValue( "external","site3name", '' ));
$tmpl->assign('s4name',OC_Appconfig::getValue( "external","site4name", '' ));
$tmpl->assign('s5name',OC_Appconfig::getValue( "external","site5name", '' ));
$tmpl->assign('s1url',OC_Config::getValue( "external-site1url", '' ));
$tmpl->assign('s2url',OC_Config::getValue( "external-site2url", '' ));
$tmpl->assign('s3url',OC_Config::getValue( "external-site3url", '' ));
$tmpl->assign('s4url',OC_Config::getValue( "external-site4url", '' ));
$tmpl->assign('s5url',OC_Config::getValue( "external-site5url", '' ));
$tmpl->assign('s1url',OC_Appconfig::getValue( "external","site1url", '' ));
$tmpl->assign('s2url',OC_Appconfig::getValue( "external","site2url", '' ));
$tmpl->assign('s3url',OC_Appconfig::getValue( "external","site3url", '' ));
$tmpl->assign('s4url',OC_Appconfig::getValue( "external","site4url", '' ));
$tmpl->assign('s5url',OC_Appconfig::getValue( "external","site5url", '' ));
return $tmpl->fetchPage();
?>

View file

@ -1,5 +1,5 @@
<?php
$RUNTIME_NOAPPS = true;
//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');

View file

@ -1,5 +1,5 @@
<?php
$RUNTIME_NOAPPS = true;
//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');

View file

@ -1,5 +1,5 @@
<?php
$RUNTIME_NOAPPS = true;
//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');

View file

@ -1,5 +1,5 @@
<?php
$RUNTIME_NOAPPS = true;
//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');

View file

@ -1,5 +1,5 @@
<?php
$RUNTIME_NOAPPS = true;
//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');

View file

@ -224,7 +224,7 @@ function addUser(uid_shared_with, permissions, parentFolder) {
var user = '<li data-uid_shared_with="'+uid_shared_with+'">';
user += '<a href="" class="unshare" style="display:none;"><img class="svg" alt="Unshare" src="'+OC.imagePath('core','actions/delete')+'"/></a>';
user += uid_shared_with;
user += '<input type="checkbox" name="permissions" id="'+uid_shared_with+'" class="permissions" "+checked+" />';
user += '<input type="checkbox" name="permissions" id="'+uid_shared_with+'" class="permissions" '+checked+' />';
user += '<label for="'+uid_shared_with+'" '+style+'>can edit</label>';
user += '</li>';
}

View file

@ -31,7 +31,8 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; }
#collection li { padding-right:10px; }
#searchresults input.play, #searchresults input.add { float:left; height:1em; width:1em; }
#collection tr.collapsed td.album, #collection tr.collapsed td.title { color:#ddd; }
a.expander { float:right; padding:0 1em; }
td.artist img, td.artist a, td.album img, td.album a { float: left; }
td.artist a.expander, td.album a.expander { float:right; padding:0 1em; }
tr.active td { background-color:#eee; font-weight:bold; }
tr td { border-top:1px solid #eee; height:2.2em; }
tr .artist img { vertical-align:middle; }

View file

@ -128,7 +128,7 @@ class OC_MEDIA_AMPACHE{
$albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id']));
$songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id']));
$id=$artist['artist_id'];
$name=utf8_decode(htmlentities($artist['artist_name']));
$name=htmlentities($artist['artist_name'], ENT_COMPAT, 'UTF-8');
echo("\t<artist id='$id'>\n");
echo("\t\t<name>$name</name>\n");
echo("\t\t<albums>$albums</albums>\n");
@ -142,10 +142,10 @@ class OC_MEDIA_AMPACHE{
if(!$artistName){
$artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
}
$artistName=utf8_decode(htmlentities($artistName));
$artistName=htmlentities($artistName, ENT_COMPAT, 'UTF-8');
$songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id']));
$id=$album['album_id'];
$name=utf8_decode(htmlentities($album['album_name']));
$name=htmlentities($album['album_name'], ENT_COMPAT, 'UTF-8');
$artist=$album['album_artist'];
echo("\t<album id='$id'>\n");
echo("\t\t<name>$name</name>\n");
@ -163,10 +163,10 @@ class OC_MEDIA_AMPACHE{
if(!$albumName){
$albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']);
}
$artistName=utf8_decode(htmlentities($artistName));
$albumName=utf8_decode(htmlentities($albumName));
$artistName=htmlentities($artistName, ENT_COMPAT, 'UTF-8');
$albumName=htmlentities($albumName, ENT_COMPAT, 'UTF-8');
$id=$song['song_id'];
$name=utf8_decode(htmlentities($song['song_name']));
$name=htmlentities($song['song_name'], ENT_COMPAT, 'UTF-8');
$artist=$song['song_artist'];
$album=$song['song_album'];
echo("\t<song id='$id'>\n");

View file

@ -93,6 +93,7 @@ class OC_MEDIA_SCANNER{
}
if(!self::$getID3){
self::$getID3=@new getID3();
self::$getID3->encoding='UTF-8';
}
$data=@self::$getID3->analyze($file);
getid3_lib::CopyTagsToComments($data);
@ -105,21 +106,18 @@ class OC_MEDIA_SCANNER{
$artist='unknown';
}else{
$artist=stripslashes($data['comments']['artist'][0]);
$artist=utf8_encode($artist);
}
if(!isset($data['comments']['album'])){
OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN);
$album='unknown';
}else{
$album=stripslashes($data['comments']['album'][0]);
$album=utf8_encode($album);
}
if(!isset($data['comments']['title'])){
OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN);
$title='unknown';
}else{
$title=stripslashes($data['comments']['title'][0]);
$title=utf8_encode($title);
}
$size=$data['filesize'];
$track=(isset($data['comments']['track']))?$data['comments']['track'][0]:0;
@ -150,4 +148,4 @@ class OC_MEDIA_SCANNER{
$ext=substr($filename,strrpos($filename,'.')+1);
return $ext=='mp3' || $ext=='flac' || $ext=='m4a' || $ext=='ogg' || $ext=='oga';
}
}
}

View file

@ -26,7 +26,10 @@ require_once('apps/user_ldap/user_ldap.php');
OC_APP::registerAdmin('user_ldap','settings');
// define LDAP_DEFAULT_PORT
define("OC_USER_BACKEND_LDAP_DEFAULT_PORT", 389);
define('OC_USER_BACKEND_LDAP_DEFAULT_PORT', 389);
// define OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME
define('OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME', 'uid');
// register user backend
OC_User::useBackend( "LDAP" );

View file

@ -20,11 +20,21 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter');
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_password', 'ldap_base', 'ldap_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase');
foreach($params as $param){
if(isset($_POST[$param])){
OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]);
if ($_POST) {
foreach($params as $param){
if(isset($_POST[$param])){
OC_Appconfig::setValue('user_ldap', $param, $_POST[$param]);
}
elseif('ldap_tls' == $param) {
// unchecked checkboxes are not included in the post paramters
OC_Appconfig::setValue('user_ldap', $param, 0);
}
elseif('ldap_nocase' == $param) {
OC_Appconfig::setValue('user_ldap', $param, 0);
}
}
}
@ -38,4 +48,7 @@ foreach($params as $param){
// ldap_port has a default value
$tmpl->assign( 'ldap_port', OC_Appconfig::getValue('user_ldap', 'ldap_port', OC_USER_BACKEND_LDAP_DEFAULT_PORT));
// ldap_display_name has a default value
$tmpl->assign( 'ldap_display_name', OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME));
return $tmpl->fetchPage();

View file

@ -1,12 +1,17 @@
<form id="ldap" action="#" method="post">
<fieldset class="personalblock">
<legend><strong>LDAP</strong></legend>
<p><label for="ldap_host">Host<input type="text" id="ldap_host" name="ldap_host" value="<?php echo $_['ldap_host']; ?>"></label>
<label for="ldap_port">Port</label><input type="text" id="ldap_port" name="ldap_port" value="<?php echo $_['ldap_port']; ?>" /></p>
<p><label for="ldap_dn">Name</label><input type="text" id="ldap_dn" name="ldap_dn" value="<?php echo $_['ldap_dn']; ?>" />
<label for="ldap_password">Password</label><input type="password" id="ldap_password" name="ldap_password" value="<?php echo $_['ldap_password']; ?>" /></p>
<p><label for="ldap_base">Base</label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" />
<label for="ldap_filter">Filter (use %uid placeholder)</label><input type="text" id="ldap_filter" name="ldap_filter" value="<?php echo $_['ldap_filter']; ?>" /></p>
<p><label for="ldap_host"><?php echo $l->t('Host');?><input type="text" id="ldap_host" name="ldap_host" value="<?php echo $_['ldap_host']; ?>"></label>
<label for="ldap_port"><?php echo $l->t('Port');?></label><input type="text" id="ldap_port" name="ldap_port" value="<?php echo $_['ldap_port']; ?>" /></p>
<p><label for="ldap_dn"><?php echo $l->t('Name');?></label><input type="text" id="ldap_dn" name="ldap_dn" value="<?php echo $_['ldap_dn']; ?>" />
<label for="ldap_password"><?php echo $l->t('Password');?></label><input type="password" id="ldap_password" name="ldap_password" value="<?php echo $_['ldap_password']; ?>" />
<small><?php echo $l->t('Leave both empty for anonymous bind for search, then bind with users credentials.');?></small></p>
<p><label for="ldap_base"><?php echo $l->t('Base');?></label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" />
<label for="ldap_filter"><?php echo $l->t('Filter (use %%uid placeholder)');?></label><input type="text" id="ldap_filter" name="ldap_filter" value="<?php echo $_['ldap_filter']; ?>" /></p>
<p><label for="ldap_display_name"><?php echo $l->t('Display Name Field');?></label><input type="text" id="ldap_display_name" name="ldap_display_name" value="<?php echo $_['ldap_display_name']; ?>" />
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
<p><input type="checkbox" id="ldap_tls" name="ldap_tls" value="1"<?php if ($_['ldap_tls']) echo ' checked'; ?>><label for="ldap_tls"><?php echo $l->t('Use TLS');?></label></p>
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if ($_['ldap_nocase']) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p>
<input type="submit" value="Save" />
</fieldset>
</form>

View file

@ -33,6 +33,9 @@ class OC_USER_LDAP extends OC_User_Backend {
protected $ldap_password;
protected $ldap_base;
protected $ldap_filter;
protected $ldap_tls;
protected $ldap_nocase;
protected $ldap_display_name;
function __construct() {
$this->ldap_host = OC_Appconfig::getValue('user_ldap', 'ldap_host','');
@ -41,13 +44,16 @@ class OC_USER_LDAP extends OC_User_Backend {
$this->ldap_password = OC_Appconfig::getValue('user_ldap', 'ldap_password','');
$this->ldap_base = OC_Appconfig::getValue('user_ldap', 'ldap_base','');
$this->ldap_filter = OC_Appconfig::getValue('user_ldap', 'ldap_filter','');
$this->ldap_tls = OC_Appconfig::getValue('user_ldap', 'ldap_tls', 0);
$this->ldap_nocase = OC_Appconfig::getValue('user_ldap', 'ldap_nocase', 0);
$this->ldap_display_name = OC_Appconfig::getValue('user_ldap', 'ldap_display_name', OC_USER_BACKEND_LDAP_DEFAULT_DISPLAY_NAME);
if( !empty($this->ldap_host)
&& !empty($this->ldap_port)
&& !empty($this->ldap_dn)
&& !empty($this->ldap_password)
&& ((!empty($this->ldap_dn) && !empty($this->ldap_password)) || (empty($this->ldap_dn) && empty($this->ldap_password)))
&& !empty($this->ldap_base)
&& !empty($this->ldap_filter)
&& !empty($this->ldap_display_name)
)
{
$this->configured = true;
@ -63,9 +69,10 @@ class OC_USER_LDAP extends OC_User_Backend {
private function getDs() {
if(!$this->ds) {
$this->ds = ldap_connect( $this->ldap_host, $this->ldap_port );
if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0))
ldap_start_tls($this->ds);
if(ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3))
if(ldap_set_option($this->ds, LDAP_OPT_REFERRALS, 0))
if($this->ldap_tls)
ldap_start_tls($this->ds);
}
// login
@ -88,15 +95,16 @@ class OC_USER_LDAP extends OC_User_Backend {
return false;
// get dn
$filter = str_replace("%uid", $uid, $this->ldap_filter);
$filter = str_replace('%uid', $uid, $this->ldap_filter);
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
if( $entries["count"] == 0 )
if( $entries['count'] == 0 )
return false;
return $entries[0]["dn"];
return $entries[0]['dn'];
}
public function checkPassword( $uid, $password ) {
if(!$this->configured){
return false;
@ -107,7 +115,28 @@ class OC_USER_LDAP extends OC_User_Backend {
if (!@ldap_bind( $this->getDs(), $dn, $password ))
return false;
return $uid;
if($this->ldap_nocase) {
$filter = str_replace('%uid', $uid, $this->ldap_filter);
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
if( $entries['count'] == 1 ) {
foreach($entries as $row) {
$ldap_display_name = strtolower($this->ldap_display_name);
if(isset($row[$ldap_display_name])) {
return $row[$ldap_display_name][0];
}
}
}
else {
return $uid;
}
}
else {
return $uid;
}
}
public function userExists( $uid ) {
@ -117,6 +146,37 @@ class OC_USER_LDAP extends OC_User_Backend {
$dn = $this->getDn($uid);
return !empty($dn);
}
public function getUsers()
{
if(!$this->configured)
return false;
// connect to server
$ds = $this->getDs();
if( !$ds )
return false;
// get users
$filter = 'objectClass=person';
$sr = ldap_search( $this->getDs(), $this->ldap_base, $filter );
$entries = ldap_get_entries( $this->getDs(), $sr );
if( $entries['count'] == 0 )
return false;
else {
$users = array();
foreach($entries as $row) {
// TODO ldap_get_entries() seems to lower all keys => needs review
$ldap_display_name = strtolower($this->ldap_display_name);
if(isset($row[$ldap_display_name])) {
$users[] = $row[$ldap_display_name][0];
}
}
// TODO language specific sorting of user names
sort($users);
return $users;
}
}
}

View file

@ -31,6 +31,10 @@
height: this.$element[0].offsetHeight
});
if (this.options.className) {
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
}
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight,
gravity = maybeCall(this.options.gravity, this.$element[0]);
@ -61,9 +65,6 @@
$tip.css(tp).addClass('tipsy-' + gravity);
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
if (this.options.className) {
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
}
if (this.options.fade) {
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});

View file

@ -14,8 +14,8 @@ $(document).ready(function() {
$('#fileList tr td.filename').draggable(dragOptions);
$('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions);
$('div.crumb').droppable(crumbDropOptions);
$('#plugins>ul>li:first-child').data('dir','');
$('#plugins>ul>li:first-child').droppable(crumbDropOptions);
$('ul#apps>li:first-child').data('dir','');
$('ul#apps>li:first-child').droppable(crumbDropOptions);
// Triggers invisible file input
$('.file_upload_button_wrapper').live('click', function() {

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-24 23:05+0200\n"
"POT-Creation-Date: 2011-10-22 13:05+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,318 +17,180 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ajax/createcalendar.php:18 ajax/settimezone.php:19
#: ajax/updatecalendar.php:18
msgid "Authentication error"
msgstr ""
#: ajax/editeventform.php:25
#: ajax/editeventform.php:26
msgid "Wrong calendar"
msgstr ""
#: ajax/settimezone.php:27
#: ajax/settimezone.php:22
msgid "Timezone changed"
msgstr ""
#: ajax/settimezone.php:29
#: ajax/settimezone.php:24
msgid "Invalid request"
msgstr ""
#: appinfo/app.php:19 templates/part.eventform.php:27
#: templates/part.eventinfo.php:18
#: appinfo/app.php:21 templates/calendar.php:11
#: templates/part.eventform.php:21
msgid "Calendar"
msgstr ""
#: lib/object.php:292
#: js/calendar.js:153
msgid "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}"
msgstr ""
#: js/calendar.js:155
msgid "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}"
msgstr ""
#: lib/object.php:344
msgid "Birthday"
msgstr ""
#: lib/object.php:293
#: lib/object.php:345
msgid "Business"
msgstr ""
#: lib/object.php:294
#: lib/object.php:346
msgid "Call"
msgstr ""
#: lib/object.php:295
#: lib/object.php:347
msgid "Clients"
msgstr ""
#: lib/object.php:296
#: lib/object.php:348
msgid "Deliverer"
msgstr ""
#: lib/object.php:297
#: lib/object.php:349
msgid "Holidays"
msgstr ""
#: lib/object.php:298
#: lib/object.php:350
msgid "Ideas"
msgstr ""
#: lib/object.php:299
#: lib/object.php:351
msgid "Journey"
msgstr ""
#: lib/object.php:300
#: lib/object.php:352
msgid "Jubilee"
msgstr ""
#: lib/object.php:301
#: lib/object.php:353
msgid "Meeting"
msgstr ""
#: lib/object.php:302
#: lib/object.php:354
msgid "Other"
msgstr ""
#: lib/object.php:303
#: lib/object.php:355
msgid "Personal"
msgstr ""
#: lib/object.php:304
#: lib/object.php:356
msgid "Projects"
msgstr ""
#: lib/object.php:305
#: lib/object.php:357
msgid "Questions"
msgstr ""
#: lib/object.php:306
#: lib/object.php:358
msgid "Work"
msgstr ""
#: lib/object.php:313
#: lib/object.php:365
msgid "Does not repeat"
msgstr ""
#: lib/object.php:314
#: lib/object.php:366
msgid "Daily"
msgstr ""
#: lib/object.php:315
#: lib/object.php:367
msgid "Weekly"
msgstr ""
#: lib/object.php:316
#: lib/object.php:368
msgid "Every Weekday"
msgstr ""
#: lib/object.php:317
#: lib/object.php:369
msgid "Bi-Weekly"
msgstr ""
#: lib/object.php:318
#: lib/object.php:370
msgid "Monthly"
msgstr ""
#: lib/object.php:319
#: lib/object.php:371
msgid "Yearly"
msgstr ""
#: lib/object.php:337
#: lib/object.php:389
msgid "Not an array"
msgstr ""
#: templates/calendar.php:3
#: templates/calendar.php:8
msgid "All day"
msgstr ""
#: templates/calendar.php:32
msgid "Sunday"
#: templates/calendar.php:9
msgid "Missing fields"
msgstr ""
#: templates/calendar.php:32
msgid "Monday"
#: templates/calendar.php:10 templates/part.eventform.php:3
msgid "Title"
msgstr ""
#: templates/calendar.php:32
msgid "Tuesday"
#: templates/calendar.php:12
msgid "From Date"
msgstr ""
#: templates/calendar.php:32
msgid "Wednesday"
#: templates/calendar.php:13
msgid "From Time"
msgstr ""
#: templates/calendar.php:32
msgid "Thursday"
#: templates/calendar.php:14
msgid "To Date"
msgstr ""
#: templates/calendar.php:32
msgid "Friday"
#: templates/calendar.php:15
msgid "To Time"
msgstr ""
#: templates/calendar.php:32
msgid "Saturday"
#: templates/calendar.php:16
msgid "The event ends before it starts"
msgstr ""
#: templates/calendar.php:33
msgid "Sun."
#: templates/calendar.php:17
msgid "There was a database fail"
msgstr ""
#: templates/calendar.php:33
msgid "Mon."
msgstr ""
#: templates/calendar.php:33
msgid "Tue."
msgstr ""
#: templates/calendar.php:33
msgid "Wed."
msgstr ""
#: templates/calendar.php:33
msgid "Thu."
msgstr ""
#: templates/calendar.php:33
msgid "Fri."
msgstr ""
#: templates/calendar.php:33
msgid "Sat."
msgstr ""
#: templates/calendar.php:34
msgid "January"
msgstr ""
#: templates/calendar.php:34
msgid "February"
msgstr ""
#: templates/calendar.php:34
msgid "March"
msgstr ""
#: templates/calendar.php:34
msgid "April"
msgstr ""
#: templates/calendar.php:34
msgid "May"
msgstr ""
#: templates/calendar.php:34
msgid "June"
msgstr ""
#: templates/calendar.php:34
msgid "July"
msgstr ""
#: templates/calendar.php:34
msgid "August"
msgstr ""
#: templates/calendar.php:34
msgid "September"
msgstr ""
#: templates/calendar.php:34
msgid "October"
msgstr ""
#: templates/calendar.php:34
msgid "November"
msgstr ""
#: templates/calendar.php:34
msgid "December"
msgstr ""
#: templates/calendar.php:35
msgid "Jan."
msgstr ""
#: templates/calendar.php:35
msgid "Feb."
msgstr ""
#: templates/calendar.php:35
msgid "Mar."
msgstr ""
#: templates/calendar.php:35
msgid "Apr."
msgstr ""
#: templates/calendar.php:35
msgid "May."
msgstr ""
#: templates/calendar.php:35
msgid "Jun."
msgstr ""
#: templates/calendar.php:35
msgid "Jul."
msgstr ""
#: templates/calendar.php:35
msgid "Aug."
msgstr ""
#: templates/calendar.php:35
msgid "Sep."
msgstr ""
#: templates/calendar.php:35
msgid "Oct."
msgstr ""
#: templates/calendar.php:35
msgid "Nov."
msgstr ""
#: templates/calendar.php:35
msgid "Dec."
msgstr ""
#: templates/calendar.php:36 templates/calendar.php:50
#: templates/calendar.php:116
#: templates/calendar.php:23
msgid "Week"
msgstr ""
#: templates/calendar.php:37 templates/calendar.php:51
msgid "Weeks"
msgstr ""
#: templates/calendar.php:38
msgid "More before {startdate}"
msgstr ""
#: templates/calendar.php:39
msgid "More after {enddate}"
msgstr ""
#: templates/calendar.php:49
msgid "Day"
msgstr ""
#: templates/calendar.php:52
#: templates/calendar.php:24
msgid "Month"
msgstr ""
#: templates/calendar.php:53
#: templates/calendar.php:25
msgid "List"
msgstr ""
#: templates/calendar.php:58
#: templates/calendar.php:30
msgid "Today"
msgstr ""
#: templates/calendar.php:59
#: templates/calendar.php:31
msgid "Calendars"
msgstr ""
#: templates/calendar.php:76 templates/calendar.php:94
msgid "Time"
msgstr ""
#: templates/calendar.php:169
#: templates/calendar.php:48
msgid "There was a fail, while parsing the file."
msgstr ""
@ -350,7 +212,6 @@ msgid "Download"
msgstr ""
#: templates/part.choosecalendar.rowfields.php:4
#: templates/part.eventinfo.php:64
msgid "Edit"
msgstr ""
@ -367,7 +228,7 @@ msgstr ""
msgid "Edit calendar"
msgstr ""
#: templates/part.editcalendar.php:12
#: templates/part.editcalendar.php:12 templates/part.import.php:29
msgid "Displayname"
msgstr ""
@ -375,88 +236,135 @@ msgstr ""
msgid "Active"
msgstr ""
#: templates/part.editcalendar.php:29 templates/part.eventform.php:88
#: templates/part.eventinfo.php:58
msgid "Description"
msgstr ""
#: templates/part.editcalendar.php:35
#: templates/part.editcalendar.php:29
msgid "Calendar color"
msgstr ""
#: templates/part.editcalendar.php:41
#: templates/part.editcalendar.php:42
msgid "Save"
msgstr ""
#: templates/part.editcalendar.php:41 templates/part.editevent.php:7
#: templates/part.editcalendar.php:42 templates/part.editevent.php:7
#: templates/part.newevent.php:6
msgid "Submit"
msgstr ""
#: templates/part.editcalendar.php:42
#: templates/part.editcalendar.php:43
msgid "Cancel"
msgstr ""
#: templates/part.editevent.php:1 templates/part.eventinfo.php:1
#: templates/part.editevent.php:1
msgid "Edit an event"
msgstr ""
#: templates/part.eventform.php:3 templates/part.eventinfo.php:4
msgid "Title"
#: templates/part.editevent.php:9
msgid "Export"
msgstr ""
#: templates/part.eventform.php:5
msgid "Title of the Event"
msgstr ""
#: templates/part.eventform.php:9 templates/part.eventinfo.php:9
msgid "Location"
msgstr ""
#: templates/part.eventform.php:11
msgid "Location of the Event"
msgstr ""
#: templates/part.eventform.php:17 templates/part.eventinfo.php:16
msgid "Category"
msgstr ""
#: templates/part.eventform.php:19
#: templates/part.eventform.php:13
msgid "Select category"
msgstr ""
#: templates/part.eventform.php:45 templates/part.eventinfo.php:28
#: templates/part.eventform.php:39
msgid "All Day Event"
msgstr ""
#: templates/part.eventform.php:49 templates/part.eventinfo.php:31
#: templates/part.eventform.php:43
msgid "From"
msgstr ""
#: templates/part.eventform.php:57 templates/part.eventinfo.php:38
#: templates/part.eventform.php:51
msgid "To"
msgstr ""
#: templates/part.eventform.php:65 templates/part.eventinfo.php:44
#: templates/part.eventform.php:59
msgid "Advanced options"
msgstr ""
#: templates/part.eventform.php:64
msgid "Repeat"
msgstr ""
#: templates/part.eventform.php:81 templates/part.eventinfo.php:51
#: templates/part.eventform.php:80
msgid "Attendees"
msgstr ""
#: templates/part.eventform.php:87
msgid "Location"
msgstr ""
#: templates/part.eventform.php:89
msgid "Location of the Event"
msgstr ""
#: templates/part.eventform.php:95
msgid "Description"
msgstr ""
#: templates/part.eventform.php:96
msgid "Description of the Event"
msgstr ""
#: templates/part.eventinfo.php:63
msgid "Close"
#: templates/part.import.php:1
msgid "Import Ical File"
msgstr ""
#: templates/part.import.php:4
msgid "How to import the new calendar?"
msgstr ""
#: templates/part.import.php:6
msgid "Import into an existing calendar"
msgstr ""
#: templates/part.import.php:7
msgid "Import into a new calendar"
msgstr ""
#: templates/part.import.php:10
msgid "Please choose the calendar"
msgstr ""
#: templates/part.import.php:20 templates/part.import.php:37
msgid "Import"
msgstr ""
#: templates/part.import.php:22 templates/part.import.php:39
msgid "Back"
msgstr ""
#: templates/part.import.php:25
msgid "Please fill out the form"
msgstr ""
#: templates/part.newevent.php:1
msgid "Create a new event"
msgstr ""
#: templates/settings.php:11
#: templates/settings.php:13
msgid "Timezone"
msgstr ""
#: templates/settings.php:32
msgid "Timeformat"
msgstr ""
#: templates/settings.php:34
msgid "24h"
msgstr ""
#: templates/settings.php:35
msgid "12h"
msgstr ""
#: templates/settings.php:41
msgid "Calendar CalDAV syncing address:"
msgstr ""

View file

@ -92,6 +92,14 @@ class OC{
$_SERVER['PHP_AUTH_PW'] = strip_tags($password);
}
//set http auth headers for apache+php-cgi work around if variable gets renamed by apache
if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION']) && preg_match('/Basic\s+(.*)$/i', $_SERVER['REDIRECT_HTTP_AUTHORIZATION'], $matches))
{
list($name, $password) = explode(':', base64_decode($matches[1]));
$_SERVER['PHP_AUTH_USER'] = strip_tags($name);
$_SERVER['PHP_AUTH_PW'] = strip_tags($password);
}
// calculate the documentroot
OC::$DOCUMENTROOT=realpath($_SERVER['DOCUMENT_ROOT']);
OC::$SERVERROOT=str_replace("\\",'/',substr(__FILE__,0,-13));

View file

@ -94,7 +94,6 @@ class OC_Config{
// Write changes
self::writeData();
return true;
}

View file

@ -77,6 +77,8 @@ class OC_Setup {
OC_Config::setValue('datadirectory', $datadir);
OC_Config::setValue('dbtype', $dbtype);
OC_Config::setValue('version',implode('.',OC_Util::getVersion()));
OC_Config::setValue('installedat',microtime(true));
OC_Config::setValue('lastupdatedat',microtime(true));
if($dbtype == 'mysql') {
$dbuser = $options['dbuser'];
$dbpass = $options['dbpass'];

View file

@ -121,7 +121,7 @@ function html_select_options($options, $selected, $params=array()) {
$label = $label[$label_name];
}
$select = in_array($value, $selected) ? ' selected="selected"' : '';
$html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>';
$html .= '<option value="' . $value . '"' . $select . '>' . $label . '</option>'."\n";
}
return $html;
}

91
lib/updater.php Normal file
View file

@ -0,0 +1,91 @@
<?php
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek karlitschek@kde.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Class that handels autoupdating of ownCloud
*/
class OC_Updater{
/**
* Check if a new version is available
*/
public static function check(){
OC_Config::setValue('lastupdatedat',microtime(true));
$updaterurl='http://apps.owncloud.com/updater.php';
$version=OC_Util::getVersion();
$version['installed']=OC_Config::getValue( "installedat");
$version['updated']=OC_Config::getValue( "lastupdatedat");
$version['updatechannel']='stable';
$versionstring=implode('x',$version);
//fetch xml data from updater
$url=$updaterurl.'?version='.$versionstring;
$xml=@file_get_contents($url);
if($xml==FALSE){
return array();
}
$data=@simplexml_load_string($xml);
$tmp=array();
$tmp['version'] = $data->version;
$tmp['versionstring'] = $data->versionstring;
$tmp['url'] = $data->url;
$tmp['web'] = $data->web;
return $tmp;
}
public static function ShowUpdatingHint(){
$data=OC_Updater::check();
if(isset($data['version']) and $data['version']<>'') {
$txt='<span style="color:#AA0000; font-weight:bold;">'.$data['versionstring'].' is available. Please click <a href="'.$data['web'].'">here</a> for more information</span>';
}else{
$txt='Your ownCloud is up to date';
}
return($txt);
}
/**
* do ownCloud update
*/
public static function doUpdate(){
//update ownCloud core
//update all apps
//update version in config
}
}
?>

View file

@ -180,7 +180,6 @@ class OC_Util {
}
$CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" );
$CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" );
$serverUser=OC_Util::checkWebserverUser();
//common hint for all file permissons error messages
$permissionsHint="Permissions can usually be fixed by giving the webserver write access to the ownCloud directory";
@ -239,21 +238,6 @@ class OC_Util {
OC_Template::printGuestPage("", "login", $parameters);
}
/**
* Try to get the username the httpd server runs on, used in hints
*/
public static function checkWebserverUser(){
if(is_callable('posix_getuid')){
$serverUser=posix_getpwuid(posix_getuid());
$serverUser='\''.$serverUser['name'].'\'';
}elseif(exec('whoami')){
$serverUser=exec('whoami');
}else{
$serverUser='\'www-data\' for ubuntu/debian'; //TODO: try to detect the distro and give a guess based on that
}
return $serverUser;
}
/**
* Check if the app is enabled, send json error msg if not

View file

@ -50,7 +50,9 @@
};?>
<p class="personalblock">
<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?>, <a href="http://gitorious.org/owncloud" target="_blank">source code</a> licensed freely under <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank">AGPL</a>
<strong>ownCloud</strong> <?php echo(OC_Util::getVersionString()); ?><br />
<?php echo(OC_Updater::ShowUpdatingHint()); ?><br />
<a href="http://gitorious.org/owncloud" target="_blank">source code</a> licensed freely under <a href="http://www.gnu.org/licenses/agpl-3.0.html" target="_blank">AGPL</a>
</p>