changes to add url directly from poche

This commit is contained in:
Nicolas Lœuillet 2013-09-10 14:41:58 +02:00
parent d5ce28df67
commit ce4a1dcc19
6 changed files with 17 additions and 28 deletions

View File

@ -182,7 +182,7 @@ class Poche
}
if (!$import) {
Tools::redirect();
Tools::redirect('?view=home');
}
break;
case 'delete':
@ -558,9 +558,4 @@ class Poche
}
return $version;
}
function convertURLToBase64($plainurl){
$convertedURL = base64_encode($plainurl);
$this->action('add', new Url($convertedURL));
}
}

View File

@ -43,9 +43,10 @@ elseif (isset($_GET['import'])) {
elseif (isset($_GET['export'])) {
$poche->export();
}
if (isset($_GET['plainurl'])){
$poche->convertURLToBase64($_GET['plainurl']);}
elseif (isset($_GET['plainurl']) && !empty($_GET['plainurl'])) {
$plain_url = new Url(base64_encode($_GET['plainurl']));
$poche->action('add', $plain_url);
}
# vars to send to templates
$tpl_vars = array(

View File

@ -3,13 +3,5 @@
<li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
<li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
<li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
<li><a id="addurlbutton" onclick="showinput();" href="#" title="{% trans "addlink" %}">{% trans "addlink" %}</a></li>
<li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>
<div id="inputform">
<form method="get" action="index.php">
<label class="addurl" for="plainurl">Entrez ici votre URL</label><br />
<input autofocus required placeholder="Ex:monsite.net/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<input type="submit" value="Envoyer" />
</form>
</div>
<li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>

View File

@ -2,13 +2,7 @@
{% block title %}{% trans "config" %}{% endblock %}
{% block menu %}
<ul id="links">
<li><a href="./" {% if view == 'home' %}class="current"{% endif %}>{% trans "home" %}</a></li>
<li><a href="./?view=fav" {% if view == 'fav' %}class="current"{% endif %}>{% trans "favorites" %}</a></li>
<li><a href="./?view=archive" {% if view == 'archive' %}class="current"{% endif %}>{% trans "archive" %}</a></li>
<li><a href="./?view=config" {% if view == 'config' %}class="current"{% endif %}>{% trans "config" %}</a></li>
<li><a href="./?logout" title="{% trans "logout" %}">{% trans "logout" %}</a></li>
</ul>
{% include '_menu.twig' %}
{% endblock %}
{% block content %}
<h2>{% trans "Poching a link" %}</h2>
@ -17,6 +11,13 @@
<li>firefox: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/poche.xpi" title="download the firefox extension">download the extension</a></li>
<li>chrome: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/poche.crx" title="download the chrome extension">download the extension</a></li>
<li>android: <a href="https://bitbucket.org/jogaulupeau/poche/downloads/Poche.apk" title="download the application">download the application</a></li>
<li>
<form method="get" action="index.php">
<label class="addurl" for="plainurl">{% trans "by filling this field" %}:</label>
<input autofocus required placeholder="Ex:mywebsite.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
<input type="submit" value="{% trans "poche it!" %}" />
</form>
</li>
<li>bookmarklet: drag & drop this link to your bookmarks bar <a id="bookmarklet" ondragend="this.click();" title="i am a bookmarklet, use me !" href="javascript:if(top['bookmarklet-url@inthepoche.com']){top['bookmarklet-url@inthepoche.com'];}else{(function(){var%20url%20=%20location.href%20||%20url;window.open('{{ poche_url }}?action=add&url='%20+%20btoa(url),'_self');})();void(0);}">{% trans "poche it!" %}</a></li>
</ul>

View File

@ -258,13 +258,14 @@ footer {
font-size: 0.8em;
}
#inputform{
#inputform {
display: none;
text-align:center;
max-width:300px;
margin-left:auto;
margin-right:auto;
margin-top:5px;
padding-bottom: 5px;
background-color: rgba(0, 0, 0, 0.9);
opacity:0.8;
color:white;

View File

@ -12,7 +12,6 @@
<![endif]-->
<title>{% block title %}{% endblock %} - poche</title>
{% include '_head.twig' %}
<script src="./tpl/js/poche.js"></script>
{% include '_bookmarklet.twig' %}
</head>
<body>