]> git.mxchange.org Git - friendica.git/commitdiff
item deletion and hover images
authorMike Macgirvin <mike@macgirvin.com>
Tue, 27 Jul 2010 00:01:37 +0000 (17:01 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Tue, 27 Jul 2010 00:01:37 +0000 (17:01 -0700)
images/b_drophide.gif
images/b_dropshow.gif [new file with mode: 0644]
mod/item.php
mod/profile.php
view/contact_edit.tpl
view/head.tpl
view/style.css
view/wall_item.tpl
view/wall_item_drop.tpl

index 3d9746a18247594d66de4489b4ae70d2d4121a5b..1207a935bb048ed510ab9ba8635936ea11bbaa20 100644 (file)
Binary files a/images/b_drophide.gif and b/images/b_drophide.gif differ
diff --git a/images/b_dropshow.gif b/images/b_dropshow.gif
new file mode 100644 (file)
index 0000000..b08c68b
Binary files /dev/null and b/images/b_dropshow.gif differ
index cb89745790c702f6db3bf350ac8d8eab0490c119..552d3e3b3c339b6091722e48aa098126b124dc60 100644 (file)
@@ -13,36 +13,6 @@ function item_post(&$a) {
 
        $uid = $_SESSION['uid'];
 
-       if(($a->argc == 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
index b0ff85a447a4e25336ed24be89334d96cc45f737..3703fe7f26c6f49d09dda271295d67fc5edf9a08 100644 (file)
@@ -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'])) {
index 26ee2ef5c5d28761d975954926dc18892a42a522..bfeb107170e606465308f851623d7e3b4a31f61a 100644 (file)
@@ -17,7 +17,7 @@
 
                <div id="contact-edit-links" >
                        <a href="contacts/$contact_id/block" id="contact-edit-block-link" ><img src="images/b_block.gif" alt="Block/Unblock contact" title="$block_text"/></a>
-                       <a href="contacts/$contact_id/drop" id="contact-edit-drop-link"><img src="images/b_drop.gif" alt="Delete contact" title="Delete contact"/></a>
+                       <a href="contacts/$contact_id/drop" id="contact-edit-drop-link" onclick="return confirmDelete();" ><img src="images/b_drophide.gif" alt="Delete contact" title="Delete contact" onmouseover="imgbright(this);" onmouseout="imgdull(this);" /></a>
                </div>
                <div id="contact-edit-nav-end"></div>
        </div>
index 81ce1287f5b85a56d180c889e8136dfbe4d1e2fb..2a6506da9d3ae7bad0f82ffbc13d4a06cee6b02b 100644 (file)
                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'));
-//             });
 
 
        });
                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'));
+       }
+
+
+
+
+
+
 </script>
 
index e3a2730a15a3688373317b2c2e41f18ef6a921aa..d0e7dd262f767bb6e3dcf3ad764ce88fb7d06526 100644 (file)
@@ -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;
 }
index f27113409bb869a14edb03697885005dad25991a..87bf86a52dcfc4ee5e8c37e75e703d82856ec409 100644 (file)
@@ -6,9 +6,9 @@
 <div class="wall-item-wrapper" id="wall-item-wrapper-$id" >
 <a href="$profile_url" title="View $name's profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-$id" >$name</span></a>
 <div class="wall-item-ago"  id="wall-item-ago-$id">$ago</div>
-$drop
 </div>
 <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+$drop
 <div class="wall-item-wrapper-end"></div>
 <div class="wall-item-comment-separator"></div>
 $comment
index 46dfb870de0871d3c6e9550636b6b6165b6405a0..9ca1ec9680be3d3a06bb05c59d7669c175659140 100644 (file)
@@ -1 +1 @@
-<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$id" ><a href="item/drop/$id" onclick="return confirmDelete();" ><img src="images/b_drop.gif" alt="Delete" title="Delete" id="wall-item-delete-icon-$id" class="wall-item-delete-icon"></a></div>
+<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-$id" ><a href="item/drop/$id" onclick="return confirmDelete();" ><img src="images/b_drophide.gif" alt="Delete" title="Delete" id="wall-item-delete-icon-$id" class="wall-item-delete-icon" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a></div><div class="wall-item-delete-end"></div>