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 20:00:55postnuke_modules/articlespnadmin.php,1.19,1.20Mike
 modify config per publication type

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

Modified Files:
	pnadmin.php 
Log Message:
modify config per publication type


Index: pnadmin.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/articles/pnadmin.php,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** pnadmin.php	28 Jul 2002 18:26:44 -0000	1.19
--- pnadmin.php	28 Jul 2002 20:00:53 -0000	1.20
***************
*** 708,757 ****
  function articles_admin_modifyconfig()
  {
-     // Create output object
-     $output = new pnHTML();
- 
      // Security check
      if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_ADMIN)) {
!         $output->Text(_NOTAUTHORISED);
!         return $output->GetOutput();
      }
  
!     // Add menu to output
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(articles_adminmenu());
!     $output->SetInputMode(_PNH_PARSEINPUT);
! 
! $text = "
! // TODO : allow different configurations (# of categories, base categories etc.)
! //        based on publication type (news, section, review etc.)
! ";
!     $output->Text($text);
! 
!     // Title
!     $output->Linebreak(2);
!     $output->Title(_ARTICLESMODIFYCONFIG);
! 
!     // Start form
!     $output->FormStart(pnModURL('articles', 'admin', 'updateconfig'));
!     $output->FormHidden('authid', pnSecGenAuthKey());
! 
!     $output->TableStart();
  
      // Get the old number of base categories
!     $old_ncats = (int) pnModGetVar('articles', 'number_of_categories');
! 
!     // Display style
!     $row = array();
!     $output->SetOutputMode(_PNH_RETURNOUTPUT);
!     $row[] = $output->Text(pnVarPrepForDisplay(_ARTICLESNUMBEROFCATEGORIES));
!     $row[] = $output->FormText('number_of_categories', $old_ncats, 1, 2);
!     $output->SetOutputMode(_PNH_KEEPOUTPUT);
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->TableAddrow($row, 'left');
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
      // Main Categories IDs
!     
!     $cids = explode(';', pnModGetVar('articles', 'cids'));
      $values = Array ();
  
--- 708,742 ----
  function articles_admin_modifyconfig()
  {
      // Security check
      if (!pnSecAuthAction(0, 'articles::category', '::', ACCESS_ADMIN)) {
!         $msg = pnML('Not authorized to change #(1) module configuration',
!                     'Articles');
!         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'NO_PERMISSION',
!                        new SystemException($msg));
!         return;
      }
  
!     // Get parameters
!     $ptid = pnVarCleanFromInput('ptid');
!     if (!isset($ptid)) {
!         $ptid = '';
!     }
  
      // Get the old number of base categories
!     if (!empty($ptid)) {
!         $old_ncats = (int) pnModGetVar('articles', 'number_of_categories.' . $ptid);
!     }
!     if (empty($old_ncats)) {
!         $old_ncats = (int) pnModGetVar('articles', 'number_of_categories');
!     }
  
      // Main Categories IDs
!     if (!empty($ptid)) {
!         $cids = explode(';', pnModGetVar('articles', 'cids.' . $ptid));
!     }
!     if (empty($cids) || empty($cids[0])) {
!         $cids = explode(';', pnModGetVar('articles', 'cids'));
!     }
! 
      $values = Array ();
  
***************
*** 767,813 ****
          }
      }
-     
-     //print_r($values);
  
      if (isset($old_ncats)&&($old_ncats>0)&&(is_int($old_ncats))) 
      {
          for ($n=0;$n<$old_ncats;$n++)
          {
!             $row = array();
!             $output->SetOutputMode(_PNH_RETURNOUTPUT);
!             $row[] = $output->Text(pnVarPrepForDisplay(_ARTICLESMAINCATEGORY).' '.($n+1));
!             $output->SetOutputMode(_PNH_KEEPOUTPUT);
  
!             if (!pnModAPILoad('categories', 'visual'))
!             {
!                 pnExceptionSet(PN_SYSTEM_EXCEPTION, 'COULDNT_LOAD',
!                        new SystemException(__FILE__."(".__LINE__."): Couldnt load the visualapi from categories module."));
!                 return;
!             }
  
!             $row[] = pnModAPIFunc('categories', 'visual', 'makeselect', Array('values' => &$values));
!             $output->SetInputMode(_PNH_VERBATIMINPUT);
!             $output->TableAddrow($row, 'left');
!             $output->SetInputMode(_PNH_PARSEINPUT);
          }
      }
  
!     // Display style
!     $row = array();
!     $output->SetOutputMode(_PNH_RETURNOUTPUT);
!     $row[] = $output->Text(pnML('Support short URLs ?'));
!     $row[] = $output->FormCheckBox('shorturls',
!                                    pnModGetVar('articles', 'SupportShortURLs'));
!     $output->SetOutputMode(_PNH_KEEPOUTPUT);
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->TableAddrow($row, 'left');
!     $output->SetInputMode(_PNH_PARSEINPUT);
!         
!     // End form
!     $output->TableEnd();
!     $output->FormSubmit(_ARTICLESUPDATECONFIG);
!     $output->FormEnd();
!     
!     return $output->GetOutput();
  }
  
--- 752,831 ----
          }
      }
  
+     if (!pnModAPILoad('categories', 'visual'))
+     {
+         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'COULDNT_LOAD',
+             new SystemException(__FILE__."(".__LINE__."): Couldnt load the visualapi from categories module."));
+         return;
+     }
+ 
+     $items = array();
      if (isset($old_ncats)&&($old_ncats>0)&&(is_int($old_ncats))) 
      {
          for ($n=0;$n<$old_ncats;$n++)
          {
!             $item = array();
!             $item['num'] = ($n+1);
! // TODO: templatize this too ?
!             $item['select'] = pnModAPIFunc('categories', 'visual', 'makeselect', Array('values' => &$values));
  
!             $items[] = $item;
!         }
!     }
  
!     $labels = array();
!     $labels['shorturls'] = pnML('Support short URLs ?');
!     $labels['numcats'] = pnVarPrepForDisplay(_ARTICLESNUMBEROFCATEGORIES);
!     $labels['maincat'] = pnVarPrepForDisplay(_ARTICLESMAINCATEGORY);
!     $labels['update'] = pnVarPrepForDisplay(_ARTICLESUPDATECONFIG);
! 
!     // 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;
!     }
! 
!     $pubfilters = array();
!     $pubitem = array();
!     if (empty($ptid)) {
!         $pubitem['plink'] = '';
!     } else {
!         $pubitem['plink'] = pnModURL('articles','admin','modifyconfig',array());
!     }
!     $pubitem['ptitle'] = pnML('Default');
!     $pubfilters[] = $pubitem;
!     $pubtypes = pnModAPIFunc('articles','user','getpubtypes');
!     foreach ($pubtypes as $id => $pubtype) {
!         $pubitem = array();
!         if ($id == $ptid) {
!             $pubitem['plink'] = '';
!         } else {
!             $pubitem['plink'] = pnModURL('articles','admin','modifyconfig',
!                                          array('ptid' => $id));
          }
+         $pubitem['ptitle'] = $pubtype['descr'];
+         $pubfilters[] = $pubitem;
      }
  
!     if (!empty($ptid)) {
!         $numcats = pnModGetVar('articles','number_of_categories.'.$ptid);
!     }
!     if (empty($numcats)) {
!         $numcats = pnModGetVar('articles','number_of_categories');
!     }
! 
!     $checked = pnModGetVar('articles','SupportShortURLs') ? 'checked' : '';
!     // Return the template variables defined in this function
!     return array('menu' => articles_admin_getmenu(),
!                  'pubfilters' => $pubfilters,
!                  'labels' => $labels,
!                  'numcats' => $numcats,
!                  'shorturls' => $checked,
!                  'items' => $items,
!                  'authid' => pnSecGenAuthKey(),
!                  'ptid' => $ptid);
  }
  
***************
*** 820,827 ****
      list($number_of_categories,
           $shorturls,
!          $cids)
                       = pnVarCleanFromInput('number_of_categories',
                                             'shorturls',
!                                            'cids');
  
      // Confirm authorisation code
--- 838,847 ----
      list($number_of_categories,
           $shorturls,
!          $cids,
!          $ptid)
                       = pnVarCleanFromInput('number_of_categories',
                                             'shorturls',
!                                            'cids',
!                                            'ptid');
  
      // Confirm authorisation code
***************
*** 837,841 ****
      }
  
!     pnModSetVar('articles', 'number_of_categories', $number_of_categories);
  
      if (!isset($shorturls)) {
--- 857,865 ----
      }
  
!     if (!empty($ptid)) {
!         pnModSetVar('articles', 'number_of_categories.'.$ptid, $number_of_categories);
!     } else {
!         pnModSetVar('articles', 'number_of_categories', $number_of_categories);
!     }
  
      if (!isset($shorturls)) {
***************
*** 843,855 ****
      }
  
!     pnModSetVar('articles', 'SupportShortURLs', $shorturls);
  
      if (isset($cids)) 
      {
          $string = join (';', $cids);
!         pnModSetVar('articles', 'cids', $string);
      }
  
!     pnRedirect(pnModURL('articles', 'admin', 'modifyconfig'));
  
      return true;
--- 867,888 ----
      }
  
!     if (!empty($ptid)) {
! // TODO: do we want this per publication type too ?
!     } else {
!         pnModSetVar('articles', 'SupportShortURLs', $shorturls);
!     }
  
      if (isset($cids)) 
      {
          $string = join (';', $cids);
!         if (!empty($ptid)) {
!             pnModSetVar('articles', 'cids.'.$ptid, $string);
!         } else {
!             pnModSetVar('articles', 'cids', $string);
!         }
      }
  
!     pnRedirect(pnModURL('articles', 'admin', 'modifyconfig',
!                         array('ptid' => $ptid)));
  
      return true;


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