]> git.mxchange.org Git - friendica.git/commitdiff
add right_aside to theme diabook
authortommy tomson <thomas.bierey@gmx.de>
Fri, 23 Mar 2012 01:36:34 +0000 (02:36 +0100)
committertommy tomson <thomas.bierey@gmx.de>
Fri, 23 Mar 2012 01:36:34 +0000 (02:36 +0100)
view/default.php
view/theme/diabook/communityhome.tpl [new file with mode: 0755]
view/theme/diabook/directory_item.tpl [new file with mode: 0755]
view/theme/diabook/right_aside.tpl [new file with mode: 0644]
view/theme/diabook/style.css
view/theme/diabook/theme.php

index ab1cb0f092ae4094c2f3dcc9d60b3fd520eed118..61f5f68635e56d13109c65c07d28c8460f0127f4 100755 (executable)
@@ -10,7 +10,8 @@
        <aside><?php if(x($page,'aside')) echo $page['aside']; ?></aside>\r
        <section><?php if(x($page,'content')) echo $page['content']; ?>\r
                <div id="page-footer"></div>\r
-       </section>\r
+       </section>
+       <right_aside><?php if(x($page,'right_aside')) echo $page['right_aside']; ?></right_aside>\r
        <footer><?php if(x($page,'footer')) echo $page['footer']; ?></footer>\r
 </body>\r
 </html>\r
diff --git a/view/theme/diabook/communityhome.tpl b/view/theme/diabook/communityhome.tpl
new file mode 100755 (executable)
index 0000000..876276c
--- /dev/null
@@ -0,0 +1,42 @@
+{{ if $lastusers_title }}
+<h3 style="margin-top:0px;">Help or #Newhere?</h3>
+<a href="https://helpers.pyxis.uberspace.de/profile/helpers" style="margin-left: 10px; color:#000;" title="Friendica Support" target="blank">Friendica Support</a><br>
+<a href="https://letstalk.pyxis.uberspace.de/profile/letstalk" style="margin-left: 10px; color:#000;" title="Let's talk" target="blank">Let's talk</a><br>
+<a href="http://kakste.com/profile/newhere" title="#NewHere" style="margin-left: 10px; color:#000;" target="blank">NewHere</a>
+{{ endif }}
+{{ if $lastusers_title }}
+<h3>$lastusers_title</h3>
+<div class='items-wrapper'>
+{{ for $lastusers_items as $i }}
+       $i
+{{ endfor }}
+</div>
+{{ endif }}
+
+{{ if $activeusers_title }}
+<h3>$activeusers_title</h3>
+<div class='items-wrapper'>
+{{ for $activeusers_items as $i }}
+       $i
+{{ endfor }}
+</div>
+{{ endif }}
+
+{{ if $photos_title }}
+<h3>$photos_title</h3>
+<div class='items-wrapper'>
+{{ for $photos_items as $i }}
+       $i
+{{ endfor }}
+</div>
+{{ endif }}
+
+
+{{ if $like_title }}
+<h3>$like_title</h3>
+<ul id='likes'>
+{{ for $like_items as $i }}
+       <li>$i</li>
+{{ endfor }}
+</ul>
+{{ endif }}
diff --git a/view/theme/diabook/directory_item.tpl b/view/theme/diabook/directory_item.tpl
new file mode 100755 (executable)
index 0000000..db1936e
--- /dev/null
@@ -0,0 +1,10 @@
+
+<div class="directory-item" id="directory-item-$id" >
+       <div class="directory-photo-wrapper" id="directory-photo-wrapper-$id" > 
+               <div class="directory-photo" id="directory-photo-$id" >
+                       <a href="$profile-link" class="directory-profile-link" id="directory-profile-link-$id" >
+                               <img class="directory-photo-img" src="$photo" alt="$alt-text" title="$alt-text" />
+                       </a>
+               </div>
+       </div>
+</div>
diff --git a/view/theme/diabook/right_aside.tpl b/view/theme/diabook/right_aside.tpl
new file mode 100644 (file)
index 0000000..a656776
--- /dev/null
@@ -0,0 +1,20 @@
+<div id="profile_side">
+       <div id="ps-usernameicon">
+               <a href="$ps.usermenu.status.0" title="$userinfo.name">
+                       <img src="$userinfo.icon" id="ps-usericon" alt="$userinfo.name">
+               </a>
+               <a href="$ps.usermenu.status.0" id="ps-username" title="$userinfo.name">$userinfo.name</a>
+       </div>
+       
+<ul id="profile-side-menu" class="menu-profile-side">
+       <li id="profile-side-status" class="menu-profile-list home"><a class="menu-profile-list-item" href="$ps.usermenu.status.0">$ps.usermenu.status.1</a></li>
+       <li id="profile-side-photos" class="menu-profile-list photos"><a class="menu-profile-list-item" href="$ps.usermenu.photos.0">$ps.usermenu.photos.1</a></li>
+       <li id="profile-side-events" class="menu-profile-list events"><a class="menu-profile-list-item" href="$ps.usermenu.events.0">$ps.usermenu.events.1</a></li>
+       <li id="profile-side-notes" class="menu-profile-list notes"><a class="menu-profile-list-item" href="$ps.usermenu.notes.0">$ps.usermenu.notes.1</a></li>
+       <li id="profile-side-foren" class="menu-profile-list foren"><a class="menu-profile-list-item" href="http://dir.friendika.com/directory/forum" target="blanc">Public Groups</a></li>
+       <li id="profile-side-foren" class="menu-profile-list com_side"><a class="menu-profile-list-item" href="$ps.usermenu.community.0">$ps.usermenu.community.1</a></li>
+</ul>
+
+</div>
+
+                               
\ No newline at end of file
index 5841a96b36f1bd1006e0b65e66d529d3f46b651a..f7dab9ef0ee857c730f9b6273e9db057c9de65b9 100644 (file)
 .hide-comments-outer {
   margin-left: 80px;
   margin-bottom: 5px;
-  width: 684px;
+  width: 484px;
   border-bottom: 1px solid #BDCDD4;
   border-top: 1px solid #BDCDD4;
 
@@ -1096,8 +1096,8 @@ aside #side-peoplefind-url {
 section {
   display: table-cell;
   vertical-align: top;
-  width: 800px;
-  padding: 0px 0px 0px 12px;
+  width: auto;
+  padding: 0px 12px 0px 12px;
 }
 
 body .pageheader{
@@ -1145,13 +1145,30 @@ body .pageheader{
 #birthday-notice, #event-notice, #birthday-wrapper, #event-wrapper{
        margin-bottom: 10px;
        }
+
+right_aside {
+  display: table-cell;
+  vertical-align: top;
+  width: 180px;
+  /*border-left: 1px solid #D2D2D2;*/
+  
+  /* background: #F1F1F1; */
+}
+right_aside h3 {border-bottom: 1px solid #D2D2D2; padding-top: 5px; padding-bottom: 0px; padding-left: 5px; margin-bottom: 0px; 
+margin-top:30px;}
+right_aside .directory-item {  width: 55px; height: 55px; vertical-align: center; text-align: center; }
+right_aside .directory-photo { margin: 0px; }
+right_aside .directory-photo-img { max-width: 48px; max-height: 48px; }
+right_aside #likes { margin: 0px; padding: 0px; list-style: none; }
+right_aside .items-wrapper{ overflow: auto;    width: 100%; border-bottom: 1px solid #D2D2D2;}
+
 /* wall item */
 .tread-wrapper {
   border-bottom: 1px solid #D2D2D2;
   position: relative;
   padding: 5px;
   margin-bottom: 0px;
-  width: 775px;
+  width: 575px;
 }
 .wall-item-decor {
   position: absolute;
@@ -1162,7 +1179,7 @@ body .pageheader{
 
 .wall-item-container {
   display: table;
-  width: 780px;
+  width: 580px;
 }
 
 
@@ -1275,7 +1292,7 @@ body .pageheader{
   margin-top: 5px;
   margin-bottom: 5px;
   margin-left: 80px;
-  width: 700px;
+  width: 500px;
   border-bottom: 1px solid hsl(198, 21%, 79%);
 }
 .wall-item-container.comment .contact-photo {
@@ -1591,7 +1608,7 @@ body .pageheader{
 }
 #profile-jot-wrapper{
        margin: 0 2em 20px 0;
-   width: 785px;
+   width: 585px;
        }
 
 #profile-jot-submit-wrapper {
index 39479ce522269e8db387c17aaebb5cfbf9d29213..25808d7e938d09ab7c0b931634c52b5c97004cb8 100755 (executable)
@@ -11,9 +11,10 @@ $a->theme_info = array(
   'extends' => 'diabook',
 );
 
-//profile_side
-
+//profile_side at networkpages
 
+if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
+//
 
 $nav['usermenu']=array();
 $userinfo = null;
@@ -36,14 +37,241 @@ $ps['usermenu'][events] = Array('events/', t('Events'), "", t('Your events'));
 $ps['usermenu'][notes] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
 $ps['usermenu'][community] = Array('community/', t('Community'), "", "");
 
-if($is_url = preg_match ("/\bnetwork\b/i", $_SERVER['REQUEST_URI'])) {
+
 $tpl = get_markup_template('profile_side.tpl');
 
 $a->page['aside'] .= replace_macros($tpl, array(
                '$userinfo' => $userinfo,
                '$ps' => $ps,
        ));
+
 }
+
+//right_aside at networkpages
+
+// last 12 users
+       $aside['$lastusers_title'] = t('Last users');
+       $aside['$lastusers_items'] = array();
+       $sql_extra = "";
+       $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
+       $order = " ORDER BY `register_date` DESC ";
+
+       $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
+                       FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` 
+                       WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
+               0,
+               12
+       );
+       $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+       if(count($r)) {
+               $photo = 'thumb';
+               foreach($r as $rr) {
+                       $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+                       $entry = replace_macros($tpl,array(
+                               '$id' => $rr['id'],
+                               '$profile-link' => $profile_link,
+                               '$photo' => $rr[$photo],
+                               '$alt-text' => $rr['name'],
+                       ));
+                       $aside['$lastusers_items'][] = $entry;
+               }
+       }
+       
+// last 10 liked items
+       $aside['$like_title'] = t('Last likes');
+       $aside['$like_items'] = array();
+       $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM 
+                       (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` 
+                               FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
+                       INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri` 
+                       WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
+                       GROUP BY `uri`
+                       ORDER BY `T1`.`created` DESC
+                       LIMIT 0,10",
+                       $a->get_baseurl(),$a->get_baseurl()
+                       );
+
+       foreach ($r as $rr) {
+               $author  = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
+               $objauthor =  '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
+               
+               //var_dump($rr['verb'],$rr['object-type']); killme();
+               switch($rr['verb']){
+                       case 'http://activitystrea.ms/schema/1.0/post':
+                               switch ($rr['object-type']){
+                                       case 'http://activitystrea.ms/schema/1.0/event':
+                                               $post_type = t('event');
+                                               break;
+                                       default:
+                                               $post_type = t('status');
+                               }
+                               break;
+                       default:
+                               if ($rr['resource-id']){
+                                       $post_type = t('photo');
+                                       $m=array();     preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
+                                       $rr['plink'] = $m[1];
+                               } else {
+                                       $post_type = t('status');
+                               }
+               }
+               $plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
+
+               $aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
+               
+       }
+// last 12 photos
+       $aside['$photos_title'] = t('Last photos');
+       $aside['$photos_items'] = array();
+       $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM 
+                               (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` 
+                                       WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
+                                               AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
+                               INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
+                               `user` 
+                               WHERE `user`.`uid` = `photo`.`uid`
+                               AND `user`.`blockwall`=0
+                               ORDER BY `photo`.`edited` DESC
+                               LIMIT 0, 12",
+                               dbesc(t('Contact Photos')),
+                               dbesc(t('Profile Photos'))
+                               );
+               if(count($r)) {
+               $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+               foreach($r as $rr) {
+                       $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
+                       $photo_url = $a->get_baseurl() . '/photo/' .  $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
+               
+                       $entry = replace_macros($tpl,array(
+                               '$id' => $rr['id'],
+                               '$profile-link' => $photo_page,
+                               '$photo' => $photo_url,
+                               '$alt-text' => $rr['username']." : ".$rr['desc'],
+                       ));
+
+                       $aside['$photos_items'][] = $entry;
+               }
+       }
+       
+
+       $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
+       $a->page['right_aside'] = replace_macros($tpl, $aside);
+       
+}
+
+//right_aside at profile pages
+
+if($is_url = preg_match ("/\bprofile\b/i", $_SERVER['REQUEST_URI'])) {
+//right_aside
+
+// last 12 users
+       $aside['$lastusers_title'] = t('Last users');
+       $aside['$lastusers_items'] = array();
+       $sql_extra = "";
+       $publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 " );
+       $order = " ORDER BY `register_date` DESC ";
+
+       $r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
+                       FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` 
+                       WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $sql_extra $order LIMIT %d , %d ",
+               0,
+               12
+       );
+       $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+       if(count($r)) {
+               $photo = 'thumb';
+               foreach($r as $rr) {
+                       $profile_link = $a->get_baseurl() . '/profile/' . ((strlen($rr['nickname'])) ? $rr['nickname'] : $rr['profile_uid']);
+                       $entry = replace_macros($tpl,array(
+                               '$id' => $rr['id'],
+                               '$profile-link' => $profile_link,
+                               '$photo' => $rr[$photo],
+                               '$alt-text' => $rr['name'],
+                       ));
+                       $aside['$lastusers_items'][] = $entry;
+               }
+       }
+       
+// last 10 liked items
+       $aside['$like_title'] = t('Last likes');
+       $aside['$like_items'] = array();
+       $r = q("SELECT `T1`.`created`, `T1`.`liker`, `T1`.`liker-link`, `item`.* FROM 
+                       (SELECT `parent-uri`, `created`, `author-name` AS `liker`,`author-link` AS `liker-link` 
+                               FROM `item` WHERE `verb`='http://activitystrea.ms/schema/1.0/like' GROUP BY `parent-uri` ORDER BY `created` DESC) AS T1
+                       INNER JOIN `item` ON `item`.`uri`=`T1`.`parent-uri` 
+                       WHERE `T1`.`liker-link` LIKE '%s%%' OR `item`.`author-link` LIKE '%s%%'
+                       GROUP BY `uri`
+                       ORDER BY `T1`.`created` DESC
+                       LIMIT 0,10",
+                       $a->get_baseurl(),$a->get_baseurl()
+                       );
+
+       foreach ($r as $rr) {
+               $author  = '<a href="' . $rr['liker-link'] . '">' . $rr['liker'] . '</a>';
+               $objauthor =  '<a href="' . $rr['author-link'] . '">' . $rr['author-name'] . '</a>';
+               
+               //var_dump($rr['verb'],$rr['object-type']); killme();
+               switch($rr['verb']){
+                       case 'http://activitystrea.ms/schema/1.0/post':
+                               switch ($rr['object-type']){
+                                       case 'http://activitystrea.ms/schema/1.0/event':
+                                               $post_type = t('event');
+                                               break;
+                                       default:
+                                               $post_type = t('status');
+                               }
+                               break;
+                       default:
+                               if ($rr['resource-id']){
+                                       $post_type = t('photo');
+                                       $m=array();     preg_match("/\[url=([^]]*)\]/", $rr['body'], $m);
+                                       $rr['plink'] = $m[1];
+                               } else {
+                                       $post_type = t('status');
+                               }
+               }
+               $plink = '<a href="' . $rr['plink'] . '">' . $post_type . '</a>';
+
+               $aside['$like_items'][] = sprintf( t('%1$s likes %2$s\'s %3$s'), $author, $objauthor, $plink);
+               
+       }
+// last 12 photos
+       $aside['$photos_title'] = t('Last photos');
+       $aside['$photos_items'] = array();
+       $r = q("SELECT `photo`.`id`, `photo`.`resource-id`, `photo`.`scale`, `photo`.`desc`, `user`.`nickname`, `user`.`username` FROM 
+                               (SELECT `resource-id`, MAX(`scale`) as maxscale FROM `photo` 
+                                       WHERE `profile`=0 AND `contact-id`=0 AND `album` NOT IN ('Contact Photos', '%s', 'Profile Photos', '%s')
+                                               AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`='' GROUP BY `resource-id`) AS `t1`
+                               INNER JOIN `photo` ON `photo`.`resource-id`=`t1`.`resource-id` AND `photo`.`scale` = `t1`.`maxscale`,
+                               `user` 
+                               WHERE `user`.`uid` = `photo`.`uid`
+                               AND `user`.`blockwall`=0
+                               ORDER BY `photo`.`edited` DESC
+                               LIMIT 0, 12",
+                               dbesc(t('Contact Photos')),
+                               dbesc(t('Profile Photos'))
+                               );
+               if(count($r)) {
+               $tpl = file_get_contents( dirname(__file__).'/directory_item.tpl');
+               foreach($r as $rr) {
+                       $photo_page = $a->get_baseurl() . '/photos/' . $rr['nickname'] . '/image/' . $rr['resource-id'];
+                       $photo_url = $a->get_baseurl() . '/photo/' .  $rr['resource-id'] . '-' . $rr['scale'] .'.jpg';
+               
+                       $entry = replace_macros($tpl,array(
+                               '$id' => $rr['id'],
+                               '$profile-link' => $photo_page,
+                               '$photo' => $photo_url,
+                               '$alt-text' => $rr['username']." : ".$rr['desc'],
+                       ));
+
+                       $aside['$photos_items'][] = $entry;
+               }
+       }
+       
+
+       $tpl = file_get_contents(dirname(__file__).'/communityhome.tpl');
+       $a->page['right_aside'] = replace_macros($tpl, $aside);
+       
 }
 
 //js scripts