diff options
author | Tom Needham <needham.thomas@gmail.com> | 2012-04-13 20:10:35 +0000 |
---|---|---|
committer | Tom Needham <needham.thomas@gmail.com> | 2012-04-13 20:10:35 +0000 |
commit | 0aaaefbb4bd635a35be46a0a2c375555f6d50efa (patch) | |
tree | b2e529755ed9ea99035b95ea5533f776e07313a2 /apps | |
parent | 1165b358b40b3cf34ac9f909d85782f30be1b6cb (diff) | |
parent | b9f9228a22944184803a8835282862e468812c1d (diff) | |
download | nextcloud-server-0aaaefbb4bd635a35be46a0a2c375555f6d50efa.tar.gz nextcloud-server-0aaaefbb4bd635a35be46a0a2c375555f6d50efa.zip |
Merge branch 'master' of gitorious.org:owncloud/owncloud
Diffstat (limited to 'apps')
-rw-r--r-- | apps/calendar/ajax/categories/rescan.php | 42 | ||||
-rw-r--r-- | apps/calendar/ajax/event/edit.form.php | 20 | ||||
-rw-r--r-- | apps/calendar/ajax/event/new.form.php | 3 | ||||
-rw-r--r-- | apps/calendar/index.php | 1 | ||||
-rw-r--r-- | apps/calendar/lib/app.php | 35 | ||||
-rw-r--r-- | apps/calendar/lib/calendar.php | 4 | ||||
-rw-r--r-- | apps/calendar/lib/object.php | 10 | ||||
-rw-r--r-- | apps/calendar/templates/part.eventform.php | 2 | ||||
-rw-r--r-- | apps/contacts/index.php | 1 | ||||
-rw-r--r-- | apps/contacts/lib/app.php | 5 | ||||
-rw-r--r-- | apps/files_external/tests/config.php | 3 | ||||
-rw-r--r-- | apps/files_external/tests/ftp.php | 31 | ||||
-rw-r--r-- | apps/files_external/tests/google.php | 31 | ||||
-rw-r--r-- | apps/files_external/tests/webdav.php | 29 | ||||
-rw-r--r-- | apps/media/appinfo/database.xml | 69 | ||||
-rw-r--r-- | apps/media/appinfo/info.xml | 2 |
16 files changed, 225 insertions, 63 deletions
diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php new file mode 100644 index 00000000000..0fd878ed8f9 --- /dev/null +++ b/apps/calendar/ajax/categories/rescan.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net> + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +require_once('../../../../lib/base.php'); +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); + +foreach ($_POST as $key=>$element) { + debug('_POST: '.$key.'=>'.print_r($element, true)); +} + +function bailOut($msg) { + OC_JSON::error(array('data' => array('message' => $msg))); + OC_Log::write('calendar','ajax/categories/rescan.php: '.$msg, OC_Log::DEBUG); + exit(); +} +function debug($msg) { + OC_Log::write('calendar','ajax/categories/rescan.php: '.$msg, OC_Log::DEBUG); +} + +$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); +if(count($calendars) == 0) { + bailOut(OC_Calendar_App::$l10n->t('No calendars found.')); +} +$events = array(); +foreach($calendars as $calendar) { + $calendar_events = OC_Calendar_Object::all($calendar['id']); + $events = $events + $calendar_events; +} +if(count($events) == 0) { + bailOut(OC_Calendar_App::$l10n->t('No events found.')); +} + +OC_Calendar_App::scanCategories($events); +$categories = OC_Calendar_App::getCategoryOptions(); + +OC_JSON::success(array('data' => array('categories'=>$categories))); diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php index 837edbbbf05..98c22eb0206 100644 --- a/apps/calendar/ajax/event/edit.form.php +++ b/apps/calendar/ajax/event/edit.form.php @@ -41,13 +41,8 @@ switch($dtstart->getDateType()) { $summary = $vevent->getAsString('SUMMARY'); $location = $vevent->getAsString('LOCATION'); -$categories = $vevent->getAsArray('CATEGORIES'); +$categories = $vevent->getAsString('CATEGORIES'); $description = $vevent->getAsString('DESCRIPTION'); -foreach($categories as $category){ - if (!in_array($category, $category_options)){ - array_unshift($category_options, $category); - } -} $last_modified = $vevent->__get('LAST-MODIFIED'); if ($last_modified){ $lastmodified = $last_modified->getDateTime()->format('U'); @@ -189,7 +184,6 @@ if($data['repeating'] == 1){ } $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); -$category_options = OC_Calendar_App::getCategoryOptions(); $repeat_options = OC_Calendar_App::getRepeatOptions(); $repeat_end_options = OC_Calendar_App::getEndOptions(); $repeat_month_options = OC_Calendar_App::getMonthOptions(); @@ -205,7 +199,6 @@ $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); $tmpl->assign('repeat_month_options', $repeat_month_options); $tmpl->assign('repeat_weekly_options', $repeat_weekly_options); @@ -242,7 +235,14 @@ if($repeat['repeat'] != 'doesnotrepeat'){ $tmpl->assign('repeat_bymonthday', $repeat['bymonthday']); $tmpl->assign('repeat_bymonth', $repeat['bymonth']); $tmpl->assign('repeat_byweekno', $repeat['byweekno']); +} else { + $tmpl->assign('repeat_month', 'monthday'); + $tmpl->assign('repeat_weekdays', array()); + $tmpl->assign('repeat_interval', 1); + $tmpl->assign('repeat_end', 'never'); + $tmpl->assign('repeat_count', '10'); + $tmpl->assign('repeat_weekofmonth', 'auto'); + $tmpl->assign('repeat_date', ''); + $tmpl->assign('repeat_year', 'bydate'); } $tmpl->printpage(); - -?>
\ No newline at end of file diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php index c19928a727e..838002a3a09 100644 --- a/apps/calendar/ajax/event/new.form.php +++ b/apps/calendar/ajax/event/new.form.php @@ -32,7 +32,6 @@ $start->setTimezone(new DateTimeZone($timezone)); $end->setTimezone(new DateTimeZone($timezone)); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); -$category_options = OC_Calendar_App::getCategoryOptions(); $repeat_options = OC_Calendar_App::getRepeatOptions(); $repeat_end_options = OC_Calendar_App::getEndOptions(); $repeat_month_options = OC_Calendar_App::getMonthOptions(); @@ -46,7 +45,6 @@ $repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions(); $tmpl = new OC_Template('calendar', 'part.newevent'); $tmpl->assign('calendar_options', $calendar_options); -$tmpl->assign('category_options', $category_options); $tmpl->assign('repeat_options', $repeat_options); $tmpl->assign('repeat_month_options', $repeat_month_options); $tmpl->assign('repeat_weekly_options', $repeat_weekly_options); @@ -73,4 +71,3 @@ $tmpl->assign('repeat_weekofmonth', 'auto'); $tmpl->assign('repeat_date', ''); $tmpl->assign('repeat_year', 'bydate'); $tmpl->printpage(); -?> diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 67e61dee40a..f964a13ef79 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -48,7 +48,6 @@ OC_Util::addScript('', 'jquery.multiselect'); OC_Util::addStyle('', 'jquery.multiselect'); OC_Util::addScript('contacts','jquery.multi-autocomplete'); OC_Util::addScript('','oc-vcategories'); -OC_Util::addStyle('','oc-vcategories'); OC_App::setActiveNavigationEntry('calendar_index'); $tmpl = new OC_Template('calendar', 'calendar', 'user'); $tmpl->assign('eventSources', $eventSources); diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index b58b70d2df8..22c1133e006 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -89,6 +89,41 @@ class OC_Calendar_App{ return $categories; } + /** + * scan events for categories. + * @param $events VEVENTs to scan. null to check all events for the current user. + */ + public static function scanCategories($events = null) { + if (is_null($events)) { + $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); + if(count($calendars) > 0) { + $events = array(); + foreach($calendars as $calendar) { + $calendar_events = OC_Calendar_Object::all($calendar['id']); + $events = $events + $calendar_events; + } + } + } + if(is_array($events) && count($events) > 0) { + $vcategories = self::getVCategories(); + $vcategories->delete($vcategories->categories()); + foreach($events as $event) { + $vobject = OC_VObject::parse($event['calendardata']); + if(!is_null($vobject)) { + $vcategories->loadFromVObject($vobject->VEVENT, true); + } + } + } + } + + /** + * check VEvent for new categories. + * @see OC_VCategories::loadFromVObject + */ + public static function loadCategoriesFromVCalendar(OC_VObject $calendar) { + self::getVCategories()->loadFromVObject($calendar->VEVENT, true); + } + public static function getRepeatOptions(){ return OC_Calendar_Object::getRepeatOptions(self::$l10n); } diff --git a/apps/calendar/lib/calendar.php b/apps/calendar/lib/calendar.php index 7eeb004d181..321f4c73ba0 100644 --- a/apps/calendar/lib/calendar.php +++ b/apps/calendar/lib/calendar.php @@ -44,10 +44,8 @@ class OC_Calendar_Calendar{ /** * @brief Returns the list of calendars for a specific user. * @param string $uid User ID - * @param boolean $active + * @param boolean $active Only return calendars with this $active state, default(=null) is don't care * @return array - * - * TODO: what is active for? */ public static function allCalendars($uid, $active=null){ $values = array($uid); diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 4d4421b5c4a..d5622f6251f 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -93,6 +93,7 @@ class OC_Calendar_Object{ */ public static function add($id,$data){ $object = OC_VObject::parse($data); + OC_Calendar_App::loadCategoriesFromVCalendar($object); list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object); if(is_null($uid)){ @@ -139,6 +140,7 @@ class OC_Calendar_Object{ $oldobject = self::find($id); $object = OC_VObject::parse($data); + OC_Calendar_App::loadCategoriesFromVCalendar($object); list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object); $stmt = OC_DB::prepare( 'UPDATE *PREFIX*calendar_objects SET objecttype=?,startdate=?,enddate=?,repeating=?,summary=?,calendardata=?, lastmodified = ? WHERE id = ?' ); @@ -436,10 +438,6 @@ class OC_Calendar_Object{ $errnum++; } - if(isset($request['categories']) && !is_array($request['categories'])){ - $errors['categories'] = $l10n->t('Not an array'); - } - $fromday = substr($request['from'], 0, 2); $frommonth = substr($request['from'], 3, 2); $fromyear = substr($request['from'], 6, 4); @@ -607,7 +605,7 @@ class OC_Calendar_Object{ { $title = $request["title"]; $location = $request["location"]; - $categories = isset($request["categories"]) ? $request["categories"] : array(); + $categories = $request["categories"]; $allday = isset($request["allday"]); $from = $request["from"]; $to = $request["to"]; @@ -781,7 +779,7 @@ class OC_Calendar_Object{ $vevent->setString('LOCATION', $location); $vevent->setString('DESCRIPTION', $description); - $vevent->setString('CATEGORIES', join(',', $categories)); + $vevent->setString('CATEGORIES', $categories); /*if($repeat == "true"){ $vevent->RRULE = $repeat; diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index 130ce111b03..3830c273a73 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -10,7 +10,7 @@ <tr> <th width="75px"><?php echo $l->t("Category");?>:</th> <td> - <input id="category" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>"> + <input id="category" name="categories" type="text" placeholder="<?php echo $l->t('Separate categories with commas'); ?>" value="<?php echo isset($_['categories']) ? htmlspecialchars($_['categories']) : '' ?>"> <a class="action edit" onclick="$(this).tipsy('hide');OCCategories.edit();" title="<?php echo $l->t('Edit categories'); ?>"><img alt="<?php echo $l->t('Edit categories'); ?>" src="<?php echo image_path('core','actions/rename.svg')?>" class="svg action" style="width: 16px; height: 16px;"></a> </td> <?php if(count($_['calendar_options']) > 1) { ?> diff --git a/apps/contacts/index.php b/apps/contacts/index.php index c3650a36086..4039b8afd3d 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -52,7 +52,6 @@ OC_Util::addScript('contacts','jquery.inview'); OC_Util::addScript('contacts','jquery.Jcrop'); OC_Util::addScript('contacts','jquery.multi-autocomplete'); OC_Util::addStyle('','jquery.multiselect'); -OC_Util::addStyle('','oc-vcategories'); OC_Util::addStyle('contacts','jquery.combobox'); OC_Util::addStyle('contacts','jquery.Jcrop'); OC_Util::addStyle('contacts','contacts'); diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php index f6f6e619075..78fdfe6a10a 100644 --- a/apps/contacts/lib/app.php +++ b/apps/contacts/lib/app.php @@ -53,11 +53,12 @@ class OC_Contacts_App { if( $addressbook === false || $addressbook['userid'] != OC_User::getUser()) { if ($addressbook === false) { OC_Log::write('contacts', 'Addressbook not found: '. $id, OC_Log::ERROR); + OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.')))); } else { OC_Log::write('contacts', 'Addressbook('.$id.') is not from '.OC_User::getUser(), OC_Log::ERROR); + OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); } - OC_JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.')))); // Same here (as with the contact error). Could this error be improved? exit(); } return $addressbook; @@ -194,7 +195,7 @@ class OC_Contacts_App { * @see OC_VCategories::loadFromVObject */ public static function loadCategoriesFromVCard(OC_VObject $contact) { - self::$categories->loadFromVObject($contact); + self::$categories->loadFromVObject($contact, true); } public static function setLastModifiedHeader($contact) { diff --git a/apps/files_external/tests/config.php b/apps/files_external/tests/config.php index 9b40d2b98cf..fa4c74a6e26 100644 --- a/apps/files_external/tests/config.php +++ b/apps/files_external/tests/config.php @@ -1,18 +1,21 @@ <?php return array( 'ftp'=>array( + 'run'=>false, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'/test', ), 'webdav'=>array( + 'run'=>false, 'host'=>'localhost', 'user'=>'test', 'password'=>'test', 'root'=>'/owncloud/files/webdav.php', ), 'google'=>array( + 'run'=>false, 'consumer_key'=>'anonymous', 'consumer_secret'=>'anonymous', 'token'=>'test', diff --git a/apps/files_external/tests/ftp.php b/apps/files_external/tests/ftp.php index aa565751ba3..e30fb9a1c38 100644 --- a/apps/files_external/tests/ftp.php +++ b/apps/files_external/tests/ftp.php @@ -5,19 +5,26 @@ * later. * See the COPYING-README file. */ + +$config=include('apps/files_external/tests/config.php'); +if(!is_array($config) or !isset($config['ftp']) or !$config['ftp']['run']){ + abstract class Test_Filestorage_FTP extends Test_FileStorage{} + return; +}else{ + class Test_Filestorage_FTP extends Test_FileStorage { + private $config; + private $id; -class Test_Filestorage_FTP extends Test_FileStorage { - private $config; - private $id; + public function setUp(){ + $id=uniqid(); + $this->config=include('apps/files_external/tests/config.php'); + $this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in + $this->instance=new OC_Filestorage_FTP($this->config['ftp']); + } - public function setUp(){ - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['ftp']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_FTP($this->config['ftp']); - } - - public function tearDown(){ - OC_Helper::rmdirr($this->instance->constructUrl('')); + public function tearDown(){ + OC_Helper::rmdirr($this->instance->constructUrl('')); + } } } + diff --git a/apps/files_external/tests/google.php b/apps/files_external/tests/google.php index 1c028945228..08116f0e748 100644 --- a/apps/files_external/tests/google.php +++ b/apps/files_external/tests/google.php @@ -20,19 +20,26 @@ * License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -class Test_Filestorage_Google extends Test_FileStorage { - - private $config; - private $id; +$config=include('apps/files_external/tests/config.php'); +if(!is_array($config) or !isset($config['google']) or !$config['google']['run']){ + abstract class Test_Filestorage_Google extends Test_FileStorage{} + return; +}else{ + class Test_Filestorage_Google extends Test_FileStorage { + + private $config; + private $id; - public function setUp(){ - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_Google($this->config['google']); - } + public function setUp(){ + $id=uniqid(); + $this->config=include('apps/files_external/tests/config.php'); + $this->config['google']['root'].='/'.$id;//make sure we have an new empty folder to work in + $this->instance=new OC_Filestorage_Google($this->config['google']); + } - public function tearDown(){ - $this->instance->rmdir('/'); + public function tearDown(){ + $this->instance->rmdir('/'); + } } } + diff --git a/apps/files_external/tests/webdav.php b/apps/files_external/tests/webdav.php index 51799290540..144659819b6 100644 --- a/apps/files_external/tests/webdav.php +++ b/apps/files_external/tests/webdav.php @@ -6,18 +6,25 @@ * See the COPYING-README file. */ -class Test_Filestorage_DAV extends Test_FileStorage { - private $config; - private $id; +$config=include('apps/files_external/tests/config.php'); +if(!is_array($config) or !isset($config['webdav']) or !$config['webdav']['run']){ + abstract class Test_Filestorage_DAV extends Test_FileStorage{} + return; +}else{ + class Test_Filestorage_DAV extends Test_FileStorage { + private $config; + private $id; - public function setUp(){ - $id=uniqid(); - $this->config=include('apps/files_external/tests/config.php'); - $this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in - $this->instance=new OC_Filestorage_DAV($this->config['webdav']); - } + public function setUp(){ + $id=uniqid(); + $this->config=include('apps/files_external/tests/config.php'); + $this->config['webdav']['root'].='/'.$id;//make sure we have an new empty folder to work in + $this->instance=new OC_Filestorage_DAV($this->config['webdav']); + } - public function tearDown(){ - $this->instance->rmdir('/'); + public function tearDown(){ + $this->instance->rmdir('/'); + } } } + diff --git a/apps/media/appinfo/database.xml b/apps/media/appinfo/database.xml index 223682fcfcd..702ae9c28b4 100644 --- a/apps/media/appinfo/database.xml +++ b/apps/media/appinfo/database.xml @@ -45,6 +45,30 @@ <notnull>true</notnull> <length>200</length> </field> + + <index> + <name>album_index</name> + <field> + <name>album_id</name> + <sorting>ascending</sorting> + </field> + </index> + + <index> + <name>album_name_index</name> + <field> + <name>album_name</name> + <sorting>ascending</sorting> + </field> + </index> + + <index> + <name>album_artist_index</name> + <field> + <name>album_artist</name> + <sorting>ascending</sorting> + </field> + </index> </declaration> @@ -81,6 +105,21 @@ <sorting>ascending</sorting> </field> </index> + + <index> + <name>artist_index</name> + <field> + <name>artist_id</name> + <sorting>ascending</sorting> + </field> + </index> + <index> + <name>artist_name_index</name> + <field> + <name>artist_name</name> + <sorting>ascending</sorting> + </field> + </index> </declaration> @@ -223,6 +262,36 @@ <notnull>true</notnull> <length>4</length> </field> + + <index> + <name>song_index</name> + <field> + <name>song_id</name> + <sorting>ascending</sorting> + </field> + </index> + <index> + <name>song_album_index</name> + <field> + <name>song_album</name> + <sorting>ascending</sorting> + </field> + </index> + <index> + <name>song_artist_index</name> + <field> + <name>song_artist</name> + <sorting>ascending</sorting> + </field> + </index> + <index> + <name>song_name_index</name> + <field> + <name>song_name</name> + <sorting>ascending</sorting> + </field> + </index> + </declaration> diff --git a/apps/media/appinfo/info.xml b/apps/media/appinfo/info.xml index 795c9a4dd71..4a642bf889d 100644 --- a/apps/media/appinfo/info.xml +++ b/apps/media/appinfo/info.xml @@ -3,7 +3,7 @@ <id>media</id> <name>Media</name> <description>Media player and server for ownCloud</description> - <version>0.2</version> + <version>0.3</version> <licence>AGPL</licence> <author>Robin Appelman</author> <require>2</require> |