From 7f782e44965b005efe01d347dedd1825872b9345 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 18:49:05 -0500 Subject: Add ability to tag an article on creation --- inc/poche/Poche.class.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a29cb327..c7c59878 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -180,6 +180,13 @@ class Poche } } + // if there are tags, add them to the new article + if (isset($_GET['tags'])) { + $_POST['value'] = $_GET['tags']; + $_POST['entry_id'] = $last_id; + $this->action('add_tag', $url); + } + $this->messages->add('s', _('the link has been added successfully')); } else { -- cgit v1.2.3 From 512e5e5bd195ea4547dc7fa29f34a9d205bd7a54 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 19:11:45 -0500 Subject: Add ability to delete all articles matching a search --- inc/poche/Poche.class.php | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index c7c59878..540aa55e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -201,18 +201,31 @@ class Poche } break; case 'delete': - $msg = 'delete link #' . $id; - if ($this->store->deleteById($id, $this->user->getId())) { - if (DOWNLOAD_PICTURES) { - Picture::removeDirectory(ABS_PATH . $id); + if (isset($_GET['search'])) { + //when we want to apply a delete to a search + $tags = array($_GET['search']); + $allentry_ids = $this->store->search($tags[0], $this->user->getId()); + $entry_ids = array(); + foreach ($allentry_ids as $eachentry) { + $entry_ids[] = $eachentry[0]; } - $this->messages->add('s', _('the link has been deleted successfully')); + } else { // delete a single article + $entry_ids = array($id); } - else { - $this->messages->add('e', _('the link wasn\'t deleted')); - $msg = 'error : can\'t delete link #' . $id; + foreach($entry_ids as $id) { + $msg = 'delete link #' . $id; + if ($this->store->deleteById($id, $this->user->getId())) { + if (DOWNLOAD_PICTURES) { + Picture::removeDirectory(ABS_PATH . $id); + } + $this->messages->add('s', _('the link has been deleted successfully')); + } + else { + $this->messages->add('e', _('the link wasn\'t deleted')); + $msg = 'error : can\'t delete link #' . $id; + } + Tools::logm($msg); } - Tools::logm($msg); Tools::redirect('?'); break; case 'toggle_fav' : -- cgit v1.2.3 From 13c7f9a462b71e89d5e252b693fc7d00aca249ec Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Mon, 12 Jan 2015 19:52:41 -0500 Subject: Add ability to mark all articles from a tag as read --- inc/poche/Poche.class.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 540aa55e..20897c61 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -240,8 +240,21 @@ class Poche } break; case 'toggle_archive' : - $this->store->archiveById($id, $this->user->getId()); - Tools::logm('archive link #' . $id); + if (isset($_GET['tag_id'])) { + //when we want to archive a whole tag + $tag_id = $_GET['tag_id']; + $allentry_ids = $this->store->retrieveEntriesByTag($tag_id, $this->user->getId()); + $entry_ids = array(); + foreach ($allentry_ids as $eachentry) { + $entry_ids[] = $eachentry[0]; + } + } else { //archive a single article + $entry_ids = array($id); + } + foreach($entry_ids as $id) { + $this->store->archiveById($id, $this->user->getId()); + Tools::logm('archive link #' . $id); + } if ( Tools::isAjaxRequest() ) { echo 1; exit; -- cgit v1.2.3