summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessandro Cosentino <cosenal@gmail.com>2012-10-08 20:23:32 -0400
committerAlessandro Cosentino <cosenal@gmail.com>2012-10-08 20:23:32 -0400
commitd5cd794c01d0e3a7774e01051fa485a82897731d (patch)
treeb4e709146cd324a879b2916061ed5e06b0939f6b
parent59616abd129009357bbef269fc1ce95525f62185 (diff)
split firstrun template from main template
-rw-r--r--index.php43
-rw-r--r--js/firstrun.js0
-rw-r--r--js/main.js2
-rw-r--r--lib/utils.php10
-rw-r--r--templates/firstrun.php (renamed from templates/part.nofeeds.php)0
-rw-r--r--templates/main.php9
6 files changed, 35 insertions, 29 deletions
diff --git a/index.php b/index.php
index fd153502d..57ca56d7f 100644
--- a/index.php
+++ b/index.php
@@ -17,15 +17,6 @@ OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('news');
OCP\App::setActiveNavigationEntry('news');
-OCP\Util::addScript('news','main');
-OCP\Util::addScript('news','news');
-OCP\Util::addScript('news','menu');
-OCP\Util::addScript('news','items');
-OCP\Util::addScript('news','jquery.timeago');
-
-OCP\Util::addStyle('news','news');
-OCP\Util::addStyle('news','settings');
-
$l = OC_L10N::get('news');
$userid = OCP\USER::getUser();
@@ -39,6 +30,16 @@ $feedid = 0;
$feedtype = 0;
if ($allfeeds) {
+
+ OCP\Util::addScript('news','main');
+ OCP\Util::addScript('news','news');
+ OCP\Util::addScript('news','menu');
+ OCP\Util::addScript('news','items');
+ OCP\Util::addScript('news','jquery.timeago');
+
+ OCP\Util::addStyle('news','news');
+ OCP\Util::addStyle('news','settings');
+
$feedid = isset( $_GET['feedid'] ) ? $_GET['feedid'] : null;
if ($feedid == null) {
$feedmapper = new OCA\News\FeedMapper(OCP\USER::getUser($userid));
@@ -55,11 +56,23 @@ if ($allfeeds) {
}
}
}
+ $tmpl = new OCP\Template( 'news', 'main', 'user' );
+ $tmpl->assign('allfeeds', $allfeeds);
+ $tmpl->assign('folderforest', $folderforest);
+ $tmpl->assign('feedid', $feedid);
+ $tmpl->assign('feedtype', $feedtype);
+ $tmpl->printPage();
+
}
+else {
+
+ OCP\Util::addScript('news','firstrun');
+
+ OCP\Util::addStyle('news','news');
+
+ $tmpl = new OCP\Template( 'news', 'firstrun', 'user' );
+ $tmpl->printPage();
+
+}
+
-$tmpl = new OCP\Template( 'news', 'main', 'user' );
-$tmpl->assign('allfeeds', $allfeeds);
-$tmpl->assign('folderforest', $folderforest);
-$tmpl->assign('feedid', $feedid);
-$tmpl->assign('feedtype', $feedtype);
-$tmpl->printPage();
diff --git a/js/firstrun.js b/js/firstrun.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/firstrun.js
diff --git a/js/main.js b/js/main.js
index 80f69742c..e8942e096 100644
--- a/js/main.js
+++ b/js/main.js
@@ -34,8 +34,6 @@ $(document).ready(function(){
// populate folderlist
$('#addfeed_dialog .menu').empty();
-
- // http://9gag.com/trending
var $rootFolder = $('<li>').addClass('menuItem').html($('<b>').html(t('News', 'None')));
$rootFolder.click(function(){
diff --git a/lib/utils.php b/lib/utils.php
index ab80018d6..af2322ec3 100644
--- a/lib/utils.php
+++ b/lib/utils.php
@@ -159,11 +159,11 @@ class Utils {
//try to extract favicon from web page
$absoluteUrl = \SimplePie_Misc::absolutize_url('/', $url);
- $handle = curl_init ( );
- curl_setopt ( $handle, CURLOPT_URL, $absoluteUrl );
- curl_setopt ( $handle, CURLOPT_RETURNTRANSFER, 1 );
- curl_setopt ( $handle, CURLOPT_FOLLOWLOCATION, TRUE );
- curl_setopt ( $handle, CURLOPT_MAXREDIRS, 10 );
+ $handle = \curl_init ( );
+ \curl_setopt ( $handle, CURLOPT_URL, $absoluteUrl );
+ \curl_setopt ( $handle, CURLOPT_RETURNTRANSFER, 1 );
+ \curl_setopt ( $handle, CURLOPT_FOLLOWLOCATION, TRUE );
+ \curl_setopt ( $handle, CURLOPT_MAXREDIRS, 10 );
if ( FALSE!==($page=curl_exec($handle)) ) {
preg_match ( '/<[^>]*link[^>]*(rel=["\']icon["\']|rel=["\']shortcut icon["\']) .*href=["\']([^>]*)["\'].*>/iU', $page, $match );
diff --git a/templates/part.nofeeds.php b/templates/firstrun.php
index 0e3f443c0..0e3f443c0 100644
--- a/templates/part.nofeeds.php
+++ b/templates/firstrun.php
diff --git a/templates/main.php b/templates/main.php
index b220f14d1..ce753d317 100644
--- a/templates/main.php
+++ b/templates/main.php
@@ -3,7 +3,6 @@
<!-- End of Dialogs -->
<?php
-if ($_['feedid']) {
$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll');
@@ -17,6 +16,8 @@ if($showAll) {
$viewButtonClass = 'show_unread';
}
+echo $this->inc("part.dialogues");
+
?>
<div id="leftcontent_news" class="leftcontent_news">
@@ -57,9 +58,3 @@ if($showAll) {
</div>
-<?php
- } else {
- echo $this->inc("part.nofeeds");
- }
-
- echo $this->inc("part.dialogues");