Skip to content

Commit

Permalink
ability to add boards, sidebar boards list
Browse files Browse the repository at this point in the history
  • Loading branch information
codex73 committed Jun 5, 2012
1 parent 453b1e4 commit db3d986
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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
Expand Down
62 changes: 44 additions & 18 deletions multido.php
Expand Up @@ -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);
Expand All @@ -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 '<a href="?uid=1&prj='.$row['bid'].'">'.$row['bname'].'</a><br/>';
}
}

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;";
Expand Down Expand Up @@ -219,23 +229,19 @@ function out_boxes($uid,$prj){
<br/>
<div class="container">
<div class="row">
<div class="span2" style="text-align: center">
<div class="span2" style="">
<img src="img/donald.png" alt="">
<hr>
<h1 class="bigger"><?= board_health($prj); ?></h1>
<hr>
<h4>Projects</h4>
<!-- Add links to the boards here -->
<p style="color: #ccc;"><a href="?uid=1&prj=1">Chris Johnson</a></p>
<p style="color: #ccc;"><a href="?uid=1&prj=2">Luxury Yachts</a></p>
<p style="color: #ccc;"><a href="?uid=1&prj=3">Airtoo</a></p>
<p style="color: #ccc;"><a href="?uid=1&prj=4">Rebajar.com</a></p>
<?php fetch_boards(); ?>
<hr>
<h4>Switchboard</h4>
<a href="#" id="trigger_add" class="btn btn-mini" style="margin-bottom:3px;">Add a box</a>
<a href="#" id="trigger_add" class="btn btn-mini" style="margin-bottom:3px;">Add Box</a><br/>
<a href="#" id="trigger_add_box" class="btn btn-mini" style="margin-bottom:3px;">Add Board</a><br/>
<!--buttons Not in use yet -->
<a href="?uid=1&prj=3" class="btn btn-mini" style="margin-bottom:3px;">Share this board</a>
<a href="?uid=1&prj=3" class="btn btn-mini" style="margin-bottom:3px;">Permissions</a>
<a href="?uid=1&prj=3" class="btn btn-mini" style="margin-bottom:3px;">Share this board</a><br/>
<a href="?uid=1&prj=3" class="btn btn-mini" style="margin-bottom:3px;">Permissions</a><br/>
</div>
<div class="span10" id="board_content">
<div class="topper" style="background-color: white;">
Expand Down Expand Up @@ -273,30 +279,48 @@ function out_boxes($uid,$prj){

var overlay_txt =
'<div id="overlay"></div><div id="formed">'+
'<h2>Who\'s working on this?</h2>'+
'<input type="text" style="width:80%" style="float: right;"> '+
'<h2>Give the box a name</h2>'+
'<input type="text" name="new_box" style="width:80%" style="float: right;"> '+
'<button class="btn add_con" style="float: right;">Save</button></div>';

$(overlay_txt).appendTo(document.body);
var overlay_txt2 =
'<div id="overlay"></div><div id="formed">'+
'<h2>Give the board a name</h2>'+
'<input type="text" name="new_board" style="width:80%" style="float: right;"> '+
'<button class="btn add_con" style="float: right;">Save</button></div>';

//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 =
Expand All @@ -318,7 +342,9 @@ function out_boxes($uid,$prj){
'</tr>'+
'</tbody>'+
'</table>';
$("#board_content").append(box_frame);
if(typerec=='new_box'){
$("#board_content").append(box_frame);
}
}
});

Expand Down
10 changes: 9 additions & 1 deletion posts_in.php
Expand Up @@ -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();
Expand Down

0 comments on commit db3d986

Please sign in to comment.