]> git.mxchange.org Git - friendica.git/commitdiff
mongo commit
authorMike Macgirvin <mike@macgirvin.com>
Mon, 12 Jul 2010 23:43:59 +0000 (16:43 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Mon, 12 Jul 2010 23:43:59 +0000 (16:43 -0700)
include/main.js
mod/item.php
mod/notifications.php
mod/profile.php
update.sql
view/comment_item.tpl
view/head.tpl
view/style.css
view/wall_item.tpl

index 8d364ebcebcb7b4b2b007d90cb7f421f87f8e2b0..f1c6cee12e30a027c82736ca63590b4a744820ef 100644 (file)
       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);
+               }
+       }
 
index 40d03a19869762683ee7fc98e3baaf45d88e2458..29e38fce73e6ec2db2516800a8822227528a4c2c 100644 (file)
@@ -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));
index 6ade0c0bb3257888e9220be61190ad5a58ca6770..f5bbe9a1692d0f95ecd70d9e35c10ac87346ad6c 100644 (file)
@@ -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))) {
 
 
index 45bac146efcb1f07e465039274e460d68ed982ef..39d1b7c6a5eafad330296078ea0dacf3ae1a6686 100644 (file)
@@ -98,6 +98,7 @@ function profile_content(&$a) {
        require_once("include/bbcode.php");
        require_once('include/security.php');
 
+       $a->page['htmlhead'] .= '<script type="text/javascript" src="include/jquery.js" ></script>';
        $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'],
index 9b5a881d7110fe7ed1da383c81cc4d2cda9626eb..63a46bce6eaa86d6b2cb965ce9a9fb27501b86f9 100644 (file)
@@ -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';
index f617bc1a0e7e1b45338b4c24b1120d57ea84ea0d..d6dcd8e4a0df3dd04a2f7987ea07ce000417a7b6 100644 (file)
@@ -1,16 +1,18 @@
 
-<div class="comment-edit" id="comment-edit-$id" onclick="openClose('comment-edit-wrapper-$id');" >Comments</div>
+
 <div class="comment-edit-wrapper" id="comment-edit-wrapper-$id" style="display: block;">
        <form class="comment-edit-form" id="comment-edit-form-$id" action="item" method="post" >
                <input type="hidden" name="type" value="jot" />
                <input type="hidden" name="profile_uid" value="$profile_uid" />
                <input type="hidden" name="parent" value="$parent" />
-               <textarea rows="2" cols="24" id="comment-edit-text-$id" name="body" onFocus="this.rows=5; this.cols=40; openMenu('comment-edit-submit-$id');" onBlur="this.rows=2; this.cols=24; closeMenu('comment-edit-submit-$id'); this.value='';"></textarea>
+
+               <textarea id="comment-edit-text-$id" class="comment-edit-text-empty" name="body" onFocus="commentOpen(this,$id);" onBlur="commentClose(this,$id);" >Comment</textarea>
 
 
-               <div class="comment-edit-submit-wrapper" id="comment-edit-submit-$id" style="display: none;" >
-                       <input type="submit" id="comment-edit-submit" name="submit" value="Submit" />
+               <div class="comment-edit-submit-wrapper" id="comment-edit-submit-wrapper-$id" style="display: none;" >
+                       <input type="submit" id="comment-edit-submit-$id" class="comment-edit-submit" name="submit" value="Submit" />
                </div>
+
                <div id="comment-edit-end"></div>
        </form>
 </div>
index d520e45f0d46a4d8bb2107587acc1dd9c39143c6..8ffd639330ff55f2cb46d4aa366e689fd317865a 100644 (file)
@@ -5,4 +5,5 @@
 <!--[if IE]>
 <script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
 <![endif]-->
+<script type="text/javascript" src="$baseurl/include/jquery.js" ></script>
 <script type="text/javascript" src="$baseurl/include/main.js" ></script>
index a2089aab2f1466e7d6a307293139c0ede3d39a21..f54810740026864c62ef5ccecca5beb7be7f9ec3 100644 (file)
@@ -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
index e483d74db03209161af6abce1ba65b6664c10926..3babc8ead376f57e72ebe56f9a516a7e74794c05 100644 (file)
@@ -8,10 +8,11 @@
 <span class="wall-item-body" id="wall-item-body-$id" >$body</span>
 <div class="wall-item-ago"  id="wall-item-ago-$id">$ago</div>
 
-<div class="wall-item-comment-separator"></div>
-$comment
 </div>
 <div class="wall-item-wrapper-end"></div>
+<div class="wall-item-comment-separator"></div>
+$comment
 </div>
+
 <div class="wall-item-$indentoutside-wrapper-end" ></div>