Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
0.8.2: Begun to add support of weblog export for listeners
- Loading branch information
Showing
5 changed files
with
122 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
namespace App\Controller; | ||
|
||
use App\Repository\ListenerRepository; | ||
use Symfony\Component\Routing\Annotation\Route; // Required for annotations | ||
|
||
/** | ||
* Class Listeners | ||
* @package App\Controller | ||
*/ | ||
class ListenerDelete extends Base | ||
{ | ||
/** | ||
* @Route( | ||
* "/{system}/listener/{id}/delete", | ||
* requirements={ | ||
* "system": "reu|rna|rww" | ||
* }, | ||
* defaults={"id"=""}, | ||
* name="listener_delete" | ||
* ) | ||
*/ | ||
public function listenerDeleteController( | ||
$system, | ||
$id, | ||
ListenerRepository $listenerRepo | ||
) { | ||
if (!(int) $id) { | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
$listener = $listenerRepo->find((int) $id); | ||
if (!$listener) { | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
if (!$this->parameters['isAdmin']) { | ||
return $this->redirectToRoute('listener', ['system' => $system, 'id' => $id]); | ||
} | ||
if ($listener->getCountLogs() > 0) { | ||
$this->session->set( | ||
'lastError', | ||
"Listener ".$listener->getName()." has ".$listener->getCountLogs()." logs and cannot be deleted" | ||
); | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
$em = $this->getDoctrine()->getManager(); | ||
$em->remove($listener); | ||
$em->flush(); | ||
|
||
$this->session->set('lastMessage', "Listener ".$listener->getName()." has been deleted"); | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
namespace App\Controller; | ||
|
||
use App\Repository\ListenerRepository; | ||
use Symfony\Component\Routing\Annotation\Route; // Required for annotations | ||
|
||
/** | ||
* Class Listeners | ||
* @package App\Controller | ||
*/ | ||
class ListenerExport extends Base | ||
{ | ||
/** | ||
* @Route( | ||
* "/{system}/listener/{id}/export/ndbweblog", | ||
* requirements={ | ||
* "system": "reu|rna|rww" | ||
* }, | ||
* defaults={"id"=""}, | ||
* name="listener_export_ndbweblog" | ||
* ) | ||
*/ | ||
public function listenerExportNdbWeblogController( | ||
$system, | ||
$id, | ||
ListenerRepository $listenerRepo | ||
) { | ||
if (!(int) $id) { | ||
$this->session->set('lastError', "Listener cannot be found."); | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
$listener = $listenerRepo->find((int) $id); | ||
if (!$listener) { | ||
$this->session->set('lastError', "Listener cannot be found"); | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
if (!$listener->getCountLogs()) { | ||
$this->session->set('lastError', "Listener <strong>".$listener->getName()."</strong> has no logs to view."); | ||
return $this->redirectToRoute('listeners', ['system' => $system]); | ||
} | ||
$parameters = [ | ||
'id' => $id, | ||
'mode' => 'NDB Weblog for '.$listener->getName(), | ||
'system' => $system, | ||
]; | ||
$parameters = array_merge($parameters, $this->parameters); | ||
return $this->render('listener/export/ndbweblog.html.twig', $parameters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | ||
<html> | ||
<head> | ||
<title>{{ mode }}</title> | ||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> | ||
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0)'> | ||
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))'> | ||
<meta name="Description" content="NDB WebLog Site"> | ||
<script type="text/javascript" src="/dx/ndb/rww/export_ndbweblog_config/{{ id }}"></script> | ||
<script type="text/javascript" src="/dx/ndb/log/functions.js"></script> | ||
<script type="text/javascript" src="/dx/ndb/log/countries.js"></script> | ||
<script type="text/javascript" src="/dx/ndb/rww/export_ndbweblog_stations/{{ id }}&ver=1.1.25"></script> | ||
<script type="text/javascript" src="/dx/ndb/rww/export_ndbweblog_log/{{ id }}"></script> | ||
</head> | ||
<FRAMESET ROWS="*" ONLOAD="top.list()"> | ||
<FRAME NAME="main" src="javascript:''"> | ||
</FRAMESET> | ||
</html> |