]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
fixup for new theme design in public.php
authorEvan Prodromou <evan@prodromou.name>
Tue, 10 Jun 2008 19:21:01 +0000 (15:21 -0400)
committerEvan Prodromou <evan@prodromou.name>
Tue, 10 Jun 2008 19:21:01 +0000 (15:21 -0400)
darcs-hash:20080610192101-84dde-29ba2cc875b73131bbbbef4cbdfb17965df37677.gz

actions/public.php
lib/stream.php
lib/util.php

index 89b12493a3ff241fc4a77c985960b62a692f1028..d92a704a6bc7876423096ecdb6aee7e242e6da69 100644 (file)
@@ -58,35 +58,21 @@ class PublicAction extends StreamAction {
 
                $cnt = $notice->find();
 
-               common_element_start('div', 'notices');
-
-               for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
-                       if ($notice->fetch()) {
-                               $this->show_notice($notice);
-                       } else {
-                               // shouldn't happen!
-                               break;
+               if ($cnt > 0) {
+                       common_element_start('ul', array('id' => 'notices'));
+                       for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
+                               if ($notice->fetch()) {
+                                       $this->show_notice($notice);
+                               } else {
+                                       // shouldn't happen!
+                                       break;
+                               }
                        }
-               }
-
-               if ($page > 1) {
-                       common_element_start('span', 'floatLeft width25');
-                       common_element('a', array('href' => common_local_url('public',
-                                                                                                                                array('page' => $page-1)),
-                                                                         'class' => 'newer'),
-                                                  _t('Newer'));
-                       common_element_end('span');
+                       common_element_end('ul');
                }
                
-               if ($cnt > NOTICES_PER_PAGE) {
-                       common_element_start('span', 'floatRight width25');
-                       common_element('a', array('href' => common_local_url('public',
-                                                                                                                                array('page' => $page+1)),
-                                                                         'class' => 'older'),
-                                                  _t('Older'));
-                       common_element_end('span');
-               }
-               common_element_end('div');
+               common_pagination($page > 1, $cnt > NOTICES_PER_PAGE,
+                                                 $page, 'public');
        }
 }
 
index ac683367f166aec509ec9a7246dc8ad6a6d36b4c..9a4cf41ebe0464104dcb224ec2a423c7f5563288 100644 (file)
@@ -31,7 +31,7 @@ class StreamAction extends Action {
                global $config;
                $profile = $notice->getProfile();
                # XXX: RDFa
-               common_element_start('div', array('class' => 'notice',
+               common_element_start('li', array('class' => 'notice_single',
                                                                                  'id' => 'notice-' . $notice->id));
                $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
                common_element_start('a', array('href' => $profile->profileurl));
@@ -47,13 +47,15 @@ class StreamAction extends Action {
                                                                  'class' => 'nickname'),
                                           $profile->nickname);
                # FIXME: URL, image, video, audio
-               common_element_start('span', array('class' => 'content'));
+               common_element_start('p', array('class' => 'content'));
                common_raw(common_render_content($notice->content, $notice));
-               common_element_end('span');
+               common_element_end('p');
                $noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
+               common_element_start('p', 'time');
                common_element('a', array('class' => 'notice',
                                                                  'href' => $noticeurl),
                                           common_date_string($notice->created));
-               common_element_end('div');
+               common_element_end('p');
+               common_element_end('li');
        }
 }
index a194e09ef9858c1c9f2b144637f572bf2c54a911..cbf60619d5d2d30c085831d4a228b8de99953834 100644 (file)
@@ -204,8 +204,7 @@ function common_raw($xml) {
 
 function common_license_block() {
        global $config, $xw;
-       common_element_start('p', 'license greenBg');
-       common_element_start('span', 'floatLeft width25');
+       common_element_start('p', 'license');
        common_element_start('a', array('class' => 'license',
                                                                        'rel' => 'license',
                                                                        href => $config['license']['url']));
@@ -213,15 +212,12 @@ function common_license_block() {
                                                                'src' => $config['license']['image'],
                                                                'alt' => $config['license']['title']));
        common_element_end('a');
-       common_element_end('span');
-       common_element_start('span', 'floatRight width75');
        common_text(_t('Unless otherwise specified, contents of this site are copyright by the contributors and available under the '));
        common_element('a', array('class' => 'license',
                                                          'rel' => 'license',
                                                          href => $config['license']['url']),
                                   $config['license']['title']);
        common_text(_t('. Contributors should be attributed by full name or nickname.'));
-       common_element_end('span');
        common_element_end('p');
 }
 
@@ -701,3 +697,37 @@ function common_valid_tag($tag) {
        }
        return false;
 }
+
+# Does a little before-after block for next/prev page
+
+function common_pagination($have_before, $have_after, $page, $action, $args=NULL) {            
+       
+       if ($have_before || $have_after) {
+               common_element_start('div', array('id' => 'pagination'));
+               common_element_start('ul', array('id' => 'nav_pagination'));
+       }
+       
+       if ($have_before) {
+               $pargs = array('page' => $page-1);
+               $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+                                                                                
+               common_element_start('li', 'before');
+               common_element('a', array('href' => common_local_url($action, $newargs)),
+                                          _t('« Before'));
+               common_element_end('li');
+       }
+
+       if ($have_after) {
+               $pargs = array('page' => $page+1);
+               $newargs = ($args) ? array_merge($args,$pargs) : $pargs;
+               common_element_start('li', 'after');
+               common_element('a', array('href' => common_local_url($action, $newargs)),
+                                                  _t('After »'));
+               common_element_end('li');
+       }
+       
+       if ($have_before || $have_after) {
+               common_element_end('ul');
+               common_element_end('div');
+       }
+}