From fc7663e86ab7fd00cace6cfc80dee60b25c83bdc Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 24 Sep 2008 16:41:31 -0400 Subject: put message form on inbox and outbox darcs-hash:20080924204131-5ed1f-099c73720b3a4f2263ca28566fcd6b4c809fd4ab.gz --- lib/util.php | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index e663eb861..624d3b7e7 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1688,3 +1688,43 @@ function common_keyize($str) { $str = preg_replace('/\s/', '_', $str); return $str; } + +function common_message_form($content, $user, $to) { + + common_element_start('form', array('id' => 'message_form', + 'method' => 'post', + 'action' => $this->self_url())); + + $mutual_users = $user->mutuallySubscribedUsers(); + + $mutual = array(); + + while ($mutual_users->fetch()) { + if ($mutual_users->id != $user->id) { + $mutual[$mutual_users->id] = $mutual_users->nickname; + } + } + + $mutual_users->free(); + unset($mutual_users); + + common_dropdown('to', _('To'), $mutual, NULL, FALSE, $to->id); + + common_element_start('p'); + + common_element('textarea', array('id' => 'message_content', + 'cols' => 60, + 'rows' => 3, + 'name' => 'content'), + ($content) ? $content : ''); + + common_element('input', array('id' => 'message_send', + 'name' => 'message_send', + 'type' => 'submit', + 'value' => _('Send'))); + + common_hidden('token', common_session_token()); + + common_element_end('p'); + common_element_end('form'); +} \ No newline at end of file -- cgit v1.2.3-54-g00ecf