]> git.mxchange.org Git - friendica.git/commitdiff
item tags as array to templates
authorFabio Comuni <fabrix.xm@gmail.com>
Tue, 15 Nov 2011 16:41:38 +0000 (17:41 +0100)
committerFabio Comuni <fabrix.xm@gmail.com>
Tue, 15 Nov 2011 16:41:38 +0000 (17:41 +0100)
include/conversation.php
include/text.php
view/theme/dispy/wall_item.tpl
view/theme/dispy/wallwall_item.tpl
view/theme/duepuntozero/wall_item.tpl
view/theme/duepuntozero/wallwall_item.tpl
view/theme/quattro/colors.less
view/theme/quattro/quattro.less
view/theme/quattro/style.css
view/theme/testbubble/wall_item.tpl
view/theme/testbubble/wallwall_item.tpl

index b8f855803dc28ea43f3e539c3616d0b676806363..7f9627a7d835cc75e3a29ba18dec3280da120343 100644 (file)
@@ -4,7 +4,7 @@
  * Render actions localized
  */
 function localize_item(&$item){
-       
+       $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";
        if ($item['verb']=== ACTIVITY_LIKE || $item['verb']=== ACTIVITY_DISLIKE){
 
                $r = q("SELECT * from `item`,`contact` WHERE 
@@ -79,7 +79,44 @@ function localize_item(&$item){
                $item['body'] = sprintf( t('%1$s is now friends with %2$s'), $A, $B)."\n\n\n".$Bphoto;
 
        }
-        
+    if ($item['verb']===ACTIVITY_TAG){
+               $r = q("SELECT * from `item`,`contact` WHERE 
+               `item`.`contact-id`=`contact`.`id` AND `item`.`uri`='%s';",
+                dbesc($item['parent-uri']));
+               if(count($r)==0) return;
+               $obj=$r[0];
+               
+               $author  = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
+               $objauthor =  '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
+               
+               switch($obj['verb']){
+                       case ACTIVITY_POST:
+                               switch ($obj['object-type']){
+                                       case ACTIVITY_OBJ_EVENT:
+                                               $post_type = t('event');
+                                               break;
+                                       default:
+                                               $post_type = t('status');
+                               }
+                               break;
+                       default:
+                               if($obj['resource-id']){
+                                       $post_type = t('photo');
+                                       $m=array();     preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
+                                       $rr['plink'] = $m[1];
+                               } else {
+                                       $post_type = t('status');
+                               }
+               }
+               $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
+               
+               $parsedobj = parse_xml_string($xmlhead.$item['object']);
+               
+               $tag = sprintf('#[url=%s]%s[/url]', $parsedobj->link, $parsedobj->content);
+               $item['body'] = sprintf( t('%1$s tagged %2$s\'s %3$s with %4$s'), $author, $objauthor, $plink, $tag );
+               
+               
+       }
 
 }
 
@@ -522,12 +559,22 @@ function conversation(&$a, $items, $mode, $update) {
                                // 
                                localize_item($item);
 
+
+                               $tags=array();
+                               foreach(explode(',',$item['tag']) as $tag){
+                                       $tag = trim($tag);
+                                       if ($tag!="") $tags[] = bbcode($tag);
+                               }
+
+
                                // Build the HTML
 
                                $body = prepare_body($item,true);
-
+                               
 
                                $tmp_item = replace_macros($template,array(
+                                       '$type' => implode("",array_slice(split("/",$item['verb']),-1)),
+                                       '$tags' => $tags,
                                        '$body' => template_escape($body),
                                        '$id' => $item['item_id'],
                                        '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
index 59fc1500746a5f6b213efc4c3230b0564631a74c..08803cc9b7be5b54bb7f4b9ceb8b6e980e520939 100644 (file)
@@ -788,14 +788,6 @@ function prepare_body($item,$attach = false) {
                $s .= '<div class="clear"></div></div>';
        }
 
-       $arr = explode(',',$item['tag']);
-       if(count($arr)) {
-               $s .= '<div class="body-tag">';
-               foreach($arr as $r) {
-                       $s .= bbcode($r) . ' ';
-               }
-               $s .= '</div>';
-       }
 
        $prep_arr = array('item' => $item, 'html' => $s);
        call_hooks('prepare_body_final', $prep_arr);
index f555ed8132fd201b1bf0f2852bbf7aa193bcfb7e..51431d4eb985d1fc18bbf7369adaf70365683c0c 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                                       <div class="body-tag">
+                                               {{ for $tags as $tag }}
+                                                       <span class='tag'>$tag</span>
+                                               {{ endfor }}
+                                       </div>
+                       </div>
                </div>
                <div class="wall-item-author">
                                <a href="$profile_url" title="$linktitle" class="wall-item-name-link"><span class="wall-item-name$sparkle" id="wall-item-name-$id" >$name</span></a>
index 9e6ea40a1805bc0f4a97686a217f97c4b4363aeb..4b2b52b85f2fc804379706dc1df059c032736e66 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                                       <div class="body-tag">
+                                               {{ for $tags as $tag }}
+                                                       <span class='tag'>$tag</span>
+                                               {{ endfor }}
+                                       </div>                  
+                       </div>
                </div>
                <div class="wall-item-author">
                        <a href="$profile_url" title="$linktitle" class="wall-item-name-link"><span class="wall-item-name$sparkle" id="wall-item-name-$id" >$name</span></a>
index 3a4a497293630706a1de9dd359d440a6b4af1819..62f33ddee4381cec1344783ce7b1335880cae846 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                                       <div class="body-tag">
+                                               {{ for $tags as $tag }}
+                                                       <span class='tag'>$tag</span>
+                                               {{ endfor }}
+                                       </div>
+                       </div>
                </div>
                <div class="wall-item-tools" id="wall-item-tools-$id">
                        {{ if $vote }}
index aaa542760e7ab592f1e8db71c3aea6625ae78fdf..050abb02d511a6d5a082725e76187fb8333a1b8d 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                                       <div class="body-tag">
+                                               {{ for $tags as $tag }}
+                                                       <span class='tag'>$tag</span>
+                                               {{ endfor }}
+                                       </div>
+                       </div>
                </div>
                <div class="wall-item-tools" id="wall-item-tools-$id">
                        {{ if $vote }}
index a7a91114c28d7b6d07c642ae6e2a2326170690c3..d36ff05b0d83b52207c72f2ad660c689a7ca7f5c 100644 (file)
@@ -77,3 +77,4 @@
 @CommentBoxFullColor: @Grey5;
 @CommentBoxFullBorderColor: @Grey5;
 
+@TagColor: @Grey1;
index ea699d5c6f9d2250e0b7e5d3267a210506652fbb..babcff3e883166d5f765c16c04ef47612bd3aa30 100644 (file)
@@ -3,7 +3,7 @@
 /* global */
 body {
        font-family: Liberation Sans,helvetica,arial,clean,sans-serif;
-       font-size: 12px;
+       font-size: 10px;
        background-color: @BodyBackground;
        color: @BodyColor;
        margin: 50px 0px 0px 0px;
@@ -302,6 +302,9 @@ section {
        
        .wall-item-item,
        .wall-item-bottom { display: table-row; }
+       
+       .wall-item-bottom { .opaque(0.5); }
+       &:hover .wall-item-bottom { .opaque(1); }
        .wall-item-info {
                display: table-cell;
                vertical-align: top;
@@ -326,7 +329,7 @@ section {
        }
        .wall-item-content {
                display: table-cell;
-               font-size: 16px;
+               font-size: 12px;
                max-width: 720px;
                word-wrap: break-word;
        }
@@ -355,11 +358,12 @@ section {
                a { float: right; }
                input { float: right; }
        }
+       
 }
 
 
 .wall-item-container.comment {
-       margin-top: 50px;
+       /*margin-top: 50px;*/
        .wall-item-photo { width: 32px; height: 32px; margin-left: 16px;}       
        .wall-item-photo-menu-button {
                top: 13px !important;
@@ -385,6 +389,19 @@ section {
        }
 }
 
+.tag {
+       background: url("../../../images/tag_b.png") no-repeat center left;
+       color: @TagColor;
+       padding-left: 3px;
+       a {
+               padding-right: 8px;
+               background: url("../../../images/tag.png") no-repeat center right;
+               color: @TagColor;
+       }
+}
+
+
+
 #profile-jot-wrapper {
        width: 100%;
        margin: 0px 2em 20px 0px;
index 95c3d087ede6430744014e58fa19439c009ba96c..560f53c2c2b2631d228d40b10defe65ece72bd86 100644 (file)
 /* global */
 body {
   font-family: Liberation Sans, helvetica, arial, clean, sans-serif;
-  font-size: 12px;
+  font-size: 10px;
   background-color: #ffffff;
   color: #2d2d2d;
   margin: 50px 0px 0px 0px;
@@ -535,6 +535,22 @@ section {
 .wall-item-container .wall-item-item, .wall-item-container .wall-item-bottom {
   display: table-row;
 }
+.wall-item-container .wall-item-bottom {
+  opacity: 0.5;
+  -webkit-transition: all 0.2s ease-in-out;
+  -moz-transition: all 0.2s ease-in-out;
+  -o-transition: all 0.2s ease-in-out;
+  -ms-transition: all 0.2s ease-in-out;
+  transition: all 0.2s ease-in-out;
+}
+.wall-item-container:hover .wall-item-bottom {
+  opacity: 1;
+  -webkit-transition: all 0.2s ease-in-out;
+  -moz-transition: all 0.2s ease-in-out;
+  -o-transition: all 0.2s ease-in-out;
+  -ms-transition: all 0.2s ease-in-out;
+  transition: all 0.2s ease-in-out;
+}
 .wall-item-container .wall-item-info {
   display: table-cell;
   vertical-align: top;
@@ -563,7 +579,7 @@ section {
 }
 .wall-item-container .wall-item-content {
   display: table-cell;
-  font-size: 16px;
+  font-size: 12px;
   max-width: 720px;
   word-wrap: break-word;
 }
@@ -619,7 +635,8 @@ section {
   float: right;
 }
 .wall-item-container.comment {
-  margin-top: 50px;
+  /*margin-top: 50px;*/
+
 }
 .wall-item-container.comment .wall-item-photo {
   width: 32px;
@@ -653,6 +670,16 @@ section {
   color: #2d2d2d;
   border: 1px solid #2d2d2d;
 }
+.tag {
+  background: url("../../../images/tag_b.png") no-repeat center left;
+  color: #ffffff;
+  padding-left: 3px;
+}
+.tag a {
+  padding-right: 8px;
+  background: url("../../../images/tag.png") no-repeat center right;
+  color: #ffffff;
+}
 #profile-jot-wrapper {
   width: 100%;
   margin: 0px 2em 20px 0px;
index 199381fd3a7586b1b65f6c010d1c27cacff5a44e..4fe819f4b9c03a4b719bb90189f93f0b09b53ad5 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                               <div class="body-tag">
+                                       {{ for $tags as $tag }}
+                                               <span class='tag'>$tag</span>
+                                       {{ endfor }}
+                               </div>
+                       </div>
                </div>
 
                <div class="wall-item-tools" id="wall-item-tools-$id">
index ba62d30fb9d687ff43854682154088dedb5e9756..015e62f3e8fa3ae5b6a44eca9b662e4eacdb73fa 100644 (file)
                <div class="wall-item-content" id="wall-item-content-$id" >
                        <div class="wall-item-title" id="wall-item-title-$id">$title</div>
                        <div class="wall-item-title-end"></div>
-                       <div class="wall-item-body" id="wall-item-body-$id" >$body</div>
+                       <div class="wall-item-body" id="wall-item-body-$id" >$body
+                                       <div class="body-tag">
+                                               {{ for $tags as $tag }}
+                                                       <span class='tag'>$tag</span>
+                                               {{ endfor }}
+                                       </div>
+                       </div>
                </div>
                <div class="wall-item-author">
                        <a href="$profile_url" title="$linktitle" class="wall-item-name-link"><span class="wall-item-name$sparkle" id="wall-item-name-$id" >$name</span></a>