From e0e2a032cfd5769f486b4b2abe58a54144b509c0 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Mon, 12 Jul 2010 16:43:59 -0700 Subject: [PATCH] mongo commit --- include/main.js | 15 ++++++++++++++- mod/item.php | 18 ++++++++++++++++-- mod/notifications.php | 4 ++-- mod/profile.php | 8 +++----- update.sql | 2 ++ view/comment_item.tpl | 10 ++++++---- view/head.tpl | 1 + view/style.css | 18 ++++++++++++++---- view/wall_item.tpl | 5 +++-- 9 files changed, 61 insertions(+), 20 deletions(-) diff --git a/include/main.js b/include/main.js index 8d364ebceb..f1c6cee12e 100644 --- a/include/main.js +++ b/include/main.js @@ -16,5 +16,18 @@ document.getElementById(theID).style.display = "none" } - + function commentOpen(obj,id) { + if(obj.value == 'Comment') { + obj.value = ''; + obj.className = "comment-edit-text-full"; + openMenu("comment-edit-submit-wrapper-" + id); + } + } + function commentClose(obj,id) { + if(obj.value == '') { + obj.value = 'Comment'; + obj.className="comment-edit-text-empty"; + closeMenu("comment-edit-submit-wrapper-" + id); + } + } diff --git a/mod/item.php b/mod/item.php index 40d03a1986..29e38fce73 100644 --- a/mod/item.php +++ b/mod/item.php @@ -11,11 +11,18 @@ function item_post(&$a) { $uid = $_SESSION['uid']; $parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0); $profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0); + if(! can_write_wall($a,$profile_uid)) { notice("Permission denied." . EOL) ; return; } + $body = escape_tags(trim($_POST['body'])); + if(! strlen($body)) { + notice("Empty post discarded." . EOL ); + goaway($a->get_baseurl() . "/profile/$profile_uid"); + } + if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id']))) $contact_id = $_SESSION['visitor_id']; else { @@ -53,9 +60,16 @@ function item_post(&$a) { dbesc($hash)); if(count($r)) { $post_id = $r[0]['id']; - if(! $parent) + if($parent) { + $r = q("UPDATE `item` SET `last-child` = 0 WHERE `parent` = %d ", + intval($parent) + ); + } + else { $parent = $post_id; - $r = q("UPDATE `item` SET `parent` = %d, `visible` = 1 + } + + $r = q("UPDATE `item` SET `parent` = %d, `last-child` = 1, `visible` = 1 WHERE `id` = %d LIMIT 1", intval($parent), intval($post_id)); diff --git a/mod/notifications.php b/mod/notifications.php index 6ade0c0bb3..f5bbe9a169 100644 --- a/mod/notifications.php +++ b/mod/notifications.php @@ -65,12 +65,12 @@ function notifications_content(&$a) { '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ), '$hide_text' => ((strlen($sql_extra)) ? 'Show Ignored Requests' : 'Hide Ignored Requests') )); -dbg(2); + $r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.* FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id` WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ", intval($_SESSION['uid'])); -dbg(0); + if(($r !== false) && (count($r))) { diff --git a/mod/profile.php b/mod/profile.php index 45bac146ef..39d1b7c6a5 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -98,6 +98,7 @@ function profile_content(&$a) { require_once("include/bbcode.php"); require_once('include/security.php'); + $a->page['htmlhead'] .= ''; $groups = array(); $tab = 'posts'; @@ -143,8 +144,6 @@ function profile_content(&$a) { } -dbg(2); - // TODO // Alter registration and settings // and profile to update contact table when names and photos change. @@ -216,11 +215,10 @@ dbg(2); $tpl = file_get_contents('view/wall_item.tpl'); if(count($r)) { - for($x = 0; $x < count($r); $x ++) { - $rr = $r[$x]; + foreach($r as $rr) { $comment = ''; if(can_write_wall($a,$a->profile['profile_uid'])) { - if((($x + 1) < count($r)) && ($r[$x+1]['parent'] != $rr['parent'])) { + if($rr['last-child']) { $comment = replace_macros($template,array( '$id' => $rr['item_id'], '$parent' => $rr['parent'], diff --git a/update.sql b/update.sql index 9b5a881d71..63a46bce6e 100644 --- a/update.sql +++ b/update.sql @@ -1,2 +1,4 @@ ALTER TABLE `item` CHANGE `allow_uid` `allow_cid` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL , CHANGE `deny_uid` `deny_cid` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ; + + ALTER TABLE `item` CHANGE `last-child` `last-child` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1'; diff --git a/view/comment_item.tpl b/view/comment_item.tpl index f617bc1a0e..d6dcd8e4a0 100644 --- a/view/comment_item.tpl +++ b/view/comment_item.tpl @@ -1,16 +1,18 @@ -
Comments
+
- + + -
diff --git a/view/head.tpl b/view/head.tpl index d520e45f0d..8ffd639330 100644 --- a/view/head.tpl +++ b/view/head.tpl @@ -5,4 +5,5 @@ + diff --git a/view/style.css b/view/style.css index a2089aab2f..f548107400 100644 --- a/view/style.css +++ b/view/style.css @@ -442,11 +442,9 @@ input#dfrn-url { border: none; } -.comment-edit { - font-size: 0.8em; - cursor: pointer; - color: #3172BD; +.comment-edit-wrapper { margin-top: 15px; + margin-left: 100px; } @@ -756,4 +754,16 @@ input#dfrn-url { #profile-tabs-end { clear: both; +} + +.comment-edit-text-empty { + color: gray; + height: 30px; + width: 175px; +} + +.comment-edit-text-full { + color: black; + height: 150px; + width: 350px; } \ No newline at end of file diff --git a/view/wall_item.tpl b/view/wall_item.tpl index e483d74db0..3babc8ead3 100644 --- a/view/wall_item.tpl +++ b/view/wall_item.tpl @@ -8,10 +8,11 @@ $body
$ago
+
+
$comment -
- +