Browse Source

- Fix the chat CSS (horizontal scroll when multiple chat openened)

- Add a new template in the Node widget + historic
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
ae4f6ec3a8
  1. 17
      app/widgets/Chat/chat.css
  2. 1
      app/widgets/Chat/chat.tpl
  3. 185
      app/widgets/Node/Node.php
  4. 119
      app/widgets/Node/_node_content.tpl

17
app/widgets/Chat/chat.css

@ -1,17 +1,32 @@
#chats {
position: fixed;
bottom: -2px;
right: 200px;
left: 0;
padding-right: 0.5em;
z-index: 3;
overflow-x: auto;
white-space: nowrap;
overflow-y: hidden;
max-width: 100%;
pointer-events: none;
}
#chats .filler {
width: 210px;
height: 0;
background-color: red;
display: inline-block;
}
#chats .chat {
white-space: normal;
display: inline-block;
position: relative;
bottom: 0;
overflow: hidden;
margin-left: 0.5em;
pointer-events: auto;
box-shadow: 0 0 0.5em rgba(0, 0, 0, 0.4);
}
#chats .chat .panel {

1
app/widgets/Chat/chat.tpl

@ -5,4 +5,5 @@
var paused = new Date().getTime();
</script>
{$chats}
<div class="filler"></div>
</div>

185
app/widgets/Node/Node.php

@ -21,6 +21,7 @@
class Node extends WidgetCommon
{
private $role;
private $_feedsize = 10;
function WidgetLoad()
{
@ -77,7 +78,6 @@ class Node extends WidgetCommon
$metadataview->assign('creator', $params[0]['creator']);
$html = $metadataview->draw('_node_metadata', true);
RPC::call('movim_fill', 'metadata', $html);
}
@ -150,149 +150,70 @@ class Node extends WidgetCommon
$title = $node->getName();
else
$title = $groupid;
$nodeview = $this->tpl();
$nodeview->assign('title', $title);
$nodeview->assign('serverid', $serverid);
$nodeview->assign('groupid', $groupid);
$nodeview->assign('subscribed', $this->searchSubscription($serverid, $groupid));
if($this->searchSubscription($serverid, $groupid))
$button = '
<a
href="#"
class="button color icon back"
onclick="movim_toggle_display(\'#groupunsubscribe\')">
'.t('Unsubscribe').'
</a>';
else
$button = '
<a
href="#"
class="button color green icon next"
onclick="movim_toggle_display(\'#groupsubscribe\')">
'.t('Subscribe').'
</a>';
$nodeview->assign('role', $this->role);
$nodeview->assign('refresh', $this->genCallAjax('ajaxGetItems', "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('getsubscription',$this->genCallAjax('ajaxGetSubscriptions', "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('subscribe', $this->genCallAjax('ajaxSubscribe', "movim_parse_form('groupsubscribe')", "'".$serverid."'", "'".$groupid."'"));
$nodeview->assign('unsubscribe', $this->genCallAjax('ajaxUnsubscribe', "'".$serverid."'", "'".$groupid."'"));
$html = '
<div class="breadcrumb">
<a href="'.Route::urlize('explore').'">
'.t('Explore').'
</a>
<a href="'.Route::urlize('server', $serverid).'">
'.$serverid.'
</a>
<a href="'.Route::urlize('node', array($serverid, $groupid)).'">
'.$title.'
</a>
<a>'.t('Posts').'</a>
</div>
<div class="clear"></div>
<div class="posthead">
'.$button.'
<a
class="button color icon blog merged left"
href="'.Route::urlize('blog',array($serverid,$groupid)).'"
target="_blank"
>
'.t('Blog').'
</a><a
class="button color orange icon alone feed merged right"
href="'.Route::urlize('feed',array($serverid,$groupid)).'"
target="_blank"
></a>
<a
href="#"
onclick="'.$this->genCallAjax('ajaxGetItems', "'".$serverid."'", "'".$groupid."'").'
this.className=\'button icon color alone orange loading\'; this.onclick=null;"
class="button color blue icon alone refresh">
</a>
<a
class="button color icon yes"
onclick="
'.$this->genCallAjax('ajaxGetSubscriptions', "'".$serverid."'", "'".$groupid."'").'"
>'.t('Get Subscription').'</a>';
if($this->searchSubscription($serverid, $groupid)
&& ($this->role == 'owner' || $this->role == 'publisher'))
$submitform = $this->prepareSubmitForm($serverid, $groupid);
else
$submitform = '';
if($this->role == 'owner') {
$html .= '
<a
class="button color icon user"
style="float: right;"
href="'.Route::urlize('nodeconfig', array($serverid,$groupid)).'"
>'.t('Configuration').'</a>';
}
$nodeview->assign('submitform', $submitform);
$html .= '
</div>
$nodeview->assign('posts', $this->preparePostsNode($serverid, $groupid, -1));
<div class="metadata" id="metadata">
$html = $nodeview->draw('_node_content', true);
return $html;
}
</div>
function prepareNext($start, $html = '', $posts, $function = 'ajaxGetPostsNode', $serverid, $groupid) {
$next = $start + $this->_feedsize;
$nexthtml = '';
<div class="popup" id="groupsubscribe">
<form name="groupsubscribe">
<fieldset>
<legend>'.t('Subscribe').'</legend>
<div class="element">
<label>'.t('Make your membership to this group public to your friends').'</label>
<div class="checkbox">
<input type="checkbox" name="listgroup" id="listgroup"/>
<label for="listgroup"></label>
</div>
</div>
<div class="element">
<label for="grouptitle">'.t('Give a nickname to this group if you want').'</label>
<input type="text" name="title" value="'.$groupid.'" id="grouptitle"/>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
'.$this->genCallAjax('ajaxSubscribe', "movim_parse_form('groupsubscribe')", "'".$serverid."'", "'".$groupid."'").'
this.onclick=null;"
>'.t('Subscribe').'</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display(\'#groupsubscribe\');"
>'.t('Close').'</a>
</div>
</form>
</div>
<div class="popup" id="groupunsubscribe">
<form name="groupunsubscribe">
<fieldset>
<legend>'.t('Unsubscribe').'</legend>
<div class="element">
<label>'.t('Are you sure ?').'</label>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
'.$this->genCallAjax('ajaxUnsubscribe', "'".$serverid."'", "'".$groupid."'").'
this.onclick=null;"
>'.t('Unsubscribe').'</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display(\'#groupunsubscribe\');"
>'.t('Close').'</a>
if(sizeof($posts) > $this->_feedsize-1 && $html != '') {
$nexthtml = '
<div class="post">
<div
class="older"
onclick="'.$this->genCallAjax($function, "'".$serverid."'", "'".$groupid."'", "'".$next."'").'; this.parentNode.style.display = \'none\'">'.
t('Get older posts').'
</div>
</form>
</div>';
$title = '';
$pd = new modl\PostnDAO();
$posts = $pd->getNode($serverid, $groupid, 0, 20);
$html .= $title;
if($this->searchSubscription($serverid, $groupid)
&& ($this->role == 'owner' || $this->role == 'publisher'))
$html .= $this->prepareSubmitForm($serverid, $groupid);
</div>';
}
$html .= $this->preparePosts($posts);
return $nexthtml;
}
function preparePostsNode($serverid, $groupid, $start) {
$pd = new \modl\PostnDAO();
$pl = $pd->getNode($serverid, $groupid, $start+1, $this->_feedsize);
$html = $this->preparePosts($pl);
$html .= $this->prepareNext($start, $html, $pl, 'ajaxGetPostsNode', $serverid, $groupid);
return $html;
}
function ajaxGetPostsNode($serverid, $groupid, $start) {
$html = $this->preparePostsNode($serverid, $groupid, $start);
RPC::call('movim_append', md5($serverid.$groupid), $html);
RPC::commit();
}
function searchSubscribed($server, $node) {
$c = Cache::c('bookmark');

119
app/widgets/Node/_node_content.tpl

@ -0,0 +1,119 @@
<div class="breadcrumb">
<a href="{$c->route('explore')}">
{$c->t('Explore')}
</a>
<a href="{$c->route('server', $serverid)}">
{$serverid}
</a>
<a href="{$c->route('node', array($serverid, $groupid))}">
{$title}
</a>
<a>{$c->t('Posts')}</a>
</div>
<div class="clear"></div>
<div class="posthead">
{if="$subscribed == true"}
<a
href="#"
class="button color icon back"
onclick="movim_toggle_display('#groupunsubscribe')">
{$c->t('Unsubscribe')}
</a>
{else}
<a
href="#"
class="button color green icon next"
onclick="movim_toggle_display('#groupsubscribe')">
{$c->t('Subscribe')}
</a>
{/if}
<a
class="button color icon blog merged left"
href="{$c->route('blog',array($serverid,$groupid))}"
target="_blank"
>
{$c->t('Blog')}
</a><a
class="button color orange icon alone feed merged right"
href="{$c->route('feed',array($serverid,$groupid))}"
target="_blank"
></a>
<a
href="#"
onclick="{$refresh}
this.className='button icon color alone orange loading'; this.onclick=null;"
class="button color blue icon alone refresh"></a>
<a
class="button color icon yes"
onclick="{$getsubscription}"
>{$c->t('Get Subscription')}</a>
{if="$role == 'owner'"}
<a
class="button color icon user"
style="float: right;"
href="{$c->route('nodeconfig', array($serverid,$groupid))}"
>{$c->t('Configuration')}</a>
{/if}
</div>
<div class="metadata" id="metadata">
</div>
<div class="popup" id="groupsubscribe">
<form name="groupsubscribe">
<fieldset>
<legend>{$c->t('Subscribe')}</legend>
<div class="element">
<label>{$c->t('Make your membership to this group public to your friends')}</label>
<div class="checkbox">
<input type="checkbox" name="listgroup" id="listgroup"/>
<label for="listgroup"></label>
</div>
</div>
<div class="element">
<label for="grouptitle">{$c->t('Give a nickname to this group if you want')}</label>
<input type="text" name="title" value="{$groupid}" id="grouptitle"/>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
{$subscribe}
this.onclick=null;"
>{$c->t('Subscribe')}</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display('#groupsubscribe');"
>{$c->t('Close')}</a>
</div>
</form>
</div>
<div class="popup" id="groupunsubscribe">
<form name="groupunsubscribe">
<fieldset>
<legend>{$c->t('Unsubscribe')}</legend>
<div class="element">
<label>{$c->t('Are you sure ?')}</label>
</div>
</fieldset>
<div class="menu">
<a
class="button tiny icon yes black merged left"
onclick="
{$unsubscribe}
this.onclick=null;"
>{$c->t('Unsubscribe')}</a><a
class="button tiny icon no black merged right"
onclick="
movim_toggle_display('#groupunsubscribe');"
>{$c->t('Close')}</a>
</div>
</form>
</div>
{$submitform}
{$posts}
Loading…
Cancel
Save