Skip to content

Commit

Permalink
добавил админку для сайта - backend
Browse files Browse the repository at this point in the history
  • Loading branch information
FladeX committed Jan 5, 2012
1 parent 68e7a25 commit c6d7b53
Show file tree
Hide file tree
Showing 22 changed files with 329 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/backend/config/app.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/11-App

# default values
#all:
8 changes: 8 additions & 0 deletions apps/backend/config/backendConfiguration.class.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

class backendConfiguration extends sfApplicationConfiguration
{
public function configure()
{
}
}
7 changes: 7 additions & 0 deletions apps/backend/config/cache.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/09-Cache

default:
enabled: false
with_layout: false
lifetime: 86400
42 changes: 42 additions & 0 deletions apps/backend/config/factories.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,42 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/05-Factories

prod:
logger:
class: sfNoLogger
param:
level: err
loggers: ~

test:
storage:
class: sfSessionTestStorage
param:
session_path: %SF_TEST_CACHE_DIR%/sessions

response:
class: sfWebResponse
param:
send_http_headers: false

mailer:
param:
delivery_strategy: none

dev:
mailer:
param:
delivery_strategy: none

all:
routing:
class: sfPatternRouting
param:
generate_shortest_url: true
extra_parameters_as_query_string: true

view_cache_manager:
class: sfViewCacheManager
param:
cache_key_use_vary_headers: true
cache_key_use_host_name: true
10 changes: 10 additions & 0 deletions apps/backend/config/filters.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/12-Filters

rendering: ~
security: ~

# insert your own filters here

cache: ~
execution: ~
25 changes: 25 additions & 0 deletions apps/backend/config/routing.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
projects:
class: sfDoctrineRouteCollection
options:
model: projects
module: projects
prefix_path: /projects
column: id
with_wildcard_routes: true

# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/10-Routing

# default rules
homepage:
url: /
param: { module: projects, action: index }

# generic rules
# please, remove them by adding more specific rules
default_index:
url: /:module
param: { action: index }

default:
url: /:module/:action/*
5 changes: 5 additions & 0 deletions apps/backend/config/security.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/08-Security

default:
is_secure: false
35 changes: 35 additions & 0 deletions apps/backend/config/settings.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,35 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/04-Settings

prod:
.settings:
no_script_name: false
logging_enabled: false

dev:
.settings:
error_reporting: <?php echo (E_ALL | E_STRICT)."\n" ?>
web_debug: true
cache: false
no_script_name: false
etag: false

test:
.settings:
error_reporting: <?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>
cache: false
web_debug: false
no_script_name: false
etag: false

all:
.settings:
# Form security secret (CSRF protection)
csrf_secret: 26193c53dc5e0b09e8c7fbe6a9d12c64ec5f7c22

# Output escaping settings
escaping_strategy: true
escaping_method: ESC_SPECIALCHARS

# Enable the database manager
use_database: true
20 changes: 20 additions & 0 deletions apps/backend/config/view.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,20 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/13-View

default:
http_metas:
content-type: text/html

metas:
#title: symfony project
#description: symfony project
#keywords: symfony, project
#language: en
#robots: index, follow

stylesheets: [main.css]

javascripts: []

has_layout: true
layout: layout
5 changes: 5 additions & 0 deletions apps/backend/lib/myUser.class.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

class myUser extends sfBasicSecurityUser
{
}
16 changes: 16 additions & 0 deletions apps/backend/modules/projects/actions/actions.class.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

require_once dirname(__FILE__).'/../lib/projectsGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/projectsGeneratorHelper.class.php';

/**
* projects actions.
*
* @package posting
* @subpackage projects
* @author Your name here
* @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class projectsActions extends autoProjectsActions
{
}
25 changes: 25 additions & 0 deletions apps/backend/modules/projects/config/generator.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
generator:
class: sfDoctrineGenerator
param:
model_class: projects
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: projects
with_doctrine_route: true
actions_base_class: sfActions

config:
actions: ~
fields: ~
list:
title: Список проектов
filter: ~
form:
class: BackendprojectsForm
edit:
title: Редактирование проекта &laquo;%%title%%&raquo;
new:
title: Добавление нового проекта
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* projects module configuration.
*
* @package posting
* @subpackage projects
* @author Your name here
* @version SVN: $Id: configuration.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class projectsGeneratorConfiguration extends BaseProjectsGeneratorConfiguration
{
}
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/**
* projects module helper.
*
* @package posting
* @subpackage projects
* @author Your name here
* @version SVN: $Id: helper.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class projectsGeneratorHelper extends BaseProjectsGeneratorHelper
{
}
14 changes: 14 additions & 0 deletions apps/backend/templates/layout.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php include_http_metas() ?>
<?php include_metas() ?>
<?php include_title() ?>
<link rel="shortcut icon" href="/favicon.ico" />
<?php include_stylesheets() ?>
<?php include_javascripts() ?>
</head>
<body>
<?php echo $sf_content ?>
</body>
</html>
6 changes: 6 additions & 0 deletions config/app.yml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,6 @@
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/11-App

# default values
all:
projects_per_page: 5
35 changes: 35 additions & 0 deletions lib/form/doctrine/BackendprojectsForm.class.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* projects form.
*
* @package posting
* @subpackage form
* @author Max Istlyaev
* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class BackendprojectsForm extends projectsForm
{
public function configure()
{
parent::configure();
}

protected function setFields()
{
$this->useFields(array('author_id', 'title', 'text', 'price', 'status', 'views_users', 'views_guests', 'expired_at', 'created_at', 'updated_at'));

$this->widgetSchema->setHelp('title', 'например, &laquo;Наполнение автомобильного форума&raquo;');
$this->widgetSchema->setHelp('text', 'подробное описание проекта для исполнителей');
$this->widgetSchema->setHelp('price', 'предполагаемый бюджет');
$this->widgetSchema->setHelp('status', 'статус проекта');

$this->widgetSchema->setLabels(array(
'title' => 'Название проекта',
'text' => 'Описание проекта',
'price' => 'Бюджет',
'status' => 'Статус',
));

}
}
5 changes: 5 additions & 0 deletions lib/form/doctrine/projectsForm.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
class projectsForm extends BaseprojectsForm class projectsForm extends BaseprojectsForm
{ {
public function configure() public function configure()
{
$this->setFields();
}

protected function setFields()
{ {
$this->useFields(array('title', 'text', 'price')); $this->useFields(array('title', 'text', 'price'));


Expand Down
19 changes: 19 additions & 0 deletions test/functional/backend/projectsActionsTest.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

include(dirname(__FILE__).'/../../bootstrap/functional.php');

$browser = new sfTestFunctional(new sfBrowser());

$browser->
get('/projects/index')->

with('request')->begin()->
isParameter('module', 'projects')->
isParameter('action', 'index')->
end()->

with('response')->begin()->
isStatusCode(200)->
checkElement('body', '!/This is a temporary page/')->
end()
;
7 changes: 7 additions & 0 deletions web/backend.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php


require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'prod', true);
sfContext::createInstance($configuration)->dispatch();
13 changes: 13 additions & 0 deletions web/backend_dev.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
{
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

require_once(dirname(__FILE__).'/../config/ProjectConfiguration.class.php');

$configuration = ProjectConfiguration::getApplicationConfiguration('backend', 'dev', true);
sfContext::createInstance($configuration)->dispatch();
1 change: 1 addition & 0 deletions web/sfDoctrinePlugin

0 comments on commit c6d7b53

Please sign in to comment.