Browse Source

- Start Bookmark widget

- Fix Posts and Comments display in WidgetCommon
- Fix Roster CSS
- Fix forms CSS
- Various CSS fixes
- Add Bookmark Widget to the main page
pull/16/head
Jaussoin Timothée 13 years ago
parent
commit
ef8cef0dbd
  1. 76
      system/Widget/WidgetCommon.php
  2. 180
      system/Widget/widgets/Bookmark/Bookmark.php
  3. 2
      system/Widget/widgets/Config/Config.php
  4. 25
      system/Widget/widgets/Node/Node.php
  5. 4
      system/Widget/widgets/Roster/Roster.php
  6. 71
      system/Widget/widgets/Roster/roster.css
  7. 25
      themes/movim/css/forms.css
  8. 56
      themes/movim/css/posts.css
  9. 92
      themes/movim/css/style2.css
  10. 2
      themes/movim/main.tpl

76
system/Widget/WidgetCommon.php

@ -16,7 +16,7 @@
*/
class WidgetCommon extends WidgetBase {
protected function printPost($post, $comments) {
protected function printPost($post, $comments = false) {
if($post->title)
$title = '
<span>
@ -31,53 +31,51 @@ class WidgetCommon extends WidgetBase {
$access .= 'protect orange';
}
if($post->public != 2) {
if($post->public == 2) {
$class .= ' folded';
$fold = t('Unfold');
$avatar = $post->getContact()->getPhoto('xs');
} else {
$fold = t('Fold');
$avatar = $post->getContact()->getPhoto('m');
}
if($post->jid != $post->uri)
$recycle .= '
<span class="recycle">
<a href="?q=friend&f='.$post->uri.'">'.$post->uri.'</a>
</span>';
if($post->jid != $post->uri)
$recycle .= '
<span class="recycle">
<a href="?q=friend&f='.$post->uri.'">'.$post->uri.'</a>
</span>';
if($post->getPlace() != false)
$place .= '
<span class="place">
<a
target="_blank"
href="http://www.openstreetmap.org/?lat='.$post->lat.'&lon='.$post->lon.'&zoom=10"
>'.$post->getPlace().'</a>
</span>';
if($post->getPlace() != false)
$place .= '
<span class="place">
<a
target="_blank"
href="http://www.openstreetmap.org/?lat='.$post->lat.'&lon='.$post->lon.'&zoom=10"
>'.$post->getPlace().'</a>
</span>';
$content =
prepareString(html_entity_decode($post->content));
if($post->commentplace)
$comments = $this->printComments($post, $comments);
else
$comments = '';
$fold = t('Fold');
} else {
$content = '…';
$content =
prepareString(html_entity_decode($post->content));
if($post->commentplace && $post->commentson)
$comments = $this->printComments($post, $comments);
else
$comments = '';
$fold = t('Unfold');
}
$html = '
<div class="post '.$class.'" id="'.$post->nodeid.'">
<a href="?q=friend&amp;f='.$post->jid.'">
<img class="avatar" src="'.$post->getContact()->getPhoto('m').'">
<img class="avatar" src="'.$avatar.'">
</a>
<div class="postmenu">
<a
href=""
onclick="'.$this->genCallAjax('ajaxPostFold', "'".$post->nodeid."'").'">'.$fold.'</a>
</div>
<div id="'.$post->nodeid.'" class="postbubble '.$access.'">
'.$title.'
<span class="title">'.$title.'</span>
<span class="fold">
<a
href=""
onclick="'.$this->genCallAjax('ajaxPostFold', "'".$post->nodeid."'").'">'.$fold.'</a>
</span>
<span>
<a href="?q=friend&amp;f='.$post->jid.'">'.$post->getContact()->getTrueName().'</a>
</span>
@ -160,8 +158,8 @@ class WidgetCommon extends WidgetBase {
* @return generated HTML
*/
protected function preparePosts($posts) {
if($posts == false) {
$html = false;
if($posts == false || empty($posts)) {
$html = '<div style="padding: 1.5em; text-align: center;">Ain\'t Nobody Here But Us Chickens...</div>';
} else {
$html = '';

180
system/Widget/widgets/Bookmark/Bookmark.php

@ -0,0 +1,180 @@
<?php
/**
* @package Widgets
*
* @file Wall.php
* This file is part of MOVIM.
*
* @brief The configuration form
*
* @author Timothée Jaussoin <edhelas_at_gmail_dot_com>
*
* @version 1.0
* @date 28 October 2010
*
* Copyright (C)2010 MOVIM project
*
* See COPYING for licensing information.
*/
class Bookmark extends WidgetBase
{
function WidgetLoad()
{
/*$this->addcss('config.css');
$this->addjs('color/jscolor.js');*/
$this->registerEvent('bookmark', 'onBookmark');
}
function onBookmark($arr)
{
Cache::c('bookmark', $arr);
}
function ajaxGetBookmark()
{
$b = new moxl\BookmarkGet();
$b->request();
}
function ajaxSetBookmark()
{
$b = new moxl\BookmarkSet();
/*$arr = array();
array_push($arr,
array(
'type' => 'conference',
'name' => 'Movim',
'autojoin' => '1',
'jid' => 'movim@conference.movim.eu',
'nick' => 'edhelas'));
array_push($arr,
array(
'type' => 'url',
'name' => 'HFR',
'url' => 'http://forum.hardware.fr'));
array_push($arr,
array(
'type' => 'url',
'name' => 'LeMonde',
'url' => 'http://www.lemonde.fr'));
array_push($arr,
array(
'type' => 'subscription',
'server' => 'pubsub.etu.univ-nantes.fr',
'node' => 'mlp',
'title' => 'My Little Pony'));*/
$arr = Cache::c('bookmark');
$b->setArr($arr)
->request();
}
function ajaxBookmarkAdd($form)
{
movim_log($form);
if(!filter_var($form['url'], FILTER_VALIDATE_URL)) {
$html = '<div class="message error">'.t('Bad URL').'</div>' ;
RPC::call('movim_fill', 'bookmarkadderror', RPC::cdata($html));
RPC::commit();
}
}
function prepareBookmark($bookmarks)
{
$html = '';
$url = '';
$conference = '';
$subscription = '';
foreach($bookmarks as $b) {
switch ($b['type']) {
case 'conference':
$conference .= '
<li>'.$b['name'].'</li>';
break;
case 'url':
$url .= '
<li>
<a target="_blank" href="'.$b['url'].'">'.
$b['name'].'
</a>
</li>';
break;
case 'subscription':
$subscription .= '
<li>
<a href="?q=node&s='.$b['server'].'&n='.$b['node'].'">'.
$b['title'].'
</a>
</li>';
break;
}
}
$html .= '
<h3>'.t('Groups').'</h3>
<ul>'.
$subscription.'
</ul>
<h3>'.t('Links').'</h3>
<ul>'.
$url.'
</ul>
<h3>'.t('Conferences').'</h3>
<ul>'.
$conference.'
</ul>';
$submit = $this->genCallAjax('ajaxBookmarkAdd', "movim_parse_form('bookmarkadd')");
$html .= '
<div class="popup">
<form name="bookmarkadd">
<fieldset>
<legend>'.t('Add a new URL').'</legend>
<div id="bookmarkadderror"></div>
<div class="element large mini">
<input name="url" placeholder="'.t('URL').'"/>
</div>
<div class="element large mini">
<input name="name" placeholder="'.t('Name').'"/>
</div>
</fieldset>
<a
class="button tiny icon yes black merged left"
onclick="'.$submit.'"
>'.
t('Add').'
</a><a
class="button tiny icon black merged right"
onclick="this.parentNode.parentNode.style.display = \'none\'"
>'.
t('Close').'
</a>
</form>
</div>
';
return $html;
}
function build()
{
$getbookmark = $this->genCallAjax("ajaxGetBookmark");
$setbookmark = $this->genCallAjax("ajaxSetBookmark");
?>
<h2><?php echo t('Bookmarks'); ?></h2>
<a class="button icon yes tiny"
onclick="<?php echo $getbookmark; ?>">Get</a>
<a class="button icon yes tiny"
onclick="<?php echo $setbookmark; ?>">Set</a>
<?php
echo $this->prepareBookmark(Cache::c('bookmark'));
}
}

2
system/Widget/widgets/Config/Config.php

@ -103,7 +103,7 @@ class Config extends WidgetBase
onclick="
document.querySelector('input[name=color]').value = '082D50';
document.body.style.backgroundColor = '#082D50';"
style="width: 25%; float: left; margin-top: 6px;"
style="width: 25%; float: left;"
class="button icon back">
<?php echo t('Reset');?>
</a>

25
system/Widget/widgets/Node/Node.php

@ -22,7 +22,7 @@ class Node extends WidgetCommon
{
function WidgetLoad()
{
$this->registerEvent('stream', 'onStream');
//$this->registerEvent('stream', 'onStream');
}
function onStream($id) {
@ -44,21 +44,24 @@ class Node extends WidgetCommon
function prepareGroup($serverid, $groupid) {
$title = '
<a href="?q=server&s='.$serverid.'">
'.$serverid.'
</a> >
<a href="?q=node&s='.$serverid.'&n='.$groupid.'">
'.$groupid.'
</a> >
'.t('Posts');
<div class="breadcrumb">
<a href="?q=server&s='.$serverid.'">
'.$serverid.'
</a>
<a href="?q=node&s='.$serverid.'&n='.$groupid.'">
'.$groupid.'
</a>
<a>
'.t('Posts').
'</a>
</div>';
$pd = new modl\PostDAO();
$posts = $pd->getGroup($serverid, $groupid);
$html = $title;
foreach($posts as $post) {
$html .= $this->printPost($post);
}
$html .= $this->preparePosts($posts);
return $html;
}

4
system/Widget/widgets/Roster/Roster.php

@ -315,7 +315,7 @@ class Roster extends WidgetBase
<input type="checkbox" id="addc"/>
<div class="tabbed">
<form id="addcontact">
<div class="element large">
<div class="element large mini">
<label for="addjid"><?php echo t('JID'); ?></label>
<input
id="addjid"
@ -325,7 +325,7 @@ class Roster extends WidgetBase
onblur="myBlur(this);"
/>
</div>
<div class="element large">
<div class="element large mini">
<label for="addalias"><?php echo t('Alias'); ?></label>
<input
id="addalias"

71
system/Widget/widgets/Roster/roster.css

@ -233,74 +233,3 @@
#rostermenu li:last-child {
float: right;
}
/*
#roster li#search:hover > a {
display: none;
}
#roster li#search:hover {
width: 100%;
}
#roster li#search:hover > input {
display: block;
}*/
/*
#roster #rostermenu {
border-top: 1px solid #222;
border-left: 1px solid #111;
position: fixed;
bottom: 0;
right: 0;
width: 199px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.5);
color: black;
background-color: white;
}
#roster #rostermenu li, #roster #rostermenu li a {
margin: 0px;
border: 0px;
padding: 0px;
width: auto;
}
#roster #rostermenu #request {
line-height: 24px;
height: 24px;
padding: 0px 6px;
border: 0px;
width: 120px;
background-color: white;
}
#roster #rostermenu li {
display: inline-block;
line-height: 22px;
border-left: 1px solid #111;
padding: 0 8px;
height: 24px;
background-color: #ddd;
}
#roster #rostermenu li:last-child {
padding: 0px;
}
#roster #rostermenu li:hover, #roster #rostermenu li:hover a {
background-color: transparent;
cursor: pointer;
}
#roster #rostermenu #addcontact {
padding: 5px;
border-bottom: 1px solid #888;
display: none;
background-color: #EFEFEF;
}
#roster #rostermenu #addcontact .element {
min-height: 0px;
}
*/

25
themes/movim/css/forms.css

@ -6,7 +6,7 @@ form * {
fieldset {
border: none;
margin-top: 20px;
margin-bottom: 2em !important;
}
legend {
@ -17,7 +17,7 @@ legend {
display: block;
width: 51%;
border-bottom: 1px solid rgb(220, 220, 220) !important;
line-height: 2em !important;
line-height: 2.5em !important;
}
.element {
@ -36,21 +36,32 @@ legend {
width: 25%;
}
.element.mini {
min-height: 0px;
}
.element.mini > input {
min-height: 1.7em;
}
.element > label {
display: block;
margin: 8px 0px;
}
.element > *:not(label):not(img):not(span):not(a) {
display: block;
width: 96%;
display: inline-block;
width: 100%;
border: 1px solid #999;
min-height: 30px;
border-radius: 2px;
background-color: white;
box-shadow: inset 0 2px 1px #ddd;
margin: 5px 0px;
margin-right: 5px;
padding-left: 5px;
padding: 0% 2%;
box-sizing: border-box;
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
}
.element > *:not(label):not(img):focus {
@ -220,7 +231,7 @@ form .element.simple > *:not(label):not(img):focus {
.element .checkbox label[for=checkbox] {
display: block;
width: 48px;
width: 38px;
height: 30px;
cursor: pointer;

56
themes/movim/css/posts.css

@ -24,18 +24,6 @@
clear: both;
}
.post .postmenu {
display: block;
clear: left;
float: left;
width: 50px;
margin-right: 15px;
margin-top: 7px;
margin-left: 0px;
text-align: center;
}
.post:first-child {
padding-top: 1.5em;
}
@ -82,6 +70,21 @@
display: inline-block;
}
.post span.title {
padding-left: 0px;
max-width: 80%;
display: block;
float: left;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.post span.fold {
float: right;
margin-right: 1.5em;
}
.post span a:hover {
text-decoration: underline;
}
@ -318,3 +321,32 @@
cursor: pointer;
text-decoration: underline;
}
.post.folded > .postbubble {
border: 0px;
background-color: transparent;
box-shadow: 0px 0px 0px;
padding: 0px;
}
.post.folded {
padding-bottom: 0em;
}
.post.folded > .postbubble:before {
display: none;
}
.post.folded .avatar {
width: 24px;
height: 24px;
margin-left: 12px;
margin-top: 8px;
}
.post.folded > .postbubble > .content,
.post.folded > .postbubble > .place,
.post.folded > .postbubble > .recycle,
.post.folded > .postbubble > .comments {
display: none;
}

92
themes/movim/css/style2.css

@ -191,13 +191,16 @@ h2:first-child {
}
h2 {
color: #888;
padding: 0.8em 0px;
font-size: 1.2em;
color: #777;
margin: 0.5em 0px;
margin-top: 1em;
padding: 0.3em 0px;
font-size: 1.15em;
border-bottom: 1px solid #CCC;
}
h3 {
color: #8C8C8C;
color: #777;
font-size: 1.1em;
padding: 0.3em 0px;
}
@ -349,6 +352,10 @@ ul.clean li {
padding-top: 60px;
}
#left ul {
list-style-type: none;
}
#center
{
float: right;
@ -437,7 +444,7 @@ ul.clean li {
.menu li a.disconnect{
position: fixed;
top: 3px;
right: 0px;
right: 10px;
}
.menu li a.active {
@ -618,3 +625,78 @@ ul.list li a {
padding: 0.7em;
display: block;
}
/* Breadcrumb */
.breadcrumb {
background-color: #F5F5F5;
padding: 10px 5px;
}
.breadcrumb > a {
display: inline-block;
line-height: 30px;
padding-left: 30px;
padding-right: 15px;
position: relative;
overflow: hidden;
}
.breadcrumb > a:first-child {
padding-left: 1.5em;
}
.breadcrumb > a:not(:first-child):after {
display: block;
width: 20px;
height: 20px;
position: absolute;
top: 5px;
left: -10px;
content: "";
border-right: 1px solid rgba(0, 0, 0, 0.2);
border-top: 1px solid rgba(0, 0, 0, 0.2);
transform: rotate(45deg);
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
}
/* Popup */
.popup {
background-color: rgba(0, 0, 0, 0.9);
position: fixed;
top: 0px;
left: 0px;
z-index: 5;
width: 50%;
height: 80%;
padding: 10% 25%;
}
.popup legend {
color: white;
font-size: 1.3em !important;
border: 0px !important;
text-shadow: 0px -1px 0px black;
}
/*
.popup .close {
position: fixed;
top: 10px;
right: 10px;
color: #CCC;
background-color: black;
padding: 5px;
font-family: sans-serif;
font-weight: bold;
width: 10px;
height: 10px;
line-height: 10px;
border-radius: 20px;
text-align: center;
border: 1px solid #777;
}
.popup .close:hover {
cursor: pointer;
}*/

2
themes/movim/main.tpl

@ -11,6 +11,7 @@
<div id="main">
<div id="left">
<?php $this->widget('Bookmark');?>
<?php $this->widget('ProfileData');?>
</div>
<div id="center" class="protect orange">
@ -22,4 +23,3 @@
<div id="right">
<?php $this->widget('Roster');?>
</div>
Loading…
Cancel
Save