Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow to create feeds.

refs #1
  • Loading branch information...
commit 8d8faa4fcc6d7d84b858447ed5027e9e47837d3f 1 parent 9cb5e18
@halfdan authored
View
17 Controller.php
@@ -5,7 +5,7 @@
*/
class Piwik_FeedAnnotation_Controller extends Piwik_Controller_Admin
{
- function index()
+ public function index()
{
Piwik::checkUserHasSomeAdminAccess();
$view = Piwik_View::factory('index');
@@ -21,4 +21,19 @@ function index()
$view->menu = Piwik_GetAdminMenu();
echo $view->render();
}
+
+ public function createFeed()
+ {
+ $idSite = Piwik_Common::getRequestVar('idSiteSelected', false, 'int');
+ Piwik::isUserHasAdminAccess($idSite);
+
+ $feedURL = Piwik_Common::getRequestVar('feedUrl');
+ try
+ {
+ Piwik_FeedAnnotation_API::getInstance()->addFeed($idSite, $feedURL);
+ } catch (Piwik_FeedAnnotation_InvalidFeedException $ex) {
+ // ToDo
+ }
+ echo $this->index();
+ }
}
View
4 templates/feedannotation.js
@@ -1,5 +1,5 @@
/*!
- *
+ * Validate Feed-URL and show error if invalid.
*/
$(document).ready(function() {
$("#feed_url").focusout(function() {
@@ -22,4 +22,6 @@ $(document).ready(function() {
ajaxRequest.setLoadingElement("#ajaxLoadingFeedUrl");
ajaxRequest.send(false);
});
+
+
});
View
6 templates/index.tpl
@@ -40,11 +40,11 @@
<h3>{'FeedAnnotation_AddFeed'|translate}</h3>
-<form action="">
- <label>{'FeedAnnotation_FeedUrl'|translate} <input type="text" id="feed_url" placeholder="Feed URL" /></label>
+<form action="{url action=createFeed}" method="POST">
+ <label>{'FeedAnnotation_FeedUrl'|translate} <input type="text" name="feedUrl" id="feed_url" placeholder="Feed URL" /></label>
{ajaxErrorDiv id=ajaxErrorFeedUrl}
{ajaxLoadingDiv id=ajaxLoadingFeedUrl}
- <input type="hidden" value="{$idSiteSelected}" /><br />
+ <input type="hidden" name="idSiteSelected" value="{$idSiteSelected}" /><br />
<input type="submit" value="Save" class="submit" />
</form>
{include file="CoreAdminHome/templates/footer.tpl"}
Please sign in to comment.
Something went wrong with that request. Please try again.