Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

common changes #9

Merged
merged 20 commits into from
May 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Build Status](https://travis-ci.org/okulbilisim/ojs.png?branch=master)](https://travis-ci.org/okulbilisim/ojs)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/okulbilisim/ojs/badges/quality-score.png?s=1f77d7ffae4541cee084070f5fb33819abd2c561)](https://scrutinizer-ci.com/g/okulbilisim/ojs/)

[![License](https://poser.pugx.org/okulbilisim/ojs/license.png)](https://packagist.org/packages/okulbilisim/ojs)
[![Latest Unstable Version](https://poser.pugx.org/okulbilisim/ojs/v/unstable.png)](https://packagist.org/packages/okulbilisim/ojs)

**Warning** : This project is under development.

Expand Down
11 changes: 4 additions & 7 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
class AppKernel extends Kernel {

public function registerBundles()
{
public function registerBundles() {
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
Expand All @@ -26,7 +24,7 @@ public function registerBundles()
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Ojstr\ManagerBundle\OjstrManagerBundle(),
new Ojstr\ApiBundle\OjstrApiBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
Expand All @@ -38,8 +36,7 @@ public function registerBundles()
return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
public function registerContainerConfiguration(LoaderInterface $loader) {
$loader->load(__DIR__ . '/config/config_' . $this->getEnvironment() . '.yml');
}

Expand Down
16 changes: 16 additions & 0 deletions app/Resources/views/language_selector.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="dropdown">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
Change Language [{{ app.request.locale }}]
<span class="caret"></span>
</button>
<ul class="dropdown-menu">


{% for lang in languages%}
<li class="{% if app.request.locale == lang.code %}disabled{%endif%}"
><a href="{{ path('change_locale', { 'code': lang.code }) }}">{{lang.name}}</a>
</li>
{% endfor %}
</ul>
</div>

3 changes: 2 additions & 1 deletion app/Resources/views/ojsbase.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
<div id="main-container">
<div class="content col-md-12">
{%include '::language_selector.html.twig'%}
{% block body %}{% endblock %}
<div id="footer">{% block footer %}{% endblock %}</div>
</div>
Expand Down
21 changes: 19 additions & 2 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ framework:
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"

globals:
languages : "%languages%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
Expand Down Expand Up @@ -119,14 +120,30 @@ sensio_framework_extra:
annotations: false

stof_doctrine_extensions:
default_locale: "%locale%"
translation_fallback: true
orm:
default:
timestampable: true
translatable: true
blameable: true
loggable: true
jms_serializer:
metadata:
directories:
FOSUB:
namespace_prefix: "FOS\\UserBundle"
path: "%kernel.root_dir%/serializer/FOSUserBundle"

nelmio_api_doc: ~
nelmio_api_doc: ~

services:
acme_locale.locale_listener:
class: Ojstr\Common\Listener\LocaleListener
arguments: ["%kernel.default_locale%"]
tags:
- { name: kernel.event_subscriber }
ojstr.twig.ojs_extension:
class: Ojstr\Common\Twig\OjsExtension
tags:
- { name: twig.extension }
3 changes: 2 additions & 1 deletion app/config/config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ assetic:
assets:
jslibs:
inputs:
- '%kernel.root_dir%/../assets/js/*'
- '%kernel.root_dir%/../assets/js/jquery-1.11.0.min.js'
- '%kernel.root_dir%/../assets/js/bootstrap.min.js'
base_ui:
inputs:
- '%kernel.root_dir%/../assets/css/*'
Expand Down
3 changes: 2 additions & 1 deletion app/config/config_prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ assetic:
assets:
jslibs:
inputs:
- '%kernel.root_dir%/../assets/js/*'
- '%kernel.root_dir%/../assets/js/jquery-1.11.0.min.js'
- '%kernel.root_dir%/../assets/js/bootstrap.min.js'
base_ui:
inputs:
- '%kernel.root_dir%/../assets/css/*'
Expand Down
8 changes: 8 additions & 0 deletions app/config/parameters.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ parameters:

locale: en
secret: ThisTokenIsNotSoSecretChangeIt
languages:
-
name: "English"
code: "en"
-
name: "Türkçe"
code: "tr"

5 changes: 5 additions & 0 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ ojstr_journal:
resource: "@OjstrJournalBundle/Resources/config/routing.yml"
prefix: /manager/

#common pages
change_locale:
pattern: /locale/{code}
defaults: { _controller: "OjstrJournalBundle:Common:changeLocale" }

auth:
resource: "@OjstrUserBundle/Resources/config/routing.yml"

Expand Down
2 changes: 2 additions & 0 deletions assets/css/app.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.records_list ul{list-style: none;}
.records_list ul li{display: inline; padding:2px;}
80 changes: 80 additions & 0 deletions src/Ojstr/Common/Entity/GenericExtendedEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace Ojstr\Common\Entity;

use Gedmo\Translatable\Translatable;

/**
* Some common properties and functions for JournalBundle Entities
*/
class GenericExtendedEntity implements Translatable {

/**
* Translateable locale field
*/
protected $locale;

/**
* @var datetime $created
*/
protected $created;

/**
* @var datetime $updated
*/
protected $updated;

/**
* @var datetime $contentChanged
*/
protected $contentChanged;

/**
* @var datetime
*/
protected $deletedAt;

/**
*
* @var String
*/
protected $createdBy;

/**
* @var String
*/
protected $updatedBy;

public function setTranslatableLocale($locale) {
$this->locale = $locale;
}

public function getUpdated() {
return $this->updated;
}

public function getContentChanged() {
return $this->contentChanged;
}

public function getCreated() {
return $this->created;
}

public function getDeletedAt() {
return $this->deletedAt;
}

public function setDeletedAt($deletedAt) {
$this->deletedAt = $deletedAt;
}

public function getCreatedBy() {
return $this->createdBy;
}

public function getUpdatedBy() {
return $this->updatedBy;
}

}
40 changes: 40 additions & 0 deletions src/Ojstr/Common/Listener/LocaleListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php
namespace Ojstr\Common\Listener;

use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class LocaleListener implements EventSubscriberInterface
{
private $defaultLocale;

public function __construct($defaultLocale = 'en')
{
$this->defaultLocale = $defaultLocale;
}

public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
if (!$request->hasPreviousSession()) {
return;
}

// try to see if the locale has been set as a _locale routing parameter
if ($locale = $request->attributes->get('_locale')) {
$request->getSession()->set('_locale', $locale);
} else {
// if no explicit locale has been set on this request, use one from the session
$request->setLocale($request->getSession()->get('_locale', $this->defaultLocale));
}
}

public static function getSubscribedEvents()
{
return array(
// must be registered before the default Locale listener
KernelEvents::REQUEST => array(array('onKernelRequest', 17)),
);
}
}
15 changes: 15 additions & 0 deletions src/Ojstr/Common/Params/ArticleParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Ojstr\Common\Params;

class ArticleParams extends CommonParams {
/**
* statusArray can be modifed like :
*
public static function statusText($statusNum) {
self::$statusArray[-1 ] = "Deleted";
return isset(self::$statusArray[$statusNum]) ? self::$statusArray[$statusNum] : NULL;
}
*
*/
}
22 changes: 22 additions & 0 deletions src/Ojstr/Common/Params/CommonParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Ojstr\Common\Params;

class CommonParams {

/**
* @return string Status description
* @param integer $status
*/
protected static $statusArray = array(
0 => "Waiting",
1 => "Published",
2 => "Unpublished",
3 => "Params"
);

public static function statusText($statusNum) {
return isset(self::$statusArray[$statusNum]) ? self::$statusArray[$statusNum] : NULL;
}

}
7 changes: 7 additions & 0 deletions src/Ojstr/Common/Params/JournalParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Ojstr\Common\Params;

class JournalParams extends CommonParams {

}
26 changes: 26 additions & 0 deletions src/Ojstr/Common/Twig/OjsExtension.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Ojstr\Common\Twig;

class OjsExtension extends \Twig_Extension {

public function getFilters() {
return array(
new \Twig_SimpleFilter('issn', array($this, 'issnValidateFilter')),
);
}

/**
* @todo reformat and validate given issn and output with/without errors
* @param string $issn
* @return string
*/
public function issnValidateFilter($issn, $withErrors = FALSE) {
return $issn."---";
}

public function getName() {
return 'ojs_extension';
}

}
29 changes: 0 additions & 29 deletions src/Ojstr/Entity/GenericEntity.php

This file was deleted.

Loading