]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/messageform.php
Added a events for the settings menu items
[quix0rs-gnu-social.git] / lib / messageform.php
index eca39cc064de98445961e7a7eb137d69f8707623..b034be3122b4400528a194949232d455a8650e74 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Form for posting a direct message
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Form
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @author    Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @copyright 2009 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -38,11 +38,11 @@ require_once INSTALLDIR.'/lib/form.php';
  * Form for posting a direct message
  *
  * @category Form
- * @package  Laconica
- * @author   Evan Prodromou <evan@controlyourself.ca>
- * @author   Sarven Capadisli <csarven@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
+ * @author   Sarven Capadisli <csarven@status.net>
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link     http://laconi.ca/
+ * @link     http://status.net/
  *
  * @see      HTMLOutputter
  */
@@ -80,12 +80,23 @@ class MessageForm extends Form
     /**
      * ID of the form
      *
-     * @return int ID of the form
+     * @return string ID of the form
      */
 
     function id()
     {
-        return 'message_form';
+        return 'form_notice-direct';
+    }
+
+   /**
+     * Class of the form
+     *
+     * @return string class of the form
+     */
+
+    function formClass()
+    {
+        return 'form_notice';
     }
 
     /**
@@ -99,6 +110,16 @@ class MessageForm extends Form
         return common_local_url('newmessage');
     }
 
+    /**
+     * Legend of the Form
+     *
+     * @return void
+     */
+    function formLegend()
+    {
+        $this->out->element('legend', null, _('Send a direct notice'));
+    }
+
     /**
      * Data elements
      *
@@ -123,17 +144,26 @@ class MessageForm extends Form
         unset($mutual_users);
 
         $this->out->dropdown('to', _('To'), $mutual, null, false,
-                             $this->to->id);
-
-        $this->out->elementStart('p');
+                             ($this->to) ? $this->to->id : null);
 
-        $this->out->element('textarea', array('id' => 'message_content',
-                                              'cols' => 60,
-                                              'rows' => 3,
+        $this->out->element('textarea', array('id' => 'notice_data-text',
+                                              'cols' => 35,
+                                              'rows' => 4,
                                               'name' => 'content'),
                             ($this->content) ? $this->content : '');
 
-        $this->out->elementEnd('p');
+        $contentLimit = Message::maxContent();
+
+        $this->out->element('script', array('type' => 'text/javascript'),
+                            'maxLength = ' . $contentLimit . ';');
+
+        if ($contentLimit > 0) {
+            $this->out->elementStart('dl', 'form_note');
+            $this->out->element('dt', null, _('Available characters'));
+            $this->out->element('dd', array('id' => 'notice_text-count'),
+                                $contentLimit);
+            $this->out->elementEnd('dl');
+        }
     }
 
     /**
@@ -144,9 +174,10 @@ class MessageForm extends Form
 
     function formActions()
     {
-        $this->out->element('input', array('id' => 'message_send',
+        $this->out->element('input', array('id' => 'notice_action-submit',
+                                           'class' => 'submit',
                                            'name' => 'message_send',
                                            'type' => 'submit',
                                            'value' => _('Send')));
     }
-}
\ No newline at end of file
+}