From db3d986edbaf3f4b1fb193e0017c3707fa3504bb Mon Sep 17 00:00:00 2001 From: Francis Suarez Date: Tue, 5 Jun 2012 16:14:24 -0400 Subject: [PATCH] ability to add boards, sidebar boards list --- README.md | 2 +- multido.php | 62 +++++++++++++++++++++++++++++++++++++--------------- posts_in.php | 10 ++++++++- 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 4291104..b55e426 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Things that could make this better: ------------ * A User System -> sign up module. -* Boards Management -> add boards(projects), rename boards, delete boards. +* Boards Management -> rename boards, delete boards. * Boards Collaboration -> sharing - permission for other users to boards and/or boxes within. Stuff it Needs diff --git a/multido.php b/multido.php index d8612fb..bed2a59 100644 --- a/multido.php +++ b/multido.php @@ -19,6 +19,7 @@ $thequery_rst = @mysql_result($thequery,0); $_SESSION['bname'] = (empty($thequery_rst) ? 'undefined' : $thequery_rst); +//Displays Big Number Count - Tasks on Board Still Active function board_health($prj,$status=1){ $query = "select box.rname,count(box_cont.cid) from box join box_cont on box.id = box_cont.fkid and box.fbid = '".$prj."' and box_cont.status = '".$status."' group by box.id;"; $result = mysql_query($query); @@ -30,6 +31,15 @@ function board_health($prj,$status=1){ return $the_count; } +//Fetches Boards Names & ID's for Menu +function fetch_boards(){ + $query = "select * from boards"; + $result = mysql_query($query); + while($row = mysql_fetch_assoc($result)){ + echo ''.$row['bname'].'
'; + } +} + function out_boxes($uid,$prj){ $query = "select * from box,box_perm,boards where box_perm.fkuid = '".$uid."' and box.fbid = '".$prj."' "; $query .= "and box.id = box_perm.fkbox group by id;"; @@ -219,23 +229,19 @@ function out_boxes($uid,$prj){
-
+
@@ -273,30 +279,48 @@ function out_boxes($uid,$prj){ var overlay_txt = '
'+ - '

Who\'s working on this?

'+ - ' '+ + '

Give the box a name

'+ + ' '+ '
'; - $(overlay_txt).appendTo(document.body); + var overlay_txt2 = + '
'+ + '

Give the board a name

'+ + ' '+ + '
'; + //Add Box $("#trigger_add").on('click',function(event){ + $(overlay_txt).appendTo(document.body); + $("#overlay,#formed").show(); + event.preventDefault(); + }); + + $("body").on('click','#overlay',function(){ + $("#overlay,#formed").hide(); + }); + + //Add Board + $("#trigger_add_box").on('click',function(event){ + $(overlay_txt2).appendTo(document.body); $("#overlay,#formed").show(); event.preventDefault(); }); - $("#overlay").on('click',function(){ + $("body").on('click','#overlay',function(){ $("#overlay,#formed").hide(); }); //Adds New Box To Board - $("#formed").on('click','.add_con',function(){ - var new_entry = $(this).prev().val(),action = 'new_asset'; + $("body").on('click','.add_con',function(){ + var new_entry = $(this).prev().val(),action = 'new_asset', + typerec = $(this).prev().attr('name'); $.ajax({ type:'post', url: 'posts_in.php', dataType: "json", - data: { action: action, content: new_entry, prj: prj, uid: uid}, + data: { action: action, content: new_entry, prj: prj, uid: uid, typerec: typerec}, success: function(data){ var action = data[0],cid= data[1], content = data[2]; var box_frame = @@ -318,7 +342,9 @@ function out_boxes($uid,$prj){ ''+ ''+ ''; - $("#board_content").append(box_frame); + if(typerec=='new_box'){ + $("#board_content").append(box_frame); + } } }); diff --git a/posts_in.php b/posts_in.php index 77c8b7e..8d4be23 100644 --- a/posts_in.php +++ b/posts_in.php @@ -24,9 +24,17 @@ $content = trim(strip_tags($_POST['content'])); $prj = trim(strip_tags($_POST['prj'])); $uid = trim(strip_tags($_POST['uid'])); +$typerec = trim(strip_tags($_POST['typerec'])); + +//New Board +if($action=='new_asset'&&$typerec=='new_board'){ + $query = "INSERT INTO boards (bid,bname) values (null,'".$content."');"; + $result = mysql_query($query); + $cid = mysql_insert_id(); +} //New Box -if($action=='new_asset'){ +if($action=='new_asset'&&$typerec=='new_box'){ $query = "INSERT INTO box (rname,bdate,fbid) values ('".$content."',NOW(),'".$prj."');"; $result = mysql_query($query); $cid = mysql_insert_id();