Browse Source

- Merge with edhelas

pull/16/head
Jaussoin Timothée 11 years ago
parent
commit
2d61984315
  1. 14
      .htaccess
  2. 18
      app/models/postn/Postn.php
  3. 27
      app/models/postn/PostnDAO.php
  4. 2
      app/views/page.tpl
  5. 8
      app/widgets/AdminDB/admindb.tpl
  6. 10
      app/widgets/AdminTest/admintest.css
  7. 44
      app/widgets/AdminTest/admintest.tpl
  8. 2
      app/widgets/AdminTest/locales.ini
  9. 5
      app/widgets/Contact/Contact.php
  10. 19
      app/widgets/Contact/_contact.tpl
  11. 4
      app/widgets/Notifs/_notifs_confirm.tpl
  12. 26
      app/widgets/Post/Post.php
  13. 4
      app/widgets/Post/_post.tpl
  14. 66
      app/widgets/Post/_post_create.tpl
  15. 6
      app/widgets/Post/_post_embed.tpl
  16. 8
      app/widgets/Post/_post_gallery.tpl
  17. 6
      app/widgets/Post/_post_header.tpl
  18. 1
      app/widgets/Post/locales.ini
  19. 36
      app/widgets/Post/post.css
  20. 9
      themes/material/css/form.css
  21. 6
      themes/material/css/grid.css
  22. 7
      themes/material/css/style.css

14
.htaccess

@ -2,7 +2,7 @@ Options -Indexes
AddType application/x-web-app-manifest+json .webapp
<IfModule mod_rewrite.c>
# Tell PHP that the mod_rewrite module is ENABLED.
#SetEnv HTTP_MOD_REWRITE 1
SetEnv HTTP_MOD_REWRITE 1
# If you have troubles or use VirtualDocumentRoot
# uncomment this and set it to the path where your Movim installation is
@ -12,11 +12,11 @@ AddType application/x-web-app-manifest+json .webapp
# Movim url: http://some.example.com/movim
# RewriteBase /movim/
#RewriteBase /0.9/
#RewriteEngine On
RewriteBase /0.9/
RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule (.*) index.php?query=$1 [L]
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php?query=$1 [L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

18
app/models/postn/Postn.php

@ -23,7 +23,8 @@ class Postn extends Model {
public $updated; //
public $delay; //
public $tags;
public $tags; // Store the tags
public $picture; // Tell if the post contain embeded pictures
public $lat;
public $lon;
@ -76,6 +77,8 @@ class Postn extends Model {
"links" :
{"type":"text" },
"picture" :
{"type":"int", "size":4 },
"tags" :
{"type":"text" },
"hash" :
@ -195,6 +198,10 @@ class Postn extends Model {
$this->lon = (string)$entry->entry->geoloc->lon;
}
}
private function typeIsPicture($type) {
return in_array($type, array('image/jpeg', 'image/png', 'image/jpg'));
}
private function setAttachements($links) {
$contentimg = '';
@ -205,9 +212,12 @@ class Postn extends Model {
$enc = array();
$enc = (array)$attachment->attributes();
$enc = $enc['@attributes'];
array_push($l, $enc);
array_push($l, $enc);
if($this->typeIsPicture($enc['type'])) {
$this->picture = true;
}
if((string)$attachment->attributes()->title == 'comments') {
$substr = explode('?',substr((string)$attachment->attributes()->href, 5));
$this->commentplace = reset($substr);
@ -231,7 +241,7 @@ class Postn extends Model {
foreach($links as $l) {
switch($l['rel']) {
case 'enclosure' :
if(in_array($l['type'], array('image/jpeg', 'image/png', 'image/jpg'))) {
if($this->typeIsPicture($l['type'])) {
array_push($attachements['pictures'], $l);
} else {
array_push($attachements['files'], $l);

27
app/models/postn/PostnDAO.php

@ -24,6 +24,7 @@ class PostnDAO extends SQL {
lon = :lon,
links = :links,
picture = :picture,
tags = :tags,
hash = :hash
@ -54,6 +55,7 @@ class PostnDAO extends SQL {
'lon' => $post->lon,
'links' => $post->links,
'picture' => $post->picture,
'tags' => $post->tags,
'hash' => $post->hash,
@ -95,6 +97,7 @@ class PostnDAO extends SQL {
lon,
links,
picture,
tags,
hash)
@ -123,6 +126,7 @@ class PostnDAO extends SQL {
:lon,
:links,
:picture,
:tags,
:hash
@ -149,6 +153,7 @@ class PostnDAO extends SQL {
'lon' => $post->lon,
'links' => $post->links,
'picture' => $post->picture,
'tags' => $post->tags,
'hash' => $post->hash,
@ -221,6 +226,28 @@ class PostnDAO extends SQL {
return $this->run('ContactPostn');
}
function getGallery($from) {
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn
left outer join contact on postn.aid = contact.jid
left outer join privacy on postn.nodeid = privacy.pkey
where postn.session = :session
and postn.jid = :jid
and postn.node like \'urn:xmpp:microblog:0\'
and postn.picture = 1
order by postn.published desc';
$this->prepare(
'Postn',
array(
'session' => $this->_user,
'jid' => $from
)
);
return $this->run('ContactPostn');
}
function getItem($id) {
$this->_sql = '
select *, postn.aid, privacy.value as privacy from postn

2
app/views/page.tpl

@ -14,7 +14,7 @@
<script src="<?php echo BASE_URI; ?>app/assets/js/leaflet.js"></script>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<!--<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">-->
<meta name="viewport" content="width=device-width, user-scalable=no">

8
app/widgets/AdminDB/admindb.tpl

@ -6,7 +6,7 @@
{if="!$connected"}
<li class="block large condensed">
<span class="icon bubble color red">
<i class="fa fa-plug"></i>
<i class="md md-settings-ethernet"></i>
</span>
<span>{$c->__('db.connect_error')}</span>
<p>{$errors}</p>
@ -14,14 +14,14 @@
{else}
<li class="block large">
<span class="icon bubble color green">
<i class="fa fa-plug"></i>
<i class="md md-settings-ethernet"></i>
</span>
<span>{$c->__('db.connect_success')}</span>
</li>
{if="null !== $infos"}
<li class="block large condensed">
<span class="icon bubble color orange">
<i class="fa fa-refresh"></i>
<i class="md md-refresh"></i>
</span>
<span>{$c->__('db.update')}</span>
<div class="control">
@ -35,7 +35,7 @@
{else}
<li class="block large">
<span class="icon bubble color green">
<i class="fa fa-refresh"></i>
<i class="md md-refresh"></i>
</span>
<span>{$c->__('db.up_to_date')}</span>
</li>

10
app/widgets/AdminTest/admintest.css

@ -51,11 +51,11 @@ figure div.link {
}
figure div.link i {
background-color: white;
margin-top: -0.75em;
padding: 0.25em;
border-radius: 2em;
font-size: 2em;
background-color: #FFF;
margin-top: -3rem;
padding: 3rem 1rem;
border-radius: 6rem;
font-size: 3rem;
}
figure div.disabled { background-color: rgba(0, 0, 0, 0.1); color: white;}

44
app/widgets/AdminTest/admintest.tpl

@ -4,14 +4,14 @@
<div id="webserver">
</div>
<div id="movim-daemon" class="link vertical disabled"><i class="fa fa-cog"></i></div>
<div id="movim-browser" class="link horizontal success"><i class="fa fa-globe"></i></div>
<div id="browser-daemon" class="link horizontal error"><i class="fa fa-plug"></i></div>
<div id="daemon-xmpp" class="link horizontal error"><i class="fa fa-code"></i></div>
<div id="movim-daemon" class="link vertical disabled"><i class="md md-settings"></i></div>
<div id="movim-browser" class="link horizontal success"><i class="md md-open-in-browser"></i></div>
<div id="browser-daemon" class="link horizontal error"><i class="md md-settings-ethernet"></i></div>
<div id="daemon-xmpp" class="link horizontal error"><i class="md md-import-export"></i></div>
<div id="movim-database" class="link vertical {if="$dbconnected"}success {if="$dbinfos > 0"}warning{/if} {else}error{/if}">
<i class="fa fa-database"></i>
<i class="md md-data-usage"></i>
</div>
<div id="movim-api" class="link horizontal disabled"><i class="fa fa-puzzle-piece"></i></div>
<div id="movim-api" class="link horizontal disabled"><i class="md md-cloud"></i></div>
<div id="browser_block">
Browser
</div>
@ -41,7 +41,7 @@
{if="$dbconnected"}
{if="$dbinfos > 0"}
<li>
<span class="icon bubble color orange"><i class="fa fa-refresh"></i></span>
<span class="icon bubble color orange"><i class="md md-refresh"></i></span>
<span>The database need to be updated, go to the database panel to fix this</span>
</li>
{else}
@ -49,7 +49,7 @@
{/if}
{else}
<li class="condensed">
<span class="icon bubble color red"><i class="fa fa-database"></i></span>
<span class="icon bubble color red"><i class="md md-data-usage"></i></span>
<span>Database connection error</span>
<p>Check if database configuration exist in the <code>config/</code> folder and fill it with proper values</p>
</li>
@ -57,7 +57,7 @@
<li id="websocket_error">
<span class="icon bubble color red">
<i class="fa fa-plug"></i>
<i class="md md-settings-ethernet"></i>
</span>
<span>
WebSocket connection error, check if the Movim Daemon is running and is reacheable
@ -66,7 +66,7 @@
<li id="xmpp_websocket_error">
<span class="icon bubble color red">
<i class="fa fa-plug"></i>
<i class="md md-settings-ethernet"></i>
</span>
<span>
XMPP Websocket connection error, please check the validity of the URL given in the General Configuration. <code>{$websocketurl}</code>
@ -75,7 +75,9 @@
{if="!$c->version()"}
<li class="condensed">
<span class="icon color bubble red"><i class="fa fa-code"></i> </span>
<span class="icon color bubble red">
<i class="md md-sync-problem"></i>
</span>
<span>{$c->__('compatibility.php1', PHP_VERSION)}</span>
<p>{$c->__('compatibility.php2')}</p>
</li>
@ -83,23 +85,31 @@
{/if}
{if="!extension_loaded('imagick')"}
<div class="message error">
<i class="fa fa-file-image-o"></i> {$c->__('compatibility.imagick')}
<li>
<span class="icon color bubble red">
<i class="md md-image"></i>
</span>
<span>
{$c->__('compatibility.imagick')}
</span>
</div>
<script type="text/javascript">AdminTest.disableMovim()</script>
{/if}
{if="!$c->testDir(DOCUMENT_ROOT)"}
<div class="message error">
<i class="fa fa-folder"></i> {$c->__('compatibility.rights')}
</div>
<li>
<span class="icon color bubble red">
<i class="md md-folder"></i>
</span>
<span>{$c->__('compatibility.rights')}</span>
</li>
<script type="text/javascript">AdminTest.disableMovim()</script>
{/if}
{if="!$_SERVER['HTTP_MOD_REWRITE']"}
<li>
<span class="icon bubble color orange">
<i class="fa fa-pencil"></i>
<i class="md md-mode-edit"></i>
</span>
<span>{$c->__('compatibility.rewrite')}</span>
</li>

2
app/widgets/AdminTest/locales.ini

@ -5,6 +5,6 @@ compatibility.info = 'Movim has found some issues or things that need to be
compatibility.php1 = 'Update your PHP-Version: %s'
compatibility.php2 = 'Required: 5.3.0'
compatibility.curl = 'Install the php5-curl library'
compatibility.gd = 'Install the php5-imagick library'
compatibility.imagick = 'Install the php5-imagick library'
compatibility.rights = "Read and write rights for the webserver in Movim's root directory"
compatibility.rewrite = 'The URL Rewriting support is currently disabled'

5
app/widgets/Contact/Contact.php

@ -136,12 +136,17 @@ class Contact extends WidgetCommon
$view = $this->tpl();
$pd = new \Modl\PostnDAO;
$gallery = $pd->getGallery($jid);
if(isset($c)) {
$view->assign('mood', getMood());
$view->assign('contact', $c);
$view->assign('contactr', $cr);
$view->assign('gallery', $gallery);
$view->assign('chat',
$this->call(
'ajaxChat',

19
app/widgets/Contact/_contact.tpl

@ -178,6 +178,24 @@
</ul>
{/if}
{if="isset($gallery)"}
<br />
<h3 class="padded">{$c->__('page.gallery')}</h3>
<br />
<ul class="grid">
{loop="$gallery"}
{$attachements = $value->getAttachements()}
<li style="background-image: url('{$attachements['pictures'][0]['href']}');">
<nav>
<a href="{$attachements['pictures'][0]['href']}" target="_blank">
{$attachements['pictures'][0]['title']}
</a>
</nav>
</li>
{/loop}
</ul>
{/if}
<a onclick="{$chat}" class="button action color red">
<i class="md md-chat"></i>
</a>
@ -189,3 +207,4 @@
</li>
</ul>
{/if}
<br />

4
app/widgets/Notifs/_notifs_confirm.tpl

@ -4,13 +4,13 @@
<h4 class="gray">{$c->__('wants_to_talk', $jid)}</h4>
<ul class="active">
<li onclick="Notifs_ajaxAccept('$jid')">
<li onclick="Notifs_ajaxAccept('{$jid}'); Dialog.clear();">
<span class="icon green">
<i class="md md-person-add"></i>
</span>
{$c->__('button.accept')}
</li>
<li onclick="Notifs_ajaxRefuse('$jid')">
<li onclick="Notifs_ajaxRefuse('{$jid}'); Dialog.clear();">
<span class="icon red">
<i class="md md-close"></i>
</span>

26
app/widgets/Post/Post.php

@ -96,8 +96,14 @@ class Post extends WidgetCommon
}
if($form->embed->value != '' && filter_var($form->embed->value, FILTER_VALIDATE_URL)) {
$content .= $this->prepareEmbed($form->embed->value);
$embed = Embed\Embed::create($form->embed->value);
$content .= $this->prepareEmbed($embed);
$p->setLink($form->embed->value);
if($embed->type == 'photo') {
$key = key($embed->images);
$p->setImage($key, $embed->title, $embed->images[$key][2]);
}
}
$p->setContentHtml(rawurldecode($content))
@ -124,7 +130,12 @@ class Post extends WidgetCommon
return;
}
$html = $this->prepareEmbed($url);
$embed = Embed\Embed::create($url);
$html = $this->prepareEmbed($embed);
if($embed->type == 'photo') {
RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
}
RPC::call('movim_fill', 'preview', $html);
}
@ -146,12 +157,17 @@ class Post extends WidgetCommon
RPC::call('movim_fill', 'comments', $html);
}
function prepareEmbed($url)
function prepareGallery($embed)
{
$info = Embed\Embed::create($url);
$view = $this->tpl();
$view->assign('embed', $embed);
return $view->draw('_post_gallery', true);
}
function prepareEmbed($embed)
{
$view = $this->tpl();
$view->assign('embed', $info);
$view->assign('embed', $embed);
return $view->draw('_post_embed', true);
}

4
app/widgets/Post/_post.tpl

@ -10,9 +10,9 @@
<header>
<ul class="thick">
<li class="condensed">
<a href="{$c->route('node', array($post->jid, $post->node))}">
<!--<a href="{$c->route('node', array($post->jid, $post->node))}">-->
<span class="icon bubble color {$post->node|stringToColor}">{$post->node|firstLetterCapitalize}</span>
</a>
<!--</a>-->
{if="$post->title != null"}
<span>{$post->title}</span>
{else}

66
app/widgets/Post/_post_create.tpl

@ -1,34 +1,34 @@
<ul class="simple">
<li>
<form name="post">
<input type="hidden" name="to" value="{$to}">
<input type="hidden" name="node" value="urn:xmpp:microblog:0">
<div>
<input type="text" name="title" placeholder="{$c->__('post.title')}">
<label for="title">{$c->__('post.title')}</label>
</div>
<div>
<textarea name="content" placeholder="{$c->__('post.content')}" onkeyup="movim_textarea_autoheight(this);"></textarea>
<label for="content">{$c->__('post.content')}</label>
</div>
<div>
<input type="url" name="embed" placeholder="http://myawesomewebsite.com/" onblur="Post_ajaxEmbedTest(this.value)">
<label for="embed">{$c->__('post.link')}</label>
</div>
<!--
<div>
<input type="text" name="tags" placeholder="food, blog, news">
<label for="tags">{$c->__('post.tags')}</label>
</div>
-->
</form>
</li>
<article>
<section>
<content id="preview">
<form name="post" class="padded_right">
<input type="hidden" name="to" value="{$to}">
<input type="hidden" name="node" value="urn:xmpp:microblog:0">
<div class="icon">
<input type="text" name="title" placeholder="{$c->__('post.title')}">
<label for="title">{$c->__('post.title')}</label>
<span class="icon gray">
<i class="md md-subject"></i>
</span>
</div>
<div class="icon">
<textarea name="content" placeholder="{$c->__('post.content')}" onkeyup="movim_textarea_autoheight(this);"></textarea>
<label for="content">{$c->__('post.content')}</label>
</div>
<div class="icon">
<input
type="url"
name="embed"
placeholder="http://myawesomewebsite.com/"
onblur="Post_ajaxEmbedTest(this.value)">
<label for="embed">{$c->__('post.link')}</label>
<span class="icon gray">
<i class="md md-link"></i>
</span>
</content>
</section>
</article>
</ul>
<br />
<article>
<section>
<content id="preview"></content>
</section>
</article>
<div id="gallery"></div>
</div>
</form>

6
app/widgets/Post/_post_embed.tpl

@ -9,10 +9,10 @@
<a href="{$embed->providerUrl|htmlspecialchars}" target="_blank">{$embed->providerName}</a>
</p>
</li>
{if="isset($embed->images[0])"}
{if="key($embed->images) != null"}
<li>
<a href="{$embed->images[0]|htmlspecialchars}" target="_blank">
<img src="{$embed->images[0]|htmlspecialchars}"/>
<a href="{$embed->images|key|htmlspecialchars}" target="_blank">
<img src="{$embed->images|key|htmlspecialchars}"/>
</a>
</li>
{/if}

8
app/widgets/Post/_post_gallery.tpl

@ -0,0 +1,8 @@
<ul class="thin">
<li>
<span class="icon bubble" style="background-image: url({$embed->images|key|htmlspecialchars});">
<i class="md md-image"></i>
</span>
<span>{$c->__('post.gallery')}</span>
</li>
</ul>

6
app/widgets/Post/_post_header.tpl

@ -1,7 +1,11 @@
<div>
<span class="on_desktop icon"><i class="md md-view-list"></i></span>
<h2>
{$post->node}
{if="$post->node == 'urn:xmpp:microblog:0'"}
{$c->__('page.blog')}
{else}
{$post->node}
{/if}
</h2>
</div>
<div>

1
app/widgets/Post/locales.ini

@ -13,3 +13,4 @@ post.valid_url = 'Please enter a valid url'
post.no_content_preview = 'No content to preview'
post.no_content = 'No content'
post.published = 'Post published'
post.gallery = 'This picture will be added to your gallery'

36
app/widgets/Post/post.css

@ -1,35 +1,3 @@
/*
#post_widget {
width: calc(75% - 15rem);
form[name=post] article section {
padding: 0;
}
#post_widget article {
padding-bottom: 1em;
}
#post_widget div.picture {
padding-bottom: 25%;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
#post_widget article header,
#post_widget article section.content,
#post_widget article footer {
max-width: 600px;
margin: 0 auto;
background-color: white;
}
#post_widget div.picture ~ header {
margin-top: -3em;
box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.3);
}
*/
/*
#post_widget #preview img {
max-height: 40rem;
max-width: 100%;
}
*/

9
themes/material/css/form.css

@ -17,6 +17,10 @@ form > div > label {
position: absolute;
top: 2rem;
}
form > div.icon {
padding-left: 9rem;
}
/*
form > div > input:focus + label,
form > div > textarea:focus + label {
@ -282,6 +286,11 @@ input[type=button].flat:focus {
font-size: 3rem;
}
.button.action:active {
background-image: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.1) 100%);
}
li.action div.action .button {
margin: 0.5rem;
display: block;

6
themes/material/css/grid.css

@ -36,3 +36,9 @@ ul.grid nav {
padding-bottom: 50%;
}
}
ul.grid:after {
content: "";
display: block;
clear: both;
}

7
themes/material/css/style.css

@ -220,7 +220,7 @@ main > header {
position: relative;
height: 7rem;
overflow: hidden;
box-shadow: 0 0 0.5rem rgba(0, 0, 0, 0.5);
box-shadow: 0 0 0.75rem rgba(0, 0, 0, 0.5);
z-index: 2;
}
@ -849,6 +849,11 @@ dl dd {
padding-left: 2rem;
box-sizing: border-box;
}
.padded_right {
padding-right: 2rem;
box-sizing: border-box;
}
}
/* Divided */

Loading…
Cancel
Save