This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> "; while($r=mysql_fetch_object($q)) { echo "
  • id}\">"; //can only delete if there's no children $tq=mysql_query("SELECT * FROM rolestasks WHERE pid='$r->id'"); if(mysql_num_rows($tq)==0) { echo "id)\"> "; } echo "id)\"> "; echo "id}\">"; echo "$r->task"; echo "\n"; echo "   "; echo "["; echo "id}\">"; if($r->link) { echo trim($r->link); } echo ""; echo "]"; echo "   "; echo "id}\">"; echo "
  • \n"; doTree($r->id,$roleid); } $level--; if($level<4) { echo "
  • "; echo ""; echo ""; // echo ""; echo "
  • "; } echo ""; } if($_GET['action']=="load") { if($_GET['roleid']) { $roleid=intval($_GET['roleid']); doTree(0,$roleid); } exit; } if($_POST['action']=="addtask") { $pid=intval($_POST['pid']); $roleid=intval($_POST['roleid']); if($pid==0) $level=0; else { $q=mysql_query("SELECT * FROM rolestasks WHERE id='$pid'"); $r=mysql_fetch_object($q); $level=$r->level+1; } $q=mysql_query("SELECT MAX(ord) AS o FROM rolestasks WHERE pid='$pid'"); $r=mysql_fetch_object($q); $ord=$r->o+1; print_r($r); mysql_query("INSERT INTO rolestasks (pid,roles_id,level,task,ord,link) VALUES ( '$pid', '$roleid', '$level', '".mysql_real_escape_string($_POST['task'])."', '$ord', '')"); exit; } if($_POST['action']=="removetask") { $id=intval($_POST['id']); //can only delete if there's no children $tq=mysql_query("SELECT * FROM rolestasks WHERE pid='$id'"); if(mysql_num_rows($tq)==0) { mysql_query("DELETE FROM rolestasks WHERE id='$id'"); } exit; } if($_POST['action']=="savetask") { $id=intval($_POST['id']); mysql_query("UPDATE rolestasks SET task='".mysql_real_escape_string($_POST['name'])."', link='".mysql_real_escape_string($_POST['link'])."' WHERE id='$id'"); exit; } if($_POST['action']=="movetask") { list($junk,$dragid)=explode("_",$_POST['dragid']); list($junk,$dropid)=explode("_",$_POST['dropid']); if($junk=="emptytasks") { //we actually want to drop it AFTER the last one in this set based on PID, not ID $q=mysql_query("SELECT * FROM rolestasks WHERE pid='$dropid' AND id!='$dragid' ORDER BY ord"); $droppid=$dropid; $dropid=100000; } else { $dropq=mysql_query("SELECT * FROM rolestasks WHERE id='$dropid'"); $dropr=mysql_fetch_object($dropq); $q=mysql_query("SELECT * FROM rolestasks WHERE pid='$dropr->pid' AND id!='$dragid' ORDER BY ord"); $droppid=$dropr->pid; } if($dragid) { $dragq=mysql_query("SELECT * FROM rolestasks WHERE id='$dragid'"); $dragr=mysql_fetch_object($dragq); $ord=0; $updated=false; echo mysql_error(); while($r=mysql_fetch_object($q)) { echo "comparing {$r->id} with {$dropid} \n"; if($r->id==$dropid) { $ord++; mysql_query("UPDATE rolestasks SET pid='$droppid', ord='$ord' WHERE id='$dragid'"); echo "found!"; $updated=true; } $ord++; mysql_query("UPDATE rolestasks SET ord='$ord' WHERE id='$r->id'"); } if(!$updated) { echo "not found, putting it at the end"; $ord++; mysql_query("UPDATE rolestasks SET pid='$droppid', ord='$ord' WHERE id='$dragid'"); } echo mysql_error(); } exit; } send_header("RoleTasks Setup"); ?>
    NOT intended for end-user usage. This tool exists only temporarily for developers to update the new UI structure
    "; echo "\n"; echo ""; echo "
    "; echo "
    "; echo "
    "; send_footer(); ?>