summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-01-15 13:58:32 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-01-15 13:58:32 -0500
commit802863907337d6e1b463c28390499017b1d4e5f1 (patch)
treede4682a26c75bf01d0835b98d179a8ff3bfc7076 /lib
parent4662e22443361b8c0c8a274f2e63b01d69eb07f8 (diff)
parent47f694582c8bb668ad711182bc7124fe2db0f339 (diff)
Merge branch 'uiredesign' of evan@dev.controlyourself.ca:/var/www/csarven into uiredesign
Diffstat (limited to 'lib')
-rw-r--r--lib/form.php17
-rw-r--r--lib/noticeform.php53
-rw-r--r--lib/noticelist.php114
3 files changed, 119 insertions, 65 deletions
diff --git a/lib/form.php b/lib/form.php
index ba1790faa..5c75bb65f 100644
--- a/lib/form.php
+++ b/lib/form.php
@@ -67,9 +67,12 @@ class Form extends Widget
array('id' => $this->id(),
'method' => 'POST',
'action' => $this->action()));
+ $this->out->elementStart('fieldset');
+ $this->formLegend();
$this->sessionToken();
$this->formData();
$this->formActions();
+ $this->out->elementEnd('fieldset');
$this->out->elementEnd('form');
}
@@ -84,6 +87,20 @@ class Form extends Widget
$this->out->hidden('token', common_session_token());
}
+
+ /**
+ * Name of the form
+ *
+ * Sub-classes should overload this with the name of their form.
+ *
+ * @return void
+ */
+
+ function formLegend()
+ {
+ }
+
+
/**
* Visible or invisible data elements
*
diff --git a/lib/noticeform.php b/lib/noticeform.php
index 0e46e0e58..0a4f486db 100644
--- a/lib/noticeform.php
+++ b/lib/noticeform.php
@@ -87,7 +87,7 @@ class NoticeForm extends Form
function id()
{
- return 'status_form';
+ return 'form_notice';
}
/**
@@ -101,6 +101,18 @@ class NoticeForm extends Form
return common_local_url('newnotice');
}
+
+ /**
+ * Legend of the Form
+ *
+ * @return void
+ */
+ function formLegend()
+ {
+ $this->out->element('legend', null, _('Send a notice'));
+ }
+
+
/**
* Data elements
*
@@ -111,21 +123,33 @@ class NoticeForm extends Form
{
$user = common_current_user();
- $this->out->element('label', array('for' => 'status_textarea',
- 'id' => 'status_label'),
+ $this->out->elementStart('ul', 'form_datas');
+ $this->out->elementStart('li', array('id' => 'notice_text'));
+ $this->out->element('label', array('for' => 'notice_data-text'),
sprintf(_('What\'s up, %s?'), $user->nickname));
// XXX: vary by defined max size
- $this->out->element('span', array('id' => 'counter',
- 'class' => 'counter'),
- '140');
- $this->out->element('textarea', array('id' => 'status_textarea',
- 'cols' => 60,
- 'rows' => 3,
+ $this->out->element('textarea', array('id' => 'notice_data-text',
+ 'cols' => 35,
+ 'rows' => 4,
'name' => 'status_textarea'),
($this->content) ? $this->content : '');
+ $this->out->elementEnd('li');
+ $this->out->elementEnd('ul');
+
+ $this->out->elementStart('dl', 'form_note');
+ $this->out->element('dt', null, _('Available characters'));
+ $this->out->element('dd', array('id' => 'notice_text-count'),
+ '140');
+ $this->out->elementEnd('dl');
+
if ($this->action) {
- $this->out->hidden('returnto', $this->action);
+ // FIXME: or VERIFY that notice_return-to doesn't break anything. Changed from 'returnto'
+ $this->out->hidden('notice_return-to', $this->action);
}
+
+ // FIXME: Does this need to be checked like returnto?
+ $this->out->hidden('notice_in-reply-to', $this->action);
+
}
/**
@@ -136,9 +160,14 @@ class NoticeForm extends Form
function formActions()
{
- $this->out->element('input', array('id' => 'status_submit',
+ $this->out->elementStart('ul', 'form_actions');
+ $this->out->elementStart('li', array('id' => 'notice_submit'));
+ $this->out->element('input', array('id' => 'notice_action-submit',
+ 'class' => 'submit',
'name' => 'status_submit',
'type' => 'submit',
'value' => _('Send')));
+ $this->out->elementEnd('li');
+ $this->out->elementEnd('ul');
}
-} \ No newline at end of file
+}
diff --git a/lib/noticelist.php b/lib/noticelist.php
index 71db067d0..be3128b4b 100644
--- a/lib/noticelist.php
+++ b/lib/noticelist.php
@@ -169,19 +169,39 @@ class NoticeListItem
function show()
{
$this->showStart();
- $this->showFaveForm();
+ $this->showNotice();
+ $this->showNoticeInfo();
+ $this->showNoticeOptions();
+ $this->showEnd();
+ }
+
+ function showNotice()
+ {
+ $this->elementStart('div', 'entry-title');
$this->showAuthor();
$this->showContent();
- $this->startTimeSection();
+ $this->elementEnd('div');
+ }
+
+ function showNoticeInfo()
+ {
+ $this->elementStart('div', 'entry-content');
$this->showNoticeLink();
$this->showNoticeSource();
$this->showReplyTo();
+ $this->elementEnd('div');
+ }
+
+ function showNoticeOptions()
+ {
+ $this->elementStart('div', 'notice-options');
+ $this->showFaveForm();
$this->showReplyLink();
$this->showDeleteLink();
- $this->endTimeSection();
- $this->showEnd();
+ $this->elementEnd('div');
}
+
/**
* start a single notice.
*
@@ -191,7 +211,8 @@ class NoticeListItem
function showStart()
{
// XXX: RDFa
- common_element_start('li', array('class' => 'notice_single hentry',
+ // TODO: add notice_type class e.g., notice_video, notice_image
+ common_element_start('li', array('class' => 'hentry notice',
'id' => 'notice-' . $this->notice->id));
}
@@ -223,10 +244,13 @@ class NoticeListItem
function showAuthor()
{
- common_element_start('span', 'vcard author');
+ $this->elementStart('span', 'vcard author');
+ $this->elementStart('a', array('href' => $this->profile->profileurl,
+ 'class' => 'url'));
$this->showAvatar();
$this->showNickname();
- common_element_end('span');
+ $this->elementEnd('a');
+ $this->elementEnd('span');
}
/**
@@ -241,18 +265,17 @@ class NoticeListItem
function showAvatar()
{
$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
- common_element_start('a', array('href' => $this->profile->profileurl));
- common_element('img', array('src' => ($avatar) ?
+
+ $this->element('img', array('src' => ($avatar) ?
common_avatar_display_url($avatar) :
common_default_avatar(AVATAR_STREAM_SIZE),
- 'class' => 'avatar stream photo',
+ 'class' => 'avatar photo',
'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE,
'alt' =>
($this->profile->fullname) ?
$this->profile->fullname :
$this->profile->nickname));
- common_element_end('a');
}
/**
@@ -265,8 +288,7 @@ class NoticeListItem
function showNickname()
{
- common_element('a', array('href' => $this->profile->profileurl,
- 'class' => 'nickname fn url'),
+ $this->element('span', array('class' => 'nickname fn'),
$this->profile->nickname);
}
@@ -283,7 +305,7 @@ class NoticeListItem
function showContent()
{
// FIXME: URL, image, video, audio
- common_element_start('p', array('class' => 'content entry-title'));
+ common_element_start('p', array('class' => 'entry-content'));
if ($this->notice->rendered) {
common_raw($this->notice->rendered);
} else {
@@ -296,21 +318,6 @@ class NoticeListItem
}
/**
- * show the "time" section of a notice
- *
- * This is the greyed-out section that appears beneath the content, including
- * links to delete or reply to the notice. Probably should be called something
- * else.
- *
- * @return void
- */
-
- function startTimeSection()
- {
- common_element_start('p', 'time');
- }
-
- /**
* show the link to the main page for the notice
*
* Displays a link to the page for a notice, with "relative" time. Tries to
@@ -328,14 +335,18 @@ class NoticeListItem
preg_match('/^http/', $this->notice->uri)) {
$noticeurl = $this->notice->uri;
}
- common_element_start('a', array('class' => 'permalink',
- 'rel' => 'bookmark',
+ $this->elementStart('dl', 'timestamp');
+ $this->element('dt', _('Published'));
+ $this->elementStart('dd', null);
+ $this->element('a', array('rel' => 'bookmark',
'href' => $noticeurl));
$dt = common_date_iso8601($this->notice->created);
- common_element('abbr', array('class' => 'published',
+ $this->element('abbr', array('class' => 'published',
'title' => $dt),
common_date_string($this->notice->created));
- common_element_end('a');
+ $this->elementEnd('a');
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
}
/**
@@ -350,7 +361,8 @@ class NoticeListItem
function showNoticeSource()
{
if ($this->notice->source) {
- common_element('span', null, _(' from '));
+ $this->elementStart('dl', 'device');
+ $this->element('dt', null, _('From'));
$source_name = _($this->notice->source);
switch ($this->notice->source) {
case 'web':
@@ -358,18 +370,22 @@ class NoticeListItem
case 'mail':
case 'omb':
case 'api':
- common_element('span', 'noticesource', $source_name);
+ $this->element('dd', 'noticesource', $source_name);
break;
default:
$ns = Notice_source::staticGet($this->notice->source);
if ($ns) {
- common_element('a', array('href' => $ns->url),
+ $this->elementStart('dd', null);
+ $this->element('a', array('href' => $ns->url,
+ 'rel' => 'external'),
$ns->name);
+ $this->elementEnd('dd');
} else {
- common_element('span', 'noticesource', $source_name);
+ $this->element('dd', 'noticesource', $source_name);
}
break;
}
+ $this->elementEnd('dl');
}
}
@@ -387,11 +403,14 @@ class NoticeListItem
if ($this->notice->reply_to) {
$replyurl = common_local_url('shownotice',
array('notice' => $this->notice->reply_to));
- common_text(' (');
- common_element('a', array('class' => 'inreplyto',
- 'href' => $replyurl),
- _('in reply to...'));
- common_text(')');
+ $this->elementStart('dl', 'response');
+ $this->element('dt', null, _('To'));
+ $this->elementStart('dd');
+ $this->element('a', array('href' => $replyurl,
+ 'rel' => 'in-reply-to'),
+ _('in reply to'));
+ $this->elementEnd('dd');
+ $this->elementEnd('dl');
}
}
@@ -442,17 +461,6 @@ class NoticeListItem
}
/**
- * end the time section
- *
- * @return void
- */
-
- function endTimeSection()
- {
- common_element_end('p');
- }
-
- /**
* finish the notice
*
* Close the last elements in the notice list item