mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-23 17:42:15 -05:00
Feature #457 : import from pocket now import tags too
This commit is contained in:
parent
d09a5674e9
commit
926acd7bba
@ -365,7 +365,7 @@ class Poche
|
|||||||
/**
|
/**
|
||||||
* Call action (mark as fav, archive, delete, etc.)
|
* Call action (mark as fav, archive, delete, etc.)
|
||||||
*/
|
*/
|
||||||
public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE)
|
public function action($action, Url $url, $id = 0, $import = FALSE, $autoclose = FALSE, $tags = null)
|
||||||
{
|
{
|
||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
@ -461,8 +461,14 @@ class Poche
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'add_tag' :
|
case 'add_tag' :
|
||||||
|
if($import){
|
||||||
|
$entry_id = $id;
|
||||||
|
$tags = explode(',', $tags);
|
||||||
|
}
|
||||||
|
else{
|
||||||
$tags = explode(',', $_POST['value']);
|
$tags = explode(',', $_POST['value']);
|
||||||
$entry_id = $_POST['entry_id'];
|
$entry_id = $_POST['entry_id'];
|
||||||
|
}
|
||||||
$entry = $this->store->retrieveOneById($entry_id, $this->user->getId());
|
$entry = $this->store->retrieveOneById($entry_id, $this->user->getId());
|
||||||
if (!$entry) {
|
if (!$entry) {
|
||||||
$this->messages->add('e', _('Article not found!'));
|
$this->messages->add('e', _('Article not found!'));
|
||||||
@ -489,7 +495,9 @@ class Poche
|
|||||||
# we assign the tag to the article
|
# we assign the tag to the article
|
||||||
$this->store->setTagToEntry($tag_id, $entry_id);
|
$this->store->setTagToEntry($tag_id, $entry_id);
|
||||||
}
|
}
|
||||||
|
if(!$import) {
|
||||||
Tools::redirect();
|
Tools::redirect();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'remove_tag' :
|
case 'remove_tag' :
|
||||||
$tag_id = $_GET['tag_id'];
|
$tag_id = $_GET['tag_id'];
|
||||||
@ -852,14 +860,18 @@ class Poche
|
|||||||
$a = $li->find('a');
|
$a = $li->find('a');
|
||||||
$url = new Url(base64_encode($a[0]->href));
|
$url = new Url(base64_encode($a[0]->href));
|
||||||
$this->action('add', $url, 0, TRUE);
|
$this->action('add', $url, 0, TRUE);
|
||||||
if ($read == '1') {
|
|
||||||
$sequence = '';
|
$sequence = '';
|
||||||
if (STORAGE == 'postgres') {
|
if (STORAGE == 'postgres') {
|
||||||
$sequence = 'entries_id_seq';
|
$sequence = 'entries_id_seq';
|
||||||
}
|
}
|
||||||
$last_id = $this->store->getLastId($sequence);
|
$last_id = $this->store->getLastId($sequence);
|
||||||
|
if ($read == '1') {
|
||||||
$this->action('toggle_archive', $url, $last_id, TRUE);
|
$this->action('toggle_archive', $url, $last_id, TRUE);
|
||||||
}
|
}
|
||||||
|
$tags = $a[0]->tags;
|
||||||
|
if(!empty($tags)) {
|
||||||
|
$this->action('add_tag',$url,$last_id,true,false,$tags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# the second <ul> is for read links
|
# the second <ul> is for read links
|
||||||
|
Loading…
Reference in New Issue
Block a user