Changeset 331
- Timestamp:
- Jan 30, 2004, 11:47:18 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/release-1_3/admin/cat_modify.php
r322 r331 65 65 { 66 66 $query.= ', id_uppercat = '; 67 if ( $_POST['associate'] == -1 ) $query.= 'NULL'; 68 else $query.= $_POST['associate']; 67 if ( $_POST['associate'] == -1 or $_POST['associate'] == '' ) 68 $query.= 'NULL'; 69 else 70 $query.= $_POST['associate']; 69 71 } 70 72 $query.= ' WHERE id = '.$_GET['cat']; … … 114 116 $query.= ';'; 115 117 $row = mysql_fetch_array( mysql_query( $query ) ); 118 119 if ( !isset( $row['dir'] ) ) $row['dir'] = ''; 120 if ( !isset( $row['id_uppercat'] ) ) $row['id_uppercat'] = ''; 121 116 122 $result = get_cat_info( $row['id'] ); 117 123 // cat name … … 119 125 $vtp->setVar( $sub, 'cat:name', $cat_name ); 120 126 // cat dir 121 if ( isset( $row['dir'] ) and$row['dir'] != '' )127 if ( $row['dir'] != '' ) 122 128 { 123 129 $vtp->addSession( $sub, 'storage' ); … … 207 213 { 208 214 $vtp->addSession( $sub, 'parent' ); 209 $vtp->addSession( $sub, 'associate_cat' ); 210 $vtp->setVar( $sub, 'associate_cat.value', '-1' ); 211 $vtp->setVar( $sub, 'associate_cat.content', '' ); 212 $vtp->closeSession( $sub, 'associate_cat' ); 213 $structure = create_structure( '', array() ); 214 display_categories( $structure, ' ', $row['id_uppercat'], $row['id'] ); 215 // We only show a List Of Values if the number of categories is less than 216 // $conf['max_LOV_categories'] 217 $query = 'SELECT COUNT(id) AS nb_total_categories'; 218 $query.= ' FROM '.PREFIX_TABLE.'categories'; 219 $query.= ';'; 220 $countrow = mysql_fetch_array( mysql_query( $query ) ); 221 if ( $countrow['nb_total_categories'] < $conf['max_LOV_categories'] ) 222 { 223 $vtp->addSession( $sub, 'associate_LOV' ); 224 $vtp->addSession( $sub, 'associate_cat' ); 225 $vtp->setVar( $sub, 'associate_cat.value', '-1' ); 226 $vtp->setVar( $sub, 'associate_cat.content', '' ); 227 $vtp->closeSession( $sub, 'associate_cat' ); 228 $page['plain_structure'] = get_plain_structure( true ); 229 $structure = create_structure( '', array() ); 230 display_categories( $structure, ' ', $row['id_uppercat'],$row['id'] ); 231 $vtp->closeSession( $sub, 'associate_LOV' ); 232 } 233 // else, we only display a small text field, we suppose the administrator 234 // knows the id of its category 235 else 236 { 237 $vtp->addSession( $sub, 'associate_text' ); 238 $vtp->setVar( $sub, 'associate_text.value', $row['id_uppercat'] ); 239 $vtp->closeSession( $sub, 'associate_text' ); 240 } 215 241 $vtp->closeSession( $sub, 'parent' ); 216 242 }
Note: See TracChangeset
for help on using the changeset viewer.