4 * Documentation action.
10 * @author Evan Prodromou <evan@status.net>
11 * @author Robin Millette <millette@status.net>
12 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
13 * @link http://status.net/
15 * StatusNet - the distributed open-source microblogging tool
16 * Copyright (C) 2008, 2009, StatusNet, Inc.
18 * This program is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Affero General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Affero General Public License for more details.
28 * You should have received a copy of the GNU Affero General Public License
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32 if (!defined('STATUSNET') && !defined('LACONICA')) {
37 * Documentation class.
41 * @author Evan Prodromou <evan@status.net>
42 * @author Robin Millette <millette@status.net>
43 * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
44 * @link http://status.net/
46 class DocAction extends Action
54 * @param array $args array of arguments
58 function handle($args)
60 parent::handle($args);
62 $this->title = $this->trimmed('title');
65 if (Event::handle('StartLoadDoc', array(&$this->title, &$this->output))) {
67 $this->filename = INSTALLDIR.'/doc-src/'.$this->title;
68 if (!file_exists($this->filename)) {
69 $this->clientError(_('No such document.'));
73 $c = file_get_contents($this->filename);
74 $this->output = common_markup_to_html($c);
76 Event::handle('EndLoadDoc', array($this->title, &$this->output));
82 // overrrided to add entry-title class
83 function showPageTitle() {
84 $this->element('h1', array('class' => 'entry-title'), $this->title());
87 // overrided to add hentry, and content-inner classes
88 function showContentBlock()
90 $this->elementStart('div', array('id' => 'content', 'class' => 'hentry'));
91 $this->showPageTitle();
92 $this->showPageNoticeBlock();
93 $this->elementStart('div', array('id' => 'content_inner',
94 'class' => 'entry-content'));
95 // show the actual content (forms, lists, whatever)
97 $this->elementEnd('div');
98 $this->elementEnd('div');
106 function showContent()
108 $this->raw($this->output);
118 return ucfirst($this->title);
121 function isReadOnly($args)