From a4e181139e8035440dfd1aa8f420b24d6e328dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaussoin=20Timoth=C3=A9e?= Date: Wed, 4 Feb 2015 23:21:15 +0100 Subject: [PATCH] - Fix some UI issues in the Admin panel (remove font-awesome) - Remove font-awesome - Same the embeded links as a picture if detected - Add a "Gallery" on the contact page from the picture-linked-posts - Fix some CSS --- .htaccess | 14 +++--- app/models/postn/Postn.php | 18 +++++-- app/models/postn/PostnDAO.php | 27 +++++++++++ app/views/page.tpl | 2 +- app/widgets/AdminDB/admindb.tpl | 8 ++-- app/widgets/AdminTest/admintest.css | 10 ++-- app/widgets/AdminTest/admintest.tpl | 44 ++++++++++------- app/widgets/AdminTest/locales.ini | 2 +- app/widgets/Contact/Contact.php | 5 ++ app/widgets/Contact/_contact.tpl | 19 ++++++++ app/widgets/Notifs/_notifs_confirm.tpl | 4 +- app/widgets/Post/Post.php | 26 ++++++++-- app/widgets/Post/_post.tpl | 4 +- app/widgets/Post/_post_create.tpl | 66 +++++++++++++------------- app/widgets/Post/_post_embed.tpl | 6 +-- app/widgets/Post/_post_gallery.tpl | 8 ++++ app/widgets/Post/_post_header.tpl | 6 ++- app/widgets/Post/locales.ini | 1 + app/widgets/Post/post.css | 36 +------------- themes/material/css/form.css | 9 ++++ themes/material/css/grid.css | 6 +++ themes/material/css/style.css | 7 ++- 22 files changed, 208 insertions(+), 120 deletions(-) create mode 100644 app/widgets/Post/_post_gallery.tpl diff --git a/.htaccess b/.htaccess index c566fb7ed..740d33a2e 100755 --- a/.htaccess +++ b/.htaccess @@ -2,7 +2,7 @@ Options -Indexes AddType application/x-web-app-manifest+json .webapp # 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}] diff --git a/app/models/postn/Postn.php b/app/models/postn/Postn.php index 954244258..6300fc260 100755 --- a/app/models/postn/Postn.php +++ b/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); diff --git a/app/models/postn/PostnDAO.php b/app/models/postn/PostnDAO.php index 9321347e3..acc3bf402 100755 --- a/app/models/postn/PostnDAO.php +++ b/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 diff --git a/app/views/page.tpl b/app/views/page.tpl index 75df3c039..a211bf659 100755 --- a/app/views/page.tpl +++ b/app/views/page.tpl @@ -14,7 +14,7 @@ - + diff --git a/app/widgets/AdminDB/admindb.tpl b/app/widgets/AdminDB/admindb.tpl index 51cfa353d..6a3a6746c 100755 --- a/app/widgets/AdminDB/admindb.tpl +++ b/app/widgets/AdminDB/admindb.tpl @@ -6,7 +6,7 @@ {if="!$connected"}
  • - + {$c->__('db.connect_error')}

    {$errors}

    @@ -14,14 +14,14 @@ {else}
  • - + {$c->__('db.connect_success')}
  • {if="null !== $infos"}
  • - + {$c->__('db.update')}
    @@ -35,7 +35,7 @@ {else}
  • - + {$c->__('db.up_to_date')}
  • diff --git a/app/widgets/AdminTest/admintest.css b/app/widgets/AdminTest/admintest.css index 1ee88d0f0..c94cedc19 100644 --- a/app/widgets/AdminTest/admintest.css +++ b/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;} diff --git a/app/widgets/AdminTest/admintest.tpl b/app/widgets/AdminTest/admintest.tpl index f6a0aed66..2ad128002 100755 --- a/app/widgets/AdminTest/admintest.tpl +++ b/app/widgets/AdminTest/admintest.tpl @@ -4,14 +4,14 @@
    - - - - + + + + - +
    Browser
    @@ -41,7 +41,7 @@ {if="$dbconnected"} {if="$dbinfos > 0"}
  • - + The database need to be updated, go to the database panel to fix this
  • {else} @@ -49,7 +49,7 @@ {/if} {else}
  • - + Database connection error

    Check if database configuration exist in the config/ folder and fill it with proper values

  • @@ -57,7 +57,7 @@
  • - + WebSocket connection error, check if the Movim Daemon is running and is reacheable @@ -66,7 +66,7 @@
  • - + XMPP Websocket connection error, please check the validity of the URL given in the General Configuration. {$websocketurl} @@ -75,7 +75,9 @@ {if="!$c->version()"}
  • - + + + {$c->__('compatibility.php1', PHP_VERSION)}

    {$c->__('compatibility.php2')}

  • @@ -83,23 +85,31 @@ {/if} {if="!extension_loaded('imagick')"} -
    - {$c->__('compatibility.imagick')} +
  • + + + + + {$c->__('compatibility.imagick')} +
  • {/if} {if="!$c->testDir(DOCUMENT_ROOT)"} -
    - {$c->__('compatibility.rights')} -
    +
  • + + + + {$c->__('compatibility.rights')} +
  • {/if} {if="!$_SERVER['HTTP_MOD_REWRITE']"}
  • - + {$c->__('compatibility.rewrite')}
  • diff --git a/app/widgets/AdminTest/locales.ini b/app/widgets/AdminTest/locales.ini index 6f3d63172..78c5cbc13 100755 --- a/app/widgets/AdminTest/locales.ini +++ b/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' diff --git a/app/widgets/Contact/Contact.php b/app/widgets/Contact/Contact.php index 5a7a48cc1..0b57c246e 100644 --- a/app/widgets/Contact/Contact.php +++ b/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', diff --git a/app/widgets/Contact/_contact.tpl b/app/widgets/Contact/_contact.tpl index cca4322c4..07ffa8542 100644 --- a/app/widgets/Contact/_contact.tpl +++ b/app/widgets/Contact/_contact.tpl @@ -178,6 +178,24 @@ {/if} + {if="isset($gallery)"} +
    +

    {$c->__('page.gallery')}

    +
    + + {/if} + @@ -189,3 +207,4 @@ {/if} +
    diff --git a/app/widgets/Notifs/_notifs_confirm.tpl b/app/widgets/Notifs/_notifs_confirm.tpl index 1039d1a68..d2add9a50 100644 --- a/app/widgets/Notifs/_notifs_confirm.tpl +++ b/app/widgets/Notifs/_notifs_confirm.tpl @@ -4,13 +4,13 @@

    {$c->__('wants_to_talk', $jid)}