Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
5b14604d9c
|
@ -31,6 +31,7 @@
|
|||
<variable name="activer_dokuwiki" type="oui/non" description="Activer Dokuwiki" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_econnect" type="oui/non" description="Activer eConnect" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_etherhome" type="oui/non" description="Activer Etherhome" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_fluxbb" type="oui/non" description="Activer Fluxbb" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_gepi" type="oui/non" description="Activer GEPI" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_grr" type="oui/non" description="Activer Grr" hidden='True' exists='False'><value>non</value></variable>
|
||||
<variable name="activer_kanboard" type="oui/non" description="Activer Kanboard" hidden='True' exists='False'><value>non</value></variable>
|
||||
|
@ -173,6 +174,12 @@
|
|||
</variable>
|
||||
<variable type='string' name='ninegate_widetherhome_url' description='URL complète de votre Etherhome' mandatory='True' />
|
||||
|
||||
<!-- FLUXBB -->
|
||||
<variable type="oui/non" name='ninegate_activate_widfluxbb' description='Activer Fluxbb' mandatory='True'>
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable type='string' name='ninegate_widfluxbb_url' description='URL complète de votre Fluxbb' mandatory='True' />
|
||||
|
||||
<!-- GEPI -->
|
||||
<variable type="oui/non" name='ninegate_activate_widgepi' description='Activer GEPI' mandatory='True'>
|
||||
<value>non</value>
|
||||
|
@ -314,6 +321,7 @@
|
|||
<separator name="ninegate_activate_widdokuwiki">Paramètres associés à Dokuwiki</separator>
|
||||
<separator name="ninegate_activate_wideconnect">Paramètres associés à eConnect</separator>
|
||||
<separator name="ninegate_activate_widetherhome">Paramètres associés à Etherhome</separator>
|
||||
<separator name="ninegate_activate_widfluxbb">Paramètres associés à Fluxbb</separator>
|
||||
<separator name="ninegate_activate_widgepi">Paramètres associés à GEPI</separator>
|
||||
<separator name="ninegate_activate_widgrr">Paramètres associés à Grr</separator>
|
||||
<separator name="ninegate_activate_widkanboard">Paramètres associés à Kanboard</separator>
|
||||
|
@ -471,6 +479,7 @@
|
|||
<target type='variable'>ninegate_activate_widdokuwiki</target>
|
||||
<target type='variable'>ninegate_activate_wideconnect</target>
|
||||
<target type='variable'>ninegate_activate_widetherhome</target>
|
||||
<target type='variable'>ninegate_activate_widfluxbb</target>
|
||||
<target type='variable'>ninegate_activate_widgepi</target>
|
||||
<target type='variable'>ninegate_activate_widgrr</target>
|
||||
<target type='variable'>ninegate_activate_widkanboard</target>
|
||||
|
@ -674,6 +683,30 @@
|
|||
|
||||
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DU WIDGET FLUXBB -->
|
||||
<fill name='calc_multi_condition' target='ninegate_activate_widfluxbb'>
|
||||
<param>oui</param>
|
||||
<param type='eole' name='condition_1' hidden='False'>activer_fluxbb</param>
|
||||
<param name='match'>oui</param>
|
||||
<param name='mismatch'>non</param>
|
||||
<param name='default_mismatch'>non</param>
|
||||
</fill>
|
||||
|
||||
<condition name='hidden_if_in' source='ninegate_activate_widfluxbb'>
|
||||
<param>non</param>
|
||||
|
||||
<target type='variable'>ninegate_widfluxbb_url</target>
|
||||
</condition>
|
||||
|
||||
<fill name='calc_multi_condition' target='ninegate_widfluxbb_url'>
|
||||
<param>oui</param>
|
||||
<param type='eole' name='condition_1' hidden='False'>activer_fluxbb</param>
|
||||
<param name='match'>/fluxbb</param>
|
||||
<param name='default_mismatch'>None</param>
|
||||
</fill>
|
||||
|
||||
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DU WIDGET GEPI -->
|
||||
<fill name='calc_multi_condition' target='ninegate_activate_widgepi'>
|
||||
<param>oui</param>
|
||||
|
|
|
@ -108,7 +108,6 @@ class OnlyCommand extends Command
|
|||
$this->writeln($this->only_url);
|
||||
$this->writeln($this->only_host);
|
||||
$this->writeln($this->only_user);
|
||||
$this->writeln($this->only_password);
|
||||
|
||||
if($this->only_sync) {
|
||||
// Only Office est-il dans le domaine
|
||||
|
|
|
@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
|||
(-100, 'Interne', 'SIREN');
|
||||
|
||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}XeJxoO2l4dkHFX78WQ1Ik30sjLt3kffh
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}Kvz21GjhkryG4l7EKniMJzVfwDufa+eI
|
||||
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
||||
|
||||
|
||||
|
|
|
@ -501,6 +501,13 @@ class GroupController extends Controller
|
|||
if($group->getFgAll()||$group->getFgtemplate())
|
||||
throw $this->createNotFoundException('Permission denied');
|
||||
|
||||
$usergroup = $em->getRepository("CadolesCoreBundle:Usergroup")->findOneBy(array("user"=>$userid,"group"=>$groupid));
|
||||
if($usergroup) {
|
||||
$response = new Response(json_encode($output));
|
||||
$response->headers->set('Content-Type', 'application/json');
|
||||
return $response;
|
||||
}
|
||||
|
||||
$key = Uuid::uuid4();
|
||||
$usergroup=new Usergroup;
|
||||
$user=$em->getRepository("CadolesCoreBundle:User")->find($userid);
|
||||
|
@ -1025,7 +1032,7 @@ class GroupController extends Controller
|
|||
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
|
||||
|
||||
// On s'assure que le label ne contient pas des caractères speciaux
|
||||
$string = preg_replace('~[^ @a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
$string = preg_replace('~[^ éèêôöàïî\'@a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
if($string!=$data->getLabel())
|
||||
{
|
||||
$form->addError(new FormError('Caractères interdit dans ce label'));
|
||||
|
|
|
@ -284,7 +284,7 @@ class Niveau01Controller extends Controller
|
|||
if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label'));
|
||||
|
||||
// On s'assure que le label ne contient pas des caractères speciaux
|
||||
$string = preg_replace('~[^ @a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
$string = preg_replace('~[^ éèêôöàïî\'@a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
if($string!=$data->getLabel())
|
||||
{
|
||||
$form->addError(new FormError('Caractères interdit dans ce label'));
|
||||
|
|
|
@ -269,7 +269,7 @@ class Niveau02Controller extends Controller
|
|||
if($tmp) $form->addError(new FormError('Un niveau de rang 01 utilise déjà ce label'));
|
||||
|
||||
// On s'assure que le label ne contient pas des caractères speciaux
|
||||
$string = preg_replace('~[^ @a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
$string = preg_replace('~[^ éèêôöàïî\'@a-zA-Z0-9._-]~', '', $data->getLabel());
|
||||
if($string!=$data->getLabel())
|
||||
{
|
||||
$form->addError(new FormError('Caractères interdit dans ce label'));
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
{% if form.label is defined %}
|
||||
{{ form_row(form.label) }}
|
||||
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
|
||||
Caractères interdits = accent, caractères spéciaux sauf @ . - _<br>
|
||||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{% if form.fgassoc is defined %}
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<div class="panel-body">
|
||||
{{ form_row(form.label) }}
|
||||
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
|
||||
Caractères interdits = accent, caractères spéciaux sauf @ . - _<br>
|
||||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.siren) }}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{{ form_row(form.niveau01) }}
|
||||
{{ form_row(form.label) }}
|
||||
<div class='alert alert-info' style='font-size: 80%;padding: 5px;margin-top: -10px;'>
|
||||
Caractères interdits = accent, caractères spéciaux sauf @ . - _<br>
|
||||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{{ form_row(form.siret) }}
|
||||
|
|
|
@ -43,6 +43,7 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$activate_widdokuwiki = $this->getContainer()->getParameter('activate_widdokuwiki');
|
||||
$activate_wideconnect = $this->getContainer()->getParameter('activate_wideconnect');
|
||||
$activate_widetherhome = $this->getContainer()->getParameter('activate_widetherhome');
|
||||
$activate_widfluxbb = $this->getContainer()->getParameter('activate_widfluxbb');
|
||||
$activate_widgepi = $this->getContainer()->getParameter('activate_widgepi');
|
||||
$activate_widgrr = $this->getContainer()->getParameter('activate_widgrr');
|
||||
$activate_widkanboard = $this->getContainer()->getParameter('activate_widkanboard');
|
||||
|
@ -50,6 +51,7 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$activate_widmindmaps = $this->getContainer()->getParameter('activate_widmindmaps');
|
||||
$activate_widmoodle = $this->getContainer()->getParameter('activate_widmoodle');
|
||||
$activate_widnextcloud = $this->getContainer()->getParameter('activate_widnextcloud');
|
||||
$activate_widonlyoffice = $this->getContainer()->getParameter('activate_widonlyoffice');
|
||||
$activate_widopensondage = $this->getContainer()->getParameter('activate_widopensondage');
|
||||
$activate_widphpldapadmin = $this->getContainer()->getParameter('activate_widphpldapadmin');
|
||||
$activate_widpiwik = $this->getContainer()->getParameter('activate_widpiwik');
|
||||
|
@ -58,6 +60,8 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$activate_widwordpress = $this->getContainer()->getParameter('activate_widwordpress');
|
||||
$activate_websocket = $this->getContainer()->getParameter('websocket_activate');
|
||||
|
||||
$widonlyoffice_sync = $this->getContainer()->getParameter('widonlyoffice_sync');
|
||||
|
||||
$output->writeln('PORTAL = Default Data');
|
||||
|
||||
// afin de forcer les ID sur certaines entités
|
||||
|
@ -354,6 +358,28 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$em->persist($entityItem);
|
||||
}
|
||||
|
||||
// Item fluxbb
|
||||
if($activate_widfluxbb) {
|
||||
$widfluxbb_url =$this->getContainer()->getParameter('widfluxbb_url');
|
||||
$entityItem = $em->getRepository('CadolesPortalBundle:Item')->find(-397);
|
||||
if(!$entityItem) {
|
||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_fluxbb.png"]);
|
||||
|
||||
$entityItem = new Item();
|
||||
$entityItem->setId(-397);
|
||||
$entityItem->setRowOrder(0);
|
||||
$entityItem->setTitle('Fluxbb');
|
||||
$entityItem->SetSubtitle("Forum");
|
||||
$entityItem->setIcon($entityicon);
|
||||
$entityItem->setTarget("_blank");
|
||||
$entityItem->setItemcategory($entityItemcategoryapp);
|
||||
$entityItem->setEssential(true);
|
||||
$entityItem->addGroup($groupall);
|
||||
}
|
||||
$entityItem->setUrl($widfluxbb_url);
|
||||
$em->persist($entityItem);
|
||||
}
|
||||
|
||||
// Item gepi
|
||||
if($activate_widgepi) {
|
||||
$widgepi_url =$this->getContainer()->getParameter('widgepi_url');
|
||||
|
@ -508,6 +534,28 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$em->persist($entityItem);
|
||||
}
|
||||
|
||||
// Item Onlyoffice
|
||||
if($activate_widonlyoffice) {
|
||||
$widonlyoffice_url =$this->getContainer()->getParameter('widonlyoffice_url');
|
||||
$entityItem = $em->getRepository('CadolesPortalBundle:Item')->find(-1000);
|
||||
if(!$entityItem) {
|
||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_onlyoffice.png"]);
|
||||
|
||||
$entityItem = new Item();
|
||||
$entityItem->setId(-1000);
|
||||
$entityItem->setRowOrder(0);
|
||||
$entityItem->setTitle('Onlyoffice');
|
||||
$entityItem->SetSubtitle("Application Bureautique");
|
||||
$entityItem->setIcon($entityicon);
|
||||
$entityItem->setTarget("_blank");
|
||||
$entityItem->setItemcategory($entityItemcategoryapp);
|
||||
$entityItem->setEssential(true);
|
||||
$entityItem->addGroup($groupall);
|
||||
}
|
||||
$entityItem->setUrl($widonlyoffice_url);
|
||||
$em->persist($entityItem);
|
||||
}
|
||||
|
||||
// Item Opensondage
|
||||
if($activate_widopensondage) {
|
||||
$widopensondage_url =$this->getContainer()->getParameter('widopensondage_url');
|
||||
|
@ -1036,6 +1084,30 @@ class InitDataCommand extends ContainerAwareCommand
|
|||
$entityWidget->setParameter($parameter);
|
||||
$em->persist($entityWidget);
|
||||
|
||||
// Onlyoffice document
|
||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1810);
|
||||
if($widonlyoffice_sync) {
|
||||
if(!$entityWidget) $entityWidget = new Widget();
|
||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_onlyoffice.png"]);
|
||||
$entityWidget->setId(-1810);
|
||||
$entityWidget->setRoworder(2);
|
||||
$entityWidget->setIcon($entityicon);
|
||||
$entityWidget->setName('Documents Onlyoffice');
|
||||
$entityWidget->setDescription("Les documents associés à votre groupe");
|
||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_onlydoc");
|
||||
$entityWidget->setHeight("630");
|
||||
$entityWidget->setAutoajust(true);
|
||||
$entityWidget->setBorder(false);
|
||||
$entityWidget->setOpened(true);
|
||||
$entityWidget->setAccess(["config","group"]);
|
||||
$parameter = json_decode('{"fields": []}');
|
||||
$entityWidget->setParameter($parameter);
|
||||
$em->persist($entityWidget);
|
||||
}
|
||||
elseif($entityWidget) {
|
||||
$em->remove($entityWidget);
|
||||
}
|
||||
|
||||
// Widget Séparateur
|
||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1600);
|
||||
if(!$entityWidget) $entityWidget = new Widget();
|
||||
|
|
|
@ -2108,6 +2108,43 @@ class PagewidgetController extends Controller
|
|||
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewOnlydocAction(Request $request,$id,$access="config") {
|
||||
$usage=$request->query->get('usage');
|
||||
$group=$request->query->get('group');
|
||||
$user=$this->getUser();
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$entity = $em->getRepository($this->labelentity)->find($id);
|
||||
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
|
||||
|
||||
// Permissions
|
||||
if($access=="config") {
|
||||
$canupdate = true;
|
||||
}
|
||||
else {
|
||||
// On s'assure que l'utilisateur à la permission de voir
|
||||
$page=$entity->getPage();
|
||||
$em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate);
|
||||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
$onlyservice = $this->container->get('cadoles.portal.service.only');
|
||||
$files=$onlyservice->getDocument($group, $folders, $firstfolder, $tasks);
|
||||
$idonly=$em->getRepository("CadolesCoreBundle:Group")->find($group)->getIdOnlyoffice();
|
||||
|
||||
// Render
|
||||
return $this->render($this->labelentity.':viewonlydoc.html.twig', [
|
||||
'entity' => $entity,
|
||||
'canadd' => $cansee,
|
||||
'canupdate' => $cansee,
|
||||
'firstfolder' => $firstfolder,
|
||||
'folders' => $folders,
|
||||
'tasks' => $tasks,
|
||||
'urlonly' => $this->getParameter("widonlyoffice_url")."/products/projects/projects.aspx?prjID=".$idonly,
|
||||
'files' => $files,
|
||||
'access' => $access,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -795,6 +795,10 @@ cadoles_portal_config_panelwidget_view_groupmessage:
|
|||
path: /config/pagewidget/view/groupmessage/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroupmessage, access: config }
|
||||
|
||||
cadoles_portal_config_panelwidget_view_onlydoc:
|
||||
path: /config/pagewidget/view/onlydoc/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewonlydoc, access: config }
|
||||
|
||||
#-- Access user
|
||||
cadoles_portal_user_pagewidget_widget_sumbit:
|
||||
path: /user/pagewidget/submit/{idpage}/{idwidgettype}
|
||||
|
@ -904,3 +908,7 @@ cadoles_portal_user_panelwidget_view_groupmessage:
|
|||
path: /pagewidget/view/groupmessage/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewgroupmessage, access: user }
|
||||
|
||||
cadoles_portal_user_panelwidget_view_onlydoc:
|
||||
path: /pagewidget/view/onlydoc/{id}
|
||||
defaults: { _controller: CadolesPortalBundle:Pagewidget:viewonlydoc, access: user }
|
||||
|
||||
|
|
|
@ -4,3 +4,8 @@ services:
|
|||
arguments: ['@service_container']
|
||||
tags:
|
||||
- { name: form.type }
|
||||
|
||||
cadoles.portal.service.only:
|
||||
public: true
|
||||
class: Cadoles\PortalBundle\Service\onlyService
|
||||
arguments: ['@service_container','@doctrine.orm.entity_manager']
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
{% set theme = app.session.get('theme') %}
|
||||
{% if theme is not empty %}
|
||||
{{ include('@Theme/'~theme~'/function.html.twig') }}
|
||||
{% endif %}
|
||||
|
||||
{% import "@CadolesPortal/Pagewidget/constants.twig" as constants %}
|
||||
|
||||
{% set stylewidget = constants.mystylewidget(entity) %}
|
||||
{% set stylewidgetmenu = constants.mystylewidgetmenu(entity) %}
|
||||
{% set stylewidgetheader = constants.mystylewidgetheader(entity) %}
|
||||
{% set stylewidgetbody = constants.mystylewidgetbody(entity) %}
|
||||
{% set stylewidgetbodyreverse = constants.mystylewidgetbodyreverse(entity) %}
|
||||
|
||||
{% set color = app.session.get('color') %}
|
||||
|
||||
{% set colorbodyback = entity.colorbodyback %}
|
||||
{% if colorbodyback is null %}
|
||||
{% set colorbodyback = color['main'] %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% set colorbodyfont = entity.colorbodyfont %}
|
||||
{% if colorbodyfont is null %}
|
||||
{% set colorbodyfont = color['fontcolorhover'] %}
|
||||
{% endif %}
|
||||
|
||||
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-file" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
|
||||
{% if canupdate or canadd %}
|
||||
<div class="widgetmenu">
|
||||
{% if canupdate %}
|
||||
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
|
||||
{% endif %}
|
||||
|
||||
{% if canadd %}
|
||||
<a style="{{ stylewidgetmenu }}" href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="widgetheader" style="{{ stylewidgetheader }}">
|
||||
{% if entity.icon %}
|
||||
<img src="/{{ alias }}/{{ entity.icon.label }}" class="logo"/>
|
||||
{% else %}
|
||||
<img src="/{{ alias }}/uploads/icon/icon_pin.png" class="logo"/>
|
||||
{% endif %}
|
||||
<span class="title">{{ entity.name }}</span>
|
||||
</div>
|
||||
|
||||
{% if files|length >= 1 or canupdate %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbody }}">
|
||||
<div class="grid clearfix">
|
||||
<div class="grid-sizer grid-small"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
|
||||
{% for file in files %}
|
||||
<div class="grid-item grid-small">
|
||||
<div class="grid-item-content">
|
||||
<a href="{{ file.webUrl }}" target="_blank">
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
{% if file.fileExst ==".png" or file.fileExst ==".jpg" or file.fileExst ==".jpeg" or file.fileExst ==".svg" or file.fileExst ==".gif"%}
|
||||
<img class="grid-item-img" height="110" src="{{file.viewUrl}}">
|
||||
{% else %}
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/{{ file.fileExst | replace({".":""})}}.png">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2 style="color:#{{colorbodyfont}}">{{ file.title }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{% if canadd %}
|
||||
<div class="grid-item grid-small">
|
||||
<div class="grid-item-content">
|
||||
<a href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'>
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_add.png">
|
||||
</div>
|
||||
<div class="grid-item-title">
|
||||
<h2>Plus</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not tasks is empty %}
|
||||
<div style='width:90%; margin:auto;'>
|
||||
<h4 style='margin-bottom:5px;border-bottom:1px solid;'>Tâches</h4>
|
||||
{% for task in tasks %}
|
||||
<li>{{ task.title }}</li>
|
||||
{% if not task.subtasks is empty %}
|
||||
<ul>
|
||||
{% for subtask in task.subtasks %}
|
||||
<li>{{ subtask.title }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
<?php
|
||||
|
||||
namespace Cadoles\PortalBundle\Service;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
||||
class onlyService
|
||||
{
|
||||
protected $container;
|
||||
protected $em;
|
||||
protected $only_activate = false;
|
||||
protected $only_url;
|
||||
protected $only_host;
|
||||
protected $only_user;
|
||||
protected $only_password;
|
||||
protected $debug = false;
|
||||
protected $headers = [];
|
||||
|
||||
public function __construct($container, EntityManager $em)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->em = $em;
|
||||
|
||||
$this->only_activate = $this->container->getParameter('activate_widonlyoffice');
|
||||
if($this->only_activate) {
|
||||
$this->only_activate=$this->container->getParameter('widonlyoffice_sync');
|
||||
if($this->only_activate) {
|
||||
$this->only_url = $this->container->getParameter('widonlyoffice_url')."/api/2.0/";
|
||||
$this->only_user = $this->container->getParameter('widonlyoffice_user');
|
||||
$this->only_password = $this->container->getParameter('widonlyoffice_password');
|
||||
$this->only_host = str_replace("https://","",str_replace("http://","",$this->container->getParameter("widonlyoffice_url")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getDocument($idgroup,&$folders,&$firstfolder,&$tasks) {
|
||||
$files=[];
|
||||
$folders=[];
|
||||
$tasks=[];
|
||||
|
||||
$group=$this->em->getRepository("CadolesCoreBundle:Group")->find($idgroup);
|
||||
if($group&&$group->getIdonlyoffice()) {
|
||||
if($this->only_activate) {
|
||||
if($this->authOnly()) {
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice(),$this->headers);
|
||||
if(!$this->koresponse($response)) {
|
||||
$firstfolder=$response->body->response->projectFolder;;
|
||||
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/files',$this->headers);
|
||||
if(!$this->koresponse($response)) {
|
||||
foreach($response->body->response->files as $fileonly) {
|
||||
array_push($files,$fileonly);
|
||||
}
|
||||
foreach($response->body->response->folders as $folderonly) {
|
||||
$folders[$folderonly->id]=$folderonly;
|
||||
$subfolder=$this->scanfolder($folderonly->id,$folders,$this->headers);
|
||||
foreach($subfolder as $file) {
|
||||
array_push($files,$file);
|
||||
}
|
||||
}
|
||||
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$group->getIdonlyoffice().'/task/open',$this->headers);
|
||||
error_log($this->only_url.'/project/'.$group->getIdonlyoffice().'/tasks/open');
|
||||
if(!$this->koresponse($response)) $tasks=$response->body->response;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
private function authOnly() {
|
||||
// Only Office est-il dans le domaine
|
||||
if(stripos($this->only_url,"/")===0)
|
||||
$this->only_url="https://".$this->container->getParameter("weburl").$this->only_url;
|
||||
$indomaine = (stripos($this->only_url,$this->container->getParameter("weburl"))!==false);
|
||||
|
||||
// Si hors domaine on utilise le proxy si proxy il y a
|
||||
if(!$indomaine) {
|
||||
$PROXYactivate = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYactivate")->getValue();
|
||||
if($PROXYactivate) {
|
||||
$PROXYserver = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYserver")->getValue();
|
||||
$PROXYport = $this->em->getRepository("CadolesCoreBundle:Config")->find("PROXYport")->getValue();
|
||||
\Unirest\Request::proxy($PROXYserver, $PROXYport, CURLPROXY_HTTP, true);
|
||||
}
|
||||
}
|
||||
|
||||
\Unirest\Request::verifyPeer(false);
|
||||
\Unirest\Request::verifyHost(false);
|
||||
\Unirest\Request::timeout(5);
|
||||
$this->headers = ['Host' => $this->only_host, 'Accept' => 'application/json','Content-Type'=>'application/json','Retry-After'=>'5'];
|
||||
$query = array('userName' => $this->only_user, 'password' => $this->only_password);
|
||||
$body = \Unirest\Request\Body::json($query);
|
||||
|
||||
$response = \Unirest\Request::post($this->only_url.'/authentication',$this->headers,$body);
|
||||
if($this->koresponse($response)) return false;
|
||||
$token=$response->body->response->token;
|
||||
$this->headers["Authorization"]=$token;
|
||||
return true;
|
||||
}
|
||||
|
||||
private function koresponse($response) {
|
||||
if($response->code>=Response::HTTP_BAD_REQUEST) {
|
||||
$this->mydebug("ERREUR ".$response->code);
|
||||
if(property_exists($response,"body") && property_exists($response->body,"error")) $this->mydebug("ERREUR ".$response->body->error->message);;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function mydebug($texte) {
|
||||
if($this->debug) error_log($texte);
|
||||
}
|
||||
|
||||
private function scanfolder($folderid,&$folders,$headers) {
|
||||
$files=[];
|
||||
$response = \Unirest\Request::get($this->only_url.'/files/'.$folderid,$headers);
|
||||
if($this->koresponse($response)) return 0;
|
||||
foreach($response->body->response->files as $fileonly) {
|
||||
array_push($files,$fileonly);
|
||||
}
|
||||
foreach($response->body->response->folders as $folderonly) {
|
||||
$folders['"'.$folderonly->id.'"']=$folderonly;
|
||||
$subfolder=$this->scanfolder($folderonly->id,$folders,$headers);
|
||||
foreach($subfolder as $file) {
|
||||
array_push($files,$file);
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
|
@ -220,6 +220,13 @@ parameters:
|
|||
activate_widetherhome: false
|
||||
%end if
|
||||
|
||||
%if %%getVar("ninegate_activate_widfluxbb", 'non') == "oui"
|
||||
activate_widfluxbb: true
|
||||
widfluxbb_url: %%ninegate_widfluxbb_url
|
||||
%else
|
||||
activate_widfluxbb: false
|
||||
%end if
|
||||
|
||||
%if %%getVar("ninegate_activate_widgepi", 'non') == "oui"
|
||||
activate_widgepi: true
|
||||
widgepi_url: %%ninegate_widgepi_url
|
||||
|
|
Loading…
Reference in New Issue