Browse Source

- Add SubmitForm in Node widget

- Start cleanning old Microblog and Group methods => Pubsub methods
pull/16/head
Jaussoin Timothée 13 years ago
parent
commit
52eeab7f8c
  1. 63
      system/Widget/WidgetCommon.php
  2. 55
      system/Widget/widgets/Feed/Feed.php
  3. 84
      system/Widget/widgets/Feed/feed.css
  4. 28
      system/Widget/widgets/Feed/feed.js
  5. 3
      system/Widget/widgets/Node/Node.php
  6. 2
      system/Widget/widgets/Vcard/Vcard.php
  7. 33
      system/js/movim.js
  8. 2
      themes/movim/css/style2.css
  9. 83
      themes/movim/css/submitform.css
  10. 1
      themes/movim/page.tpl

63
system/Widget/WidgetCommon.php

@ -489,6 +489,57 @@ class WidgetCommon extends WidgetBase {
return $tmp;
}
protected function prepareSubmitForm($server = '', $node = '') {
$html = '
<table id="feedsubmitform">
<tbody>
<tr>
<td>
<textarea
placeholder="'.t("What's new ?").'"
id="feedmessagecontent"
class="steditor"
onkeyup="movim_textarea_autoheight(this);"></textarea>
</td>
</tr>
<script type="text/javascript">
var ste = new SimpleTextEditor("feedmessagecontent", "ste");
ste.init();
</script>
<tr id="feedsubmitrow">
<td>
<a
title="Plus"
href="#"
onclick="frameHeight(this);"
style="float: left;"
class="button tiny icon add merged left">'.t("Size").'
</a>
<a
title="Rich"
href="#"
onclick="richText(this);"
style="float: left;"
class="button tiny icon yes merged right">'.t("Rich Text").'
</a>
<a
title="'.t("Submit").'"
href="#"
id="feedmessagesubmit"
onclick="ste.submit();'.$this->genCallAjax('ajaxPublishItem', "'".$server."'", "'".$node."'",'getFeedMessage()').'; ste.clearContent();"
class="button tiny icon submit">'.t("Submit").'
</a>
</td>
</tr>
</tbody>
</table>';
return $html;
}
function onComment($parent) {
$p = new \modl\ContactPostn();
$p->nodeid = $parent;
@ -531,6 +582,18 @@ class WidgetCommon extends WidgetBase {
->request();
}
function ajaxPublishItem($server, $node, $content)
{
if($content != '') {
$p = new moxl\PubsubPostPublish();
$p->setFrom($this->user->getLogin())
->setTo($server)
->setNode($node)
->setContent(htmlspecialchars(rawurldecode($content)))
->request();
}
}
function ajaxPublishComment($to, $id, $content) {
if($content != '') {
$p = new moxl\MicroblogCommentPublish();

55
system/Widget/widgets/Feed/Feed.php

@ -113,50 +113,7 @@ class Feed extends WidgetCommon {
$this->genCallAjax('ajaxCreateCommentNode', 'parentid[0]').
'}
</script>
<table id="feedsubmitform">
<tbody>
<tr>
<td>
<textarea
placeholder="'.t("What's new ?").'"
id="feedmessagecontent"
class="steditor"
onkeyup="movim_textarea_autoheight(this);"></textarea>
</td>
</tr>
<script type="text/javascript">
var ste = new SimpleTextEditor("feedmessagecontent", "ste");
ste.init();
</script>
<tr id="feedsubmitrow">
<td>
<a
title="Plus"
href="#"
onclick="frameHeight(this);"
style="float: left;"
class="button tiny icon add merged left">'.t("Size").'
</a>
<a
title="Rich"
href="#"
onclick="richText(this);"
style="float: left;"
class="button tiny icon yes merged right">'.t("Rich Text").'
</a>
<a
title="'.t("Submit").'"
href="#"
id="feedmessagesubmit"
onclick="ste.submit();'.$this->genCallAjax('ajaxPublishItem', 'getFeedMessage()').'; ste.clearContent();"
class="button tiny icon submit">'.t("Submit").'
</a>
</td>
</tr>
</tbody>
</table>
'.$this->prepareSubmitForm($this->user->getLogin(), 'urn:xmpp:microblog:0').'
<div id="feednotifs"></div>';
}
@ -209,16 +166,6 @@ class Feed extends WidgetCommon {
RPC::commit();
}
function ajaxPublishItem($content)
{
if($content != '') {
$p = new moxl\MicroblogPostPublish();
$p->setFrom($this->user->getLogin())
->setContent(htmlspecialchars(rawurldecode($content)))
->request();
}
}
function ajaxCreateNode()
{
$p = new moxl\MicroblogCreateNode();

84
system/Widget/widgets/Feed/feed.css

@ -1,85 +1 @@
/* MAIN FEED STYLE */
#feed table#feedsubmitform {
display: block;
border: 1px solid;
border-color: #999999 #BBBBBB #BBBBBB;
margin: 18px;
overflow: hidden;
}
#feed #feedsubmitform tbody, #feed #feedsubmitform tr, #feed #feedsubmitform td {
display: block;
}
#feed #feedsubmitform td {
padding: 5px;
}
#feed #feedsubmitform textarea {
width: 100%;
padding: 0px;
border: 0px;
height: 2em;
resize: none;
}
#feed #feedsubmitform #feedsubmitrow {
background-color: #EEE;
width: auto;
overflow: auto;
padding-bottom: 5px;
}
#feed #feedsubmitform #feedsubmitrow a {
float: right;
}
#feed #feedcontent {
clear: both;
/*padding-top: 1.5em;
background-color: rgb(245,245,245);
}
#feed #feedcontent .post:first-child {
padding-top: 0px;*/
}
#feed #feednotifs {
margin: 1em 1.5em 0em;
}
#feed #feedsubmitform .ste {
width: 100%;
margin: 0px;
padding: 0px;
}
#feed #feedsubmitform .button.merged.right {
margin-right: 5px;
}
#feed #feedsubmitform .button img {
margin: 0px;
padding: 0px;
margin-top: 2px;
width: auto;
height: auto;
}
#feed #feedsubmitform td.frame {
padding: 0px;
}
#feed #feedsubmitform .menueditor {
margin-bottom: 5px;
padding-bottom: 5px;
display: none;
}
#feed #feedhead {
}
iframe {
width: 100%;
}

28
system/Widget/widgets/Feed/feed.js

@ -19,31 +19,3 @@ function showPosts(n, me) {
tabs[i].className = '';
n.className = 'on';
}
function getFeedMessage() {
var text = document.querySelector('#feedmessagecontent');
message = text.value;
text.value = '';
text.blur();
return encodeURIComponent(message);
}
function frameHeight(n) {
if(n.className == 'button tiny icon add merged left') {
n.className = 'button tiny icon rm merged left';
document.querySelector('iframe#feedmessagecontent-frame').style.height = '400px';
} else {
n.className = 'button tiny icon add merged left';
document.querySelector('iframe#feedmessagecontent-frame').style.height = '50px';
}
}
function richText(n) {
if(n.className == 'button tiny icon yes merged right') {
n.className = 'button tiny icon no merged right';
document.querySelector('.menueditor').style.display = 'block';
} else {
n.className = 'button tiny icon yes merged right';
document.querySelector('.menueditor').style.display = 'none';
}
}

3
system/Widget/widgets/Node/Node.php

@ -179,6 +179,9 @@ class Node extends WidgetCommon
$posts = $pd->getGroup($serverid, $groupid);
$html .= $title;
if($this->searchSubscription($serverid, $groupid))
$html .= $this->prepareSubmitForm($serverid, $groupid);
$html .= $this->preparePosts($posts);

2
system/Widget/widgets/Vcard/Vcard.php

@ -334,7 +334,7 @@ class Vcard extends WidgetBase
function build()
{
?>
<div class="tabelem padded" title="<?php echo t('Edit my Profile'); ?>" id="vcard">
<div class="tabelem padded" style="padding-top: 0px;" title="<?php echo t('Edit my Profile'); ?>" id="vcard">
<?php
echo $this->prepareInfos();
?>

33
system/js/movim.js

@ -121,3 +121,36 @@ function movim_toggle_display(param) {
else
node.style.display = 'block';
}
/**
* Feed Javascript
*/
function getFeedMessage() {
var text = document.querySelector('#feedmessagecontent');
message = text.value;
text.value = '';
text.blur();
return encodeURIComponent(message);
}
function frameHeight(n) {
if(n.className == 'button tiny icon add merged left') {
n.className = 'button tiny icon rm merged left';
document.querySelector('iframe#feedmessagecontent-frame').style.height = '400px';
} else {
n.className = 'button tiny icon add merged left';
document.querySelector('iframe#feedmessagecontent-frame').style.height = '50px';
}
}
function richText(n) {
if(n.className == 'button tiny icon yes merged right') {
n.className = 'button tiny icon no merged right';
document.querySelector('.menueditor').style.display = 'block';
} else {
n.className = 'button tiny icon yes merged right';
document.querySelector('.menueditor').style.display = 'none';
}
}

2
themes/movim/css/style2.css

@ -147,7 +147,7 @@ hr {
h1 {
color: #183C67;
padding: 15px 20px 0px;
padding: 15px 20px;
font-size: 1.5em;
}

83
themes/movim/css/submitform.css

@ -0,0 +1,83 @@
/* MAIN FEED STYLE */
table#feedsubmitform {
display: block;
border: 1px solid;
border-color: #999999 #BBBBBB #BBBBBB;
margin: 1.5em;
margin-top: 0px;
overflow: hidden;
}
#feedsubmitform tbody, #feedsubmitform tr, #feedsubmitform td {
display: block;
}
#feedsubmitform td {
padding: 5px;
}
#feedsubmitform textarea {
width: 100%;
padding: 0px;
border: 0px;
height: 2em;
resize: none;
}
#feedsubmitform #feedsubmitrow {
background-color: #EEE;
width: auto;
overflow: auto;
padding-bottom: 5px;
}
#feedsubmitform #feedsubmitrow a {
float: right;
}
#feedcontent {
clear: both;
/*padding-top: 1.5em;
background-color: rgb(245,245,245);
}
#feedcontent .post:first-child {
padding-top: 0px;*/
}
#feednotifs {
margin: 1em 1.5em 0em;
}
#feedsubmitform .ste {
width: 100%;
margin: 0px;
padding: 0px;
}
#feedsubmitform .button.merged.right {
margin-right: 5px;
}
#feedsubmitform .button img {
margin: 0px;
padding: 0px;
margin-top: 2px;
width: auto;
height: auto;
}
#feedsubmitform td.frame {
padding: 0px;
}
#feedsubmitform .menueditor {
margin-bottom: 5px;
padding-bottom: 5px;
display: none;
}
iframe {
width: 100%;
}

1
themes/movim/page.tpl

@ -13,6 +13,7 @@
<?php
$this->addCss('css/animations.css');
$this->addCss('css/forms.css');
$this->addCss('css/submitform.css');
$this->addCss('css/posts.css');
$this->addCss('css/style2.css');

Loading…
Cancel
Save