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_official / html / modules / template [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
01 Aug 2002 18:25:42postnuke_official/html/modules/templatepnuser.php,1.13,1.14Mike
 templatize the template module - designers wanted for improvement ! :-)

Update of /home/cvsroot/postnuke_official/html/modules/template
In directory ns7.hostnuke.net:/tmp/cvs-serv30509

Modified Files:
	pnuser.php 
Log Message:
templatize the template module - designers wanted for improvement ! :-)


Index: pnuser.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/template/pnuser.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** pnuser.php	1 Aug 2002 15:05:20 -0000	1.13
--- pnuser.php	1 Aug 2002 18:25:40 -0000	1.14
***************
*** 33,41 ****
  function template_user_main()
  {
-     // Create output object - this object will store all of our output so that
-     // we can return it easily when required
-     $output = new pnHTML();
- 
- 
      // Security check - important to do this as early as possible to avoid
      // potential security holes or just too much wasted processing.  For the
--- 33,36 ----
***************
*** 50,65 ****
      }
  
!     // Add menu to output - it helps if all of the module pages have a standard
!     // menu at their head to aid in navigation
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(template_usermenu());
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
!     // Return the output that has been generated by this function
!     return $output->GetOutput();
  }
  
  /**
!  * view items
   * This is a standard function to provide an overview of all of the items
   * available from the module.
--- 45,74 ----
      }
  
!     // If you want to go directly to some default function, instead of
!     // having a separate main function, you can simply use this :
!     // return template_user_view();
  
!     // Initialise the $data variable that will hold the data to be used in
!     // the blocklayout template, and get the common menu configuration - it
!     // helps if all of the module pages have a standard menu at the top to
!     // support easy navigation
!     $data = template_usermenu();
! 
!     // Specify some other variables used in the blocklayout template
!     $data['welcome'] = pnML('Welcome to this Example module...');
! 
!     // Return the template variables defined in this function
!     return $data;
! 
!     // Note : instead of using the $data variable, you could also specify
!     // the different template variables directly in your return statement :
!     //
!     // return array('menutitle' => ...,
!     //              'welcome' => ...,
!     //              ... => ...);
  }
  
  /**
!  * view a list of items
   * This is a standard function to provide an overview of all of the items
   * available from the module.
***************
*** 74,92 ****
      $startnum = pnVarCleanFromInput('startnum');
  
!     // Create output object - this object will store all of our output so that
!     // we can return it easily when required
!     $output = new pnHTML();
  
!     // Add menu to output - it helps if all of the module pages have a standard
!     // menu at their head to aid in navigation
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(template_usermenu());
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
      // Security check - important to do this as early as possible to avoid
      // potential security holes or just too much wasted processing
      if (!pnSecAuthAction(0, 'Templates::', '::', ACCESS_OVERVIEW)) {
!         $output->Text(_TEMPLATENOAUTH);
!         return $output->GetOutput();
      }
  
--- 83,105 ----
      $startnum = pnVarCleanFromInput('startnum');
  
!     // Initialise the $data variable that will hold the data to be used in
!     // the blocklayout template, and get the common menu configuration - it
!     // helps if all of the module pages have a standard menu at the top to
!     // support easy navigation
!     $data = template_usermenu();
  
!     // Prepare the variable that will hold some status message if necessary
!     $data['status'] = '';
! 
!     // Prepare the array variable that will hold all items for display
!     $data['items'] = array();
  
      // Security check - important to do this as early as possible to avoid
      // potential security holes or just too much wasted processing
      if (!pnSecAuthAction(0, 'Templates::', '::', ACCESS_OVERVIEW)) {
!         // Fill in some status variable to be shown in the blocklayout template
!         $data['status'] = _TEMPLATENOAUTH;
!         // Return the template variables defined in this function
!         return $data;
      }
  
***************
*** 96,101 ****
      // posted and the function returns
      if (!pnModAPILoad('template', 'user')) {
!         $output->Text(_LOADFAILED);
!         return $output->GetOutput();
      }
  
--- 109,116 ----
      // posted and the function returns
      if (!pnModAPILoad('template', 'user')) {
!         // Fill in the status variable with the status to be shown
!         $data['status'] = _LOADFAILED;
!         // Return the template variables defined in this function
!         return $data;
      }
  
***************
*** 121,125 ****
          }
          // Handle the user exceptions yourself
!         $output->Text(_TEMPLATEITEMFAILED);
          // Possibly handle different exception IDs in specific ways :
          // if (pnExceptionId() == 'BAD_PARAM') {
--- 136,140 ----
          }
          // Handle the user exceptions yourself
!         $data['status'] = _TEMPLATEITEMFAILED;
          // Possibly handle different exception IDs in specific ways :
          // if (pnExceptionId() == 'BAD_PARAM') {
***************
*** 136,146 ****
          $reason = pnExceptionValueString();
          if (!empty($reason)) {
!             $output->Linebreak(2);
!             $output->Text(pnML('Reason') . ' : ' . $reason);
          }
          // Free the exception to tell PostNuke that you handled it
          pnExceptionFree();
!         // Return the result
!         return $output->GetOutput();
      }
  
--- 151,160 ----
          $reason = pnExceptionValueString();
          if (!empty($reason)) {
!             $data['status'] .= '<br /><br />'. pnML('Reason') .' : '. $reason;
          }
          // Free the exception to tell PostNuke that you handled it
          pnExceptionFree();
!         // Return the template variables defined in this function
!         return $data;
      }
  
***************
*** 150,154 ****
      // remove any words from the name that the administrator has deemed
      // unsuitable for the site
-     $output->SetInputMode(_PNH_VERBATIMINPUT);
      foreach ($items as $item) {
  
--- 164,167 ----
***************
*** 171,189 ****
                              "$item[name]::$item[tid]",
                              ACCESS_READ)) {
!             $output->URL(pnModURL('template',
!                                   'user',
!                                   'display',
!                                   array('tid' => $item['tid'])),
!                          pnVarPrepForDisplay(pnVarCensor($item['name'])));
!             $output->Linebreak();
  
          // Security check 2 - else only display the item name (or whatever is
          // appropriate for your module)
          } else {
!             $output->Text(pnVarPrepForDisplay(pnVarCensor($item['name'])));
!             $output->Linebreak();
          }
      }
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
      // Call the pnHTML helper function to produce a pager in case of there
--- 184,209 ----
                              "$item[name]::$item[tid]",
                              ACCESS_READ)) {
!             $item['link'] = pnModURL('template',
!                                      'user',
!                                      'display',
!                                      array('tid' => $item['tid']));
  
          // Security check 2 - else only display the item name (or whatever is
          // appropriate for your module)
          } else {
!             $item['link'] = '';
          }
+ 
+         // Clean up the item text before display
+         $item['name'] = pnVarPrepForDisplay(pnVarCensor($item['name']));
+ 
+         // Add this item to the list of items to be displayed
+         $data['items'][] = $item;
      }
! 
! // TODO: replace with a blocklayout pager
!     // Create output object - this object will store all of our output so that
!     // we can return it easily when required
!     $output = new pnHTML();
  
      // Call the pnHTML helper function to produce a pager in case of there
***************
*** 200,210 ****
                                    array('startnum' => '%%')),
                           pnModGetVar('template', 'itemsperpage'));
  
!     // Return the output that has been generated by this function
!     return $output->GetOutput();
  }
  
  /**
!  * display item
   * This is a standard function to provide detailed informtion on a single item
   * available from the module.
--- 220,239 ----
                                    array('startnum' => '%%')),
                           pnModGetVar('template', 'itemsperpage'));
+     $data['pager'] = $output->GetOutput();
  
!     // Return the template variables defined in this function
!     return $data;
! 
!     // Note : instead of using the $data variable, you could also specify
!     // the different template variables directly in your return statement :
!     //
!     // return array('menu' => ...,
!     //              'items' => ...,
!     //              'pager' => ...,
!     //              ... => ...);
  }
  
  /**
!  * display an item
   * This is a standard function to provide detailed informtion on a single item
   * available from the module.
***************
*** 245,257 ****
      }
  
!     // Create output object - this object will store all of our output so that
!     // we can return it easily when required
!     $output = new pnHTML();
  
!     // Add menu to output - it helps if all of the module pages have a standard
!     // menu at their head to aid in navigation
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(template_usermenu());
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
      // Load API.  All of the actual work for obtaining information on the items
--- 274,285 ----
      }
  
!     // Initialise the $data variable that will hold the data to be used in
!     // the blocklayout template, and get the common menu configuration - it
!     // helps if all of the module pages have a standard menu at the top to
!     // support easy navigation
!     $data = template_usermenu();
  
!     // Prepare the variable that will hold some status message if necessary
!     $data['status'] = '';
  
      // Load API.  All of the actual work for obtaining information on the items
***************
*** 260,265 ****
      // posted and the function returns
      if (!pnModAPILoad('template', 'user')) {
!         $output->Text(_LOADFAILED);
!         return $output->GetOutput();
      }
  
--- 288,295 ----
      // posted and the function returns
      if (!pnModAPILoad('template', 'user')) {
!         // Fill in the status variable with the status to be shown
!         $data['status'] = _LOADFAILED;
!         // Return the template variables defined in this function
!         return $data;
      }
  
***************
*** 283,287 ****
          }
          // Handle the user exceptions yourself
!         $output->Text(_TEMPLATEITEMFAILED);
          // Possibly handle different exception IDs in specific ways :
          // if (pnExceptionId() == 'BAD_PARAM') {
--- 313,317 ----
          }
          // Handle the user exceptions yourself
!         $data['status'] = _TEMPLATEITEMFAILED;
          // Possibly handle different exception IDs in specific ways :
          // if (pnExceptionId() == 'BAD_PARAM') {
***************
*** 298,308 ****
          $reason = pnExceptionValueString();
          if (!empty($reason)) {
!             $output->Linebreak(2);
!             $output->Text(pnML('Reason') . ' : ' . $reason);
          }
          // Free the exception to tell PostNuke that you handled it
          pnExceptionFree();
!         // Return the result
!         return $output->GetOutput();
      }
  
--- 328,337 ----
          $reason = pnExceptionValueString();
          if (!empty($reason)) {
!             $data['status'] .= '<br /><br />'. pnML('Reason') .' : '. $reason;
          }
          // Free the exception to tell PostNuke that you handled it
          pnExceptionFree();
!         // Return the template variables defined in this function
!         return $data;
      }
  
***************
*** 312,317 ****
      // if (!pnSecAuthAction(0, 'Templates::', "$item[name]::$item[tid]",
      //        ACCESS_READ)) {
!     //    $output->Text(_TEMPLATENOAUTH);
!     //    return $output->GetOutput();
      //}
  
--- 341,348 ----
      // if (!pnSecAuthAction(0, 'Templates::', "$item[name]::$item[tid]",
      //        ACCESS_READ)) {
!     //    // Fill in the status variable with the status to be shown
!     //    $data['status'] = _TEMPLATENOAUTH;
!     //    // Return the template variables defined in this function
!     //    return $data;
      //}
  
***************
*** 327,345 ****
  // TODO: check for conflicts between transformation hook output and
  //       pnVarCensor / input parsing of Text() by pnHTML
!     // Display details of the item.  Note the use of pnVarCensor() to remove
      // any words from the name that the administrator has deemed unsuitable for
      // the site.  Also note that a module variable is used here to determine
      // whether or not parts of the item information should be displayed in
      // bold type or not
!     $output->Text(_TEMPLATENAME . ': ');
!     if (pnModGetVar('template', 'bold')) {
!         $output->BoldText(pnVarCensor($item['name']));
!     } else {
!         $output->Text(pnVarCensor($item['name']));
!     }
!     $output->Linebreak(2);
!     $output->Text(_TEMPLATENUMBER . ': ');
!     $output->Text($item['number']);
!     $output->Linebreak(2);
  
  
--- 358,379 ----
  // TODO: check for conflicts between transformation hook output and
  //       pnVarCensor / input parsing of Text() by pnHTML
!     // Fill in the details of the item.  Note the use of pnVarCensor() to remove
      // any words from the name that the administrator has deemed unsuitable for
      // the site.  Also note that a module variable is used here to determine
      // whether or not parts of the item information should be displayed in
      // bold type or not
!     $data['namelabel'] = _TEMPLATENAME;
!     $data['namevalue'] = pnVarCensor($item['name']);
!     $data['numberlabel'] = _TEMPLATENUMBER;
!     $data['numbervalue'] = $item['number'];
! 
!     $data['bold'] = pnModGetVar('template', 'bold');
!     // Note : module variables can also be specified directly in the
!     // blocklayout template by using &pnt-mod-<modname>-<varname>;
! 
!     // Note that you could also pass on the $item variable, and specify
!     // the labels directly in the blocklayout template. But make sure you
!     // use the <pnt:ml>, <pnt:mlstring> or <pnt:mlkey> tags then, so that
!     // labels can be translated for other languages...
  
  
***************
*** 348,399 ****
      // hooks will show after they have finished their own work.  It is normal
      // for that URL to bring the user back to this function
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->Text(pnModCallHooks('item',
!                                  'display',
!                                  $tid,
!                                  pnModURL('template',
!                                           'user',
!                                           'display',
!                                           array('tid' => $tid))));
!     $output->SetInputMode(_PNH_PARSEINPUT);
  
!     // Return the output that has been generated by this function
!     return $output->GetOutput();
  }
  
  /**
!  * generate menu fragment
   */
  function template_usermenu()
  {
!     // Create output object - this object will store all of our output so that
!     // we can return it easily when required
!     $output = new pnHTML();
  
!     // Display status message if any.  Note that in future this functionality
!     // will probably be in the theme rather than in this menu, but this is the
!     // best place to keep it for now
  
!     // Start options menu
!     $output->Text(pnGetStatusMsg());
!     $output->Linebreak(2);
  
!     // Menu options.  These options are all added in a single row, to add
!     // multiple rows of options the code below would just be repeated
!     $output->TableStart(_TEMPLATE);
!     $output->SetOutputMode(_PNH_RETURNOUTPUT);
!     $columns = array();
!     $columns[] = $output->URL(pnModURL('template',
!                                        'user',
!                                        'view'),
!                               _TEMPLATEVIEW);
!     $output->SetOutputMode(_PNH_KEEPOUTPUT);
!     $output->SetInputMode(_PNH_VERBATIMINPUT);
!     $output->TableAddRow($columns);
!     $output->SetInputMode(_PNH_PARSEINPUT);
!     $output->TableEnd();
  
!     // Return the output that has been generated by this function
!     return $output->GetOutput();
  }
  
--- 382,459 ----
      // hooks will show after they have finished their own work.  It is normal
      // for that URL to bring the user back to this function
!     $data['hookoutput'] = pnModCallHooks('item',
!                                          'display',
!                                          $tid,
!                                          pnModURL('template',
!                                                   'user',
!                                                   'display',
!                                                   array('tid' => $tid)));
  
!     // Return the template variables defined in this function
!     return $data;
! 
!     // Note : instead of using the $data variable, you could also specify
!     // the different template variables directly in your return statement :
!     //
!     // return array('menu' => ...,
!     //              'item' => ...,
!     //              'hookoutput' => ...,
!     //              ... => ...);
  }
  
  /**
!  * generate the common menu configuration
   */
  function template_usermenu()
  {
!     // Initialise the array that will hold the menu configuration
!     $menu = array();
  
!     // Specify the menu title to be used in your blocklayout template
!     $menu['menutitle'] = _TEMPLATE;
  
!     // Specify the menu items to be used in your blocklayout template
!     $menu['menulabelview'] = _TEMPLATEVIEW;
!     $menu['menulinkview'] = pnModURL('template',
!                                      'user',
!                                      'view');
  
!     // Specify the labels/links for more menu items if relevant
!     // $menu['menulabelother'] = pnML('Some other menu item');
!     // $menu['menulinkother'] = pnModURL('template','user','other');
!     // ...
  
!     // Note : you could also put all menu items in a $menu['menuitems'] array
!     //
!     // Initialise the array that will hold the different menu items
!     // $menu['menuitems'] = array();
!     //
!     // Define a menu item
!     // $item = array();
!     // $item['menulabel'] = _TEMPLATEVIEW;
!     // $item['menulink'] = pnModURL('template','user','view');
!     //
!     // Add it to the array of menu items
!     // $menu['menuitems'][] = $item;
!     //
!     // Add more menu items to the array
!     // ...
!     //
!     // Then you can let the blocklayout template create the different
!     // menu items *dynamically*, e.g. by using something like :
!     //
!     // <pnt:loop name="menuitems">
!     //    <td><a href="&pnt-var-menulink;">&pnt-var-menulabel;</a></td>
!     // </pnt:loop>
!     //
!     // in the templates of your module. Or you could even pass an argument
!     // to the usermenu() function to turn links on/off automatically
!     // depending on which function is currently called...
!     //
!     // But most people will prefer to specify all this manually in each
!     // blocklayout template anyway :-)
! 
!     // Return the array containing the menu configuration
!     return $menu;
  }
  


Directory filter : [ all ] / postnuke_official / html / modules / template [ 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