[wpkg_web] / prof_general.php Repository:
ViewVC logotype

View of /prof_general.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 29 - (download) (annotate)
Thu Jan 11 02:13:58 2007 UTC (11 years, 3 months ago) by linuxkidd
File size: 7017 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['pack_id'])) {
    
$pack_id=$_GET['pack_id'];
  } else {
    
$pack_id=0;
  }
  if(isset(
$_GET['dep_id'])) {
    
$dep_id=$_GET['dep_id'];
  } else {
    
$dep_id=0;
  }

?>
<form name='prof_general' id='prof_general' method='GET' action='prof_gen_sub.php'>
<input type='hidden' id='prof_id' name='prof_id' value='<?php print $prof_id?>'>
<table class='tbl_sub2' cellspacing='0' cellpadding='2'>
  <tr class='headline'>
    <td>Profile Name</td>
  </tr>
  <tr>
    <td><input type='text' name='name' id='name'<?php
      $sub_button_name
=$vocab['button-submit'];
      
$sub_button="Submit";
      if(isset(
$prof_name)) {
        print 
" value='{$prof_name}'";
        
$sub_button_name=$vocab['button-update'];
        
$sub_button="Update";
      }
      print 
"> &nbsp; ";
      print 
"<input type='submit' name='{$sub_button}' id='{$sub_button}' value='" .
           
"{$sub_button_name}'>";
    
?> <input type='reset' name='reset' id='reset' value='<?php print $vocab['button-reset']; ?>'></td>
  </tr>
</table>
<?php if ($prof_id>0) { ?>
<table class='tbl_sub2' cellspacing='2' cellpadding='2'>
  <tr>
<?php
  $section_data
=array(array('pack','package''1'),
                      array(
'dep','depends''2'));
  foreach(
$section_data as $section) {
    print 
"    <td valign='top' width='50%'>\n";
    print 
"<table class='tbl_sub2' cellspacing='0' cellpadding='2'>\n";
    
$sql2=sprintf("select count(prof_id) from prof_%ss where prof_id=%s"$section[0], quote_smart($prof_id));
    
$sql2_handle=mysql_query($sql2) or error_report($sql2,mysql_error());
    list(${
$section[0] . "_count"})=mysql_fetch_array($sql2_handle);
    print 
"  <tr class='headline'>\n";
    print 
"    <td><input type='button' onclick='window.location=\"profiles.php?prof_id=" .
        
"{$prof_id}&page={$page}&new={$section[2]}\"' value=\"{$vocab['button-add']}\" style='font-weight: normal;'>" .
        
" &nbsp; " $vocab['title-' $section[0] . "list"];
    print 
"</td>\n";
    print 
"  </tr>\n";
    if(
$section[0] == 'pack') {
      
$sql2="select id,idtxt,name,version from packages,prof_packs where
       id=pack_id and prof_id='" 
$prof_id "' order by idtxt";
    } else if ( 
$section[0] == 'dep' ) {
      
$sql2=sprintf("select id,name from profiles,prof_deps where profiles.id=prof_deps.dep_id and prof_id=%s order by name"quote_smart($prof_id));
    }
    
$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'>";
      print 
"<a href='prof_gen_sub.php?{$section[0]}_id={$data['id']}&prof_id={$prof_id}&type={$section[2]}&del=1' title='{$vocab['title-delete']}' onClick=\"return confirm('{$vocab['popup-permdel']} ";
      if(
$section[0]=='pack') {
        print 
$data['idtxt'];
      } else if (
$section[0]=='dep') {
        print 
$data['name'];
      }
      print 
" " strtolower($vocab['gen-' $section[1]]) . {$vocab['gen-from']} {$prof_name} " strtolower($vocab['title-profile']) . ". {$vocab['gen-confirm']}');\">{$icon['delete'][0]}</a> &nbsp; ";
      if(
$section[0]=='pack') {
        print 
"<a href='packages.php?page=general&pack_id={$data['id']}' title='{$vocab['title-edit']} {$data['idtxt']}'>";
        print 
"{$data['idtxt']} ( {$data['name']} - {$data['version']} )";
        print 
"</a>";
      } else {
        
$sql4="select count(prof_id) from prof_packs where prof_id="quote_smart($data['id']);
        
$sql4_handle=mysql_query($sql4) or error_report($sql4,mysql_error());
        list(
$p_count)=mysql_fetch_array($sql4_handle);
        
$sql4="select count(prof_id) from prof_deps where prof_id=" quote_smart($data['id']);
        
$sql4_handle=mysql_query($sql4) or error_report($sql4,mysql_error());
        list(
$d_count)=mysql_fetch_array($sql4_handle);
        print 
"<a href='profiles.php?page=general&prof_id={$data['id']}' title='{$vocab['title-edit']} {$data['name']}'>";
        print 
"{$data['name']} ( {$p_count} / {$d_count} )";
        print 
"</a>";
      }
      print 
"\n    </td>\n";
      
$count++;
    }
    
$gotit=0;
    if(isset(
$_GET['new'])){
      if(
$_GET['new']==$section[2]){
        
$gotit=$section[2];
        ${
$section[0] . "_count"}++;
        
?>
  <tr>
    <td style='background: <?php print $alt_bg_colors[$count%2]; ?>'>
      <input type='hidden' id='type' name='type' value='<?php print $section[2]; ?>'>
      <select id='<?php print $section[0]; ?>_id[]' name='<?php print $section[0]; ?>_id[]' multiple size='9'>
        <?php
        
if($section[0]=='pack') {
          
$sql3="SELECT p.id,p.name,p.version,p.idtxt FROM packages p";
          if(${
$section[0] . "_count"}>1) {
            
$sql3 .= " LEFT JOIN prof_packs p2 ON p.id = p2.pack_id AND p2.prof_id='{$prof_id}' WHERE isnull(p2.pack_id) ";
          }
          
$sql3.=" order by p.idtxt";
        } else if (
$section[0]=='dep') {
          
$sql3="SELECT p.id,p.name FROM profiles p ";
          if(${
$section[0] . "_count"}>1) {
            
$sql3.= " LEFT JOIN prof_deps d ON d.dep_id = p.id AND d.prof_id = ".quote_smart($prof_id)." ";
          }
          
$sql3.="WHERE p.id!=" quote_smart($prof_id);
          if(${
$section[0] . "_count"}>1) {
           
$sql3.=" AND isnull(d.dep_id)";
          }
          
$sql3.=" order by p.name";
        }
        
$sql3_handle=mysql_query($sql3) or error_report($sql3,mysql_error());
        while(
$package=mysql_fetch_array($sql3_handle)) {
          if(
$section[0]=='pack') {
            unset(
$style);
            unset(
$junk);
            
$sql4=sprintf("select prof_id from prof_packs where pack_id=%s limit 0,1"quote_smart($package['id']));
            
$sql4_handle=mysql_query($sql4) or error_report($sql4,mysql_error());
            list(
$junk)=mysql_fetch_array($sql4_handle);
            if(!
$junk) {
              
$style='background-color: #FFFF33;';
            }
            print 
"        <option ";
            if(isset(
$style)) {
              print 
"style='{$style}' ";
            }
            print 
" value='{$package['id']}'>{$package['idtxt']} ( " .
               
"{$package['name']} - {$package['version']} )</option>\n";
          } else {
            print 
"        <option value='{$package['id']}'>{$package['name']}</option>\n";
          }
        } 
?>
      </select>
      <input type='submit' id='Add' name='Add' value='<?php print $vocab['button-add']; ?>'>
      <input type='button' onclick='window.location="profiles.php?prof_id=<?php print $prof_id?>&page=<?php print $page?>"' value='<?php print $vocab['button-cancel']; ?>'>
    </td>
  </tr>
  <?php
      
}
    }
    if(!${
$section[0] . "_count"} && $gotit!=$section[2]) {
      print 
"  <tr>\n    <td style='background: " $alt_bg_colors[0] . ";'>{$vocab['gen-ext_none-1']} {$vocab['gen-' $section[1]]} {$vocab['gen-defined']}.</td>\n  </tr>\n";
    }
    print 
"</table>\n";
    print 
"   </td>\n";
  }
?>
  </tr>
</table>
</form>
<?php
}
?>

ViewVC Help
Powered by ViewVC 1.0.3