]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Bookmark/bookmarkform.php
Merge branch '0.9.x' into socialbookmark
[quix0rs-gnu-social.git] / plugins / Bookmark / bookmarkform.php
1 <?php
2 /**
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010, StatusNet, Inc.
5  *
6  * Form for adding a new bookmark
7  * 
8  * PHP version 5
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Affero General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Affero General Public License for more details.
19  *
20  * You should have received a copy of the GNU Affero General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  *
23  * @category  Bookmark
24  * @package   StatusNet
25  * @author    Evan Prodromou <evan@status.net>
26  * @copyright 2010 StatusNet, Inc.
27  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
28  * @link      http://status.net/
29  */
30
31 if (!defined('STATUSNET')) {
32     // This check helps protect against security problems;
33     // your code file can't be executed directly from the web.
34     exit(1);
35 }
36
37 /**
38  * Form to add a new bookmark
39  *
40  * @category  Bookmark
41  * @package   StatusNet
42  * @author    Evan Prodromou <evan@status.net>
43  * @copyright 2010 StatusNet, Inc.
44  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
45  * @link      http://status.net/
46  */
47
48 class BookmarkForm extends Form
49 {
50         private $_title       = null;
51         private $_url         = null;
52         private $_tags        = null;
53         private $_description = null;
54
55         function __construct($out=null, $title=null, $url=null, $tags=null, $description=null)
56         {
57                 parent::__construct($out);
58
59                 $this->_title       = $title;
60                 $this->_url         = $url;
61                 $this->_tags        = $tags;
62                 $this->_description = $description;
63         }
64
65     /**
66      * ID of the form
67      *
68      * @return int ID of the form
69      */
70
71     function id()
72     {
73         return 'form_new_bookmark';
74     }
75
76     /**
77      * class of the form
78      *
79      * @return string class of the form
80      */
81
82     function formClass()
83     {
84         return 'form_new_bookmark';
85     }
86
87     /**
88      * Action of the form
89      *
90      * @return string URL of the action
91      */
92
93     function action()
94     {
95         return common_local_url('newbookmark');
96     }
97
98     /**
99      * Data elements of the form
100      *
101      * @return void
102      */
103
104     function formData()
105     {
106                 $this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
107         $this->out->elementStart('ul', 'form_data');
108
109         $this->li();
110                 $this->out->input('title',
111                                                   _('Title'),
112                                                   $this->_title,
113                                                   _('Title of the bookmark'));
114         $this->unli();
115
116         $this->li();
117         $this->out->input('url',
118                                                   _('URL'),
119                           $this->_url,   
120                                                   _('URL to bookmark'));
121         $this->unli();
122
123         $this->li();
124         $this->out->input('tags',
125                                                   _('Tags'),
126                           $this->_tags,   
127                                                   _('Comma- or space-separated list of tags'));
128         $this->unli();
129
130         $this->li();
131         $this->out->input('description',
132                                                   _('Description'),
133                           $this->_description,   
134                                                   _('Description of the URL'));
135         $this->unli();
136
137         $this->out->elementEnd('ul');
138         $this->out->elementEnd('fieldset');
139     }
140
141     /**
142      * Action elements
143      *
144      * @return void
145      */
146
147     function formActions()
148     {
149         $this->out->submit('submit', _m('BUTTON', 'Save'));
150     }
151 }