diff options
author | Adam Bellinson <thread@gentoo.org> | 2001-07-25 04:10:45 +0000 |
---|---|---|
committer | Adam Bellinson <thread@gentoo.org> | 2001-07-25 04:10:45 +0000 |
commit | 779db62d51bacbabf6cea56e7a543b92dba10257 (patch) | |
tree | 50dfcc95733bcca866390f060e2f34bf48c131c8 /app-doc | |
parent | Re-removed 2.2.0, then commented the PAM stuff out. Basically it's a (diff) | |
download | gentoo-2-779db62d51bacbabf6cea56e7a543b92dba10257.tar.gz gentoo-2-779db62d51bacbabf6cea56e7a543b92dba10257.tar.bz2 gentoo-2-779db62d51bacbabf6cea56e7a543b92dba10257.zip |
*** empty log message ***
Diffstat (limited to 'app-doc')
-rw-r--r-- | app-doc/gentoo-web/files/wiki/devtodo.php | 2 | ||||
-rw-r--r-- | app-doc/gentoo-web/files/wiki/functions.php | 63 | ||||
-rw-r--r-- | app-doc/gentoo-web/files/wiki/profileedit.php | 20 | ||||
-rw-r--r-- | app-doc/gentoo-web/files/wiki/single.php | 36 | ||||
-rw-r--r-- | app-doc/gentoo-web/files/wiki/teams.php | 18 | ||||
-rw-r--r-- | app-doc/gentoo-web/files/wiki/useredit.php | 134 |
6 files changed, 158 insertions, 115 deletions
diff --git a/app-doc/gentoo-web/files/wiki/devtodo.php b/app-doc/gentoo-web/files/wiki/devtodo.php index 18bb9769bbc1..a9b7ebf13b08 100644 --- a/app-doc/gentoo-web/files/wiki/devtodo.php +++ b/app-doc/gentoo-web/files/wiki/devtodo.php @@ -24,7 +24,7 @@ <td bgcolor="#dddaec"><b>Followups</b></td> </tr> <?php - $result = mysql_query( "select * from todos where owner=$devid and priority!=0 order by priority,date desc" ); + $result = mysql_query( "select * from todos where owner=$devid and priority!=0 order by priority desc, date" ); while ( $todo = mysql_fetch_array($result) ) { if ( $todo['priority'] == 1 ) { $priority = 'low'; diff --git a/app-doc/gentoo-web/files/wiki/functions.php b/app-doc/gentoo-web/files/wiki/functions.php index d87cfb654d5c..2f17cc5455ec 100644 --- a/app-doc/gentoo-web/files/wiki/functions.php +++ b/app-doc/gentoo-web/files/wiki/functions.php @@ -6,6 +6,23 @@ // tags to allow for output $allow_tags = "<a>,<br>,<b>,<u>"; + // init the team/branch arrays + $teams = array( + 0 => 'None', + 1 => 'All', + 2 => 'System', + 3 => 'Desktop', + 4 => 'Server', + 5 => 'Tools', + 6 => 'Infrastructure', + ); + $branches = array( + 0 => 'none', + 1 => 'all', + 2 => 'stable', + 3 => 'unstable', + ); + // make sure our uid, which dictates whether they're logged in or not, is all straight if ( !isset($uid) ) { $uid = 0; @@ -253,39 +270,31 @@ global $uid, $dbusername, $show_privates, $list; ?> } ?> <?php function team_num_name ( $num ) { - if ( $num == 0 ) $team = 'None'; - elseif ( $num == 1 ) $team = 'All'; - elseif ( $num == 2 ) $team = 'System'; - elseif ( $num == 3 ) $team = 'Desktop'; - elseif ( $num == 4 ) $team = 'Server'; - elseif ( $num == 5 ) $team = 'Tools'; - elseif ( $num == 6 ) $team = 'Infrastructure'; - return $team; + // take a team number, return a team name. + // The following three functions are similar in spirit. + global $teams; + return $teams[$num]; } ?> <?php function team_name_num ( $name ) { - if ( $name == 'None' ) $num = 0; - elseif ( $name == 'All' ) $num = 1; - elseif ( $name == 'System' ) $num = 2; - elseif ( $name == 'Desktop' ) $num = 3; - elseif ( $name == 'Server' ) $num = 4; - elseif ( $name == 'Tools' ) $num = 5; - elseif ( $name == 'Infrastructure' ) $num = 6; - return $num; + global $teams; + while ( $each = each($teams) ) { + if ( $each['value'] == $name ) return $each['key']; + } + // we found nothing; we should never get here. + return 0; } ?> <?php function branch_num_name ( $num ) { - if ( $num == 0 ) $branch = 'none'; - elseif ( $num == 1 ) $branch = 'all'; - elseif ( $num == 2 ) $branch = 'stable'; - elseif ( $num == 3 ) $branch = 'unstable'; - return $branch; + global $branches; + return $branches[$num]; } ?> -<?php function branch_name_num ( $num ) { - if ( $num == 'none' ) $branch = 0; - elseif ( $num == 'all' ) $branch = 1; - elseif ( $num == 'stable' ) $branch = 2; - elseif ( $num == 'unstable' ) $branch = 3; - return $branch; +<?php function branch_name_num ( $name ) { + global $branches; + while ( $each = each($branches) ) { + if ( $each['value'] == $name ) return $each['key']; + } + // we found nothing; we should never get here. + return 0; } ?> diff --git a/app-doc/gentoo-web/files/wiki/profileedit.php b/app-doc/gentoo-web/files/wiki/profileedit.php index 4e7f35cecd6b..13b75fd3e877 100644 --- a/app-doc/gentoo-web/files/wiki/profileedit.php +++ b/app-doc/gentoo-web/files/wiki/profileedit.php @@ -12,7 +12,7 @@ if ( $submitted ) { if ( $pass1 != $pass2 ) { print '<p style="color:red;">Your password fields did not match.</p>'; } else { - $query = "update users set email='$email'"; + $query = "update users set email='$email',location='$location'"; if ( $pass1 ) $query .= ",password='$pass1'"; $query .= " where uid=$uid"; $result = mysql_query( $query ); @@ -23,12 +23,6 @@ if ( $submitted ) { $dude = mysql_query( "select * from users where uid=$uid" ); $dude = mysql_fetch_array( $dude ); -// are we leader? -if ( isset($dude['team']) ) { // prevent errors if dude's team wasn't set for some reason - $result = mysql_query( 'select leader from teams where gid='.$dude['team'] ); - list( $leader ) = mysql_fetch_row( $result ); -} -if ( $leader == $uid ) $leader='Yes'; else $leader='No'; ?> <p style="font-size:medium;font-weight:bold;"><?=$dude['username'];?> Profile</p> @@ -41,7 +35,7 @@ if ( $leader == $uid ) $leader='Yes'; else $leader='No'; </tr> <tr> <td align="right"><b>Password:</b></td> - <td><input type="password" name="pass1"><br><input type="password" name="pass2"></td> + <td><input type="password" name="pass1" maxlength=10><br><input type="password" name="pass2" maxlength=10></td> <td><p>Type in a password twice to change</p></td> </tr> <tr> @@ -50,15 +44,11 @@ if ( $leader == $uid ) $leader='Yes'; else $leader='No'; </tr> <tr> <td align="right"><b>Email:</b></td> - <td><input type="input" name="email" value="<?=$dude['email'];?>"></td> -</tr> -<tr> - <td align="right"><b>Team:</b></td> - <td><?=team_num_name( $dude['team'] );?></td> + <td><input type="input" name="email" value="<?=$dude['email'];?>" maxlength=200></td> </tr> <tr> - <td align="right"><b>Team Leader:</b></td> - <td><?=$leader;?></td> + <td align="right"><b>Location:</b></td> + <td><input type="input" name="location" value="<?=$dude['location'];?>" maxlength=200></td> </tr> </table> <input type="hidden" name="submitted" value="1"> diff --git a/app-doc/gentoo-web/files/wiki/single.php b/app-doc/gentoo-web/files/wiki/single.php index 487ad952e7d5..2868e7221ea1 100644 --- a/app-doc/gentoo-web/files/wiki/single.php +++ b/app-doc/gentoo-web/files/wiki/single.php @@ -129,20 +129,12 @@ <b>Todo posted:</b> <?=date( "n/j/y", $todo['date'] );?><br> <?php } ?> <b>Team:</b> - <?php if ( $theirs ) { ?> - <select name="team"><?php - if ( $team == 'None' ) { - print '<option>None</option><option>System</option><option>Desktop</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'System' ) { - print '<option>System</option><option>None</option><option>Desktop</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Desktop' ) { - print '<option>Desktop</option><option>None</option><option>System</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Server' ) { - print '<option>Server</option><option>None</option><option>Desktop</option><option>System</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Tools' ) { - print '<option>Tools</option><option>None</option><option>Desktop</option><option>Server</option><option>System</option><option>Infrastructure</option>'; - } elseif ( $team == 'Infrastructure' ) { - print '<option>Infrastructure</option><option>None</option><option>Desktop</option><option>Server</option><option>Tools</option><option>System</option>'; + <?php if ( $theirs ) { + if (!$team) $team = 'None'; ?> + <select name="team"><option><?=$team;?></option><?php + while ( $each = each($teams) ) { + if ( $each['value'] == $team ) continue; + print '<option>'.$each['value'].'</option>'; } ?></select> <?php } else { @@ -181,16 +173,12 @@ print "$public - <img src=\"images/$public.gif\" width=16 height=16>"; } ?><br> <b>Branch:</b> - <?php if ( $theirs ) { ?> - <select name="branch"><?php - if ( $branch == 'all' ) { - print '<option>stable</option><option>unstable</option><option>none</option><option>all</option>'; - } elseif ( $branch == 'unstable' ) { - print '<option>unstable</option><option>stable</option><option>none</option><option>all</option>'; - } elseif ( $branch == 'all' ) { - print '<option>all</option><option>stable</option><option>unstable</option><option>none</option>'; - } else { - print '<option>none</option><option>stable</option><option>unstable</option><option>all</option>'; + <?php if ( $theirs ) { + if (!$branch) $branch = 'none'; ?> + <select name="branch"><option><?=$branch;?></option><?php + while ( $each = each($branches) ) { + if ( $each['value'] == $branch ) continue; + print '<option>'.$each['value'].'</option>'; } ?></select> <?php } else { diff --git a/app-doc/gentoo-web/files/wiki/teams.php b/app-doc/gentoo-web/files/wiki/teams.php index 2f89e67dcd8f..f211c6ce71b9 100644 --- a/app-doc/gentoo-web/files/wiki/teams.php +++ b/app-doc/gentoo-web/files/wiki/teams.php @@ -80,7 +80,10 @@ </tr> <tr> <td><a href="teamtasks.php?team=<?=$team_num;?>&q=on">Outstanding Neither:</a></td> - <td><?=$on;?><br></td> + <td><?=$on;?></td> + </tr> + <tr> + <td colspan=2> </td> </tr> <tr> <td><a href="teamtasks.php?team=<?=$team_num;?>&q=u">Total Unassigned:</a></td> @@ -104,8 +107,13 @@ </td></tr></table> </div> - -<p style="font-size:medium;font-weight:bold;"><?=$team;?> Team</p> +<?php + $leader = mysql_query( "select leader from teams where gid=$team_num" ); + list( $leader ) = mysql_fetch_row( $leader ); + $leader = mysql_query( "select username from users where uid=$leader" ); + list( $leader ) = mysql_fetch_row( $leader ); +?> +<p style="font-size:medium;font-weight:bold;"><?=$team;?> Team<?php if ($leader) print " - Leaded by $leader"; else print " - no leader"; ?></p> <p><b>Summary</b></p> <p style="margin:0 5px 10px 10px;"><?=$summary;?></p> <p><b>Status</b></p> @@ -114,10 +122,10 @@ <p><b>Team Members</b></p> <ul> <?php - $result = mysql_query( "select username,title,email,realname from users where team=$team_num" ); + $result = mysql_query( "select username,title,email,realname,location from users where team=$team_num" ); while ( $dude = mysql_fetch_array($result) ) { ?> - <li> <a href="mailto:<?=$dude['email'];?>"><?=$dude['realname'];?></a> (aka <?=$dude['username'];?>) - <?=$dude['title'];?> + <li> <a href="mailto:<?=$dude['email'];?>"><?=$dude['realname'];?></a> (aka <?=$dude['username'];?>) - <?=$dude['title'];?> from <?=$dude['location'];?> <?php } ?> diff --git a/app-doc/gentoo-web/files/wiki/useredit.php b/app-doc/gentoo-web/files/wiki/useredit.php index a76d3db8f2ac..317d04548758 100644 --- a/app-doc/gentoo-web/files/wiki/useredit.php +++ b/app-doc/gentoo-web/files/wiki/useredit.php @@ -19,27 +19,54 @@ if ( $submitted ) { // stuff that needs to be done for both $team = team_name_num( $team ); if ( $admin ) $admin = '1'; else $admin = '0'; - if ( $leader ) $leader = '1'; else $leader = '0'; + reset( $teams ); + while ( $cur = each($teams) ) { // construct special teams value + if ( $$cur['value'] == 'r' || $$cur['value'] == 'l' ) $tms[] = $cur['key']; + if ( $$cur['value'] == 'l' ) $leads[] = $cur['key']; + } + if ( $tms ) { + $team = implode( ',', $tms ); + } else { + $team = ''; + } + + + // grant leaderships + if ( $leads ) { + while ( $cur = each($leads) ) { + mysql_query( "update teams set leader=$xuid where gid=".$cur['value'] ); + } + } + + + // revoke leaderships + $oldleads = explode( ',', $oldleads ); + if ($leads) reset( $leads ); + while ( $ol = each($oldleads) ) { + $tmp = 1; + if ( $leads ) { + reset( $leads ); + while ( $g = each($leads) ) { + if ( $g['value'] == $ol['value'] ) { $tmp = 0; break; } + } + } + if ( $tmp ) { + mysql_query( 'update teams set leader=0 where gid='.$ol['value'] ); + } + } if ( $xuid == 'new' ) { // new user - print '<p style="color:red;">You omitted vital information.</p>'; - mysql_query( "insert into users set username='$username',password='$pass1',admin=$admin,title='$title',email='$email',realname='$realname',team=$team" ); - - if ( $leader ) mysql_query( "update teams set leader=$uid where gid=$team" ); - elseif ( !$leader && $wasleader ) mysql_query( "update teams set leader=0 where gid=$team" ); - + mysql_query( "insert into users set username='$username',password='$pass1',admin=$admin,title='$title',email='$email',realname='$realname',location='$location',team='$team'" ); + $xuid = mysql_insert_id(); print '<p style="color:red;">User added to database.</p>'; } else { // change existing $query = "update users set username='$username'"; if ( $pass1 ) $query .= ",password='$pass1'"; - $query .= ",admin=$admin,title='$title',email='$email',realname='$realname',team='$team' where uid=$xuid"; + $query .= ",admin=$admin,title='$title',email='$email',realname='$realname',location='$location',team='$team' where uid=$xuid"; mysql_query( $query ); - if ( $leader ) mysql_query( "update teams set leader=$xuid where gid=$team" ); - elseif ( !$leader && $wasleader ) mysql_query( "update teams set leader=0 where gid=$team" ); - print '<p style="color:red;">User information updated.</p>'; } } @@ -70,10 +97,7 @@ if ( !$xuid ) { $dude = mysql_query( "select * from users where uid=$xuid" ); $dude = mysql_fetch_array( $dude ); - // are we leader? - $result = mysql_query( 'select leader from teams where gid='.$dude['team'] ); - list( $leader ) = mysql_fetch_row( $result ); - if ( $leader == $xuid ) $leader=1; else $leader=0; + $xteams = explode( ",", $dude['team'] ); } ?> <form action="useredit.php" method="post"> @@ -87,9 +111,8 @@ if ( !$xuid ) { <td><input type="text" name="username" maxlength=10 value="<?=$dude['username'];?>"></td> </tr> <tr> - <td align="right"><b>/<br>Password:<br>\</b></td> + <td align="right"><b>Password:</b><br>(Type in a<br>password twice<br>to change.)</td> <td><input type="password" name="pass1" maxlength=10><br><input type="password" name="pass2" maxlength=10></td> - <td><p>Type in a password twice to change</p></td> </tr> <tr> <td align="right"><b>Title:</b></td> @@ -97,40 +120,65 @@ if ( !$xuid ) { </tr> <tr> <td align="right"><b>Email:</b></td> - <td><input type="input" name="email" value="<?=$dude['email'];?>"></td> - </tr> - <tr> - <td align="right"><b>Team:</b></td> - <td><select name="team"><?php - $team = team_num_name( $dude['team'] ); - if ( $team == 'None' ) { - print '<option>None</option><option>System</option><option>Desktop</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'System' ) { - print '<option>System</option><option>None</option><option>Desktop</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Desktop' ) { - print '<option>Desktop</option><option>None</option><option>System</option><option>Server</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Server' ) { - print '<option>Server</option><option>None</option><option>Desktop</option><option>System</option><option>Tools</option><option>Infrastructure</option>'; - } elseif ( $team == 'Tools' ) { - print '<option>Tools</option><option>None</option><option>Desktop</option><option>Server</option><option>System</option><option>Infrastructure</option>'; - } elseif ( $team == 'Infrastructure' ) { - print '<option>Infrastructure</option><option>None</option><option>Desktop</option><option>Server</option><option>Tools</option><option>System</option>'; - } - ?></select></td> + <td><input type="input" name="email" value="<?=$dude['email'];?>" maxlength=200></td> </tr> <tr> - <td align="right"><b>Team Leader:</b></td> - <td><input type="checkbox" name="leader"<?php if ( $leader ) print ' checked'; ?>></td> + <td align="right"><b>Location:</b></td> + <td><input type="input" name="location" value="<?=$dude['location'];?>" maxlength=200></td> </tr> <tr> <td align="right"><b>Admin:</b></td> <td><input type="checkbox" name="admin"<?php if ( $dude['admin'] ) print ' checked'; ?>></td> </tr> + <tr> + <td align="right" valign="top"><b>Team Memberships:</b></td> + <td> + <table border=0 cellpadding=1 cellspacing=0 bgcolor="black"><tr><td> + <table width=300 border=0 cellpadding=5 cellspacing=0 bgcolor="#bdbacc"> + <tr> + <td> </td> + <td align="center"><b>Unaffiliated</b></td> + <td align="center"><b>Regular</b></td> + <td align="center"><b>Leader</b></td> + </tr> + <?php + // get team info + reset( $teams ); + while ( $each = each($teams) ) { + if ( $each['key'] == 0 || $each['key'] == 1 ) continue; // skip 'none' and 'all' + $tm = 'u'; // set the default + if ( $xuid != 'new' ) { + // are they a simple member? ... + reset( $xteams ); + while ( $cur = each($xteams) ) { + if ( $cur['value'] == $each['key'] ) $tm = 'r'; + } + // are they the team LEADER?!?! :) + $ldr = mysql_query( 'select leader from teams where gid='.$each['key'] ); + list( $ldr ) = mysql_fetch_row( $ldr ); + if ( $ldr == $xuid ) { $tm = 'l'; $oldlead[] = $each['key']; } + } + ?> + <tr> + <td><b><?=$each['value'];?></b></td> + <td align="center"><input type="radio" name="<?=$each['value'];?>" value="u"<?php if ($tm=='u') print ' checked'; ?>></td> + <td align="center"><input type="radio" name="<?=$each['value'];?>" value="r"<?php if ($tm=='r') print ' checked'; ?>></td> + <td align="center"><input type="radio" name="<?=$each['value'];?>" value="l"<?php if ($tm=='l') print ' checked'; ?>></td> + </tr> + <?php + } + ?> + </table> + </td></tr></table> + </td> + </tr> + <tr> + <input type="hidden" name="submitted" value="1"> + <input type="hidden" name="oldleads" value="<?php if ($oldlead) print implode( ',', $oldlead );?>"> + <input type="hidden" name="xuid" value="<?=$xuid;?>"> + <td align="center" colspan=2><input type="submit" value="Submit"></td> + <tr> </table> - <input type="hidden" name="submitted" value="1"> - <input type="hidden" name="wasleader" value="<?=$leader;?>"> - <input type="hidden" name="xuid" value="<?=$xuid;?>"> - <p><input type="submit" value="Submit"></p> </form> <?php } |