Browse Source

- Comment some stuff in Chat

- Add author box in post
- Fix mud
pull/16/head
Jaussoin Timothée 12 years ago
parent
commit
b7a82dc178
  1. 19
      app/models/postn/Postn.php
  2. 5
      app/models/postn/PostnDAO.php
  3. 8
      app/widgets/Chat/_chat_contact.tpl
  4. 15
      app/widgets/Config/Config.php
  5. 2
      app/widgets/Roster/Roster.php
  6. 24
      app/widgets/WidgetCommon/WidgetCommon.php
  7. 1
      app/widgets/WidgetCommon/_post.tpl
  8. 9
      mud.php
  9. 20
      themes/movim/css/posts.css

19
app/models/postn/Postn.php

@ -11,6 +11,7 @@ class Postn extends ModlModel {
public $aname; // author name
public $aid; // author id
public $aemail; // author email
public $title; //
public $content; // the content
@ -49,6 +50,8 @@ class Postn extends ModlModel {
{"type":"string", "size":128 },
"aid" :
{"type":"string", "size":128 },
"aemail" :
{"type":"string", "size":64 },
"title" :
{"type":"text" },
"content" :
@ -98,10 +101,13 @@ class Postn extends ModlModel {
if($entry->entry->id)
$this->nodeid = (string)$entry->entry->id;
// Get some informations on the author
if($entry->entry->author->name)
$this->aname = (string)$entry->entry->author->name;
if($entry->entry->author->uri)
$this->aid = substr((string)$entry->entry->author->uri, 5);
if($entry->entry->author->email)
$this->aemail = (string)$entry->entry->author->email;
// Non standard support
if($entry->entry->source && $entry->entry->source->author->name)
@ -150,12 +156,19 @@ class Postn extends ModlModel {
$contentimg = $this->setAttachements($entry->entry->link);
// Tags parsing
if($entry->entry->category) {
$this->tags = array();
foreach($entry->entry->category as $cat)
array_push($this->tags, (string)$cat->attributes()->term);
if($entry->entry->category->count() == 1
&& isset($entry->entry->category->attributes()->term))
array_push($this->tags, (string)$entry->entry->category->attributes()->term);
else
foreach($entry->entry->category as $cat)
array_push($this->tags, (string)$cat->attributes()->term);
}
if(!empty($this->tags))
$this->tags = serialize($this->tags);

5
app/models/postn/PostnDAO.php

@ -8,6 +8,7 @@ class PostnDAO extends ModlSQL {
update postn
set aname = :aname,
aid = :aid,
aemail = :aemail,
title = :title,
content = :content,
@ -36,6 +37,7 @@ class PostnDAO extends ModlSQL {
array(
'aname' => $post->aname,
'aid' => $post->aid,
'aemail' => $post->aemail,
'title' => $post->title,
'content' => $post->content,
@ -75,6 +77,7 @@ class PostnDAO extends ModlSQL {
aname,
aid,
aemail,
title,
content,
@ -101,6 +104,7 @@ class PostnDAO extends ModlSQL {
:aname,
:aid,
:aemail,
:title,
:content,
@ -125,6 +129,7 @@ class PostnDAO extends ModlSQL {
array(
'aname' => $post->aname,
'aid' => $post->aid,
'aemail' => $post->aemail,
'title' => $post->title,
'content' => $post->content,

8
app/widgets/Chat/_chat_contact.tpl

@ -24,23 +24,23 @@
state = 0;
{$send}
return false;
} else {
}/* else {
if(state == 0 || state == 2) {
state = 1;
{$composing}
since = new Date().getTime();
}
}
}*/
"
onkeyup="
movim_textarea_autoheight(this);
setTimeout(function()
/*setTimeout(function()
{
if(state == 1 && since+5000 < new Date().getTime()) {
state = 2;
{$paused}
}
},5000);
},5000); */
"
></textarea>
</div>

15
app/widgets/Config/Config.php

@ -24,18 +24,18 @@ class Config extends WidgetBase
{
$this->addjs('color/jscolor.js');
$this->registerEvent('config', 'onConfig');
/* We load the user configuration */
$this->view->assign('languages', load_lang_array());
$this->view->assign('me', $this->user->getLogin());
$this->view->assign('conf', $this->user->getConfig('language'));
$this->view->assign('color', $this->user->getConfig('color'));
$this->view->assign('size', $this->user->getConfig('size'));
if($this->user->getConfig('chatbox') == 1)
$this->view->assign('chatbox', 'checked="true"');
if($this->user->getConfig('chatbox'))
$this->view->assign('chatbox', 'checked');
else
$this->view->assign('chatbox', 'checked="false"');
$this->view->assign('chatbox', '');
$this->view->assign('submit',
$this->genCallAjax(
@ -43,10 +43,6 @@ class Config extends WidgetBase
"movim_parse_form('general')"
)
. "this.className='button icon color orange loading';
setTimeout(
function() {
location.reload(false)}, 2000
);
this.onclick=null;"
);
}
@ -54,6 +50,7 @@ class Config extends WidgetBase
function onConfig(array $data)
{
$this->user->setConfig($data);
RPC::call('movim_reload_this');
Notification::appendNotification(t('Configuration updated'));
}

2
app/widgets/Roster/Roster.php

@ -34,7 +34,7 @@ class Roster extends WidgetBase
$this->view->assign('offline_shown', '');
$offline_state = Cache::c('offlineshown');
$bool = Cache::c('rostershow');
if($bool)
$this->view->assign('roster_show', 'hide');

24
app/widgets/WidgetCommon/WidgetCommon.php

@ -102,6 +102,8 @@ class WidgetCommon extends WidgetBase {
} else
$enc = '';
$author = $this->prepareAuthor($post);
$content = prepareString(html_entity_decode($post->content));
if($post->node == 'urn:xmpp:microblog:0')
@ -138,6 +140,8 @@ class WidgetCommon extends WidgetBase {
$view->assign('recycle', $recycle);
$view->assign('group', $group);
$view->assign('author', $author);
$html = $view->draw('_post', true);
return $html;
@ -186,6 +190,26 @@ class WidgetCommon extends WidgetBase {
return $enc;
}
private function prepareAuthor($post) {
$html = $content = '';
if($post->aname != null) {
$content .= ' <span>'.t('by').'</span> '.$post->aname;
}
if($post->aemail != null) {
$content .= ' <span>'.t('email').'</span> '.$post->aemail;
}
if($post->aid != null) {
$content .= ' <span>'.t('jid').'</span> '.$post->aid;
}
if($content .= '')
$html .= '<div class="author">'.$content.'</div>';
return $html;
}
private function getToolbox($post) {
$view = $this->loadTemplate();

1
app/widgets/WidgetCommon/_post.tpl

@ -17,6 +17,7 @@
{$content}<br />
</div>
{$tags}
{$author}
{$toolbox}
{$enc}
{$comments}

9
mud.php

@ -1,9 +1,10 @@
#!/usr/bin/php
<?php
define('DOCUMENT_ROOT', dirname(__FILE__));
require_once(DOCUMENT_ROOT.'/bootstrap.php');
require('loader.php');
//var_dump($argv);
$bootstrap = new Bootstrap();
$bootstrap->boot();
$argsize = count($argv);
if($argsize == 1) {
@ -31,7 +32,7 @@ Here some requests you can do with me :
function comploc() {
echo "Locales compiler\n";
$folder = 'cache/locales/';
$folder = DOCUMENT_ROOT.'/cache/locales/';
if(!file_exists($folder)) {
$bool = mkdir($folder);

20
themes/movim/css/posts.css

@ -64,6 +64,7 @@
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
clear: both;
}
.post .header span {
@ -98,6 +99,8 @@
padding: 0.5em 1em;
position: relative;
border-radius: 0.2em;
float: left;
margin-bottom: 0.5em;
}
.post span.tag:first-child {
@ -143,6 +146,7 @@
.post .comments {
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
clear: both;
}
.post .comments:hover {
@ -197,6 +201,21 @@
margin-bottom: 0.5em;
}
.post .author {
float: right;
font-weight: normal;
background-color: #4C5A61;
color: white;
font-size: 0.8em;
padding: 0.5em 1em;
border-radius: 0.2em;
margin-bottom: 0.5em;
}
.post .author span {
font-weight: bold;
}
.post .content i, .post .content em { font-style: italic; }
.post .content b, .post .content strong { font-weight: bold; }
.post .content u, .post .content a { text-decoration: underline; }
@ -307,6 +326,7 @@
padding: 0.5em 1em;
position: relative;
line-height: 1.5em;
clear: both;
}
.post .tools a:hover {

Loading…
Cancel
Save