]> gitweb.fluxo.info Git - semanticscuttle.git/commitdiff
Bug fix: correct popup behaviour.
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 17 Feb 2009 09:36:20 +0000 (09:36 +0000)
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>
Tue, 17 Feb 2009 09:36:20 +0000 (09:36 +0000)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@284 b3834d28-1941-0410-a4f8-b48e95affb8f

bookmarks.php
edit.php
services/bookmarkservice.php
templates/editbookmark.tpl.php

index 6f2463e52bfdfac4bf0bf1cb8cf76839f5d11e8f..81af8afc080c1ba8e18dc3b11cfad9de6ec30771 100644 (file)
@@ -104,9 +104,9 @@ if ($user) {
 }
 if ($cat) {
        $catTitle = ': '. str_replace('+', ' + ', $cat);
-       
-       $catTitleWithUrls = ': ';       
-       $titleTags = explode('+', filter($cat));        
+
+       $catTitleWithUrls = ': ';
+       $titleTags = explode('+', filter($cat));
        for($i = 0; $i<count($titleTags);$i++) {
                $catTitleWithUrls.= $titleTags[$i].'<a href="'.createUrl('bookmarks', $user.'/'.aggregateTags($titleTags, '+', $titleTags[$i])).'" title="'.T_('Remove the tag from the selection').'">*</a> + ';
        }
@@ -162,8 +162,8 @@ if ($userservice->isLoggedOn() && POST_SUBMITTED != '') {
 
 if (GET_ACTION == "add") {
        // If the bookmark exists already, edit the original
-       if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {
-               $bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, md5(stripslashes(GET_ADDRESS)));
+       if ($bookmarkservice->bookmarkExists(stripslashes(GET_ADDRESS), $currentUserID)) {              
+               $bookmark =& $bookmarkservice->getBookmarks(0, NULL, $currentUserID, NULL, NULL, NULL, NULL, NULL, NULL, md5($bookmarkservice->normalize(stripslashes(GET_ADDRESS))));
                $popup = (GET_POPUP!='') ? '?popup=1' : '';
                header('Location: '. createURL('edit', $bookmark['bookmarks'][0]['bId'] . $popup));
                exit();
@@ -184,11 +184,23 @@ if ($templatename == 'editbookmark.tpl') {
                                'bStatus' => 0,
                        );
                        $tplVars['tags'] = POST_TAGS;
-               } else {                        
-                       $tplVars['row'] = $bookmarkservice->getBookmark(GET_COPYOF, true);
-                       if(!$currentUser->isAdmin()) {
-                               $tplVars['row']['bPrivateNote'] = ''; //only admin can copy private note
-                       }               
+               } else {
+                       if(GET_COPYOF != '') {  //copy from bookmarks page
+                               $tplVars['row'] = $bookmarkservice->getBookmark(GET_COPYOF, true);
+                               if(!$currentUser->isAdmin()) {
+                                       $tplVars['row']['bPrivateNote'] = ''; //only admin can copy private note
+                               }
+                       }else {  //copy from pop-up bookmarklet
+                        $tplVars['row'] = array(
+                               'bTitle' => stripslashes(GET_TITLE),
+                'bAddress' => stripslashes(GET_ADDRESS),
+                'bDescription' => stripslashes(GET_DESCRIPTION),
+                'bPrivateNote' => stripslashes(GET_PRIVATENOTE),
+                'tags' => (GET_TAGS ? explode(',', stripslashes(GET_TAGS)) : array()),
+                'bStatus' => 0
+                        );
+                       }
+                               
                }
                $title = T_('Add a Bookmark');
                $tplVars['referrer'] = $_SERVER['HTTP_REFERER'];
index 9011ac3ca120c5111ddc64f94257bec56a2eccb3..01f2e592e0343c5f1589d5ce9294d6405cacdaf8 100644 (file)
--- a/edit.php
+++ b/edit.php
@@ -87,12 +87,13 @@ if (!($row = $bookmarkservice->getBookmark(intval($bookmark), true))) {
         if (POST_DELETE != '') {
             // Delete bookmark
             if ($bookmarkservice->deleteBookmark($bookmark)) {
-                if (POST_REFERRER != '') {
+               if (POST_POPUP != '') {                         
+                       $tplVars['msg'] = '<script type="text/javascript">window.close();</script>';
+               } elseif (POST_REFERRER != '') {
                     header('Location: '. POST_REFERRER);
                 } else {
                     header('Location: '. createURL('bookmarks', $currentUser->getUsername()));
                 }
-                exit();
             } else {
                 $tplVars['error'] = T_('Failed to delete bookmark');
                 $templateservice->loadTemplate('error.500.tpl', $tplVars);
index dcce54bfed9bd9fbd2f78e8e6753917a050e7132..22044f2d05ab0588d1338473c53dc1b6ad056dae 100644 (file)
@@ -436,8 +436,10 @@ class BookmarkService {
                        message_die(GENERAL_ERROR, 'Could not delete bookmarks', '', __LINE__, __FILE__, $query, $this->db);
                        return false;
                }
+               
+               
 
-               $query = 'DELETE FROM '. $GLOBALS['tableprefix'] .'tags WHERE bId = '. intval($bookmarkid);
+               $query = 'DELETE FROM '. $GLOBALS['tableprefix'] .'bookmarks2tags WHERE bId = '. intval($bookmarkid);
                $this->db->sql_transaction('begin');
                if (!($dbresult = & $this->db->sql_query($query))) {
                        $this->db->sql_transaction('rollback');
index bbf34848a14099929358ee0d7825429e8448b121..8031aad3b4c667057ac84a2eb1e00a133bcbdb4b 100644 (file)
@@ -95,7 +95,7 @@ $this->includeTemplate("dojo.inc");
     <td></td>
     <td>
         <input type="submit" name="submitted" value="<?php echo $btnsubmit; ?>" />
-        <input type="button" name="cancel" value="<?php echo T_('Cancel') ?>" onclick="javascript: history.go(-1)" />
+        <input type="button" name="cancel" value="<?php echo T_('Cancel') ?>" onclick="<?php echo $popup?'window.close();':'javascript: history.go(-1)'; ?>" />
         <?php
         if (isset($showdelete) && $showdelete) {
         ?>