widget only
This commit is contained in:
parent
4d7d0fd82b
commit
1d0628ea03
|
@ -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);
|
||||
|
|
|
@ -2129,15 +2129,18 @@ class PagewidgetController extends Controller
|
|||
if(!$cansee) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
$onlyservice = $this->container->get('cadoles.portal.service.only');
|
||||
$files=$onlyservice->getDocument($group, $folders, $firstfolder);
|
||||
$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' => $canupdate,
|
||||
'canupdate' => $canupdate,
|
||||
'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,
|
||||
]);
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if canadd %}
|
||||
<a style="{{ stylewidgetmenu }}" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers'><i class="fa fa-plus fa-fw"></i></a>
|
||||
<a style="{{ stylewidgetmenu }}" href="{{urlonly}}" target="_blank" title='Plus de fonctionnalités'><i class="fa fa-plus fa-fw"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -51,44 +51,26 @@
|
|||
{% if files|length >= 1 or canupdate %}
|
||||
<div class="widgetbody" style="{{ stylewidgetbody }}">
|
||||
<div class="grid clearfix">
|
||||
{% if canupdate %}
|
||||
<div class="grid-sizer grid-small"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
{% endif %}
|
||||
|
||||
{% for file in files|sort %}
|
||||
{% if loop.index==1 and not canupdate%}
|
||||
<div class="grid-sizer grid-small"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
{% endif %}
|
||||
<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">
|
||||
{% if canadd %}
|
||||
<a style="color:#{{colorbodyfont}}; cursor:pointer" onClick="delFile('widget-{{ entity.id}}','{{file.name }}')" class="item-delete">
|
||||
<i style="color:#{{colorbodyfont}}" class="fa fa-trash" title="Supprimer le fichier"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
<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>
|
||||
|
||||
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
|
||||
<a style="cursor:pointer" onClick="showFrameitem('file-{{entity.id}}-{{loop.index}}','{{ path('cadoles_core_'~access~'_file_view',{'directory':'widget-'~entity.id,'filename':file.name }) }}')">
|
||||
{% else %}
|
||||
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'widget-'~entity.id,'filename':file.name }) }}">
|
||||
{% endif %}
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo">
|
||||
{% if file.thumb is not empty %}
|
||||
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
|
||||
{% else %}
|
||||
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">
|
||||
{% endif %}
|
||||
<div class="grid-item-title">
|
||||
<h2 style="color:#{{colorbodyfont}}">{{ file.title }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2 style="color:#{{colorbodyfont}}">{{ file.name }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -96,19 +78,37 @@
|
|||
|
||||
{% if canadd %}
|
||||
<div class="grid-item grid-small">
|
||||
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'widget-'~entity.id,'type':'all'}) }}');" title='Ajouter des fichiers' class="grid-item-content" style="background-color: #{{color['main']}};cursor:pointer;">
|
||||
<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 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>
|
||||
<div class="grid-item-title">
|
||||
<h2>Ajouter un fichier</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>
|
||||
|
|
|
@ -4,6 +4,7 @@ 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
|
||||
|
@ -35,26 +36,36 @@ class onlyService
|
|||
}
|
||||
}
|
||||
|
||||
public function getDocument($idproject,&$folders,&$firstfolder) {
|
||||
public function getDocument($idgroup,&$folders,&$firstfolder,&$tasks) {
|
||||
$files=[];
|
||||
$folders=[];
|
||||
$tasks=[];
|
||||
|
||||
if($this->only_activate) {
|
||||
if($this->authOnly()) {
|
||||
$response = \Unirest\Request::get($this->only_url.'/project/'.$idproject,$this->headers);
|
||||
if($this->koresponse($response)) return false;
|
||||
$firstfolder=$response->body->response->projectFolder;;
|
||||
$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/'.$idproject.'/files',$this->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,$this->headers);
|
||||
foreach($subfolder as $file) {
|
||||
array_push($files,$file);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +114,10 @@ class onlyService
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue