diff --git a/migrations/Version20220214105551.php b/migrations/Version20220214105551.php new file mode 100644 index 0000000..2c730ef --- /dev/null +++ b/migrations/Version20220214105551.php @@ -0,0 +1,29 @@ +addSql('ALTER TABLE reference ADD hits INT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE reference DROP hits'); + } +} diff --git a/migrations/Version20220216071047.php b/migrations/Version20220216071047.php new file mode 100644 index 0000000..06b5ba0 --- /dev/null +++ b/migrations/Version20220216071047.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE conference ADD conference_start DATE DEFAULT NULL, ADD conference_end DATE DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE conference DROP conference_start, DROP conference_end'); + } +} diff --git a/migrations/Version20220216091608.php b/migrations/Version20220216091608.php new file mode 100644 index 0000000..84dc347 --- /dev/null +++ b/migrations/Version20220216091608.php @@ -0,0 +1,31 @@ +addSql('ALTER TABLE reference ADD confirmed_in_proc TINYINT(1) DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('ALTER TABLE reference DROP confirmed_in_proc'); + } +} diff --git a/public/js/global.js b/public/js/global.js index deb39e5..0655bad 100644 --- a/public/js/global.js +++ b/public/js/global.js @@ -133,4 +133,45 @@ $(document).ready(function(){ $('input[type=file]').on('change',function(e){ var fileName = e.target.files[0].name; $(this).closest(".custom-file").find('.custom-file-label').html(fileName); +}); + +$('.js-datepicker').datepicker({ + format: 'dd/mm/yyyy' +}); + +function toDate(dateString) { + var dateParts = dateString.split("/"); + return new Date(+dateParts[2], dateParts[1] - 1, +dateParts[0]); +} + +function monthYear(date) { + month = date.toLocaleString('default', { month: 'long' }); + year = date.getFullYear(); + + if (month.length > 3) { + month = month.substring(0, 3) + "."; + } + return { + month: month, + year: year + }; +} + +$(".conference-date").blur(function(){ + start = monthYear(toDate($(".conference-date-start").val())); + end = monthYear(toDate($(".conference-date-end").val())); + + if (!isNaN(end.year) && !isNaN(start.year)) { + newDate = ""; + if (start.month != end.month) { + if (start.year != end.year) { + newDate = start.month + " " + start.year + "-" + end.month + " " + end.year + } else { + newDate = start.month + "-" + end.month + " " + end.year + } + } else { + newDate = end.month + " " + end.year + } + $(".conference-date-formatted").val(newDate); + } }); \ No newline at end of file diff --git a/public/js/search.js b/public/js/search.js index a6613cb..4134e42 100644 --- a/public/js/search.js +++ b/public/js/search.js @@ -102,23 +102,28 @@ $(".conference-location-typeahead").typeahead({ $("form input").on("keyup", function(){ if ($("form").serialize() !== searchContent) { adjustedText = true; + currentPage = 0; } date = new Date(); lastInput = date.getTime(); }).on("change", function(){ if ($("form").serialize() !== searchContent) { adjustedText = true; + currentPage = 0; } date = new Date(); lastInput = date.getTime(); }).on("blur", function(){ if ($("form").serialize() !== searchContent) { adjustedText = true; + currentPage = 0; } date = new Date(); lastInput = date.getTime(); }); +var currentPage = 0; + setInterval(function() { date = new Date(); if (adjustedText && (date.getTime() - lastInput > 600) && (date.getTime() - lastSearch > 600)) { @@ -126,14 +131,26 @@ setInterval(function() { } },200); + +function prevPage() { + currentPage -= 5; + triggerSearch(); +} + +function nextPage() { + currentPage += 5; + triggerSearch(); +} + function triggerSearch() { + adjustedText = false; lastSearch = date.getTime(); $("#searching").toggle(true); $("#no-results").toggle(false); $("#results").empty(); searchContent = $("form").serialize(); - $.post(Routing.generate('search'), searchContent, function(content){ + $.post(Routing.generate('search', { page: currentPage }), searchContent, function(content){ $("#searching").toggle(false); var results = $("#results"); favourites = content.favourites; @@ -149,6 +166,10 @@ function triggerSearch() { $(".show-total #current-total").text(content.results.length); $(".show-total #overall-total").text(content.total); + let total = parseInt($("#overall-total").text()); + $('.prev-page').toggle(currentPage > 0); + $('.next-page').toggle((currentPage + 5) <= total); + $('.page-number').text((currentPage / 5) + 1); },"json"); diff --git a/src/Controller/AuthorController.php b/src/Controller/AuthorController.php index 22fd948..432261c 100644 --- a/src/Controller/AuthorController.php +++ b/src/Controller/AuthorController.php @@ -31,10 +31,11 @@ public function indexAction(Request $request, PaginatorInterface $paginator) $manager = $this->getDoctrine()->getManager(); $search = $manager->getRepository(Author::class) ->createQueryBuilder("a"); - + $search->addSelect('SIZE(a.references) as HIDDEN total'); if ($form->isSubmitted() && $form->isValid()) { + $terms = $form->get('terms')->getData(); - + $parts = explode(".", $terms); // get initials @@ -68,10 +69,10 @@ public function indexAction(Request $request, PaginatorInterface $paginator) $search->orWhere("LOWER(a.name) LIKE :terms") ->setParameter("terms", '%' . mb_strtolower($lastName) . '%'); } + } - $pagination = $paginator->paginate( $search->getQuery(), $request->query->getInt('page', 1), diff --git a/src/Controller/CleanController.php b/src/Controller/CleanController.php index 5bc6db8..d77d4db 100644 --- a/src/Controller/CleanController.php +++ b/src/Controller/CleanController.php @@ -5,10 +5,14 @@ use App\Entity\Author; use App\Entity\Favourite; use App\Entity\Reference; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\JsonResponse; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; use App\Service\AuthorService; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\Routing\Annotation\Route; +use Knp\Component\Pager\PaginatorInterface; /** * Clean controller, for basic data cleansing purposes @@ -17,6 +21,47 @@ */ class CleanController extends AbstractController { + /** + * @IsGranted("ROLE_ADMIN") + * @Route("/talks/{id}/{talk}", name="talk_update", options={"expose"=true}) + */ + public function updatePossibleTalkAction(Reference $reference, bool $talk) { + $manager = $this->getDoctrine()->getManager(); + $reference->setInProc($talk); + $reference->setConfirmedInProc(1); + $manager->flush(); + return new JsonResponse(); + } + + /** + * @IsGranted("ROLE_ADMIN") + * @Route("/talks", name="talk_clean") + */ + public function talkAction(Request $request, PaginatorInterface $paginator) + { + $allPossibleTalks = $this->getDoctrine()->getManager() + ->getRepository(Reference::class) + ->createQueryBuilder("r") + ->select("r.id") + ->addSelect('SIZE(r.authors) as HIDDEN authorsCount') + ->where('r.position is null or r.position = :empty') + ->andWhere('r.inProc = 1') + ->andWhere('r.confirmedInProc is null') + ->setParameter("empty", "") + ->having('authorsCount = 1') + ->getQuery() + ->getArrayResult(); + + $count = count($allPossibleTalks); + $referenceId = array_rand($allPossibleTalks); + + $reference = $this->getDoctrine()->getManager() + ->getRepository(Reference::class) + ->find($allPossibleTalks[$referenceId]['id']); + + // parameters to template + return $this->render('clean/talk.html.twig', array('reference' => $reference, 'count'=>$count)); + } /** * Regenerate cache for all references. * @Route("/duplicate", name="duplicate_clean") diff --git a/src/Controller/ConferenceController.php b/src/Controller/ConferenceController.php index 045f8bf..1d613d4 100644 --- a/src/Controller/ConferenceController.php +++ b/src/Controller/ConferenceController.php @@ -78,7 +78,7 @@ public function indexAction(Request $request, PaginatorInterface $paginator) $manager = $this->getDoctrine()->getManager(); $search = $manager->getRepository(Conference::class) - ->createQueryBuilder("c"); + ->createQueryBuilder("c")->orderBy("c.id", "DESC"); if ($form->isSubmitted() && $form->isValid()) { $terms = mb_strtolower($form->get('terms')->getData()); diff --git a/src/Controller/ReferenceController.php b/src/Controller/ReferenceController.php index fe6d681..e7a9247 100644 --- a/src/Controller/ReferenceController.php +++ b/src/Controller/ReferenceController.php @@ -51,7 +51,7 @@ public function indexAction(Request $request, PaginatorInterface $paginator) $manager = $this->getDoctrine()->getManager(); $search = $manager->getRepository(Reference::class) - ->createQueryBuilder("r"); + ->createQueryBuilder("r")->orderBy("r.hits", "DESC"); if ($form->isSubmitted() && $form->isValid()) { $terms = mb_strtolower($form->get('terms')->getData()); @@ -127,7 +127,6 @@ public function showAction(Reference $reference) $paperService = new PaperService(); $update = $paperService->check($reference); - if ($update || $reference->__toString() !== $reference->getCache()) { $reference->setCache($reference->__toString()); $this->getDoctrine()->getManager()->flush(); diff --git a/src/Controller/SearchController.php b/src/Controller/SearchController.php index 5d92f0a..89f1833 100644 --- a/src/Controller/SearchController.php +++ b/src/Controller/SearchController.php @@ -33,7 +33,7 @@ public function indexAction(Request $request, FavouriteService $favouriteService $references = []; if ($form->isSubmitted() && $form->isValid()) { $query = $this->getDoctrine()->getManager() - ->getRepository(Reference::class)->search($search); + ->getRepository(Reference::class)->search($search)->orderBy('r.hits', 'DESC'); if ($query !== false) { $references = $query->setMaxResults(5) @@ -69,12 +69,12 @@ private function endsWith($string, $endString) /** * Search page * JSON results only of page - * @Route("/search", name="search", options={"expose"=true}) + * @Route("/search/{page}", name="search", options={"expose"=true}, requirements={"page"="\d+"}) * @param Request $request * @return JsonResponse * @throws \Doctrine\ORM\NonUniqueResultException */ - public function searchAction(Request $request, FavouriteService $favouriteService, CurrentConferenceService $currentConferenceService) { + public function searchAction(int $page = 0, Request $request, FavouriteService $favouriteService, CurrentConferenceService $currentConferenceService) { $response = ["favourites" => $favouriteService->getFavourites()]; $search = new Search(); @@ -90,8 +90,10 @@ public function searchAction(Request $request, FavouriteService $favouriteServic if ($query !== false) { $response["total"] = $query->select("COUNT(r)")->getQuery()->getSingleScalarResult(); $query = $this->getDoctrine()->getManager() - ->getRepository(Reference::class)->search($search); - $results = $query->setMaxResults(5) + ->getRepository(Reference::class)->search($search)->orderBy('r.hits', 'DESC'); + $results = $query + ->setFirstResult($page) + ->setMaxResults(5) ->getQuery() ->getResult(); diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 870d872..3489ebf 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -9,6 +9,7 @@ use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Annotation\Route; +use Knp\Component\Pager\PaginatorInterface; /** * User controller. @@ -22,26 +23,22 @@ class UserController extends AbstractController * @IsGranted("ROLE_ADMIN") * @Route("/", name="user_index") */ - public function indexAction(EntityManagerInterface $em) + public function indexAction(Request $request, PaginatorInterface $paginator) { - /** @var User[] $pending */ - $pending = $em->getRepository('App:User')->findBy(["enabled"=>true]); - - $pending = array_filter($pending, function(User $user) { - return !$user->hasRole("ROLE_ADMIN"); - }); - - $users = $em->getRepository('App:User')->findBy(["enabled"=>true]); - - $current = $this->getUser(); - $admins = array_filter($users, function(User $user) use ($current) { - return $user->hasRole("ROLE_ADMIN") && $user != $current; - }); - - return $this->render('user/index.html.twig', array( - 'pending' => $pending, - 'admins' => $admins, - )); + $manager = $this->getDoctrine()->getManager(); + $query = $manager->getRepository(User::class) + ->createQueryBuilder("u") + ->where("u.enabled = 1") + ->getQuery(); + + $pagination = $paginator->paginate( + $query, + $request->query->getInt('page', 10), + 10 + ); + + // parameters to template + return $this->render('user/index.html.twig', array('pagination' => $pagination)); } diff --git a/src/DataFixtures/ConferenceFixtures.php b/src/DataFixtures/ConferenceFixtures.php index f8f90b9..f48b0b8 100644 --- a/src/DataFixtures/ConferenceFixtures.php +++ b/src/DataFixtures/ConferenceFixtures.php @@ -14,6 +14,9 @@ class ConferenceFixtures extends Fixture public function __construct($rootDir) { $this->documentRoot = $rootDir; + if ($rootDir == "") { + $this->documentRoot = getcwd(); + } } public function load($manager) @@ -21,7 +24,7 @@ public function load($manager) ini_set('memory_limit','2G'); ini_set('max_execution_time', 600); - $path = $this->documentRoot. "/../src/App/DataFixtures/Import/"; + $path = $this->documentRoot. "/src/DataFixtures/Import/"; $filename = $path . "conferences.csv"; if (($handle = fopen($filename, "r")) !== FALSE) { diff --git a/src/DataFixtures/ReferenceFixtures.php b/src/DataFixtures/ReferenceFixtures.php index 586212f..b52ed70 100644 --- a/src/DataFixtures/ReferenceFixtures.php +++ b/src/DataFixtures/ReferenceFixtures.php @@ -17,22 +17,27 @@ class ReferenceFixtures extends Fixture implements DependentFixtureInterface public function __construct($rootDir, ImportService $importService) { $this->documentRoot = $rootDir; + if ($rootDir == "") { + $this->documentRoot = getcwd(); + } + $this->importService = $importService; } public function load($manager) { - $path = $this->documentRoot . "/../src/App/DataFixtures/"; + $path = $this->documentRoot . "/src/DataFixtures/"; $conferences = $path . "Import/conferences.csv"; if (($handle = fopen($conferences, "r")) !== FALSE) { while (($data = fgetcsv($handle, 4000, ",")) !== FALSE) { - $filename = $path . "/References/" . $data[4] . ".csv"; + $filename = $path . "References/" . $data[4] . ".csv"; if (file_exists($filename)) { $conference = $manager->getRepository(Conference::class)->findOneBy(["code"=>$data[1]]); if ($conference) { try { $file = file($filename); + dump($filename, file_exists($filename)); echo "Importing " . count($file) . " reference for " . $conference . "\n"; $references = $this->importService->import($filename, $conference); echo "Successfully imported: " . $references . "\n"; diff --git a/src/Entity/Conference.php b/src/Entity/Conference.php index 9dec25b..3a03424 100644 --- a/src/Entity/Conference.php +++ b/src/Entity/Conference.php @@ -37,6 +37,19 @@ class Conference implements \JsonSerializable */ private $code; + /** + * Start of conference (e.g. 18 March 2018) + * @var DateTime + * @ORM\Column(type="date", nullable=true) + */ + private $conferenceStart; + + /** + * Last day of conference (e.g. 21 March 2018) + * @var DateTime + * @ORM\Column(type="date", nullable=true) + */ + private $conferenceEnd; /** * This is the date of the conference, Eg. May 2018 * @var string @@ -422,6 +435,13 @@ public function getIssn(){ return $this->issn; } + public function getIssnFormatted() { + $issn = $this->getIssn(); + $result = substr($issn, 0, 4) . "-"; + $result .= substr($issn, 4, 8); + return $result; + } + public function setIssn($issn){ $this->issn = $issn; } @@ -430,6 +450,16 @@ public function getIsbn(){ return $this->isbn; } + public function getIsbnFormatted() { + $isbn = $this->getIsbn(); + $result = substr($isbn, 0, 3) . "-"; + $result .= substr($isbn, 3, 1) . "-"; + $result .= substr($isbn, 4, 2) . "-"; + $result .= substr($isbn, 6, 6) . "-"; + $result .= substr($isbn, 12, 1); + return $result; + } + public function setIsbn($isbn){ $this->isbn = $isbn; } @@ -449,4 +479,20 @@ public function getPubYear(){ public function setPubYear($pubYear){ $this->pubYear = $pubYear; } + + public function getConferenceStart(){ + return $this->conferenceStart; + } + + public function setConferenceStart($conferenceStart){ + $this->conferenceStart = $conferenceStart; + } + + public function getConferenceEnd(){ + return $this->conferenceEnd; + } + + public function setConferenceEnd($conferenceEnd){ + $this->conferenceEnd = $conferenceEnd; + } } diff --git a/src/Entity/Reference.php b/src/Entity/Reference.php index 43a3902..471d736 100644 --- a/src/Entity/Reference.php +++ b/src/Entity/Reference.php @@ -23,6 +23,13 @@ class Reference implements \JsonSerializable */ private $id; + /** + * Numbers of hits a reference has + * @var int + * @ORM\Column(type="integer", nullable=true) + */ + private $hits; + /** * The original imported author string to help aid with correcting errors. * @var string @@ -143,6 +150,11 @@ class Reference implements \JsonSerializable */ private $favourites; + /** + * @ORM\Column(type="boolean", nullable=true) + */ + public $confirmedInProc; + /** * Constructor */ @@ -385,12 +397,20 @@ public function doi() { } } - public function doiText() { + public function doiOnly() { if ($this->getCustomDoi() !== null && $this->getCustomDoi() !== "") { - return 'doi:' . $this->getCustomDoi(); + return '' . $this->getCustomDoi(); } elseif ($this->getConference()->isUseDoi() && $this->getInProc()) { - return 'doi:10.18429/JACoW-' . $this->getConference()->getDoiCode() . '-' . $this->getPaperId(); + return '10.18429/JACoW-' . $this->getConference()->getDoiCode() . '-' . $this->getPaperId(); + } + return ""; + } + + public function doiText() { + $doi = $this->doiOnly(); + if ($doi !== "") { + return "doi:" . $doi; } return ""; } @@ -648,4 +668,20 @@ public function setCustomDoi($customDoi) { $this->customDoi = $customDoi; } + + public function getHits() { + return $this->hits; + } + + public function setHits($hits) { + $this->hits = $hits; + } + + public function getConfirmedInProc() { + return $this->confirmedInProc; + } + + public function setConfirmedInProc($confirmed) { + $this->confirmedInProc = $confirmed; + } } diff --git a/src/Form/ConferenceType.php b/src/Form/ConferenceType.php index 9847e66..2a7c4fd 100644 --- a/src/Form/ConferenceType.php +++ b/src/Form/ConferenceType.php @@ -23,8 +23,23 @@ public function buildForm(FormBuilderInterface $builder, array $options) ->add('code', null, array("label"=>"Conference Code (format ACRONYM'YY)")) ->add('series', null, ["label"=>"Series (e.g. International Beam Instrumentation Conference)", "required"=>false]) ->add('seriesNumber', null, ["label"=>"Series Number (e.g. 12)", "required"=>false]) + ->add('conferenceStart', null, [ + 'widget' => 'single_text', + "label"=>"First day of conference", + 'html5' => false, + 'attr' => ['class' => 'js-datepicker conference-date conference-date-start'], + 'format' => 'dd/MM/yyyy', + "required"=>false]) + ->add('conferenceEnd', null, [ + 'widget' => 'single_text', + 'html5' => false, + 'attr' => ['class' => 'js-datepicker conference-date conference-date-end'], + 'format' => 'dd/MM/yyyy', + "label"=>"Last day of conference", + "required"=>false]) ->add('year',null,array( - "label"=>"Month Year of Conference (format May 2018, Jun.-Jul. 2019 or Jun. 2019)")) + "label"=>"Month Year of Conference (format May 2018, Jun.-Jul. 2019 or Jun. 2019)", + 'attr' => ['class' => 'conference-date-formatted'],)) ->add('location', null, array("label"=>"City, State (if USA), Country")) ->add("useDoi", ChoiceType::class, ["choices"=>[ "No"=>0,"Yes"=>1]]) ->add("doiCode", TextType::class, ["label"=>"Doi Code: IPAC2017 (from 10.18429/JACoW-THISCODE-PAPERID)", "required"=>false]) diff --git a/src/Service/FavouriteService.php b/src/Service/FavouriteService.php index 45eb3fe..5c4a854 100644 --- a/src/Service/FavouriteService.php +++ b/src/Service/FavouriteService.php @@ -104,6 +104,7 @@ private function save($favourites) { $newFav->setUser($user); $reference = $this->manager->getRepository(Reference::class)->find($fav); $newFav->setReference($reference); + $reference->setHits(($reference->getHits() ?? 0) + 1); $this->manager->persist($newFav); } } diff --git a/src/Service/FormService.php b/src/Service/FormService.php index 72b7b62..5fc0e91 100644 --- a/src/Service/FormService.php +++ b/src/Service/FormService.php @@ -41,7 +41,7 @@ public function toggleForm() { public function getForm() { if (!$this->getSession()->has("form")) { - return "long"; + return "short"; } else { return $this->getSession()->get("form"); diff --git a/src/Service/ImportService.php b/src/Service/ImportService.php index b221135..591b349 100644 --- a/src/Service/ImportService.php +++ b/src/Service/ImportService.php @@ -33,6 +33,10 @@ public function __construct(EntityManagerInterface $manager, CsvService $csvServ private function findReferences($filename) { $contents = $this->csvService->open($filename); + $contentsWithoutExcluded = array_filter($contents, function ($data) { + return !in_array(trim($data[5]),["4","5"]); + }); + /** @var Reference[] $references */ $references = array_map(function ($data) { $reference = new Reference(); @@ -51,7 +55,7 @@ private function findReferences($filename) { } } if (isset($data[5])) { - $inProc = !in_array(trim($data[5]),["no", "3", "4", "5"]); + $inProc = !in_array(trim($data[5]),["no", "3"]); $reference->setInProc($inProc); } if (isset($data[6])) { @@ -65,7 +69,7 @@ private function findReferences($filename) { } } return $reference; - }, $contents); + }, $contentsWithoutExcluded); // filter out header rows $references = array_filter($references, function(Reference $reference) { @@ -91,7 +95,8 @@ public function merge($filename, Conference $conference) { foreach ($dbReferences as $dbReference) { $found = false; foreach ($fileReferences as $fileReference) { - if ($dbReference->getContributionId() == $fileReference->getContributionId()) { + if ($dbReference->getContributionId() !== null && + $dbReference->getContributionId() == $fileReference->getContributionId()) { $found = true; } } @@ -105,7 +110,8 @@ public function merge($filename, Conference $conference) { foreach ($fileReferences as $fileReference) { $found = false; foreach ($dbReferences as $dbReference) { - if ($dbReference->getContributionId() == $fileReference->getContributionId()) { + if ($dbReference->getContributionId() !== null && + $dbReference->getContributionId() == $fileReference->getContributionId()) { $found = true; $dbReference->setPaperId($fileReference->getPaperId()); $dbReference->setPosition($fileReference->getPosition()); @@ -128,7 +134,6 @@ public function merge($filename, Conference $conference) { } } if (!$found) { - $calculateAuthors[] = $fileReference; $this->manager->persist($fileReference); } diff --git a/templates/author/index.html.twig b/templates/author/index.html.twig index 47b8a44..3b94ae7 100644 --- a/templates/author/index.html.twig +++ b/templates/author/index.html.twig @@ -11,7 +11,8 @@ - {{ knp_pagination_sortable(pagination, 'Name', 'a.name') }} + + {{ knp_pagination_sortable(pagination, 'References (Included in reference)', 'total') }} {% if is_granted("ROLE_ADMIN") %} {% endif %} @@ -21,6 +22,17 @@ {% for author in pagination %} + {% if is_granted("ROLE_ADMIN") %}
{{ knp_pagination_sortable(pagination, 'Name', 'a.name') }}Actions
{{ author.name }} + + {% set primary = 0 %} + {% for reference in author.references %} + {% if author.name in reference.author %} + {% set primary = primary + 1 %} + {% endif %} + {% endfor %} + {{ author.references|length }} ({{ primary }}) + + Edit diff --git a/templates/base.html.twig b/templates/base.html.twig index be388f4..77a1432 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -17,6 +17,7 @@ {% block stylesheets %} + @@ -123,6 +124,7 @@ + diff --git a/templates/clean/talk.html.twig b/templates/clean/talk.html.twig new file mode 100644 index 0000000..56e37c6 --- /dev/null +++ b/templates/clean/talk.html.twig @@ -0,0 +1,44 @@ +{% extends 'base.html.twig' %} + +{% block javascripts %} + {{ parent() }} + +{% endblock %} +{% block body %} +

Possible Talk

+
+ + {{ reference|latin }}
+ + {% if reference.paperUrl is not null %} +

Paper URL: {{ reference.paperUrl }}

+ {% endif %} + +

+ +
+ Not Talk + Skip + Change to Talk + +

+ Well done, only {{ count }} more possible talks! +
+{% endblock %} diff --git a/templates/conference/show.html.twig b/templates/conference/show.html.twig index 5e98c7b..7e21104 100644 --- a/templates/conference/show.html.twig +++ b/templates/conference/show.html.twig @@ -41,10 +41,10 @@ {% endif %} {% if conference.isbn %} - ISBN {{ conference.isbn[0:3] ~ '-' ~ conference.isbn[3:1] ~ '-' ~ conference.isbn[4:2] ~ '-' ~ conference.isbn[6:6] ~ '-' ~ conference.isbn[12:1] }}
+ ISBN {{ conference.isbnFormatted }}
{% endif %} {% if conference.issn %} - ISSN {{ conference.issn[0:4] ~ '-' ~ conference.issn[4:4] }}
+ ISSN {{ conference.issnFormatted }}
{% endif %}

diff --git a/templates/feedback/index.html.twig b/templates/feedback/index.html.twig index 77ea820..4bf95f1 100644 --- a/templates/feedback/index.html.twig +++ b/templates/feedback/index.html.twig @@ -1,9 +1,6 @@ {% extends 'base.html.twig' %} {% block body %} - {% if is_granted("ROLE_ADMIN") %} - Add Reference - {% endif %}

Feedback


{% set filters = {'f.email': 'Contact','f.feedback': 'Feedback'} %} diff --git a/templates/reference/bibtex.html.twig b/templates/reference/bibtex.html.twig index fe6dfd8..64419b9 100644 --- a/templates/reference/bibtex.html.twig +++ b/templates/reference/bibtex.html.twig @@ -1,25 +1,55 @@ -@InProceedings{{ '{' ~ reference.firstLastName ~ (reference.conference.code|replace({"'":""}) ~ '-' ~ reference.paperId)|trim(" -") ~ ',' }} +{%- if reference.conference.isPublished and reference.inProc -%} +@inproceedings +{%- elseif current_conference.hasCurrent and current_conference.current == reference.conference -%} +{% set this_conference = true %} +@conference +{%- else -%} +@unpublished +{%- endif -%}{{ '{' ~ (reference.firstLastName ~ (reference.conference.code|replace({"'":""}) ~ '-' ~ reference.paperId)|trim(" -"))|lower ~ ',' }} {{ "author = {" ~ reference.author|replace({", and ":" and ",", ": " and ", " et al.": " and others"}) ~ "}," }} - {{ "title = {" ~ reference.title ~ "}," }} -{% if reference.conference.published %} - {{ "booktitle = {Proc. " ~ reference.conference.name ~ " (" ~ reference.conference.code ~ ")}," }} -{% else %} - {{ "booktitle = {presented at the " ~ reference.conference.name ~ " (" ~ reference.conference.code ~ ")}," }} + {{ "title = {{" ~ reference.title ~ "}}," }} +{% if reference.conference.isPublished %} + {{ "booktitle = {Proc. " ~ reference.conference.code ~ "}," }} {% endif %} {% if reference.position is not null and reference.position != "99-98" and reference.position != "na" %} {{ "pages = {" ~ reference.position|replace({"-": "--"}) ~ "}," }} {% endif %} {{ "paper = {" ~ reference.paperId ~ "}," }} +{% if reference.conference.pubYear is null and reference.conference.pubMonth is null %} + {{ "venue = {" ~ reference.conference.location ~ ", " ~ reference.conference.year ~ "}," }} +{% else %} {{ "venue = {" ~ reference.conference.location ~ "}," }} - {{ "publisher = {JACoW Publishing}," }} - {{ "month = {" ~ reference.conference.year|split(" ")[0] ~ "}," }} - {{ "year = {" ~ reference.conference.year|split(" ")[1] ~ "}," }} +{% endif %} +{% if not reference.conference.isPublished or not reference.inProc %} + {{ "intype = {presented at the},"}} +{% endif %} +{% if reference.conference.series %} + {{ "series = {" ~ reference.conference.series ~ "}," }} +{% endif %} +{% if reference.conference.seriesNumber %} + {{ "number = {" ~ reference.conference.seriesNumber ~ "}," }} +{% endif %} + {{ "publisher = {JACoW Publishing, Geneva, Switzerland}," }} +{% if reference.conference.pubMonth %} + {{ "month = {" ~ reference.conference.pubMonth ~ "}," }} +{% endif %} +{% if reference.conference.pubYear %} + {{ "year = {" ~ reference.conference.pubYear ~ "}," }} +{% endif %} +{% if reference.conference.issn %} + {{ "issn = {" ~ reference.conference.issnFormatted ~ "}," }} +{% endif %} +{% if reference.conference.isbn %} + {{ "isbn = {" ~ reference.conference.isbnFormatted ~ "}," }} +{% endif %} {% if reference.doiVerified %} - {{ "doi = {" ~ reference.doiText ~ "}," }} - {{ "note = {" ~ reference.doi ~ "}," }} + {{ "doi = {" ~ reference.doiOnly ~ "}," }} {% endif %} {% if reference.paperUrl is not null %} {{ "url = {" ~ reference.paperUrl ~ "}," }} +{% endif %} +{% if not reference.conference.isPublished or not reference.inProc %} + {{ "note = {presented at " ~ reference.conference.code ~ ", " ~ reference.conference.location ~ ", " ~ reference.conference.year ~ ", paper " ~ reference.paperId ~ ", " ~ (this_conference is defined ? "this conference" : "unpublished") ~ "}," }} {% endif %} {{ "language = {english}" }} {{ "}" -}} diff --git a/templates/reference/latex.html.twig b/templates/reference/latex.html.twig index dc16063..54b70e1 100644 --- a/templates/reference/latex.html.twig +++ b/templates/reference/latex.html.twig @@ -11,6 +11,9 @@ {{ reference.paperSection ~ ", this conference" }} {%- else -%} {{ reference.paperSection|replace({"-": "--"}) }} + {%- if not reference.conference.isPublished or not reference.inProc -%} + , unpublished + {%- endif -%} {%- endif -%}. {%- if reference.doi and reference.doiVerified -%} {{ '\n \\url{' ~ reference.doiText ~ '}' -}} diff --git a/templates/reference/show.html.twig b/templates/reference/show.html.twig index 5d3d0d6..b8a900f 100644 --- a/templates/reference/show.html.twig +++ b/templates/reference/show.html.twig @@ -69,14 +69,12 @@ {% endspaceless %}

- {% if reference.inProc %} -

For BibTeX

-

{% spaceless %} - - {% endspaceless %} -

- {% endif %} + {% endspaceless %} +

{% if form_service.getForm == "long" %} diff --git a/templates/search/index.html.twig b/templates/search/index.html.twig index c238992..862e01e 100644 --- a/templates/search/index.html.twig +++ b/templates/search/index.html.twig @@ -41,8 +41,15 @@ {% endfor %} - -

Showing {{ references|length }} results of total {{ total }}

+ +

+ + Showing {{ references|length }} results of total {{ total }} +

+
+ Page 1 + Next » +

diff --git a/templates/user/index.html.twig b/templates/user/index.html.twig index 221a15d..be7ea53 100644 --- a/templates/user/index.html.twig +++ b/templates/user/index.html.twig @@ -1,63 +1,53 @@ {% extends 'base.html.twig' %} {% block body %} -

User Administration

- +

Users


- {% if pending|length != 0 %} -

Pending Promotion

- -

Below are a list of users pending promotion.

- -
- - - - - - - - - {% for user in pending %} - - - - - {% endfor %} - -
EmailActions
{{ user.email }} + {% set filters = {'u.email': 'Email'} %} -
- Promote + {{ knp_pagination_filter(pagination, filters) }} - -
-
-
-
+ {% set filtered = 0 %} + {% if pagination.params.filterField is defined and pagination.params.filterField in filters|keys %} + {% set filtered = 1 %} + {% set label = filters[pagination.params.filterField] %} + {% set field = pagination.params.filterField|slice(2) %} {% endif %} +
-

Current Admins

-
- - +
+ + + + + + + + {% for user in pagination %} - - + + - - - {% for user in admins %} - - - - - {% endfor %} - -
EmailActions
EmailActions{{ user.email }} +
+ {% if 'ROLE_ADMIN' in user.roles %} + Adminstrator + {% else %} + Promote + {% endif %} +
+
{{ user.email }} -
- -
-
+ {% endfor %} + +
+
+
+
+ {{ pagination.getTotalItemCount }} results +
+ +
+ {% endblock %}