17 changed files with 286 additions and 29 deletions
-
1app/controllers/InfosController.php
-
1app/views/admin.tpl
-
10app/widgets/Admin/Admin.php
-
86app/widgets/Api/Api.php
-
42app/widgets/Api/api.tpl
-
7app/widgets/Api/locales.ini
-
2app/widgets/Config/Config.php
-
1app/widgets/Config/locales.ini
-
10app/widgets/Infos/Infos.php
-
2app/widgets/Pods/Pods.php
-
40app/widgets/Pods/pods.tpl
-
2bootstrap.php
-
5locales/locales.ini
-
1system/Conf.php
-
16system/Utils.php
-
1themes/movim/css/nav.css
-
88themes/movim/img/icons/menu/net.svg
@ -0,0 +1,86 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* @package Widgets |
|||
* |
|||
* @file Statistics.php |
|||
* This file is part of MOVIM. |
|||
* |
|||
* @brief The administration widget. |
|||
* |
|||
* @author Timothée Jaussoin <edhelas@gmail.com> |
|||
* * |
|||
* Copyright (C)2014 MOVIM project |
|||
* |
|||
* See COPYING for licensing information. |
|||
*/ |
|||
|
|||
class Api extends WidgetBase { |
|||
function load() |
|||
{ |
|||
} |
|||
|
|||
function display() |
|||
{ |
|||
$this->view->assign( |
|||
'infos', |
|||
$this->__( |
|||
'api.info', |
|||
'<a href="http://api.movim.eu/" target="_blank">', |
|||
'</a>', |
|||
'<a href="'.$this->route('pods').'">', |
|||
'</a>')); |
|||
|
|||
$json = requestURL(MOVIM_API.'status', 1, array('uri' => BASE_URI)); |
|||
$json = json_decode($json); |
|||
|
|||
$conf = Conf::getServerConf(); |
|||
|
|||
if(isset($json)) { |
|||
$this->view->assign('json', $json); |
|||
if($json->status == 200) { |
|||
$this->view->assign('unregister', $this->genCallAjax('ajaxUnregister')); |
|||
$this->view->assign('unregister_status', $conf['unregister']); |
|||
} else { |
|||
$conf['unregister'] = false; |
|||
Conf::saveConfFile($conf); |
|||
$this->view->assign('register', $this->genCallAjax('ajaxRegister')); |
|||
} |
|||
} else { |
|||
$this->view->assign('json', null); |
|||
} |
|||
} |
|||
|
|||
function ajaxRegister() |
|||
{ |
|||
$rewrite = false; |
|||
if(isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) { |
|||
$rewrite = true; |
|||
} |
|||
|
|||
$json = requestURL( |
|||
MOVIM_API.'register', |
|||
1, |
|||
array( |
|||
'uri' => BASE_URI, |
|||
'rewrite' => $rewrite)); |
|||
$json = json_decode($json); |
|||
|
|||
if(isset($json) && $json->status == 200) { |
|||
RPC::call('movim_reload_this'); |
|||
Notification::appendNotification(t('Configuration updated')); |
|||
} |
|||
} |
|||
|
|||
function ajaxUnregister() |
|||
{ |
|||
$conf = Conf::getServerConf(); |
|||
$conf['unregister'] = !$conf['unregister']; |
|||
Conf::saveConfFile($conf); |
|||
|
|||
sleep(2); |
|||
|
|||
RPC::call('movim_reload_this'); |
|||
RPC::commit(); |
|||
} |
|||
} |
@ -0,0 +1,42 @@ |
|||
<div id="api" class="tabelem padded" title="{$c->__("api.title")}"> |
|||
<p>{$infos}</p> |
|||
|
|||
{if="isset($json)"} |
|||
{if="$json->status == 200"} |
|||
<div class="message success"> |
|||
{$c->__('api.registered')} |
|||
{if="!$unregister_status"} |
|||
<a class="button color red oppose" onclick="{$unregister}"> |
|||
{$c->__('button.unregister')} |
|||
</a> |
|||
{/if} |
|||
<div class="clear"></div> |
|||
</div> |
|||
|
|||
{if="$json->pod->activated"} |
|||
<div class="message success"> |
|||
{$c->__('api.validated')} |
|||
</div> |
|||
{else} |
|||
<div class="message warning">{$c->__('api.wait')}</div> |
|||
{/if} |
|||
|
|||
{if="$unregister_status"} |
|||
<div class="message info">{$c->__('api.unregister')} |
|||
<a class="button color orange oppose" onclick="{$unregister}"> |
|||
{$c->__('button.reset')} |
|||
</a> |
|||
<div class="clear"></div> |
|||
</div> |
|||
{/if} |
|||
{else} |
|||
<div class="message info"> |
|||
{$c->__('api.register')} |
|||
<a class="button color green oppose" onclick="{$register}">{$c->__('button.register')}</a> |
|||
<div class="clear"></div> |
|||
</div> |
|||
{/if} |
|||
{else} |
|||
<div class="message error">{$c->__('api.error')}</div> |
|||
{/if} |
|||
</div> |
@ -0,0 +1,7 @@ |
|||
api.title = 'API' |
|||
api.info = 'Here you can register your pod on the official %sMovim API%s and be listed on %sthe pods page%s.' |
|||
api.register = 'Your pod is not registered on the API' |
|||
api.registered = 'Your pod is registered on the API' |
|||
api.wait = 'Your pod is not yet validated' |
|||
api.validated = 'Your pod is validated' |
|||
api.unregister = 'You asked to be removed from the API, this request will be processed in a couple of hours' |
@ -1,17 +1,23 @@ |
|||
{loop="$pods"} |
|||
<article class="block"> |
|||
<header> |
|||
<span class="title"> |
|||
<a href="{$value->url}" target="_blank">{$value->url}</a> |
|||
</span> |
|||
</header> |
|||
<section class="content">{$value->description}</section> |
|||
<footer> |
|||
<img |
|||
title="{$value->language}" |
|||
alt="{$value->language}" |
|||
src="{$c->flagPath($value->language)}"/> |
|||
<span>{$value->connected} • {$value->population}</span> |
|||
</footer> |
|||
</article> |
|||
{/loop} |
|||
{if="isset($pods)"} |
|||
{loop="$pods->pods"} |
|||
<article class="block"> |
|||
<header> |
|||
<span class="title"> |
|||
<a href="{$value->url}" target="_blank">{function="parse_url($value->url, PHP_URL_HOST)"}</a> |
|||
</span> |
|||
</header> |
|||
<section class="content">{$value->description}</section> |
|||
<footer> |
|||
<img |
|||
title="{$value->language}" |
|||
alt="{$value->language}" |
|||
src="{$c->flagPath($value->language)}"/> |
|||
<span>{$value->connected} • {$value->population}</span> |
|||
</footer> |
|||
</article> |
|||
{/loop} |
|||
{else} |
|||
<div class="padded"> |
|||
<div class="message error">{$c->__('api.error')}</div> |
|||
</div> |
|||
{/if} |
@ -0,0 +1,88 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<!-- Generated by IcoMoon.io --> |
|||
|
|||
<svg |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:cc="http://creativecommons.org/ns#" |
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|||
xmlns:svg="http://www.w3.org/2000/svg" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|||
version="1.1" |
|||
width="32" |
|||
height="32" |
|||
viewBox="0 0 32 32" |
|||
id="svg2" |
|||
inkscape:version="0.48.4 r9939" |
|||
sodipodi:docname="net.svg"> |
|||
<metadata |
|||
id="metadata10"> |
|||
<rdf:RDF> |
|||
<cc:Work |
|||
rdf:about=""> |
|||
<dc:format>image/svg+xml</dc:format> |
|||
<dc:type |
|||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
|||
<dc:title></dc:title> |
|||
</cc:Work> |
|||
</rdf:RDF> |
|||
</metadata> |
|||
<defs |
|||
id="defs8" /> |
|||
<sodipodi:namedview |
|||
pagecolor="#000000" |
|||
bordercolor="#666666" |
|||
borderopacity="1" |
|||
objecttolerance="10" |
|||
gridtolerance="10" |
|||
guidetolerance="10" |
|||
inkscape:pageopacity="1" |
|||
inkscape:pageshadow="2" |
|||
inkscape:window-width="1920" |
|||
inkscape:window-height="1014" |
|||
id="namedview6" |
|||
showgrid="false" |
|||
inkscape:zoom="14.86" |
|||
inkscape:cx="6.1596339" |
|||
inkscape:cy="16.001358" |
|||
inkscape:window-x="0" |
|||
inkscape:window-y="23" |
|||
inkscape:window-maximized="1" |
|||
inkscape:current-layer="svg2" /> |
|||
<path |
|||
sodipodi:type="arc" |
|||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" |
|||
id="path3803" |
|||
sodipodi:cx="6.8304172" |
|||
sodipodi:cy="6.3270526" |
|||
sodipodi:rx="4.3405113" |
|||
sodipodi:ry="4.3405113" |
|||
d="m 11.170928,6.3270526 a 4.3405113,4.3405113 0 1 1 -8.6810222,0 4.3405113,4.3405113 0 1 1 8.6810222,0 z" |
|||
transform="matrix(0.98959123,0.26962431,-0.26962431,0.98959123,6.1616871,-1.2238856)" /> |
|||
<path |
|||
transform="matrix(0.98959123,0.26962431,-0.26962431,0.98959123,0.5889972,17.993748)" |
|||
sodipodi:type="arc" |
|||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" |
|||
id="path3803-9" |
|||
sodipodi:cx="6.8304172" |
|||
sodipodi:cy="6.3270526" |
|||
sodipodi:rx="4.3405113" |
|||
sodipodi:ry="4.3405113" |
|||
d="m 11.170928,6.3270526 a 4.3405113,4.3405113 0 1 1 -8.6810222,0 4.3405113,4.3405113 0 1 1 8.6810222,0 z" /> |
|||
<path |
|||
transform="matrix(0.98959123,0.26962431,-0.26962431,0.98959123,21.461565,12.407638)" |
|||
sodipodi:type="arc" |
|||
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" |
|||
id="path3803-7" |
|||
sodipodi:cx="6.8304172" |
|||
sodipodi:cy="6.3270526" |
|||
sodipodi:rx="4.3405113" |
|||
sodipodi:ry="4.3405113" |
|||
d="m 11.170928,6.3270526 a 4.3405113,4.3405113 0 1 1 -8.6810222,0 4.3405113,4.3405113 0 1 1 8.6810222,0 z" /> |
|||
<path |
|||
style="fill:none;stroke:#ffffff;stroke-width:3.07699394;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" |
|||
d="M 11.228485,6.6048146 26.723175,20.627194 5.5128348,26.795047 z" |
|||
id="path3837" |
|||
inkscape:connector-curvature="0" /> |
|||
</svg> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue