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 / categories [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
27 Jul 2002 19:06:09postnuke_official/html/modules/categoriespnadmin.php,1.1,1.2 pnadminapi.php,1.2,1.3 pninit.php,1.1,1.2 pntables.php,1.1,1.2 pnuserapi.php,1.1,1.2 pnversion.php,1.1,1.2 pnvisualapi.php,1.1,1.2Mike
 re-upload actual version

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

Modified Files:
	pnadmin.php pnadminapi.php pninit.php pntables.php 
	pnuserapi.php pnversion.php pnvisualapi.php 
Log Message:
re-upload actual version


Index: pnadmin.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnadmin.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pnadmin.php	20 Jul 2002 20:24:43 -0000	1.1
--- pnadmin.php	27 Jul 2002 19:06:07 -0000	1.2
***************
*** 216,220 ****
      $cid = pnModAPIFunc('categories',
                          'admin',
!                         'create_celko',
                          array(
                                'name' => $name ,
--- 216,220 ----
      $cid = pnModAPIFunc('categories',
                          'admin',
!                         'createcat',
                          array(
                                'name' => $name ,
***************
*** 330,334 ****
      if (pnModAPIFunc('categories',
                       'admin',
!                      'modify_celko',
                       array('cid' => $cid,
                             'name' => $name,
--- 330,334 ----
      if (pnModAPIFunc('categories',
                       'admin',
!                      'updatecat',
                       array('cid' => $cid,
                             'name' => $name,
***************
*** 357,367 ****
  {
      list($cid,
!          $confirmation,
           $return_url) = pnVarCleanFromInput('cid',
!                                             'confirmation',
                                              'return_url');
!     
!     $cid = (int) $cid;
!                                            
      if (
          !isset($return_url) ||
--- 357,365 ----
  {
      list($cid,
!          $ok,
           $return_url) = pnVarCleanFromInput('cid',
!                                             'confirm',
                                              'return_url');
!                                             
      if (
          !isset($return_url) ||
***************
*** 381,387 ****
      }
  
!     if (isset($confirmation))
      {
!        if ($confirmation==1)
         {
            // Load API
--- 379,385 ----
      }
  
!     if (isset($ok))
      {
!        if ($ok==1)
         {
            // Load API
***************
*** 438,449 ****
            'admin',
            'deletecat',
-           Array()
-          ),
-          _CATGOBACK,
-          $return_url,
            Array
            (
!            'cid' => $cid
            )
          );
  
--- 436,448 ----
            'admin',
            'deletecat',
            Array
            (
!            'ok' => 1,
!            'cid' => $cid,
            )
+          ),
+          _CATGOBACK,
+          $return_url,
+          Array()
          );
  

Index: pnadminapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnadminapi.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pnadminapi.php	22 Jul 2002 14:23:57 -0000	1.2
--- pnadminapi.php	27 Jul 2002 19:06:07 -0000	1.3
***************
*** 116,120 ****
   */
  
! function categories_adminapi_create_celko ($args)
  {
      // Get arguments from argument array
--- 116,120 ----
   */
  
! function categories_adminapi_createcat($args)
  {
      // Get arguments from argument array
***************
*** 161,165 ****
         
         if ($n == 0) {
!             // Editing database doesn�t need to have a great performance
              // So the 2 extras updates are OK...
              return categories_adminapi_createcatdirectly
--- 161,165 ----
         
         if ($n == 0) {
!                // Editing database doesn�t need to have a great performance
              // So the 2 extras updates are OK...
              return categories_adminapi_createcatdirectly
***************
*** 220,300 ****
  }
  
- /**
-  * creates a category using the parent model
-  *
-  *  -- INPUT --
-  * @param $args['name'] the name of the category
-  * @param $args['description'] the description of the category
-  * @param $args['image'] the (optional) image for the category
-  * @param $args['parent_id'] Parent Category ID (0 if root)
-  *
-  *  -- OUTPUT --
-  * @returns int
-  * @return category ID on success, false on failure
-  */
- // Creates a category using the parent model
- function categories_adminapi_create ($args)
- {
-     // Get arguments from argument array
-     extract($args);
-     
-     // Argument check
-     if ((!isset($name))        ||
-         (!isset($description)) ||
-         (!isset($parent_id))   ||
-         (!is_int($parent_id))
-        )
-     {
-         pnSessionSetVar('errormsg', _MODARGSERROR);
-         return false;
-     }
- 
-     if (!isset($image)) {
-         $image = '';
-     }
- 
-     // Security check
-     // Has to be redone later
- 
-     if (!pnSecAuthAction(0, "categories::category", "ID::", ACCESS_ADD))
-     {
-         pnSessionSetVar('errormsg', _CATEGORIESNOAUTH);
-         return false;
-     }
- 
-     if (!pnModAPILoad('categories', 'user')) 
-     {
-         pnExceptionSet(PN_SYSTEM_EXCEPTION, 'MODULE_FILE_NOT_EXIST',
-                        new SystemException(__FILE__.'('.__LINE__.'): Unable to load the categories module�s user API'));
-         return;
-     }
- 
-     if ($parent_id != 0) 
-     {
-        $cat = pnModAPIFunc('categories', 'user', 'getcatinfo', Array('cid'=>$parent_id));
- 
-        if ($cat == false) 
-        {
-           pnExceptionSet(PN_USER_EXCEPTION, 'BAD_PARAM',
-                           new SystemException(__FILE__.'('.__LINE__.'): Unable to load the categories module�s user API'));
-           return false;
-        }
-        $point_of_insertion = $cat['left'] + 1;
-     } else {
-        $point_of_insertion = 1;    
-     }
- 
-     return categories_adminapi_createcatdirectly
-            (
-                 Array
-                 (
-                     'point_of_insertion' => $point_of_insertion,
-                     'name' => $name,
-                     'description' => $description,
-                     'image' => $image
-                 )
-             );
- }
- 
  function categories_adminapi_createcatdirectly($args)
  {
--- 220,223 ----
***************
*** 390,397 ****
      $args = Array(
                    'cid' => $cid,
!                   //getcatinfo called first, this is going to be later on
!                   'getparents' => false,
!                   'getchildren' => true,  
!                   'return_itself' => true
                   );
      $cat = pnModAPIFunc('categories', 'user', 'getcatinfo', $args);
--- 313,318 ----
      $args = Array(
                    'cid' => $cid,
!                   'getparets' => false,
!                   'getchildren' => true
                   );
      $cat = pnModAPIFunc('categories', 'user', 'getcatinfo', $args);
***************
*** 412,420 ****
                                 $args);
  
!     if ($categories == false || count($categories) == 0) {
         pnSessionSetVar('errormsg', _CATEGORIESDOESNOTEXIST);
         return false;
      }
  
      // Useful Variables set...
  
--- 333,355 ----
                                 $args);
  
!     if ($categories == false) {
         pnSessionSetVar('errormsg', _CATEGORIESDOESNOTEXIST);
         return false;
      }
  
+     // This is set to be used later on
+     $n=0;
+     $cid_concat_or = '';
+ 
+     foreach ($categories as $category) {
+        if ($n > 0) {
+           $cid_concat_or .= " OR ";
+        }
+ 
+        $cid_concat_or .= $category['cid'];
+ 
+        $n++;
+     }
+     
      // Useful Variables set...
  
***************
*** 448,459 ****
      $categorieslinkagecolumn = &$pntable['categories_linkage_column'];
  
-     $catlist = array();
-     foreach ($categories as $mycat) {
-         $catlist[] = $mycat['cid'];
-     }
-     $cats_comma_separated = implode (',', $catlist);
-     
      $sql = "DELETE FROM $categorieslinkagetable
!             WHERE $categorieslinkagecolumn[cid] IN (" . $cats_comma_separated .")";
      $dbconn->Execute($sql);
      // What is the largest number of bytes a SQL query can have?
--- 383,388 ----
      $categorieslinkagecolumn = &$pntable['categories_linkage_column'];
  
      $sql = "DELETE FROM $categorieslinkagetable
!             WHERE $categorieslinkagecolumn[cid] = " . $cid_concat_or;
      $dbconn->Execute($sql);
      // What is the largest number of bytes a SQL query can have?
***************
*** 502,606 ****
  }
  
- function categories_adminapi_modifydirectly($args)
- {
-     // Get arguments from argument array
-     extract($args);
- 
-     // Argument check
-     if (
-         (!isset($cid)) ||
-         (!isset($name)) ||
-         (!isset($description)) ||
-         (
-          ($moving == 1) &&
-          (!isset($point_of_insertion))
-         )
-        ) 
-     {
-         pnSessionSetVar('errormsg', _MODARGSERROR);
-         return false;
-     }
- 
-     if (!isset($image)) {
-         $image = '';
-     }
- 
-     pnModAPILoad('categories', 'user');
-     $cat = pnModAPIFunc('categories', 'user', 'getcatinfo', Array('cid'=> $cid));
- 
-     if ($cat == false) {
-        pnSessionSetVar('errormsg', _CATEGORIESDOESNOTEXIST);
-        return false;
-     }
- 
-     // Get database setup
-     list($dbconn) = pnDBGetConn();
-     $pntable = pnDBGetTables();
-     $categoriestable = $pntable['categories'];
-     $categoriescolumn = &$pntable['categories_column'];
- 
-     $size = $cat['right'] - $cat['left'] + 1;
-     $distance = $point_of_insertion - $cat['left'];
- 
-     // If necessary to move then evaluate
-     if ($distance != 0) 
-     { // It�s Moving, baby!  Do the Evolution!
-        if ($distance > 0)
-        { // moving forward
-           $distance = $point_of_insertion - $cat['right'] - 1;
-           $deslocation_outside = -$size;
-           $between_string = ($cat['right'] + 1)." AND ".($point_of_insertion - 1);
-        }
-        else
-        { // $distance < 0 (moving backward)
-           $deslocation_outside = $size;
-           $between_string = $point_of_insertion." AND ".($cat['left'] - 1);
-        }
- 
-        $SQLquery = "UPDATE $categoriestable SET
-                            $categoriescolumn[left] = CASE
-                       WHEN $categoriescolumn[left] BETWEEN ".$cat['left']." AND ".$cat['right']."
-                       THEN $categoriescolumn[left] + ($distance)
-                       WHEN $categoriescolumn[left] BETWEEN $between_string
-                       THEN $categoriescolumn[left] + ($deslocation_outside)
-                       ELSE $categoriescolumn[left]
-                       END,
-                            $categoriescolumn[right] = CASE
-                       WHEN $categoriescolumn[right] BETWEEN ".$cat['left']." AND ".$cat['right']."
-                       THEN $categoriescolumn[right] + ($distance)
-                       WHEN $categoriescolumn[right] BETWEEN $between_string
-                       THEN $categoriescolumn[right] + ($deslocation_outside)
-                       ELSE $categoriescolumn[right]
-                       END
-                   ";
-                   // This seems SQL-92 standard... Its a good test to see if
-                   // the databases we are supporting are complying with it. This can be
-                   // broken down in 3 simple UPDATES which shouldnt be a problem with any database
- 
-        $result = $dbconn->Execute($SQLquery);
- 
-        if ($dbconn->ErrorNo() != 0) {
-           pnSessionSetVar('errormsg', _CATEGORIESCOMPLEXUPDATE);
-           return false;
-        }
-     } // else (distace == 0) not necessary to move
- 
-     // Update name and description
-     $SQLquery = "UPDATE $categoriestable
-                     SET $categoriescolumn[name] = '".pnVarPrepForStore($name)."',
-                         $categoriescolumn[description] = '".pnVarPrepForStore($description)."',
-                         $categoriescolumn[image] = '".pnVarPrepForStore($image)."'
-                   WHERE $categoriescolumn[cid] = ".pnVarPrepForStore($cid);
-     $result = $dbconn->Execute($SQLquery);
- 
-     if($dbconn->ErrorNo() != 0) {
-         pnSessionSetVar('errormsg', _CATEGORIESLASTUPDATE);
-         return false;
-     }
-     
-     return true;
- }
- 
- 
  /**
   * update a category
--- 431,434 ----
***************
*** 613,617 ****
   * @param $args['moving'] = 1 means the category can move around
   *
!  * If $args['moving'] == 1 then these should be set:
   *
   *    @param $args['refcid'] the ID of the reference category
--- 441,445 ----
   * @param $args['moving'] = 1 means the category can move around
   *
!  * If $args['moving'] != 1 then these shouldn�t be set:
   *
   *    @param $args['refcid'] the ID of the reference category
***************
*** 626,630 ****
  
   */
! function categories_adminapi_modify_celko ($args)
  {
      // Get arguments from argument array
--- 454,458 ----
  
   */
! function categories_adminapi_updatecat($args)
  {
      // Get arguments from argument array
***************
*** 644,649 ****
           )
          )
!        ) 
!     {
          pnSessionSetVar('errormsg', _MODARGSERROR);
          return false;
--- 472,476 ----
           )
          )
!        ) {
          pnSessionSetVar('errormsg', _MODARGSERROR);
          return false;
***************
*** 671,674 ****
--- 498,502 ----
      // Get inside if the category is supposed to move
      if ($moving == 1) {
+ 
         // Obtain current information on the reference category
         $refcat = pnModAPIFunc('categories', 'user', 'getcatinfo', Array('cid'=>$refcid));
***************
*** 703,768 ****
                                $refcat['left']
                               );
!         $args['point_of_insertion'] = $point_of_insertion;
!     }
! 
!     return categories_adminapi_modifydirectly($args);
! }
! 
! /**
!  * update a category
!  *
!  *  -- INPUT --
!  * @param $args['cid'] the ID of the category
!  * @param $args['name'] the modified name of the category
!  * @param $args['description'] the modified description of the category
!  * @param $args['image'] the (optional) modified image for the category
!  * @param $args['parent_id'] = ID of the parent_id (If not set it stays the same)
!  *
!  *  -- OUTPUT --
!  * @return true on success, false on failure
  
!  */
! function categories_adminapi_modify ($args)
! {
!     // Get arguments from argument array
!     extract($args);
  
!     // Argument check
!     if (
!         (!isset($cid)) ||
!         (!isset($name)) ||
!         (!isset($description)) 
!        ) 
!     {
!         pnSessionSetVar('errormsg', _MODARGSERROR);
!         return false;
!     }
  
!     if (!isset($image)) {
!         $image = '';
      }
!     
!     if (isset($parent_id)) 
!     {
!         $args['moving'] = 1;
!         if ($parent_id == 0) 
!         {
!            $args['point_of_insertion'] = 1;
!         }
!         else 
!         {
!            $args['refcid'] = $parent_id;
!            $args['inorout'] = 'IN';
!            $args['rightorleft'] = 'LEFT';
!            return categories_adminapi_modify_celko ($args);
          }
-     } 
-     else 
-     {
-         $args['moving'] = 0;
      }
  
!     return categories_adminapi_modifydirectly ($args);
  }
  
  /**
--- 531,608 ----
                                $refcat['left']
                               );
!        $size = $cat['right'] - $cat['left'] + 1;
!        $distance = $point_of_insertion - $cat['left'];
  
!        // If necessary to move then evaluate
!        if ($distance != 0) { // It�s Moving, baby!  Do the Evolution!
!           if ($distance > 0)
!           { // moving forward
!               $distance = $point_of_insertion - $cat['right'] - 1;
!               $deslocation_outside = -$size;
!               $between_string = ($cat['right'] + 1)." AND ".($point_of_insertion - 1);
!           }
!           else
!           { // $distance < 0 (moving backward)
!               $deslocation_outside = $size;
!               $between_string = $point_of_insertion." AND ".($cat['left'] - 1);
!           }
  
!           $SQLquery = "UPDATE $categoriestable SET
!                       $categoriescolumn[left] = CASE
!                         WHEN $categoriescolumn[left] BETWEEN ".$cat['left']." AND ".$cat['right']."
!                            THEN $categoriescolumn[left] + ($distance)
!                         WHEN $categoriescolumn[left] BETWEEN $between_string
!                            THEN $categoriescolumn[left] + ($deslocation_outside)
!                         ELSE $categoriescolumn[left]
!                         END,
!                       $categoriescolumn[right] = CASE
!                         WHEN $categoriescolumn[right] BETWEEN ".$cat['left']." AND ".$cat['right']."
!                            THEN $categoriescolumn[right] + ($distance)
!                         WHEN $categoriescolumn[right] BETWEEN $between_string
!                            THEN $categoriescolumn[right] + ($deslocation_outside)
!                         ELSE $categoriescolumn[right]
!                         END
!                      ";
!                      // This seems SQL-92 standard... Its a good test to see if
!                      // the databases we are supporting are complying with it. This can be
!                      // broken down in 3 simple UPDATES which shouldnt be a problem with any database
  
!           $result = $dbconn->Execute($SQLquery);
!           if($dbconn->ErrorNo() != 0) {
!              pnSessionSetVar('errormsg', _CATEGORIESCOMPLEXUPDATE);
!              return false;
!           }
!        } // else (distace == 0) not necessary to move
      }
!     else
!     {// (moving != 1)
!         if (
!             (isset($inorout)) ||
!             (isset($rightorleft)) ||
!             (isset($refcid))
!            )
!         { // Show them that moving is not set, or else they wont know why it
!           // is not working
!              pnSessionSetVar('statusmsg', _CATMOVINGNOTSET);
          }
      }
  
! // TODO: use pnVarPrepForStore
!     // Update name and description
!     $SQLquery = "UPDATE $categoriestable
!                     SET $categoriescolumn[name] = '$name',
!                         $categoriescolumn[description] = '$description',
!                         $categoriescolumn[image] = '$image'
!                   WHERE $categoriescolumn[cid] = $cid";
!     $result = $dbconn->Execute($SQLquery);
! 
!     if($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', _CATEGORIESLASTUPDATE);
!         return false;
!     }
! 
!     return true;
  }
+ 
  
  /**

Index: pninit.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pninit.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pninit.php	20 Jul 2002 20:24:43 -0000	1.1
--- pninit.php	27 Jul 2002 19:06:07 -0000	1.2
***************
*** 45,49 ****
              $categoriescolumn[name] varchar(64) NOT NULL,
              $categoriescolumn[description] varchar(255) NOT NULL,
!             $categoriescolumn[image] varchar(64) NULL,
              $categoriescolumn[left] int(11) unsigned NOT NULL,
              $categoriescolumn[right] int(11) unsigned NOT NULL,
--- 45,49 ----
              $categoriescolumn[name] varchar(64) NOT NULL,
              $categoriescolumn[description] varchar(255) NOT NULL,
!             $categoriescolumn[image] varchar(255) NOT NULL,
              $categoriescolumn[left] int(11) unsigned NOT NULL,
              $categoriescolumn[right] int(11) unsigned NOT NULL,
***************
*** 77,93 ****
  
      // Set up module variables
!     // Setting up global postnuke category (core)
!     //Set Exceptions correctly
!     pnModAPILoad('categories', 'admin');
!     $globalcid = pnModAPIFunc('categories',
!                               'admin', 
!                               'create', 
!                               Array(
!                                     'name' => 'Categories',
!                                     'description' => 'Postnuke Core Categories',
!                                     'parent_id' => 0,
!                                     'image' => 'PostNuke.gif'));
!     
!     pnConfigSetVar('globalcid', $globalcid);
  
      // Initialisation successful
--- 77,81 ----
  
      // Set up module variables
! //    pnModSetVar('categories', 'bold', 0);
  
      // Initialisation successful
***************
*** 165,169 ****
  
      // Delete module variables
!     pnConfigDelVar('globalcid');
  
      // Deletion successful
--- 153,157 ----
  
      // Delete module variables
! //    pnModDelVar('categories', 'bold');
  
      // Deletion successful

Index: pntables.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pntables.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2

Index: pnuserapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnuserapi.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pnuserapi.php	20 Jul 2002 20:24:43 -0000	1.1
--- pnuserapi.php	27 Jul 2002 19:06:07 -0000	1.2
***************
*** 75,90 ****
      }
      if (!isset($start)) {
!         $start = 0;
      }
      elseif (!is_int($start)) {
          pnSessionSetVar('errormsg', _MODARGSNUMERIC);
          return false;
-     } else {
-         //The pager starts counting from 1
-         //SelectLimit starts from 0
-         $start--;
      }
      if (!isset($count)) {
!         $count = 10;
      }
      elseif (!is_int($count)) {
--- 75,86 ----
      }
      if (!isset($start)) {
!         $start = -1;
      }
      elseif (!is_int($start)) {
          pnSessionSetVar('errormsg', _MODARGSNUMERIC);
          return false;
      }
      if (!isset($count)) {
!         $count = -1;
      }
      elseif (!is_int($count)) {
***************
*** 184,192 ****
                .  " ORDER BY P1.".$categoriescolumn['left'];
  
!     if (is_int($count) && is_int($start)) {
!        $result = $dbconn->SelectLimit($SQLquery, $count, $start);
!     } else {
         $result = $dbconn->Execute($SQLquery);
!     }
  
      if($dbconn->ErrorNo() != 0) {
--- 180,189 ----
                .  " ORDER BY P1.".$categoriescolumn['left'];
  
! // Am i doing something wrong or isn�t SelectLimit working properly?
! //    if (($count > 0) && ($start > 0)) {
! //       $result = $dbconn->SelectLimit($sql, $count, $start);
! //    } else {
         $result = $dbconn->Execute($SQLquery);
! //    }
  
      if($dbconn->ErrorNo() != 0) {
***************
*** 214,218 ****
            ) {
          $result->MoveNext();
-         // FIXME: Move max/min depth into the SQL
          if ((
               (!isset($minimum_depth)) || 
--- 211,214 ----

Index: pnversion.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnversion.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pnversion.php	20 Jul 2002 20:24:43 -0000	1.1
--- pnversion.php	27 Jul 2002 19:06:07 -0000	1.2
***************
*** 1,5 ****
  <?php
  // $Id$
! $modversion['name'] = 'categories';
  $modversion['version'] = '2.1';
  $modversion['id'] = '147';
--- 1,5 ----
  <?php
  // $Id$
! $modversion['name'] = 'CatData';
  $modversion['version'] = '2.1';
  $modversion['id'] = '147';
***************
*** 15,19 ****
  $modversion['class'] = 'Core Utility';
  $modversion['category'] = 'Global';
! $modversion['securityschema'] = array('categories::category' => 'Category name::Category ID',
!                                       'categories::item' => 'Item name:Category name:Item ID');
  ?>
--- 15,19 ----
  $modversion['class'] = 'Core Utility';
  $modversion['category'] = 'Global';
! $modversion['securityschema'] = array('CatData::Category' => 'Category name::Category ID',
!                                       'CatData::Item' => 'Item name:Category name:Item ID');
  ?>

Index: pnvisualapi.php
===================================================================
RCS file: /home/cvsroot/postnuke_official/html/modules/categories/pnvisualapi.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** pnvisualapi.php	20 Jul 2002 20:24:43 -0000	1.1
--- pnvisualapi.php	27 Jul 2002 19:06:07 -0000	1.2
***************
*** 29,76 ****
  // ----------------------------------------------------------------------
  
- function categories_visualapi_findimages ()
- {
-    //Set the proper filesystem delimiter
-    $fs_delimiter = (pnConfigGetVar('system'))?'\\':'/';
- 
-    //Find the root of PostNuke directory
-    $path_array = explode($fs_delimiter, $_SERVER["PATH_TRANSLATED"]);
-    array_pop ($path_array);
-    $postnuke_path = implode ($fs_delimiter, $path_array);
-         
-    $dir_path = $postnuke_path
-               .$fs_delimiter
-               .'images'
-               .$fs_delimiter
-               .'categories';
- 
-    $image_array = Array ();
-    $image_array[] = '';
  
-    // We need appropriate Error Check here... Or else it just hangs there...
-    $dir = @opendir($dir_path);
-    if (!$dir) 
-    {
-       pnExceptionSet(PN_SYSTEM_EXCEPTION, 'DIRECTORY_INEXISTENT',
-                      new SystemException(__FILE__.'('.__LINE__.'): An error occured trying to access the categories image�s directory '.$dir_path));
-       return $image_array ();
-    }
-    while (($file = readdir($dir)) !== false) {
-       // Should be put somewhere else?
-       // Conf vars?
-       $extension_array = Array('.png', '.gif', '.jpg');
-       $is_image = false;
-       foreach ($extension_array as $extension)
-       {
-          if (ereg("$extension\$", $file)) {$is_image = true;}
-       }
-       if ($is_image) 
-       {
-          $image_array[] = $file;
-       }
-    }
-    closedir($dir);
-    return $image_array;
- }
  /**
   * Visual Menu to add a new category
--- 29,33 ----
***************
*** 131,154 ****
  
      // Image
-     // Make a Select from images/categories
-     // Does this work in IIS ?? _SERVER["PATH_TRANSLATED"]???
-     // Need to change the delimiter depending on Win/Unix filesystem
-     $image_array = categories_visualapi_findimages ();
-     
-     $select = '<select name="image" id="image">';
-     foreach ($image_array as $image)
-     {
-        // Putting a javascript to show the image
-        // would be really nice
-        $select .= '<option>'.$image;
-     }
-     
-     $select .= '</select>';
-     
-     //Image
      $row = array();
      $output->SetOutputMode(_PNH_RETURNOUTPUT);
      $row[] = $output->Text(pnVarPrepForDisplay(_CATEGORIESIMAGE));
!     $row[] = $select;
      $output->SetOutputMode(_PNH_KEEPOUTPUT);
      $output->SetInputMode(_PNH_VERBATIMINPUT);
--- 88,95 ----
  
      // Image
      $row = array();
      $output->SetOutputMode(_PNH_RETURNOUTPUT);
      $row[] = $output->Text(pnVarPrepForDisplay(_CATEGORIESIMAGE));
!     $row[] = $output->FormText('image', '', 64, 255);
      $output->SetOutputMode(_PNH_KEEPOUTPUT);
      $output->SetInputMode(_PNH_VERBATIMINPUT);
***************
*** 182,185 ****
--- 123,135 ----
  function categories_visualapi_makeselect ($args)
  {
+ // Old Stuff
+ /* 
+     if (!isset($args['return_var'])) 
+     {
+         $args['return_var'] = 'categoryid';
+     }
+ // Old way
+ //    $select = "<select name='$args[return_var]".(($args[multiple] == 1)?"[]' multiple":'').">";
+ */    
      $tree_array = categories_visualapi_treearray ($args);
  
***************
*** 188,205 ****
      }
  
      $select = "<select name='cids[]'".(($args['multiple'] == 1)?" multiple":'').">";
      foreach ($tree_array as $option)
      {
          $select .= "<option ";
          if (isset($args['values']) && isset($args['values'][$option['id']]) &&
!             ($args['multiple'] == 1) &&
              ($args['values'][$option['id']]>0))
          {
              $select .= "selected ";
              $args['values'][$option['id']]--;
          }
          $select .= "value='".$option['id']."'>".$option['name'];
      }
      $select .= "</select>";
      
      return $select;
--- 138,162 ----
      }
  
+ //    if (count($tree_array) > 0) {
+ // New way -> Makes cids[] Array
      $select = "<select name='cids[]'".(($args['multiple'] == 1)?" multiple":'').">";
+     $already_passed = false;
      foreach ($tree_array as $option)
      {
          $select .= "<option ";
          if (isset($args['values']) && isset($args['values'][$option['id']]) &&
!             ($args['multiple'] == 1 || !$already_passed) &&
              ($args['values'][$option['id']]>0))
          {
              $select .= "selected ";
              $args['values'][$option['id']]--;
+             $already_passed = true;
          }
          $select .= "value='".$option['id']."'>".$option['name'];
      }
      $select .= "</select>";
+ //    } else {
+ //        $select = _ARTICLENOCAT . "<input hidden='$args[return_var]' value=0>";
+ //    }
      
      return $select;
***************
*** 446,471 ****
      $output->SetInputMode(_PNH_PARSEINPUT);
  
!     // Make a Select from images/categories
!     // Does this work in IIS ?? _SERVER["PATH_TRANSLATED"]???
!     // Need to change the delimiter depending on Win/Unix filesystem
!     $image_array = categories_visualapi_findimages ();
!     
!     $select = '<select name="image" id="image">';
!     foreach ($image_array as $image)
!     {
!        // Putting a javascript to show the image
!        // would be really nice
!        $select .= '<option';
!        $select .= ($cat['image']==$image)?' selected':' ';
!        $select .= '>'.$image;
!     }
!     
!     $select .= '</select>';
!     
!     //Image
      $row = array();
      $output->SetOutputMode(_PNH_RETURNOUTPUT);
      $row[] = $output->Text(pnVarPrepForDisplay(_CATEGORIESIMAGE));
!     $row[] = $select;
      $output->SetOutputMode(_PNH_KEEPOUTPUT);
      $output->SetInputMode(_PNH_VERBATIMINPUT);
--- 403,414 ----
      $output->SetInputMode(_PNH_PARSEINPUT);
  
!     // Image
      $row = array();
      $output->SetOutputMode(_PNH_RETURNOUTPUT);
      $row[] = $output->Text(pnVarPrepForDisplay(_CATEGORIESIMAGE));
!     $row[] = $output->FormText('image',
!                                pnVarPrepForDisplay($cat['image']),
!                                64,
!                                255);
      $output->SetOutputMode(_PNH_KEEPOUTPUT);
      $output->SetInputMode(_PNH_VERBATIMINPUT);
***************
*** 509,519 ****
          $pagerstart = 1;
      }
-     
-     if (!isset($catsperpage)) {
-         $catsperpage = pnModGetVar('categories', 'catsperpage');
-        if (!is_int($catsperpage)) {
-           $catsperpage = 10;
-        }
-     }
  
      if (!isset($cid)) {
--- 452,455 ----
***************
*** 533,538 ****
      }
  
!     if (!isset($catstotal)) {
!         $catstotal = pnModAPIFunc('categories', 'user', 'countcats');
      }
  
--- 469,474 ----
      }
  
!     if (!isset($pagertotal)) {
!         $pagertotal = pnModAPIFunc('categories', 'user', 'countcats');
      }
  
***************
*** 542,548 ****
                                  'user',
                                  'getcat',
!                                 array('start' => (int) $pagerstart,
!                                       'count' => (int) $catsperpage,
!                                       'cid' => (int) $cid,
                                        'getchildren' => true
                                       ));
--- 478,484 ----
                                  'user',
                                  'getcat',
!                                 array('start' => $pagerstart,
!                                       'count' => 10,
!                                       'cid' => $cid,
                                        'getchildren' => true
                                       ));
***************
*** 598,617 ****
          // Image
          $this_row = Array();
!         if (isset($category['image']) && ($category['image'] != '')) 
!         {
!            $fs_delimiter = (pnConfigGetVar('system'))?'\\':'/';
!            // How you know the image isn�t going to be too big?
!            // Expect it to be a square?
!            $image = "<img src='images"
!                    .$fs_delimiter
!                    ."categories"
!                    .$fs_delimiter
!                    .pnVarPrepHTMLDisplay($category['image'])."' width=40 />";
!         }
!         else
!         {
!            $image = '&nbsp';
!         }
!         $this_row['content'] = $image;
          $row[] = $this_row;
  
--- 534,538 ----
          // Image
          $this_row = Array();
!         $this_row['content'] = pnVarPrepHTMLDisplay($category['image']);
          $row[] = $this_row;
  
***************
*** 654,664 ****
  
      $output->Pager($pagerstart,
!                    $catstotal,
                     pnModURL(pnModGetName(),
                              'admin',
                              'viewcats',
                              array('pagerstart' => '%%',
!                                   'pagertotal' => $catstotal)),
!                    $catsperpage);
  
      return $output->GetOutput();
--- 575,585 ----
  
      $output->Pager($pagerstart,
!                    $pagertotal,
                     pnModURL(pnModGetName(),
                              'admin',
                              'viewcats',
                              array('pagerstart' => '%%',
!                                   'pagertotal' => $pagertotal)),
!                    10);
  
      return $output->GetOutput();


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