From 6609de28d832262e8f72fb19e5f0343cd021cca3 Mon Sep 17 00:00:00 2001 From: Jenkins for ownCloud Date: Mon, 20 May 2013 02:10:11 +0200 Subject: [tx-robot] updated from transifex --- lib/l10n/nb_NO.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') diff --git a/lib/l10n/nb_NO.php b/lib/l10n/nb_NO.php index fc95561d3b4..23146154c77 100644 --- a/lib/l10n/nb_NO.php +++ b/lib/l10n/nb_NO.php @@ -15,6 +15,8 @@ "Files" => "Filer", "Text" => "Tekst", "Images" => "Bilder", +"Your web server is not yet properly setup to allow files synchronization because the WebDAV interface seems to be broken." => "Din nettservev er ikke konfigurert korrekt for filsynkronisering. WebDAV ser ut til å ikke funkere.", +"Please double check the installation guides." => "Vennligst dobbelsjekk installasjonsguiden.", "seconds ago" => "sekunder siden", "1 minute ago" => "1 minutt siden", "%d minutes ago" => "%d minutter siden", -- cgit v1.2.3 From b1bb899867b787f024c94ae26907b857e203d59c Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 20 May 2013 10:16:07 +0200 Subject: Add rename() method to OC_VCategories. --- lib/vcategories.php | 32 ++++++++++++++++++++++++++++++++ tests/lib/vcategories.php | 10 ++++++++++ 2 files changed, 42 insertions(+) (limited to 'lib') diff --git a/lib/vcategories.php b/lib/vcategories.php index 5975e688b75..74864704e30 100644 --- a/lib/vcategories.php +++ b/lib/vcategories.php @@ -324,6 +324,38 @@ class OC_VCategories { return $id; } + /** + * @brief Rename category. + * @param string $from The name of the existing category + * @param string $to The new name of the category. + * @returns bool + */ + public function rename($from, $to) { + $id = $this->array_searchi($from, $this->categories); + if($id === false) { + OCP\Util::writeLog('core', __METHOD__.', category: ' . $from. ' does not exist', OCP\Util::DEBUG); + return false; + } + + $sql = 'UPDATE `' . self::CATEGORY_TABLE . '` SET `category` = ? ' + . 'WHERE `uid` = ? AND `type` = ? AND `id` = ?'; + try { + $stmt = OCP\DB::prepare($sql); + $result = $stmt->execute(array($to, $this->user, $this->type, $id)); + if (OC_DB::isError($result)) { + echo 'DB error: ' . $result . "\n"; + OC_Log::write('core', __METHOD__. 'DB error: ' . OC_DB::getErrorMessage($result), OC_Log::ERROR); + return false; + } + } catch(Exception $e) { + OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(), + OCP\Util::ERROR); + return false; + } + $this->categories[$id] = $to; + return true; + } + /** * @brief Add a new category. * @param $names A string with a name or an array of strings containing diff --git a/tests/lib/vcategories.php b/tests/lib/vcategories.php index e79dd49870c..a8af6ae9f7a 100644 --- a/tests/lib/vcategories.php +++ b/tests/lib/vcategories.php @@ -81,6 +81,16 @@ class Test_VCategories extends PHPUnit_Framework_TestCase { } + public function testrenameCategory() { + $defcategories = array('Friends', 'Family', 'Wrok', 'Other'); + $catmgr = new OC_VCategories($this->objectType, $this->user, $defcategories); + + $this->assertTrue($catmgr->rename('Wrok', 'Work')); + $this->assertTrue($catmgr->hasCategory('Work')); + $this->assertFalse($catmgr->hasCategory('Wrok')); + + } + public function testAddToCategory() { $objids = array(1, 2, 3, 4, 5, 6, 7, 8, 9); -- cgit v1.2.3 From c38dc3666532199a40d78b647d10c62af4496246 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 20 May 2013 13:56:57 +0200 Subject: Remove debug output --- lib/vcategories.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/vcategories.php b/lib/vcategories.php index 74864704e30..91c72d5dfae 100644 --- a/lib/vcategories.php +++ b/lib/vcategories.php @@ -343,7 +343,6 @@ class OC_VCategories { $stmt = OCP\DB::prepare($sql); $result = $stmt->execute(array($to, $this->user, $this->type, $id)); if (OC_DB::isError($result)) { - echo 'DB error: ' . $result . "\n"; OC_Log::write('core', __METHOD__. 'DB error: ' . OC_DB::getErrorMessage($result), OC_Log::ERROR); return false; } -- cgit v1.2.3