summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/admin_dependencies_chk/settings.php2
-rw-r--r--apps/bookmarks/bookmarksHelper.php5
-rw-r--r--apps/calendar/ajax/editevent.php9
-rw-r--r--apps/calendar/ajax/editeventform.php9
-rw-r--r--apps/calendar/ajax/events.php77
-rwxr-xr-xapps/calendar/ajax/guesstimezone.php39
-rw-r--r--apps/calendar/ajax/moveevent.php10
-rw-r--r--apps/calendar/ajax/neweventform.php48
-rw-r--r--apps/calendar/ajax/resizeevent.php10
-rw-r--r--apps/calendar/appinfo/app.php2
-rw-r--r--apps/calendar/css/style.css30
-rw-r--r--apps/calendar/index.php5
-rw-r--r--apps/calendar/js/calendar.js127
-rwxr-xr-xapps/calendar/js/geo.js20
-rw-r--r--apps/calendar/l10n/xgettextfiles10
-rw-r--r--apps/calendar/lib/object.php17
-rw-r--r--apps/calendar/lib/search.php26
-rwxr-xr-x[-rw-r--r--]apps/calendar/templates/calendar.php33
-rw-r--r--apps/calendar/templates/part.editevent.php1
-rw-r--r--apps/contacts/ajax/addcard.php5
-rw-r--r--apps/contacts/ajax/setproperty.php24
-rw-r--r--apps/contacts/ajax/showsetproperty.php2
-rw-r--r--apps/contacts/css/formtastic.css8
-rw-r--r--apps/contacts/css/styles.css14
-rw-r--r--apps/contacts/index.php6
-rw-r--r--apps/contacts/js/interface.js15
-rw-r--r--apps/contacts/lib/vcard.php20
-rw-r--r--apps/contacts/templates/part.addcardform.php2
-rw-r--r--apps/contacts/templates/part.details.php8
-rw-r--r--apps/contacts/templates/part.property.FN.php9
-rw-r--r--apps/contacts/templates/part.property.php27
-rw-r--r--apps/contacts/templates/part.setpropertyform.php13
-rw-r--r--apps/external/ajax/seturls.php20
-rw-r--r--apps/external/appinfo/app.php10
-rw-r--r--apps/external/index.php2
-rw-r--r--apps/external/settings.php20
-rw-r--r--apps/files_sharing/ajax/getitem.php2
-rw-r--r--apps/files_sharing/ajax/setpermissions.php2
-rw-r--r--apps/files_sharing/ajax/share.php2
-rw-r--r--apps/files_sharing/ajax/unshare.php2
-rw-r--r--apps/files_sharing/ajax/userautocomplete.php2
-rw-r--r--apps/files_sharing/js/share.js2
-rw-r--r--apps/media/css/music.css3
-rw-r--r--apps/media/lib_ampache.php12
-rw-r--r--apps/media/lib_scanner.php6
-rw-r--r--apps/user_ldap/appinfo/app.php5
-rw-r--r--apps/user_ldap/settings.php21
-rw-r--r--apps/user_ldap/templates/settings.php17
-rw-r--r--apps/user_ldap/user_ldap.php78
49 files changed, 604 insertions, 235 deletions
diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php
index de2f97aa79d..34028056dbe 100644
--- a/apps/admin_dependencies_chk/settings.php
+++ b/apps/admin_dependencies_chk/settings.php
@@ -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'));
diff --git a/apps/bookmarks/bookmarksHelper.php b/apps/bookmarks/bookmarksHelper.php
index 44d4235b9b3..ac512fbc241 100644
--- a/apps/bookmarks/bookmarksHelper.php
+++ b/apps/bookmarks/bookmarksHelper.php
@@ -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;
-} \ No newline at end of file
+}
diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php
index 3abf4de98b3..46feb068499 100644
--- a/apps/calendar/ajax/editevent.php
+++ b/apps/calendar/ajax/editevent.php
@@ -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) {
diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php
index 34d6c657cec..63c72934079 100644
--- a/apps/calendar/ajax/editeventform.php
+++ b/apps/calendar/ajax/editeventform.php
@@ -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);
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
index 8f466bee91a..1ef6bd30594 100644
--- a/apps/calendar/ajax/events.php
+++ b/apps/calendar/ajax/events.php
@@ -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);
+?> \ No newline at end of file
diff --git a/apps/calendar/ajax/guesstimezone.php b/apps/calendar/ajax/guesstimezone.php
new file mode 100755
index 00000000000..a3594498b0f
--- /dev/null
+++ b/apps/calendar/ajax/guesstimezone.php
@@ -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();
+}
+
+?> \ No newline at end of file
diff --git a/apps/calendar/ajax/moveevent.php b/apps/calendar/ajax/moveevent.php
index 1fef1c5b200..6b315a39213 100644
--- a/apps/calendar/ajax/moveevent.php
+++ b/apps/calendar/ajax/moveevent.php
@@ -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')));
diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php
index d02b1163473..68423adb344 100644
--- a/apps/calendar/ajax/neweventform.php
+++ b/apps/calendar/ajax/neweventform.php
@@ -15,39 +15,35 @@ if(!OC_USER::isLoggedIn()) {
}
OC_JSON::checkAppEnabled('calendar');
-$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';
+if (!isset($_POST['start'])){
+ OC_JSON::error();
+ die;
}
+$start = $_POST['start'];
+$end = $_POST['end'];
+$allday = $_POST['allday'];
-$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);
-
+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);
$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();
?>
diff --git a/apps/calendar/ajax/resizeevent.php b/apps/calendar/ajax/resizeevent.php
index 3a2bf87afd9..28a185411e0 100644
--- a/apps/calendar/ajax/resizeevent.php
+++ b/apps/calendar/ajax/resizeevent.php
@@ -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')));
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php
index 2dc01eab0f6..5675e624dda 100644
--- a/apps/calendar/appinfo/app.php
+++ b/apps/calendar/appinfo/app.php
@@ -21,3 +21,5 @@ OC_App::addNavigationEntry( array(
'name' => $l->t('Calendar')));
OC_App::registerPersonal('calendar', 'settings');
+
+require_once('apps/calendar/lib/search.php'); \ No newline at end of file
diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css
index e6d212ef532..0204f2fc12f 100644
--- a/apps/calendar/css/style.css
+++ b/apps/calendar/css/style.css
@@ -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;
+}
diff --git a/apps/calendar/index.php b/apps/calendar/index.php
index 1129bdcf7fd..7561f987b21 100644
--- a/apps/calendar/index.php
+++ b/apps/calendar/index.php
@@ -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');
diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js
index bf9e2628ff9..005e359f8eb 100644
--- a/apps/calendar/js/calendar.js
+++ b/apps/calendar/js/calendar.js
@@ -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(){
diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js
new file mode 100755
index 00000000000..acea17c0269
--- /dev/null
+++ b/apps/calendar/js/geo.js
@@ -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.');
+ }
+ });
+ });
+} \ No newline at end of file
diff --git a/apps/calendar/l10n/xgettextfiles b/apps/calendar/l10n/xgettextfiles
index 4cc636436b4..27b8e457193 100644
--- a/apps/calendar/l10n/xgettextfiles
+++ b/apps/calendar/l10n/xgettextfiles
@@ -1,7 +1,11 @@
../appinfo/app.php
+../lib/object.php
../templates/calendar.php
+../templates/part.choosecalendar.php
+../templates/part.choosecalendar.rowfields.php
+../templates/part.editcalendar.php
../templates/part.editevent.php
-../templates/part.eventinfo.php
+../templates/part.eventform.php
+../templates/part.import.php
../templates/part.newevent.php
-../templates/part.choosecalendar.php
-../js/calendar.js
+../templates/settings.php \ No newline at end of file
diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php
index e44334bc757..b0164690429 100644
--- a/apps/calendar/lib/object.php
+++ b/apps/calendar/lib/object.php
@@ -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);
diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php
new file mode 100644
index 00000000000..41faf49a519
--- /dev/null
+++ b/apps/calendar/lib/search.php
@@ -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(); \ No newline at end of file
diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php
index 1c948b948c2..2003b7efc49 100644..100755
--- a/apps/calendar/templates/calendar.php
+++ b/apps/calendar/templates/calendar.php
@@ -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 -->
diff --git a/apps/calendar/templates/part.editevent.php b/apps/calendar/templates/part.editevent.php
index ae969f2dc3b..b3acfc4a072 100644
--- a/apps/calendar/templates/part.editevent.php
+++ b/apps/calendar/templates/part.editevent.php
@@ -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">
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php
index 0cecd3bdc06..dd5b90651f5 100644
--- a/apps/contacts/ajax/addcard.php
+++ b/apps/contacts/ajax/addcard.php
@@ -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 )));
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
index 18e00872473..22f228cbf43 100644
--- a/apps/contacts/ajax/setproperty.php
+++ b/apps/contacts/ajax/setproperty.php
@@ -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();
diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php
index 4ec3dd7d8e1..2ec4b89b824 100644
--- a/apps/contacts/ajax/showsetproperty.php
+++ b/apps/contacts/ajax/showsetproperty.php
@@ -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 )));
diff --git a/apps/contacts/css/formtastic.css b/apps/contacts/css/formtastic.css
index 629c220732b..fede92b61ca 100644
--- a/apps/contacts/css/formtastic.css
+++ b/apps/contacts/css/formtastic.css
@@ -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
--------------------------------------------------------------------------------------------------*/
diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css
index ad64c777ee7..f351589fe12 100644
--- a/apps/contacts/css/styles.css
+++ b/apps/contacts/css/styles.css
@@ -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; } */
diff --git a/apps/contacts/index.php b/apps/contacts/index.php
index 7e93d6183ed..29d41d3c4c4 100644
--- a/apps/contacts/index.php
+++ b/apps/contacts/index.php
@@ -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 );
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 1cc3a5dfd63..eb81e872682 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -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();
});
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 56602f25c0a..4865fae7642 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -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;
}
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
index 037e3629bb9..627053547ad 100644
--- a/apps/contacts/templates/part.addcardform.php
+++ b/apps/contacts/templates/part.addcardform.php
@@ -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>
diff --git a/apps/contacts/templates/part.details.php b/apps/contacts/templates/part.details.php
index f5bd75809b1..afad0b7f64c 100644
--- a/apps/contacts/templates/part.details.php
+++ b/apps/contacts/templates/part.details.php
@@ -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>
diff --git a/apps/contacts/templates/part.property.FN.php b/apps/contacts/templates/part.property.FN.php
new file mode 100644
index 00000000000..83cef94e303
--- /dev/null
+++ b/apps/contacts/templates/part.property.FN.php
@@ -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 ?>
diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php
index 4bc3a4d85f8..afef4311260 100644
--- a/apps/contacts/templates/part.property.php
+++ b/apps/contacts/templates/part.property.php
@@ -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">
diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php
index 811b9626ce4..8635d7db1ce 100644
--- a/apps/contacts/templates/part.setpropertyform.php
+++ b/apps/contacts/templates/part.setpropertyform.php
@@ -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>
diff --git a/apps/external/ajax/seturls.php b/apps/external/ajax/seturls.php
index c8e97754544..e994385a199 100644
--- a/apps/external/ajax/seturls.php
+++ b/apps/external/ajax/seturls.php
@@ -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';
diff --git a/apps/external/appinfo/app.php b/apps/external/appinfo/app.php
index df14954d86f..0f536cbf418 100644
--- a/apps/external/appinfo/app.php
+++ b/apps/external/appinfo/app.php
@@ -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", '' )));
diff --git a/apps/external/index.php b/apps/external/index.php
index 116e16d9096..86b19abc10e 100644
--- a/apps/external/index.php
+++ b/apps/external/index.php
@@ -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' );
diff --git a/apps/external/settings.php b/apps/external/settings.php
index ad33c16e1bf..3e0c3425128 100644
--- a/apps/external/settings.php
+++ b/apps/external/settings.php
@@ -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();
?>
diff --git a/apps/files_sharing/ajax/getitem.php b/apps/files_sharing/ajax/getitem.php
index 075ec043eac..d9df4abe984 100644
--- a/apps/files_sharing/ajax/getitem.php
+++ b/apps/files_sharing/ajax/getitem.php
@@ -1,5 +1,5 @@
<?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/setpermissions.php b/apps/files_sharing/ajax/setpermissions.php
index 7ee8f0e57bd..200202c704c 100644
--- a/apps/files_sharing/ajax/setpermissions.php
+++ b/apps/files_sharing/ajax/setpermissions.php
@@ -1,5 +1,5 @@
<?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/share.php b/apps/files_sharing/ajax/share.php
index d1f50994317..9b10260da5a 100644
--- a/apps/files_sharing/ajax/share.php
+++ b/apps/files_sharing/ajax/share.php
@@ -1,5 +1,5 @@
<?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/unshare.php b/apps/files_sharing/ajax/unshare.php
index a19a85cfda3..d8a72a00efe 100644
--- a/apps/files_sharing/ajax/unshare.php
+++ b/apps/files_sharing/ajax/unshare.php
@@ -1,5 +1,5 @@
<?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
OC_JSON::checkAppEnabled('files_sharing');
diff --git a/apps/files_sharing/ajax/userautocomplete.php b/apps/files_sharing/ajax/userautocomplete.php
index 21516c3d091..9d971fb62af 100644
--- a/apps/files_sharing/ajax/userautocomplete.php
+++ b/apps/files_sharing/ajax/userautocomplete.php
@@ -1,5 +1,5 @@
<?php
-$RUNTIME_NOAPPS = true;
+//$RUNTIME_NOAPPS = true;
require_once('../../../lib/base.php');
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 4056d693bfa..4457dddbe15 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -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>';
}
diff --git a/apps/media/css/music.css b/apps/media/css/music.css
index 67d56075194..a6738058be3 100644
--- a/apps/media/css/music.css
+++ b/apps/media/css/music.css
@@ -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; }
diff --git a/apps/media/lib_ampache.php b/apps/media/lib_ampache.php
index 0ad84d66809..bc1f853047f 100644
--- a/apps/media/lib_ampache.php
+++ b/apps/media/lib_ampache.php
@@ -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");
diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php
index ef63cea45df..c2bea2d836d 100644
--- a/apps/media/lib_scanner.php
+++ b/apps/media/lib_scanner.php
@@ -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';
}
-} \ No newline at end of file
+}
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php
index 7906241f79b..3261708f590 100644
--- a/apps/user_ldap/appinfo/app.php
+++ b/apps/user_ldap/appinfo/app.php
@@ -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" );
diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php
index 8dbd3c0462b..1f2d8ed9af3 100644
--- a/apps/user_ldap/settings.php
+++ b/apps/user_ldap/settings.php
@@ -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();
diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php
index 32e1b29dafb..2abb0b47291 100644
--- a/apps/user_ldap/templates/settings.php
+++ b/apps/user_ldap/templates/settings.php
@@ -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>
diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php
index 1154efc17b1..106240e74b8 100644
--- a/apps/user_ldap/user_ldap.php
+++ b/apps/user_ldap/user_ldap.php
@@ -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;
+ }
+ }
}