Browse Source

- Clean old CSS

- Move addContact form from Notif widget to Roster
- More clean search bar/buttons for roster menu
- Hide Notifs widget by default
- Add date when Location is displayed
pull/16/head
Jaussoin Timothée 13 years ago
parent
commit
77606485ac
  1. 4
      system/Widget/widgets/Chat/Chat.php
  2. 3
      system/Widget/widgets/Chat/chat.css
  3. 2
      system/Widget/widgets/ContactInfo/ContactInfo.php
  4. 6
      system/Widget/widgets/Feed/Feed.php
  5. 67
      system/Widget/widgets/Notifs/Notifs.php
  6. 23
      system/Widget/widgets/Notifs/notifs.css
  7. 10
      system/Widget/widgets/Notifs/notifs.js
  8. 3
      system/Widget/widgets/ProfileData/ProfileData.php
  9. 72
      system/Widget/widgets/Roster/Roster.php
  10. 60
      system/Widget/widgets/Roster/roster.css
  11. 27
      system/js/steditor.js

4
system/Widget/widgets/Chat/Chat.php

@ -127,7 +127,7 @@ class Chat extends WidgetBase
$contact = RosterLink::run_query($query);
$contact = $contact[0];
if($contact->getData('chaton') == 1) {
if(in_array($contact->getData('chaton'), array(1, 2))) {
RPC::call('showComposing',
$contact->getData('jid'));
@ -145,7 +145,7 @@ class Chat extends WidgetBase
$contact = RosterLink::run_query($query);
$contact = $contact[0];
if($contact->getData('chaton') == 1) {
if(in_array($contact->getData('chaton'), array(1, 2))) {
RPC::call('showPaused',
$contact->getData('jid'));

3
system/Widget/widgets/Chat/chat.css

@ -153,7 +153,8 @@
overflow: auto;
background-color: white;
resize: none;
height: 1.1em;
height: 17px;
line-height: 17px;
}
#chats .chat .panel .text textarea:focus {

2
system/Widget/widgets/ContactInfo/ContactInfo.php

@ -72,6 +72,8 @@ class ContactInfo extends WidgetCommon
) {
$html .= '
<h2>'.t('Location').'</h2>';
$html .= prepareDate(strtotime($contact->loctimestamp->getval())).'<br /><br />';
if($contact->getPlace() != '')
$html .= $contact->getPlace().'<br /><br />';

6
system/Widget/widgets/Feed/Feed.php

@ -154,7 +154,7 @@ class Feed extends WidgetCommon {
title="'.t("Submit").'"
href="#"
id="feedmessagesubmit"
onclick="ste.submit();'.$this->genCallAjax('ajaxPublishItem', 'getFeedMessage()').'"
onclick="ste.submit();'.$this->genCallAjax('ajaxPublishItem', 'getFeedMessage()').'; ste.clearContent();"
class="button tiny icon submit">'.t("Submit").'
</a>
</td>
@ -179,13 +179,13 @@ class Feed extends WidgetCommon {
'Post`.`parentid' => '',
'Post`.`key' => $this->user->getLogin()))
->orderby('Post.updated', true)
->limit($start, '60');
->limit($start, '20');
$messages = Post::run_query($query);
// We ask for the HTML of all the posts
$html = $this->preparePosts($messages);
$next = $start + 60;
$next = $start + 20;
if(sizeof($messages) > 9 && $html != '') {
$html .= '<div class="post older" onclick="'.$this->genCallAjax('ajaxGetFeed', "'".$next."'").'; this.style.display = \'none\'">'.t('Get older posts').'</div>';

67
system/Widget/widgets/Notifs/Notifs.php

@ -37,8 +37,10 @@ class Notifs extends WidgetBase
$contact = $contact[0];
RPC::call('notification', $contact->getTrueName(), RPC::cdata($message->getData('body'), ENT_COMPAT, "UTF-8"));
RPC::commit();
if(is_object($contact)) {
RPC::call('notification', $contact->getTrueName(), RPC::cdata($message->getData('body'), ENT_COMPAT, "UTF-8"));
RPC::commit();
}
}
function prepareNotifs($from) {
@ -127,41 +129,32 @@ class Notifs extends WidgetBase
Cache::c('activenotifs', $notifs);
}
function ajaxAddContact($jid, $alias) {
$r = new moxl\RosterAddItem();
$r->setTo($jid)
->request();
$p = new moxl\PresenceSubscribe();
$p->setTo($jid)
->request();
}
function build() {
$notifs = Cache::c('activenotifs');
if($notifs == false)
$notifs = array();
$query = RosterLink::query()
/*$query = RosterLink::query()
->where(
array(
'key' => $this->user->getLogin(),
'jid!' => $this->user->getLogin(),
array(
'rostersubscription!' => 'none',
'rostersubscription!' => 'vcard',
'|rosterask' => 'subscribe')));
$contacts = RosterLink::run_query($query);
$contacts = RosterLink::run_query($query);*/
?>
<div id="notifs">
<span id="widgettitle">
<?php echo t('Contacts (%s)', sizeof($contacts)); ?> -
<a
<?php //echo t('Contacts (%s)', sizeof($contacts)); ?>
<!--<a
class=""
href="#"
id="addstart"
onclick="addJid(this);">
<?php echo t('Add'); ?>
</a>
</a>-->
</span>
<ul id="notifslist">
<?php
@ -170,46 +163,6 @@ class Notifs extends WidgetBase
echo $this->prepareNotifs($key);
}
?>
<li>
<form id="addcontact">
<div class="element large">
<label for="addjid"><?php echo t('JID'); ?></label>
<input
id="addjid"
class="tiny"
placeholder="user@server.tld"
onfocus="myFocus(this);"
onblur="myBlur(this);"
/>
</div>
<div class="element large">
<label for="addalias"><?php echo t('Alias'); ?></label>
<input
id="addalias"
type="text"
class="tiny"
placeholder="<?php echo t('Alias'); ?>"
onfocus="myFocus(this);"
onblur="myBlur(this);"
/>
</div>
<a
class="button tiny icon yes merged right"
href="#"
id="addvalidate"
onclick="<?php $this->callAjax("ajaxAddContact", "getAddJid()", "getAddAlias()"); ?> cancelAddJid();">
<?php echo t('Send request'); ?>
</a>
<a
class="button tiny icon no merged left"
href="#"
id="addrefuse"
onclick="cancelAddJid();">
<?php echo t('Cancel'); ?>
</a>
</form>
</li>
</ul>
</div>
<?php

23
system/Widget/widgets/Notifs/notifs.css

@ -1,7 +1,13 @@
#notifs {
padding-right: 5px;
clear: both;
border-bottom: 1px solid #888;
position: fixed;
top: 28px;
z-index: 3;
right: 0;
width: 200px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.3);
color: black;
background-color: #f0f0f0;
}
#notifs ul {
@ -9,15 +15,8 @@
overflow: hidden;
}
#notifs ul li:last-child {
border-bottom: 0px;
padding: 3px;
}
#notifs ul li {
padding-bottom: 5px;
border-top: 1px solid #CCC;
/*border-bottom: 1px solid #DDD;*/
font-size: 10px;
overflow: auto;
padding: 5px;
@ -32,14 +31,14 @@
margin-top: 5px;
}
#notifs #notifsalias, #notifs #labelnotifsalias/*, #notifs #addjid, #notifs #addalias*/ {
#notifs #notifsalias, #notifs #labelnotifsalias {
display: none;
}
#notifs #addcontact, #notifs #notifsvalidate/*, #notifs #addvalidate, #notifs #addrefuse*/ {
#notifs #addcontact, #notifs #notifsvalidate {
display: none;
}
#notifs .element {
min-height: 20px;
min-height: 0px;
}

10
system/Widget/widgets/Notifs/notifs.js

@ -10,21 +10,11 @@ function showAlias(n) {
}
function addJid(n) {
n.style.display = "none";
/* document.querySelector('#addvalidate').style.display = "block";
document.querySelector('#addrefuse').style.display = "block";
document.querySelector('#addalias').style.display = "block";
document.querySelector('#addjid').style.display = "block";*/
document.querySelector('#addcontact').style.display = "block";
}
function cancelAddJid() {
/* document.querySelector('#addvalidate').style.display = "none";
document.querySelector('#addrefuse').style.display = "none";
document.querySelector('#addalias').style.display = "none";
document.querySelector('#addjid').style.display = "none";*/
document.querySelector('#addcontact').style.display = "none";
document.querySelector('#addstart').style.display = "inline";
}
function getAlias() {

3
system/Widget/widgets/ProfileData/ProfileData.php

@ -93,7 +93,8 @@ class ProfileData extends WidgetBase
if($c) {
$c = $c[0];
$data = $c->getPlace();
$data = prepareDate(strtotime($c->loctimestamp->getval())).'<br /><br />';
$data .= $c->getPlace();
} else {
$data = '';
}

72
system/Widget/widgets/Roster/Roster.php

@ -114,10 +114,6 @@ class Roster extends WidgetBase
return $start.$middle.$end;
}
function stackGroup() {
}
function prepareRoster()
{
$query = RosterLink::query()->join('Presence',
@ -156,7 +152,8 @@ class Roster extends WidgetBase
$group = '';
if($contacts != false) {
$currentchat = '';
if($contacts[0][0]->getData('group') == '')
$html .= '<div><h1>'.t('Ungrouped').'</h1>';
else {
@ -178,18 +175,34 @@ class Roster extends WidgetBase
$html .= '<div><h1>'.$group.'</h1>';
}
if($c[0]->getData('chaton') > 0)
$currentchat .= $this->prepareRosterElement($c);
$html .= $this->prepareRosterElement($c);
array_push($duplicate, $c[0]->getData('jid'));
}
}
$html .= '</div>';
if($currentchat != '')
$html = '<div><h1>'.t('Active Chat').'</h1>'.$currentchat.'</div>'.$html;
} else {
$html .= '<script type="text/javascript">setTimeout(\''.$this->genCallAjax('ajaxRefreshRoster').'\', 1500);</script>';
}
return $html;
}
function ajaxAddContact($jid, $alias) {
$r = new moxl\RosterAddItem();
$r->setTo($jid)
->request();
$p = new moxl\PresenceSubscribe();
$p->setTo($jid)
->request();
}
function build()
{
@ -198,14 +211,55 @@ class Roster extends WidgetBase
<ul id="rosterlist">
<?php echo $this->prepareRoster(); ?>
</ul>
<div id="rostermenu">
<div id="rostermenu" class="menubar">
<form id="addcontact">
<div class="element large">
<label for="addjid"><?php echo t('JID'); ?></label>
<input
id="addjid"
class="tiny"
placeholder="user@server.tld"
onfocus="myFocus(this);"
onblur="myBlur(this);"
/>
</div>
<div class="element large">
<label for="addalias"><?php echo t('Alias'); ?></label>
<input
id="addalias"
type="text"
class="tiny"
placeholder="<?php echo t('Alias'); ?>"
onfocus="myFocus(this);"
onblur="myBlur(this);"
/>
</div>
<a
class="button tiny icon no merged left"
href="#"
id="addrefuse"
onclick="cancelAddJid();">
<?php echo t('Cancel'); ?>
</a>
<a
class="button tiny icon yes merged right"
href="#"
id="addvalidate"
onclick="<?php $this->callAjax("ajaxAddContact", "getAddJid()", "getAddAlias()"); ?> cancelAddJid();">
<?php echo t('Send request'); ?>
</a>
</form>
<ul>
<li>
<input type="text" name="search" id="request" autocomplete="off" onkeyup="rosterSearch(event);" onclick="focusContact();" placeholder="<?php echo t('Search');?>"/>
<li onclick="addJid(this)"; style="float: right;" title="<?php echo t('Add'); ?>">
<a href="#">+</a>
</li>
<li onclick="showRoster(this);" style="float: right; padding-right: 10px;" title="<?php echo t('Show/Hide'); ?>">
<li onclick="showRoster(this);" style="float: right;" title="<?php echo t('Show/Hide'); ?>">
<a href="#"></a>
</li>
<li>
<input type="text" name="search" id="request" autocomplete="off" onkeyup="rosterSearch(event);" onclick="focusContact();" placeholder="<?php echo t('Search');?>"/>
</li>
</ul>
</div>
<div class="config_button" onclick="<?php $this->callAjax('ajaxRefreshRoster');?>"></div>

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

@ -106,42 +106,60 @@
}
#roster #rostermenu {
border-top: 1px solid #888;
position: fixed;
bottom: 0;
right: 0;
background-color: #242424;
color: white;
height: 21px;
width: 200px;
box-shadow: 0px 0px 10px rgba(0,0,0,0.3);
color: black;
background-color: #f0f0f0;
}
/*
#roster #rostermenu a:link, #roster #rostermenu a:visited {
color: white;
line-height: 17px;
font-size: 11px;
#roster #rostermenu li, #roster #rostermenu li a {
margin: 0px;
padding: 0px;
width: auto;
}
*/
#roster #rostermenu ul li {
display: inline;
float: left;
#roster #rostermenu #request {
line-height: 24px;
height: 24px;
padding: 0px 5px;
width: 120px;
}
#roster #rostermenu ul li a {
color: white;
width: auto;
#roster #rostermenu li {
display: inline-block;
line-height: 22px;
border-left: 1px solid #AAA;
padding: 0 8px;
height: 24px;
background-color: #ddd;
}
#roster #rostermenu li:last-child {
border-left: none;
padding: 0px;
}
#roster #rostermenu li:hover, #roster #rostermenu li:hover a {
background-color: transparent;
color: black;
cursor: pointer;
}
#roster #rostermenu #addcontact {
padding: 5px;
border-bottom: 1px solid #888;
display: none;
}
#roster #request{
/*position: fixed;
bottom: 0px;
z-index: 3;
display: block;*/
#roster #rostermenu #addcontact .element {
min-height: 0px;
}
.focused{
#roster li.focused{
background-color: #B8C7DA;
}

27
system/js/steditor.js

@ -77,16 +77,14 @@ function SimpleTextEditor(id, objectId) {
var html = "";
html += '<input type="hidden" id="'+this.id+'" name="'+this.id+'" value="" autofocus="autofocus">';
html += '<table class="ste" cellspacing="0" cellpadding="0">';
//html += '<tr><td class="bar"><table id="'+this.id+'-buttons" cellspacing="0" cellpadding="0"><tr>';
//html += '<td><div class="separator"></div></td>';
html += '<div class="menueditor">';
//html += '<div class="element" style="width: auto; min-height: 0px; float: right;"><div class="select"><select onchange="'+this.objectId+'.execCommand(\'formatblock\', this.value);this.selectedIndex=0;"><option value=""></option><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny merged left" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h1>\');"><img src="'+this.path+'images/h1.png" alt="H1" title="H1" ></a>';//this.selectedIndex=0;"><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny merged" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h2>\');"><img src="'+this.path+'images/h2.png" alt="H2" title="H2" ></a>';//this.selectedIndex=0;"><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny merged" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h3>\');"><img src="'+this.path+'images/h3.png" alt="H3" title="H3" ></a>';//this.selectedIndex=0;"><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny merged right" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h4>\');"><img src="'+this.path+'images/h4.png" alt="H4" title="H4" ></a>';//this.selectedIndex=0;"><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny merged left" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h1>\');"><img src="'+this.path+'images/h1.png" alt="H1" title="H1" ></a>';
html += '<a class="button tiny merged" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h2>\');"><img src="'+this.path+'images/h2.png" alt="H2" title="H2" ></a>';
html += '<a class="button tiny merged" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h3>\');"><img src="'+this.path+'images/h3.png" alt="H3" title="H3" ></a>';
html += '<a class="button tiny merged right" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<h4>\');"><img src="'+this.path+'images/h4.png" alt="H4" title="H4" ></a>';
html += '<a class="button tiny" style="margin-right: 5px;" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<p>\');"><img src="'+this.path+'images/paragraph.png" alt="Paragraph" title="Paragraph" ></a>';//this.selectedIndex=0;"><option value="<h1>">Heading 1</option><option value="<h2>">Heading 2</option><option value="<h3>">Heading 3</option><option value="<p>">Paragraph</option><option value="<pre>">Preformatted</option></select></div></div>';
html += '<a class="button tiny" style="margin-right: 5px;" onclick="'+this.objectId+'.execCommand(\'formatblock\', \'<p>\');"><img src="'+this.path+'images/paragraph.png" alt="Paragraph" title="Paragraph" ></a>';
html += '<a class="button tiny merged left" onclick="'+this.objectId+'.execCommand(\'bold\')"><img src="'+this.path+'images/bold.png" alt="Bold" title="Bold"></a>';
html += '<a class="button tiny merged" onclick="'+this.objectId+'.execCommand(\'italic\')"><img src="'+this.path+'images/italic.png" alt="Italic" title="Italic"></a>';
@ -106,11 +104,9 @@ function SimpleTextEditor(id, objectId) {
html += '<a class="button tiny merged right" onclick="'+this.objectId+'.execCommand(\'insertimage\')"><img src="'+this.path+'images/picture.png" alt="Insert Image" title="Insert Image"></a>';
html += '</div>';
//html += '<td><div class="separator"></div></td>';
//html += '<td class="button"><img src="'+this.path+'images/help.gif" width="20" height="20" alt="Help" title="Help" onclick="'+this.objectId+'.openWindow(\''+this.path+'help.html\', \'300\', \'300\')"></td>';
//html += '</tr></table></td></tr>';
html += '<tr><td class="frame"><iframe style="height: 50px;" id="'+this.id+'-frame" frameborder="0"></iframe></td></tr>';
//html += '<tr><td class="source"><input id="'+this.id+'-viewSource" type="checkbox" onclick="'+this.objectId+'.toggleSource()"> View Source</td></tr>';
html += '</table>';
return html;
};
@ -121,8 +117,7 @@ function SimpleTextEditor(id, objectId) {
html += '<html><head>';
html += '<meta http-equiv="Content-Type" content="text/html; charset='+this.charset+'">';
html += '<title>SimpleTextEditor frame</title>';
//html += '<style type="text/css">pre { background-color: #eeeeee; padding: 0.75em 1.5em; border: 1px solid #dddddd; }</style>';
//if (this.cssFile) { html += '<link rel="stylesheet" type="text/css" href="'+this.cssFile+'">'; }
html += '<style type="text/css">html,body { cursor: text; } body { margin: 0px; padding: 0; font-size: 12px; }</style>';
html += '</head><body></body></html>';
return html;
@ -205,4 +200,8 @@ function SimpleTextEditor(id, objectId) {
document.getElementById(this.id).value = this.getContent();
}
};
this.clearContent = function() {
this.frame.document.body.innerHTML = '';
};
}
Loading…
Cancel
Save