]> source.dussan.org Git - nextcloud-server.git/commitdiff
Removed redundant code.
authorMarvin Thomas Rabe <m.rabe@echtzeitraum.de>
Wed, 22 Feb 2012 15:04:17 +0000 (16:04 +0100)
committerMarvin Thomas Rabe <m.rabe@echtzeitraum.de>
Wed, 22 Feb 2012 15:04:32 +0000 (16:04 +0100)
12 files changed:
apps/bookmarks/addBm.php
apps/bookmarks/ajax/addBookmark.php
apps/bookmarks/ajax/getMeta.php [deleted file]
apps/bookmarks/appinfo/app.php
apps/bookmarks/appinfo/database.xml
apps/bookmarks/appinfo/info.xml
apps/bookmarks/js/addBm.js
apps/bookmarks/js/bookmarks.js
apps/bookmarks/settings.php
apps/bookmarks/templates/addBm.php
apps/bookmarks/templates/list.php
apps/bookmarks/templates/settings.php

index f56022c42c2b4405c9f43c4cade29f4524fc316f..d3d6ab0b1a2e293db2519e449f6d4be1ad76c07c 100644 (file)
@@ -27,8 +27,6 @@ require_once('../../lib/base.php');
 OC_Util::checkLoggedIn();
 OC_Util::checkAppEnabled('bookmarks');
 
-require_once('bookmarksHelper.php');
-
 OC_App::setActiveNavigationEntry( 'bookmarks_index' );
 
 OC_Util::addScript('bookmarks','addBm');
@@ -37,10 +35,6 @@ OC_Util::addStyle('bookmarks', 'bookmarks');
 $tmpl = new OC_Template( 'bookmarks', 'addBm', 'user' );
 
 $url = isset($_GET['url']) ? urldecode($_GET['url']) : '';
-$metadata = getURLMetadata($url);
-
-$tmpl->assign('URL', htmlentities($metadata['url'],ENT_COMPAT,'utf-8'));
-$title = isset($metadata['title']) ? $metadata['title'] : (isset($_GET['title']) ? $_GET['title'] : '');
-$tmpl->assign('TITLE', htmlentities($title,ENT_COMPAT,'utf-8'));
+$tmpl->assign('URL', htmlentities($url,ENT_COMPAT,'utf-8'));
 
 $tmpl->printPage();
index 45b16ae5fa6e4a76c93b200f959187f844626349..89446564110d86b2942e42f13e224d21a0335c3c 100644 (file)
@@ -45,8 +45,13 @@ $query = OC_DB::prepare("
        (url, title, user_id, public, added, lastmodified)
        VALUES (?, ?, ?, 0, $_ut, $_ut)
        ");
-       
-       
+
+if(empty($_GET["title"])) {
+       require_once('../bookmarksHelper.php');
+       $metadata = getURLMetadata($_GET["url"]);
+       $_GET["title"] = $metadata['title'];
+}
+
 $params=array(
        htmlspecialchars_decode($_GET["url"]),
        htmlspecialchars_decode($_GET["title"]),
@@ -56,7 +61,6 @@ $query->execute($params);
 
 $b_id = OC_DB::insertid('*PREFIX*bookmarks');
 
-
 if($b_id !== false) {
        $query = OC_DB::prepare("
                INSERT INTO *PREFIX*bookmarks_tags
@@ -76,4 +80,3 @@ if($b_id !== false) {
 
        OC_JSON::success(array('data' => $b_id));
 }
-
diff --git a/apps/bookmarks/ajax/getMeta.php b/apps/bookmarks/ajax/getMeta.php
deleted file mode 100644 (file)
index ca79731..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
-* ownCloud - bookmarks plugin
-*
-* @author Arthur Schiwon
-* @copyright 2011 Arthur Schiwon blizzz@arthur-schiwon.de
-* 
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-* License as published by the Free Software Foundation; either 
-* version 3 of the License, or any later version.
-* 
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-*  
-* You should have received a copy of the GNU Lesser General Public 
-* License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-* 
-*/
-
-//no apps or filesystem
-$RUNTIME_NOSETUPFS=true;
-
-require_once('../../../lib/base.php');
-
-// Check if we are a user
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('bookmarks');
-
-// $metadata = array();
-
-require '../bookmarksHelper.php';
-$metadata = getURLMetadata(htmlspecialchars_decode($_GET["url"]));
-
-
-OC_JSON::success(array('data' => $metadata));
index 479d8ed476751a830ef4486c6dbdd68c6ca6dab8..a1f6139d89bfe9307c8326e3285830f0d47742b8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
-* Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+* Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
 * Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
index fca38ad84b2d5c5e2d82098cd54360635765e225..f2fc68e4b5824ed8c4690a12f8cbd6ab936ad947 100644 (file)
                                        <sorting>descending</sorting>
                                </field>
                        </index>
-<!--                   <index>
-                               <name>url</name>
-                               <unique>true</unique>
-                               <field>
-                                       <name>url</name>
-                                       <sorting>ascending</sorting>
-                               </field>
-                       </index>-->
                </declaration>
        </table>
        
index 23aa6c219a9fb6be93bb66bb4813ebe64e69fb1d..862ab805a60f2eafd29afa57e02bcac9c75113ea 100644 (file)
@@ -3,8 +3,8 @@
        <id>bookmarks</id>
        <name>Bookmarks</name>
        <description>Bookmark manager for ownCloud</description>
-       <version>0.1</version>
+       <version>0.2</version>
        <licence>AGPL</licence>
-       <author>Arthur Schiwon</author>
+       <author>Arthur Schiwon, Marvin Thomas Rabe</author>
        <require>2</require>
 </info>
\ No newline at end of file
index 59735f80ca6e289c6ff9c4b505e163652c5fa2b1..d64e55e8920c0ab16af88f79d276b626dd6ae19b 100644 (file)
@@ -4,11 +4,10 @@ $(document).ready(function() {
 
 function addBookmark(event) {
        var url = $('#bookmark_add_url').val();
-       var title = $('#bookmark_add_title').val();
        var tags = $('#bookmark_add_tags').val();
        $.ajax({
                url: 'ajax/addBookmark.php',
-               data: 'url=' + encodeURI(url) + '&title=' + encodeURI(title) + '&tags=' + encodeURI(tags),
+               data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
                success: function(data){ 
                        window.close();
                }
index 328f88a45d9276cd8742c7d91f469577bceb6f65..6db0969a2bbb85cec96170537901630f33c706b4 100644 (file)
@@ -11,8 +11,6 @@ $(document).ready(function() {
        $('#bookmark_add_submit').click(addOrEditBookmark);
        $(window).scroll(updateOnBottom);
        
-       $('#bookmark_add_url').focusout(getMetadata);
-       
        $('.bookmarks_list').empty();
        getBookmarks();
        
@@ -47,20 +45,6 @@ function getBookmarks() {
        });     
 }
 
-function getMetadata() {
-       var url = encodeEntities($('#bookmark_add_url').val());
-       $('.loading_meta').css('display','inline');
-       $.ajax({
-               url: 'ajax/getMeta.php',
-               data: 'url=' + encodeURIComponent(url),
-               success: function(pageinfo){
-                       $('#bookmark_add_url').val(pageinfo.data.url);
-                       $('#bookmark_add_title').val(pageinfo.data.title);
-                       $('.loading_meta').css('display','none');
-               }
-       });
-}
-
 // function addBookmark() {
 // Instead of creating editBookmark() function, Converted the one above to
 // addOrEditBookmark() to make .js file more compact.
@@ -86,21 +70,9 @@ function addOrEditBookmark(event) {
                                var bookmark_id = response.data;
                                $('.bookmarks_add').slideToggle(); 
                                $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); 
-                               $('.bookmarks_list').prepend(
-                               '<div class="bookmark_single" data-id="' + bookmark_id + '" >' +
-                                       '<p class="bookmark_actions">' +
-                                               '<span class="bookmark_delete">' +
-                                                       '<img class="svg" src="'+OC.imagePath('core', 'actions/delete')+'" title="Delete">' +
-                                               '</span>&nbsp;' +
-                                               '<span class="bookmark_edit">' +
-                                                       '<img class="svg" src="'+OC.imagePath('core', 'actions/rename')+'" title="Edit">' +
-                                               '</span>' +
-                                       '</p>' +
-                                       '<p class="bookmark_title"><a href="' + url + '" target="_blank" class="bookmark_link">' + title + '</a></p>' +
-                                       '<p class="bookmark_tags">' + tagshtml + '</p>' +
-                                       '<p class="bookmark_url">' + url + '</p>' +
-                               '</div>'
-                               );
+                               $('.bookmarks_list').empty();
+                               bookmarks_page = 0;
+                               getBookmarks();
                        }
                });
        }
@@ -112,15 +84,9 @@ function addOrEditBookmark(event) {
                                $('.bookmarks_add').slideToggle(); 
                                $('.bookmarks_add').children('p').children('.bookmarks_input').val(''); 
                                $('#bookmark_add_id').val('0');
-                               
-                               var record = $('.bookmark_single[data-id = "' + id + '"]');
-                               record.children('.bookmark_url:first').text(url);
-                               
-                               var record_title = record.children('.bookmark_title:first').children('a:first');
-                               record_title.attr('href', url);
-                               record_title.text(title);
-                               
-                               record.children('.bookmark_tags:first').html(tagshtml);
+                               $('.bookmarks_list').empty();
+                               bookmarks_page = 0;
+                               getBookmarks();
                        }
                });
        }
@@ -162,6 +128,7 @@ function updateBookmarksList(bookmark) {
        if(!hasProtocol(bookmark.url)) {
                bookmark.url = 'http://' + bookmark.url;
        }
+       if(bookmark.title == '') bookmark.title = bookmark.url;
        $('.bookmarks_list').append(
                '<div class="bookmark_single" data-id="' + bookmark.id +'" >' +
                        '<p class="bookmark_actions">' +
index 0ace04fa2c8e3efe0b6fb481b105a21f4ae772e9..9d945f64dadc0a20ac8b011240c3bd543e30a34e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
  * See the COPYING-README file.
@@ -8,6 +8,4 @@
 
 $tmpl = new OC_Template( 'bookmarks', 'settings');
 
-//OC_Util::addScript('bookmarks','settings');
-
 return $tmpl->fetchPage();
index c285c3579c565e82d459130c0b035df498b32017..9067d3481a32fbc643aadbc05cb81a2c76f8c8fc 100644 (file)
@@ -1,6 +1,5 @@
 <div class="bookmarks_addBm">
        <p><label class="bookmarks_label"><?php echo $l->t('Address'); ?></label><input type="text" id="bookmark_add_url" class="bookmarks_input" value="<?php echo $_['URL']; ?>"/></p>
-       <p><label class="bookmarks_label"><?php echo $l->t('Title'); ?></label><input type="text" id="bookmark_add_title" class="bookmarks_input" value="<?php echo $_['TITLE']; ?>" /></p>
        <p><label class="bookmarks_label"><?php echo $l->t('Tags'); ?></label><input type="text" id="bookmark_add_tags" class="bookmarks_input" /></p>
        <p><label class="bookmarks_label"> </label><label class="bookmarks_hint"><?php echo $l->t('Hint: Use space to separate tags.'); ?></label></p>
        <p><label class="bookmarks_label"></label><input type="submit" value="<?php echo $l->t('Add bookmark'); ?>" id="bookmark_add_submit" /></p>
index bd33fe457fd9b05ebb4fa8318266906da2225ceb..d772cb905aa878a424259773d8bffbc504720102 100644 (file)
@@ -1,6 +1,6 @@
 <?php 
 /**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
  * Copyright (c) 2011 Arthur Schiwon <blizzz@arthur-schiwon.de>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
index 41433d847678c51adb2c986247cd9963bd9cffd3..b787e31f3c582e4479ef79baeedfe1ae71a4ffa0 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright (c) 2011 Marvin Thomas Rabe <m.rabe@echtzeitraum.de>
+ * Copyright (c) 2011 Marvin Thomas Rabe <mrabe@marvinrabe.de>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
  * See the COPYING-README file.