diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/FrameController.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/FrameController.php new file mode 100644 index 00000000..3ecb370c --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Controller/FrameController.php @@ -0,0 +1,114 @@ +getPermission($access,$directory,$widget,$grp); + $subdirectory=$request->get("subdirectory"); + $clear=$request->get("clear"); + $view=$request->get("view"); + $defaultview=$request->get("defaultview"); + + // Récupérer en session le dernier subdirectory visité + $sessionsubdirectory = $this->get('session')->get('sessionsubdirectory'); + if(!is_array($sessionsubdirectory)) $sessionsubdirectory=[]; + + if($clear) { + if(array_key_exists($directory,$sessionsubdirectory)) unset($sessionsubdirectory[$directory]); + $this->get('session')->set('sessionsubdirectory',$sessionsubdirectory); + } + else { + if(!$subdirectory) { + if(array_key_exists($directory,$sessionsubdirectory)) $subdirectory=$sessionsubdirectory[$directory]; + } + else { + $sessionsubdirectory[$directory] = $subdirectory; + $this->get('session')->set('sessionsubdirectory',$sessionsubdirectory); + } + } + + // Récupérer en session le mode de visualisation + $sessionviewdirectory = $this->get('session')->get('sessionviewdirectory'); + if(!is_array($sessionviewdirectory)) $sessionviewdirectory=[$directory=>$defaultview]; + if(!array_key_exists($directory,$sessionviewdirectory)) $sessionviewdirectory[$directory]=$defaultview; + if($view) + $sessionviewdirectory[$directory] = $view; + $this->get('session')->set('sessionviewdirectory',$sessionviewdirectory); + + // Initialiser le service only + $onlyservice = $this->container->get('cadoles.portal.service.only'); + $firstfolder=($subdirectory?$subdirectory:null); + $files=$onlyservice->getDocument($grp->getId(), $firstfolder, $parents, $tasks); + + // Récupération du numéro de groupe oo + if($grp) $idonly= $grp->getIdOnlyoffice(); + else $idonly=0; + + // Récupération des paramétres du widget + $apponly=0; + foreach($widget->getParameter()["fields"] as $parameter) { + switch($parameter["id"]) { + case "apponly": + $apponly=$parameter["value"]; + break; + } + } + + return $this->render('CadolesPortalBundle:Frame:only.html.twig',[ + 'useheader' => false, + 'usemenu' => false, + 'usesidebar' => false, + 'access' => $access, + 'urlonly' => $this->getParameter("widonlyoffice_url")."/products/projects/tmdocs.aspx?prjID=".$idonly."#".$firstfolder, + 'directory' => $directory, + 'parents' => $parents, + 'subdirectory' => $subdirectory, + 'files' => $files, + 'canupdate' => $canupdate, + 'view' => $sessionviewdirectory[$directory], + 'tasks' => $tasks, + 'apponly' => $apponly + ]); + } + + + public function getPermission($access, $id, &$widget, &$group) { + $em = $this->getDoctrine()->getManager(); + + // Récupération du widget & de la page + $widget=$em->getRepository("CadolesPortalBundle:Pagewidget")->find($id); + if (!$widget) throw $this->createNotFoundException('Unable to find entity.'); + $page=$widget->getPage(); + + $groups=$page->getGroups(); + $group=$groups[0]; + + if($access=="user") { + // On s'assure que l'utilisateur à la permission de voir + $em->getRepository("CadolesPortalBundle:Page")->getPermission($this->getUser(),$page,$cansee,$canupdate); + if(!$cansee) throw $this->createNotFoundException('Permission denied'); + } + else $canupdate=true; + + return $canupdate; + } +} diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Frame/only.html.twig b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Frame/only.html.twig new file mode 100644 index 00000000..788b249c --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Frame/only.html.twig @@ -0,0 +1,179 @@ +{% extends '@CadolesCore/base.html.twig' %} + +{% block localstyle %} + #page-wrapper { + min-height:0px !important; + } + + .grid .grid-list .grid-item-logo { + margin:0px; + } + + .grid .grid-list .grid-item-title h2 { + font-size: 14px; + line-height: 22px; + height: 22px; + } + + .grid-item-title h2 { + text-transform: initial !important; + } + +{% endblock %} + +{% block pagewrapper %} + +
+ + + +
+ +
+ +
+
+
+ + + {% for dir in files %} + {% for folder in dir.folders %} + + {% endfor %} + + {% for file in dir.files %} + + {% endfor %} + {% endfor %} +
+
+ + {% if not tasks is empty %} +
+ {% if apponly==0 %} +

Tâches

+ {%endif%} + + {% if apponly==0 or apponly==2 %} + {% for task in tasks %} +
  • {{ task.title }}
  • + {% if not task.subtasks is empty %} + + {% endif %} + {% endfor %} + {%endif%} +
    + {% endif %} +{% endblock %} + + +{% block localjavascript %} + var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'}; + + + // Création des grilles d'items + $('body').imagesLoaded(function() { + var grid = $('.grid').masonry(optiongrid); + ajust(); + }); + + $('document').ready(function(){ + if(inIframe()) { + color=$("#frame-{{directory}}",window.parent.document).data("color"); + } + else { + color = "#{{ color["main"]}}"; + } + + $(".grid-item-title > h2").css("color",color); + $("#onlytasks").css("color",color); + }); + + $(window).resize(function() { + ajust(); + }); + + + function ajust(formodal) { + if(inIframe()) { + if(!$("#frame-{{directory}}",window.parent.document).hasClass("notframeajust")) { + $("#frame-{{directory}}",window.parent.document).height($("#page-wrapper").height() + 10); + } + } + } +{% endblock %} + + +