From 7a6665b5cfb35daf3cb6ad13db00a19e89f8c8b8 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 26 Jul 2010 17:01:37 -0700 Subject: [PATCH] item deletion and hover images --- images/b_drophide.gif | Bin 111 -> 111 bytes images/b_dropshow.gif | Bin 0 -> 138 bytes mod/item.php | 94 +++++++++++++++++++++++++++------------- mod/profile.php | 8 ++-- view/contact_edit.tpl | 2 +- view/head.tpl | 18 +++++--- view/style.css | 11 +++-- view/wall_item.tpl | 2 +- view/wall_item_drop.tpl | 2 +- 9 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 images/b_dropshow.gif diff --git a/images/b_drophide.gif b/images/b_drophide.gif index 3d9746a18247594d66de4489b4ae70d2d4121a5b..1207a935bb048ed510ab9ba8635936ea11bbaa20 100644 GIT binary patch literal 111 zcmZ?wbhEHb6krfwIK<8{w=I8iXXnh`-uV+J&Y3c0=Je_Fr%(L<|G(l-7Dg@xb_N{= zAONXlU^c1Pbth`k4pj|_gPmuN9FSe!c-$;-M&+VMuUMb_)G9RA-|8e0YHZTt&3#HX*wXgyz#hM;Ec*ek6tl8`KeWCtiRPrBvjd?*_->g#FH@R M`&lPbR2Uen0kVoIfB*mh diff --git a/images/b_dropshow.gif b/images/b_dropshow.gif new file mode 100644 index 0000000000000000000000000000000000000000..b08c68b62d7b7cd7c3329f62863f91b87a0a8387 GIT binary patch literal 138 zcmZ?wbhEHb6krfwc+9~tGcE1^OymD)3}=ju&oD6jXJDAg00RGU0L7myj9d)t3_2i1 zATt2bzxwz1_1Margc == 3) && ($a->argv[1] == 'drop') && intval($a->argv[2])) { - $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", - intval($argv[2]) - ); - if(! count($r)) { - notice("Permission denied." . EOL); - goway($a->get_baseurl() . $_SESSION['return_url']); - } - $item = $r[0]; - if(($_SESSION['visitor_id'] == $item['contact-id']) || ($_SESSION['uid'] == $item['uid'])) { - $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' WHERE `id` = %d LIMIT 1", - dbesc(datetime_convert()), - intval($item['id']) - ); - if($item['uri'] == $item['parent-uri']) { - $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' WHERE `parent-uri` = '%s', - dbesc(datetime_convert()), - dbesc($item['parent-uri']) - ); - } - - $url = $a->get_baseurl(); - $drop_id = intval($item['id'])l - - proc_close(proc_open("php include/notifier.php \"$url\" \"$drop" \"$drop_id\" > notify.log &", - array(),$foo)); - - goway($a->get_baseurl() . $_SESSION['return_url']); - - } $parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0); @@ -210,4 +180,68 @@ function item_post(&$a) { } goaway($a->get_baseurl() . "/" . $_POST['return'] ); return; // NOTREACHED +} + +function item_content(&$a) { + + if((! local_user()) && (! remote_user())) + return; + + require_once('include/security.php'); + + $uid = $_SESSION['uid']; + + if(($a->argc == 3) && ($a->argv[1] == 'drop') && intval($a->argv[2])) { + + // locate item to be deleted + + $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1", + intval($a->argv[2]) + ); + + if(! count($r)) { + notice("Item not found." . EOL); + goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); + } + $item = $r[0]; + + // check if logged in user is either the author or owner of this item + + if(($_SESSION['visitor_id'] == $item['contact-id']) || ($_SESSION['uid'] == $item['uid'])) { + + // delete the item + + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' WHERE `id` = %d LIMIT 1", + dbesc(datetime_convert()), + intval($item['id']) + ); + + // If it's the parent of a comment thread, kill all the kids + + if($item['uri'] == $item['parent-uri']) { + $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s' + WHERE `parent-uri` = '%s' AND `uid` = %d ", + dbesc(datetime_convert()), + dbesc($item['parent-uri']), + intval($item['uid']) + ); + } + + $url = $a->get_baseurl(); + $drop_id = intval($item['id']); + + // send the notification upstream/downstream as the case may be + + proc_close(proc_open("php include/notifier.php \"$url\" \"drop\" \"$drop_id\" > notify.log &", + array(),$foo)); + + goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); + return; //NOTREACHED + } + else { + notice("Permission denied." . EOL); + goaway($a->get_baseurl() . '/' . $_SESSION['return_url']); + return; //NOTREACHED + } + } } \ No newline at end of file diff --git a/mod/profile.php b/mod/profile.php index b0ff85a44..3703fe7f2 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -219,6 +219,10 @@ function profile_content(&$a, $update = false) { $tpl = file_get_contents('view/wall_item.tpl'); + if($update) + $return_url = $_SESSION['return_url']; + else + $return_url = $_SESSION['return_url'] = $a->cmd; if(count($r)) { foreach($r as $item) { @@ -227,10 +231,6 @@ function profile_content(&$a, $update = false) { $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ; - if($update) - $return_url = $_SESSION['return_url']; - else - $return_url = $_SESSION['return_url'] = $a->cmd; if(can_write_wall($a,$a->profile['uid'])) { diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl index 26ee2ef5c..bfeb10717 100644 --- a/view/contact_edit.tpl +++ b/view/contact_edit.tpl @@ -17,7 +17,7 @@
diff --git a/view/head.tpl b/view/head.tpl index 81ce1287f..2a6506da9 100644 --- a/view/head.tpl +++ b/view/head.tpl @@ -20,11 +20,6 @@ msie = $.browser.msie ; NavUpdate(); -// $('.wall-item-delete-icon').hover(function() { -// $(this).attr("src",$(this).attr("src").replace('hide','')); -// },function() { -// $(this).attr("src",$(this).attr("src").replace('','hide')); -// }); }); @@ -79,5 +74,18 @@ return confirm("Delete this item?"); } + function imgbright(node) { + $(node).attr("src",$(node).attr("src").replace('hide','show')); + } + + function imgdull(node) { + $(node).attr("src",$(node).attr("src").replace('show','hide')); + } + + + + + + diff --git a/view/style.css b/view/style.css index e3a2730a1..d0e7dd262 100644 --- a/view/style.css +++ b/view/style.css @@ -483,9 +483,13 @@ input#dfrn-url { } .wall-item-delete-wrapper { - float: left; - margin-top: 10px; - margin-left: 50px; + float: right; + margin-top: 20px; + margin-right: 50px; +} + +.wall-item-delete-end { + clear: both; } .wall-item-delete-icon { @@ -506,6 +510,7 @@ input#dfrn-url { } .wall-item-body { float: left; + width: 450px; margin-top: 30px; margin-left: 10px; } diff --git a/view/wall_item.tpl b/view/wall_item.tpl index f27113409..87bf86a52 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -6,9 +6,9 @@
$name
$ago
-$drop
$body
+$drop
$comment diff --git a/view/wall_item_drop.tpl b/view/wall_item_drop.tpl index 46dfb870d..9ca1ec968 100644 --- a/view/wall_item_drop.tpl +++ b/view/wall_item_drop.tpl @@ -1 +1 @@ -
Delete
+
Delete