Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_modules / articles [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
11 Aug 2002 00:00:25postnuke_modules/articlespnuser.php,1.43,1.44Mike
 templating user_view part 1

Update of /home/cvsroot/postnuke_modules/articles
In directory ns7.hostnuke.net:/tmp/cvs-serv3343

Modified Files:
	pnuser.php 
Log Message:
templating user_view part 1


Index: pnuser.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnuser.php,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** pnuser.php	9 Aug 2002 00:00:43 -0000	1.43
--- pnuser.php	11 Aug 2002 00:00:23 -0000	1.44
***************
*** 76,95 ****
      }
  
-     // Create output object
-     $output = new pnHTML();
- 
- // TODO: drop $output once we're templated
- 
- // TODO: show this *after* category list when we start from categories :)
-     $row = articles_user_showpubtypes($output,$ptid,$ishome);
-     if (count($row) > 0) {
-         $output->Text(pnML('Publication Type'));
-         $output->Text(' : ');
-         $output->SetInputMode(_PNH_VERBATIMINPUT);
-         $output->Text(join(' - ',$row));
-         $output->SetInputMode(_PNH_PARSEINPUT);
-         $output->LineBreak(2);
-     }
- 
      // Load APIs
      if (!pnModAPILoad('articles', 'user')) {
--- 76,79 ----
***************
*** 100,103 ****
--- 84,106 ----
          return;
      }
+     if (!pnModAPILoad('categories', 'user')) {
+         $msg = pnML('Unable to load #(1) #(2) API',
+                     'categories','user');
+         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNABLE_TO_LOAD',
+                        new SystemException($msg));
+         return;
+     }
+ 
+ // TODO: show this *after* category list when we start from categories :)
+     // Navigation links
+     $data['publabel'] = pnML('Publication');
+     $data['publinks'] = pnModAPIFunc('articles','user','getpublinks',
+                                      array('ptid' => $ishome ? '' : $ptid));
+     $data['maplabel'] = pnML('View Article Map');
+     $data['maplink'] = pnModURL('articles','user','viewmap');
+     $data['archivelabel'] = pnML('View Archives');
+     $data['archivelink'] = pnModURL('articles','user','archive');
+ 
+     $data['pager'] = '';
  
      // Get the users requested number of stories per page.
***************
*** 133,150 ****
      if (!is_array($articles)) {
          // Error getting articles
!         $output->Text(_ARTICLESITEMFAILED);
!         return $output->GetOutput();
      }
  
- /*
- *     Nice stuff mike
- *     CVS is making us clash even when not messing exactly in the
- * same place...
- * Have to figure out if both our modifications work well together. 
- *
- * They do - at least for the moment :)
- *
- * */
- 
  // TODO 1: make an overall 'index' template with the bread-crumb trails etc.
  //         at the top, and that includes the individual (templated) articles
--- 136,143 ----
      if (!is_array($articles)) {
          // Error getting articles
!         $data['output'] = _ARTICLESITEMFAILED;
!         return $data;
      }
  
  // TODO 1: make an overall 'index' template with the bread-crumb trails etc.
  //         at the top, and that includes the individual (templated) articles
***************
*** 169,180 ****
  
  // TODO: make this dependent on publication type too ?
!         $output->Text(pnML('Browse in') . ' : ');
!         $output->Text('[ ');
!         $output->URL(pnModURL('articles',
!                               'user',
!                               'view',
!                               array('ptid' => $ptid)),
!                      pnVarPrepForDisplay(pnML('all')));
!         $output->Text(' ] ');
  
          // get the counts for all categories
--- 162,169 ----
  
  // TODO: make this dependent on publication type too ?
!         $data['catlabel'] = pnML('Browse in');
!         $data['backlabel'] = pnML('All');
!         $data['backlink'] = pnModURL('articles', 'user', 'view',
!                                      array('ptid' => $ptid));
  
          // get the counts for all categories
***************
*** 194,198 ****
--- 183,190 ----
  
          // display one (or more) bread-crumb trails of categories
+         $data['trails'] = array();
          foreach ($cids as $cid) {
+             $trailitem = array();
+             $trailitem['cid'] = $cid;
              $trail = pnModAPIFunc('categories',
                                    'user',
***************
*** 202,224 ****
                                          'getparents' => true));
  // TODO: make sure permissions are taken into account here !
              foreach ($trail as $info) {
!                 if ($info['cid'] == $cid) {
!                     $output->Text(pnVarPrepForDisplay(pnVarCensor($info['name'])));
!                     if (isset($pubcatcount[$cid][$curptid])) {
!                         $output->Text(' (' . $pubcatcount[$cid][$curptid] . ')');
!                     }
!                 } else {
!                     $output->URL(pnModURL('articles',
                                            'user',
                                            'view',
                                            array('cids' => array($info['cid']),
!                                                 'ptid' => $ptid)),
!                                pnVarPrepForDisplay(pnVarCensor($info['name'])));
!                     $output->Text(" - ");
                  }
              }
!             $output->Linebreak();
          }
-         $output->Linebreak();
  
          //TODO: only show 1-st level children, horizontally ?
--- 194,220 ----
                                          'getparents' => true));
  // TODO: make sure permissions are taken into account here !
+             if (isset($pubcatcount[$cid][$curptid])) {
+                 $trailitem['cidcount'] = $pubcatcount[$cid][$curptid];
+             } else {
+                 $trailitem['cidcount'] = '';
+             }
+             $trailitem['parentlinks'] = array();
              foreach ($trail as $info) {
!                 $item['plink'] = pnModURL('articles',
                                            'user',
                                            'view',
                                            array('cids' => array($info['cid']),
!                                                 'ptid' => $ptid));
!                 $item['ptitle'] = pnVarPrepForDisplay(pnVarCensor($info['name']));
!                 if ($info['cid'] != $cid) {
!                     $item['pjoin'] = ' > ';
!                 } else {
!                     $item['pjoin'] = '';
!                     $item['plink'] = '';
                  }
+                 $trailitem['parentlinks'][] = $item;
              }
!             $data['trails'][] = $trailitem;
          }
  
          //TODO: only show 1-st level children, horizontally ?
***************
*** 259,284 ****
                  $curptid = 'total';
              }
!             $output->SetInputMode(_PNH_VERBATIMINPUT);
              foreach ($list as $info) {
                  if ($info['id'] == $cids[0]) {
                      continue;
                  }
-                 $output->Text($info['beforetags']);
          // TODO: show icons instead of (or in addition to) a link if available ?
!                 $output->URL(pnModURL('articles',
!                                       'user',
!                                       'view',
!                                       array('cids' => array($info['id']),
!                                             'ptid' => $ptid)),
!                              pnVarPrepForDisplay(pnVarCensor($info['name'])));
                  if (isset($pubcatcount[$info['id']][$curptid])) {
!                     $output->Text(' (' . $pubcatcount[$info['id']][$curptid] . ')');
                  }
!                 $output->Text($info['aftertags']);
              }
-             $output->Linebreak();
          }
      } elseif (!empty($ptid)) {
!         $output->Text(pnML('Browse in') . ' : ');
          $string = pnModGetVar('articles','cids.'.$ptid);
          if (empty($string)) {
--- 255,278 ----
                  $curptid = 'total';
              }
!             $data['cats'] = array();
              foreach ($list as $info) {
                  if ($info['id'] == $cids[0]) {
                      continue;
                  }
          // TODO: show icons instead of (or in addition to) a link if available ?
!                 $info['link'] = pnModURL('articles','user','view',
!                                          array('cids' => array($info['id']),
!                                                'ptid' => $ptid));
!                 $info['name'] = pnVarPrepForDisplay(pnVarCensor($info['name']));
                  if (isset($pubcatcount[$info['id']][$curptid])) {
!                     $info['count'] = $pubcatcount[$info['id']][$curptid];
!                 } else {
!                     $info['count'] = '';
                  }
!                 $data['cats'][] = $info;
              }
          }
      } elseif (!empty($ptid)) {
!         $data['catlabel'] = pnML('Browse in');
          $string = pnModGetVar('articles','cids.'.$ptid);
          if (empty($string)) {
***************
*** 286,292 ****
          }
  // TODO: make 1 call to get all
-         $row = array();
-         $output->SetOutputMode(_PNH_RETURNOUTPUT);
          $rootcats = split(';',$string);
          foreach ($rootcats as $cid) {
              if (empty($cid)) {
--- 280,286 ----
          }
  // TODO: make 1 call to get all
          $rootcats = split(';',$string);
+         $isfirst = 1;
+         $data['catlinks'] = array();
          foreach ($rootcats as $cid) {
              if (empty($cid)) {
***************
*** 297,339 ****
                                   'getcatinfo',
                                   array('cid' => $cid));
!             $row[] = $output->URL(pnModURL('articles',
!                                            'user',
!                                            'view',
!                                            array('cids' => array($info['cid']),
!                                                  'ptid' => $ptid)),
!                                pnVarPrepForDisplay(pnVarCensor($info['name'])));
          }
-         $output->SetOutputMode(_PNH_KEEPOUTPUT);
-         $output->SetInputMode(_PNH_VERBATIMINPUT);
-         $output->Text('[ ' . join(' | ',$row) . ' ]');
-         $output->SetInputMode(_PNH_PARSEINPUT);
-         $output->Linebreak(2);
      }
  
      if (empty($articles)) {
          // No articles
!         $output->Text("No articles");
!         $output->Linebreak();
!         $output->URL(pnModURL('articles',
!                               'user',
!                               'viewmap',
!                               array()),
!                      pnML('View Article Map'));
! 
!         $output->SetInputMode(_PNH_VERBATIMINPUT);
!         $output->Text('   ');
!         $output->SetInputMode(_PNH_PARSEINPUT);
!         $output->URL(pnModURL('articles',
!                               'user',
!                               'archive',
!                               array()),
!                      pnML('View Archive'));
!         return $output->GetOutput();
      }
  
- /* 
- * End of Mike�s modification
- */
- 
      $out = '';
      foreach ($articles as $article)
--- 291,315 ----
                                   'getcatinfo',
                                   array('cid' => $cid));
!             $item = array();
!             $item['cattitle'] = pnVarPrepForDisplay(pnVarCensor($info['name']));
!             $item['catlink'] = pnModURL('articles','user','view',
!                                         array('cids' => array($info['cid']),
!                                               'ptid' => $ptid));
!             if ($isfirst) {
!                 $item['catjoin'] = '';
!                 $isfirst = 0;
!             } else {
!                 $item['catjoin'] = ' | ';
!             }
!             $data['catlinks'][] = $item;
          }
      }
  
      if (empty($articles)) {
          // No articles
!         $data['output'] = pnML('No articles');
!         return $data;
      }
  
      $out = '';
      foreach ($articles as $article)
***************
*** 362,388 ****
          $out .= pnModTemplate('articles', 'user', $template . '-summary', $article);
      }
-     
-     $output->SetInputMode(_PNH_VERBATIMINPUT);
-     $output->Text($out);
-     $output->SetInputMode(_PNH_PARSEINPUT);
  
! /*    Mike�s modification
! * i think here mine should stand...
! * Let�s start using these templates?
! * 
! * Oh, definitely :-)
! * Mike.
! */
  
      // Pager
!     if (!pnModAPILoad('categories', 'user'))
!     {
!         $msg = pnML('Unable to load #(1) #(2) API',
!                     'categories','user');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNABLE_TO_LOAD',
!                        new SystemException($msg));
!         return;
!     }
!     $output->Linebreak(2);
  
  // TODO: make count depend on language in the future
--- 338,348 ----
          $out .= pnModTemplate('articles', 'user', $template . '-summary', $article);
      }
  
!     $data['output'] = $out;    
  
      // Pager
! // TODO: drop $output once BL has a pager
!     // Create output object
!     $output = new pnHTML();
  
  // TODO: make count depend on language in the future
***************
*** 401,422 ****
                                    'startnum' => '%%')),
                     pnModGetVar('articles', 'itemsperpage'));
  
!     $output->Linebreak();
!     $output->URL(pnModURL('articles',
!                           'user',
!                           'viewmap',
!                           array()),
!                  pnML('View Article Map'));
! 
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text('   ');
!     $output->SetInputMode(_PNH_PARSEINPUT);
!     $output->URL(pnModURL('articles',
!                           'user',
!                           'archive',
!                           array()),
!                  pnML('View Archive'));
! 
!     return $output->GetOutput();
  }
  
--- 361,367 ----
                                    'startnum' => '%%')),
                     pnModGetVar('articles', 'itemsperpage'));
+     $data['pager'] = $output->GetOutput();
  
!     return $data;
  }
  
***************
*** 484,487 ****
--- 429,434 ----
                                 'reverse' => 0));
  
+     $data['catlabel'] = pnML('Browse in');
+ 
      // get the counts for all categories this article belongs to
      $seencid = array();
***************
*** 525,529 ****
              $item['ptitle'] = pnVarPrepForDisplay(pnVarCensor($info['name']));
              if ($info['cid'] != $cid) {
!                 $item['pjoin'] = ' - ';
              } else {
                  $item['pjoin'] = '';
--- 472,476 ----
              $item['ptitle'] = pnVarPrepForDisplay(pnVarCensor($info['name']));
              if ($info['cid'] != $cid) {
!                 $item['pjoin'] = ' > ';
              } else {
                  $item['pjoin'] = '';
***************
*** 591,596 ****
--- 538,546 ----
  
      // Navigation links
+     $data['publabel'] = pnML('Publication');
      $data['publinks'] = pnModAPIFunc('articles','user','getpublinks');
+     $data['maplabel'] = pnML('View Article Map');
      $data['maplink'] = pnModURL('articles','user','viewmap');
+     $data['archivelabel'] = pnML('View Archives');
      $data['archivelink'] = pnModURL('articles','user','archive');
  
***************
*** 814,820 ****
                   'articles' => $articles,
                   'catlist' => $catlist,
                   'publinks' => pnModAPIFunc('articles','user','getpublinks',
                                              array('ptid' => $ptid)),
!                  'maplink' => pnModURL('articles','user','viewmap'));
  }
  
--- 764,773 ----
                   'articles' => $articles,
                   'catlist' => $catlist,
+                  'publabel' => pnML('Publication'),
                   'publinks' => pnModAPIFunc('articles','user','getpublinks',
                                              array('ptid' => $ptid)),
!                  'maplabel' => pnML('View Article Map'),
!                  'maplink' => pnModURL('articles','user','viewmap'),
!                  'archivelabel' => pnML('View Archives'));
  }
  
***************
*** 945,989 ****
  
      return array('publinks' => $publinks,
                   'archivelink' => $archivelink);
- }
- 
- // TODO: drop $output once we're templated
- /**
-  * show publication types
-  */
- function articles_user_showpubtypes($output,$ptid = null,$ishome = 0)
- {
-     if (!pnModAPILoad('articles', 'user')) {
-         $msg = pnML('Unable to load #(1) #(2) API',
-                     'articles','user');
-         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'UNABLE_TO_LOAD',
-                        new SystemException($msg));
-         return;
-     }
- 
-     // Get publication types
-     $pubtypes = pnModAPIFunc('articles','user','getpubtypes');
-     $pubcount = pnModAPIFunc('articles','user','getpubcount');
- 
-     $row = array();
-     $output->SetOutputMode(_PNH_RETURNOUTPUT);
-     foreach ($pubtypes as $id => $pubtype) {
-         if (isset($pubcount[$id]) && $pubcount[$id] > 0) {
-              if (isset($ptid) && $ptid == $id && $ishome == 0) {
-                  $out = $output->Text($pubtype['descr']);
-              } else {
-                  $out = $output->URL(pnModURL('articles','user','view',
-                                               array('ptid' => $id)),
-                                      $pubtype['descr']);
-              }
-              $out .= ' (' . $pubcount[$id] . ')';
-              $row[] = $out;
-         } else {
-         //     $output->Text($pubtype['descr']);
-         }
-     }
-     $output->SetOutputMode(_PNH_KEEPOUTPUT);
- 
-     return $row;
  }
  
--- 898,904 ----
  
      return array('publinks' => $publinks,
+                  'maplabel' => pnML('View Article Map'),
+                  'archivelabel' => pnML('View Archives'),
                   'archivelink' => $archivelink);
  }
  


Directory filter : [ all ] / postnuke_modules / articles [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3