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]
28 Jul 2002 17:33:43postnuke_modules/articlespnadmin.php,1.17,1.18Mike
 admin main & view templated

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

Modified Files:
	pnadmin.php 
Log Message:
admin main & view templated


Index: pnadmin.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnadmin.php,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** pnadmin.php	27 Jul 2002 19:17:30 -0000	1.17
--- pnadmin.php	28 Jul 2002 17:33:41 -0000	1.18
***************
*** 29,48 ****
  function articles_admin_main()
  {
-     // Create output object
-     $output = new pnHTML();
- 
      // Security check
!     if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_DELETE)) {
!         $output->Text('Not authorised to carry out that operation');
!         return $output->GetOutput();
      }
  
!     // Add menu to output
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(articles_adminmenu());
!     $output->SetInputMode(_PNH_PARSEINPUT);
! 
!     // Return output
!     return $output->GetOutput();
  }
  
--- 29,43 ----
  function articles_admin_main()
  {
      // Security check
!     if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_EDIT)) {
!         $msg = pnML('Not authorized to access #(1) module administration',
!                     'Articles');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
!                        new SystemException($msg));
!         return;
      }
  
!     // Return the template variables defined in this function
!     return array('menu' => articles_admin_getmenu());
  }
  
***************
*** 323,353 ****
      }
  
-     // Create output object
-     $output = new pnHTML();
- 
      if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_EDIT)) {
!         $output->Text('Not authorised to carry out that operation');
!         return $output->GetOutput();
      }
  
-     // Add menu to output
-     $output->SetInputMode(_PNH_VERBATIMINPUT);
-     $output->Text(articles_adminmenu());
-     $output->SetInputMode(_PNH_PARSEINPUT);
- 
-     // Title
-     $output->Title(_ARTICLESVIEW);
- 
      // Load user API to obtain item information function
      if (!pnModAPILoad('articles', 'user')) {
!         $output->Text(_LOADFAILED);
!         return $output->GetOutput();
      }
  
- $text = "
- // TODO : allow viewing per publication type, category etc.
- ";
-     $output->Text($text);
- 
      // Get item information
      $articles = pnModAPIFunc('articles',
--- 318,338 ----
      }
  
      if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_EDIT)) {
!         $msg = pnML('Not authorized to view #(1) items',
!                     'Articles');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
!                        new SystemException($msg));
!         return;
      }
  
      // Load user API to obtain item information function
      if (!pnModAPILoad('articles', 'user')) {
!         $msg = pnML('Unable to load #(1) user API',
!                     'Articles');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
!                        new SystemException($msg));
!         return;
      }
  
      // Get item information
      $articles = pnModAPIFunc('articles',
***************
*** 358,414 ****
                                     'cids' => false));
  
      if ($articles != false) {
-         // Start output table
-         $output->TableStart('',
-                             array(_ARTICLESTITLE,
-                                   _ARTICLESPUBDATE,
-                                   _ARTICLESOPTIONS),
-                             2);
- 
          foreach ($articles as $article) {
  
!             $row = array();
!     
!             if (pnSecAuthAction(0, 'articles::Item', "$article[title]::$article[aid]", ACCESS_READ)) {
!     
!                 // Name and number
!                 $row[] = $article['title'];
!                 $row[] = strftime(_DATETIMELONG, $article['pubdate']);
  
!                 // Options
!                 $options = array();
!                 $output->SetOutputMode(_PNH_RETURNOUTPUT);
!                 if (pnSecAuthAction(0, 'articles::Item', "$article[title]::$article[aid]", ACCESS_EDIT)) {
!                     $options[] = $output->URL(pnModURL('articles',
!                                                        'admin',
!                                                        'modify',
!                                                        array('aid' => $article['aid'])),
!                                               _EDIT);
!                     if (pnSecAuthAction(0, 'articles::Item', "$article[title]::$article[aid]", ACCESS_DELETE)) {
!                         $options[] = $output->URL(pnModURL('articles',
!                                                            'admin',
!                                                            'delete',
!                                                            array('aid' => $article['aid'])),
!                                                   _DELETE);
!                     }
!                 }
  
!                 $options = join(' | ', $options);
!                 $output->SetInputMode(_PNH_VERBATIMINPUT);
!                 $row[] = $output->Text($options);
!                 $output->SetOutputMode(_PNH_KEEPOUTPUT);
!                 $output->TableAddRow($row);
!                 $output->SetInputMode(_PNH_PARSEINPUT);
              }
          }
-         $output->TableEnd();
      }
  
      // Load user API to obtain item count function
      if (!pnModAPILoad('categories', 'user')) {
!         $output->Text(_LOADFAILED);
!         return $output->GetOutput();
      }
  
      // Add pager
      $output->Pager($startnum,
--- 343,391 ----
                                     'cids' => false));
  
+     $items = array();
      if ($articles != false) {
          foreach ($articles as $article) {
  
!             $item = array();
  
!             // Title and pubdate
!             $item['title'] = $article['title'];
!             $item['pubdate'] = strftime(_DATETIMELONG, $article['pubdate']);
!     
!             if (pnSecAuthAction(0, 'articles::Item', "$article[title]::$article[aid]", ACCESS_EDIT)) {
!                 $item['editurl'] = pnModURL('articles',
!                                             'admin',
!                                             'modify',
!                                             array('aid' => $article['aid']));
!             } else {
!                 $item['editurl'] = '';
!             }
!             $item['edittitle'] = _EDIT;
  
!             if (pnSecAuthAction(0, 'articles::Item', "$article[title]::$article[aid]", ACCESS_DELETE)) {
!                 $item['deleteurl'] = pnModURL('articles',
!                                               'admin',
!                                               'delete',
!                                               array('aid' => $article['aid']));
!             } else {
!                 $item['deleteurl'] = '';
              }
+             $item['deletetitle'] = _DELETE;
+ 
+             $items[] = $item;
          }
      }
  
      // Load user API to obtain item count function
      if (!pnModAPILoad('categories', 'user')) {
!         $msg = pnML('Unable to load #(1) user API',
!                     'Categories');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
!                        new SystemException($msg));
!         return;
      }
  
+ // TODO : add pager (once it exists in BL)
+     $output = new pnHTML();
      // Add pager
      $output->Pager($startnum,
***************
*** 419,424 ****
                              array('startnum' => '%%')),
                     pnModGetVar('articles', 'itemsperpage'));
  
!     return $output->GetOutput();
  }
  
--- 396,411 ----
                              array('startnum' => '%%')),
                     pnModGetVar('articles', 'itemsperpage'));
+     $pager = $output->GetOutput();
  
!     $labels = array();
!     $labels['title'] = pnVarPrepForDisplay(_ARTICLESTITLE);
!     $labels['pubdate'] = pnVarPrepForDisplay(_ARTICLESPUBDATE);
!     $labels['options'] = pnVarPrepForDisplay(_ARTICLESOPTIONS);
! 
!     // Return the template variables defined in this function
!     return array('menu' => articles_admin_getmenu(),
!                  'labels' => $labels,
!                  'items' => $items,
!                  'pager' => $pager);
  }
  
***************
*** 588,592 ****
--- 575,581 ----
      $output->TableColStart(1, 'left', 'center');
      $output->FormCheckbox('bodytype', true, 'text', 'radio');
+     $output->SetInputMode(_PNH_VERBATIMINPUT);
      $output->Text(_BODYTEXT);
+     $output->SetInputMode(_PNH_PARSEINPUT);
      $output->TableColEnd();
      $output->TableColStart(1, 'left', 'center');
***************
*** 599,603 ****
--- 588,594 ----
      $output->TableColStart(1, 'left', 'top');
      $output->FormCheckbox('bodytype', false, 'file', 'radio');
+     $output->SetInputMode(_PNH_VERBATIMINPUT);
      $output->Text(_BODYFILE);
+     $output->SetInputMode(_PNH_PARSEINPUT);
      $output->TableColEnd();
      $output->TableColStart(1, 'left', 'center');
***************
*** 903,907 ****
--- 894,917 ----
  }
  
+ /**
+  * Main administration menu labels
+  */
+ function articles_admin_getmenu()
+ {
+     $menu = array();
  
+     // Display status message if any
+     $menu['status'] = pnGetStatusMsg();
+ 
+     // Start options menu
+     $menu['title'] = _ARTICLES;
+ 
+     // Menu options
+     $menu['new'] = _ARTICLESNEW;
+     $menu['view'] = _ARTICLESVIEW;
+     $menu['modifyconfig'] = _ARTICLESMODIFYCONFIG;
+ 
+     return $menu;
+ }
  
  /*


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