My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php

/*
* This file is part of Lyra CMS. Lyra CMS is free software; you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses>.
*/

/**
* LyraArticleForm
*
* @package lyra
* @subpackage form
* @copyright Copyright (C) 2009-2010 Massimo Giagnoni. All rights reserved.
* @license GNU General Public License version 2 or later (see LICENSE.txt)
*/
class LyraArticleForm extends BaseLyraArticleForm
{
public
$panels = null,
$break_at = null;

protected
$show_params = false;

public function configure()
{

parent::configure();
//remove fields that must never be displayed in form
unset(
$this['status'],
$this['params'],
$this['created_by'],
$this['updated_by'],
$this['locked_by'],
$this['created_at'],
$this['updated_at'],
$this['article_labels_list'],
$this['num_comments'],
$this['num_active_comments']
);

//FCKeditor
$this->widgetSchema['summary'] = new sfWidgetFormTextareaFCKEditor(
array(
'width' => 430,
'height' => 250,
'tool' => 'lyra',
'config'=> 'myfckconfig'
)
);

$this->widgetSchema['content'] = new sfWidgetFormTextareaFCKEditor(
array(
'width' => 430,
'height' => 450,
'tool' => 'lyra',
'config'=> 'myfckconfig'
)
);

$this->widgetSchema['ctype_id'] = new sfWidgetFormInputHidden();

$user = $this->getOption('user');
$this->widgetSchema['publish_start'] = new sfWidgetFormI18nDateTime(array(
'culture' => $user->getCulture(),
));

$this->widgetSchema['publish_end'] = new sfWidgetFormI18nDateTime(array(
'culture' => $user->getCulture()
));

$this->validatorSchema->setPostValidator(new LyraValidatorPublishDate());

//change default labels
$this->widgetSchema['title']->setLabel('TITLE');
$this->widgetSchema['slug']->setLabel('SLUG');
$this->widgetSchema['subtitle']->setLabel('SUBTITLE');
$this->widgetSchema['summary']->setLabel(false);
$this->widgetSchema['content']->setLabel(false);
$this->widgetSchema['is_active']->setLabel('IS_ACTIVE');
$this->widgetSchema['is_featured']->setLabel('IS_FEATURED');
$this->widgetSchema['is_sticky']->setLabel('IS_STICKY');
$this->widgetSchema['is_archived']->setLabel('IS_ARCHIVED');
$this->widgetSchema['is_feeded']->setLabel('IS_FEEDED');
$this->widgetSchema['publish_start']->setLabel('PUBLISH_START');
$this->widgetSchema['publish_end']->setLabel('PUBLISH_END');

$this->widgetSchema['content']->setAttribute('rows',20);
$this->widgetSchema['content']->setAttribute('cols',50);
$this->widgetSchema['summary']->setAttribute('rows',15);
$this->widgetSchema['summary']->setAttribute('cols',50);

$this->panels = array(
'NONE' => array('title', 'slug', 'subtitle'),
'PANEL_CONTENT' => array('content'),
'PANEL_SUMMARY' => array('summary'),
'PANEL_PUBLISH' => array('is_active', 'is_featured', 'is_sticky', 'is_archived','publish_start', 'publish_end'),
'PANEL_LABELS' => array('labels'),
'PANEL_METATAGS' => array('meta_title', 'meta_descr', 'meta_keys', 'meta_robots')
);
$this->break_at = 'PANEL_PUBLISH';

$this->widgetSchema->setFormFormatterName('LyraContent');
$this->widgetSchema->setNameFormat('article[%s]');
}

public function updateObject($values = null)
{
$item = parent::updateObject($values);
$user = $this->getOption('user');
if(isset($user)) {
$uid = $user->getGuardUser()->getId();
if($this->isNew()) {
$item->setCreatedBy($uid);
$item->setUpdatedBy($uid);
} elseif($item->isModified()) {
$item->setUpdatedBy($uid);
}
}
return $item;
}
}

Change log

r81 by gimassimo on Nov 12, 2010   Diff
Moved metatags management functions to
LyraContent class.
Go to: 
Project members, sign in to write a code review

Older revisions

r70 by gimassimo on Aug 24, 2010   Diff
Added a first basic implementation of
article feed.
r60 by gimassimo on May 13, 2010   Diff
Created is_archived column in
LyraArticle to enable/disable
inclusion of content items in archive.
r57 by gimassimo on May 11, 2010   Diff
Fixed method getActiveItemsQuery
(LyraArticleTable) to consider
publication dates (publish_start,
publish_end). Added a custom validator
(LyraValidatorPublishDate) to
...
All revisions of this file

File info

Size: 4076 bytes, 127 lines
Powered by Google Project Hosting