[wpkg_web] / pack_extras.php Repository:
ViewVC logotype

View of /pack_extras.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (download) (annotate)
Thu Jan 11 02:13:58 2007 UTC (11 years, 10 months ago) by linuxkidd
File size: 5190 byte(s)
Language pack and Icon pack conversion complete.
Moved all settings into config.php.
Added CHANGELOG.
Fixed bug in packages_xml_in which prevented proper creation of initial level.
Added UPGRADE instructions.

<?php
  
if(isset($_GET['extid'])) {
    
$extid=$_GET['extid'];
  } else {
    
$extid=0;
  }
?>
<form name='extras' id='extras' method='GET' action='pack_ext_sub.php'>
<input type='hidden' id='pack_id' name='pack_id' value='<?php print $pack_id?>'>
<?php
  
include "pack_header.php";
  
$sql="select * from pack_exttype order by id";
  
$sql_handle=mysql_query($sql) or error_report($sql,mysql_error());
  while(
$exttype=mysql_fetch_array($sql_handle)) {
?>
<table class='tbl_sub2' cellspacing='0' cellpadding='2'>
  <tr class='headline'>
    <td><input type='button' onclick='window.location="packages.php?pack_id=<?php
      
print $pack_id?>&page=<?php print $page?>&new=<?php print $exttype['id']; ?>"'
      value="<?php print $vocab['button-add']; ?>" style='font-weight: normal;'> &nbsp; <?php print $vocab['title-' $exttype['value']]; ?></td>
  </tr>
<?php
    $sql2
=sprintf("select packages.idtxt as idtxt, packages.name as name, packages.version as version, pack_extras.id as id, pack_extras.value as value from packages left join pack_extras on packages.id=pack_extras.value where pack_id=%s and exttype_id=%s order by idtxt"quote_smart($pack_id), quote_smart($exttype['id']));
    
$fields=array('idtxt''name''version''id','value');
    
$sql2_handle=mysql_query($sql2) or error_report($sql2,mysql_error());
    
$count=0;
    while(
$data=mysql_fetch_array($sql2_handle)) {
      print 
"  <tr>\n    <td style='background:{$alt_bg_colors[$count%2]};' valign='middle'>";
      if(
$extid==$data['id']) {
      
?>
      <input type='hidden' id='extid' name='extid' value='<?php print $data['id']; ?>'>
      <?php if($exttype['id']==3) { ?>
      <input type='text' id='value' name='value' size='75' maxlength='100' value='<?php print $data['value']; ?>'>
      <?php } else { ?>
      <select id='value' name='value'>
        <?php
        
if($pack_id) {
          
$sql3=sprintf("select id,name,version,idtxt from packages where id!=%s order by idtxt"quote_smart($pack_id));
          
$sql3_handle=mysql_query($sql3) or error_report($sql3,mysql_error());
          while(
$package=mysql_fetch_array($sql3_handle)) { ?>
        <option value='<?php print $package['id'?>'<?php
            
if($package['id']==$data['value']) {
              print 
" selected";
            }
        
?>><?php
          
print $package['idtxt'] . " ( " $package['name'] . " - " $package['version'] . " )";
         
?></option>
         <?php
          
}
        } 
?>
      </select>
      <?php ?>
      <input type='submit' id='Update' name='Update' value='<?php print $vocab['button-update']; ?>'>
      <input type='button' onclick='window.location="packages.php?pack_id=<?php print $pack_id?>&page=<?php
        
print $page?>"' value='<?php print $vocab['button-cancel']; ?>'>
    </td>
  </tr>
      <?php
        $count
++;
        
$gotit++;
        continue;
      }
      print 
"<a href='pack_ext_sub.php?extid={$data['id']}&pack_id={$pack_id}&del=1' title='{$vocab['title-delete']}'
      onClick=\"return confirm('
{$vocab['popup-permdel']} {$vocab['title-extended_' $exttype['value']]}{$vocab['gen-confirm']}');\">{$icon['delete'][0]}</a> &nbsp; ";
      print 
"<a href='packages.php?pack_id=" $pack_id "&page=" $page "&extid=" $data['id'] .
          
"' title='{$vocab['title-edit']}'>";
      print 
$data['idtxt'] . " ( " $data['name'] . " - " $data['version'] . " ) ";
      print 
"</a>\n    </td>\n";
      
$count++;
    }
    
$gotit=0;
    if(isset(
$_GET['new'])){
      if(
$_GET['new']==$exttype['id']){
        
$gotit=1;
        
$count++;
        
?>
  <tr>
    <td style='background: <?php print $alt_bg_colors[$count%2]; ?>'>
      <input type='hidden' id='exttype_id' name='exttype_id' value='<?php print $exttype['id']; ?>'>
      <select id='value' name='value'>
        <?php
        $sql3
="select p.id,p.name,p.version,p.idtxt from packages p ";
        if(
$count>1) {
          
$sql3.="left join pack_extras e on p.id=e.value and e.exttype_id=" quote_smart($exttype['id']) . " and e.pack_id=" quote_smart($pack_id);
        }
        
$sql3.=" where p.id!=" quote_smart($pack_id);
        if(
$count>1) {
          
$sql3.=" and isnull(e.value)";
        }
        
$sql3.="  order by p.idtxt";

        
$sql3_handle=mysql_query($sql3) or error_report($sql3,mysql_error());
        while(
$package=mysql_fetch_array($sql3_handle)) { ?>
        <option value='<?php print $package['id'?>'><?php
          
print $package['idtxt'] . " ( " $package['name'] . " - " $package['version'] . " )";
         
?></option>
         <?php
        
?>
      </select>
      <input type='submit' id='Add' name='Add' value='<?php print $vocab['button-add']; ?>'>
      <input type='button' onclick='window.location="packages.php?pack_id=<?php print $pack_id?>&page=<?php
        
print $page?>"' value='<?php print $vocab['button-cancel']; ?>'>
    </td>
  </tr>
  <?php
      
}
    }
    if(!
$count && !$gotit) {
      print 
"  <tr>\n    <td style='background: " $alt_bg_colors[0] . ";'>{$vocab['gen-ext_none-1']} {$vocab['title-extended_' $exttype['value']]} {$vocab['gen-defined']}.</td>\n  </tr>\n";
    }
    print 
"</table>\n";
  }
 
?>

ViewVC Help
Powered by ViewVC 1.0.3