Commit 80286390 authored by Evan Prodromou's avatar Evan Prodromou

Merge branch 'uiredesign' of evan@dev.controlyourself.ca:/var/www/csarven into uiredesign

parents 4662e224 47f69458
/* Fixes issue here http://code.google.com/p/jcrop/issues/detail?id=1 */
.jcrop-holder
{
text-align: left;
}
.jcrop-vline, .jcrop-hline
{
font-size: 0;
position: absolute;
background: white url('Jcrop.gif') top left repeat;
/*
opacity: .5;
*filter:alpha(opacity=50);
*/
}
.jcrop-vline { height: 100%; width: 1px !important; }
.jcrop-hline { width: 100%; height: 1px !important; }
.jcrop-handle {
font-size: 1px;
width: 7px !important;
height: 7px !important;
border: 1px #eee solid;
background-color: #333;
*width: 9px;
*height: 9px;
}
.jcrop-tracker {
*background-color: gray;
width: 100%; height: 100%;
}
.custom .jcrop-vline,
.custom .jcrop-hline
{
background: yellow;
}
.custom .jcrop-handle
{
border-color: black;
background-color: #C7BB00;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
$(function(){
jQuery("#avatar_original img.avatar").Jcrop({ onChange: showPreview,
setSelect: [ 0, 0, $("#avatar_original img.avatar").attr("width"), $("#avatar_original img.avatar").attr("height") ],
onSelect: updateCoords,
aspectRatio: 1,
boxWidth: 480,
boxHeight: 480,
bgColor: '#000',
bgOpacity: .4
});
jQuery("#photo_original img").Jcrop({
onChange: showPreview,
setSelect: [ 0, 0, $("#photo_original img").attr("width"), $("#photo_original img").attr("height") ],
onSelect: updateCoords,
aspectRatio: 1,
boxWidth: 480,
boxHeight: 480,
bgColor: '#000',
bgOpacity: .4
});
});
function showPreview(coords) {
var rx = 96 / coords.w;
var ry = 96 / coords.h;
var img_width = $("#avatar_original img.avatar").attr("width");
var img_height = $("#avatar_original img.avatar").attr("height");
var img_width = $("#photo_original img").attr("width");
var img_height = $("#photo_original img").attr("height");
$('#avatar_preview img.avatar').css({
$('#photo_preview img').css({
width: Math.round(rx *img_width) + 'px',
height: Math.round(ry * img_height) + 'px',
marginLeft: '-' + Math.round(rx * coords.x) + 'px',
......@@ -27,14 +27,14 @@
};
function updateCoords(c) {
$('#avatar_crop_x').val(c.x);
$('#avatar_crop_y').val(c.y);
$('#avatar_crop_w').val(c.w);
$('#avatar_crop_h').val(c.h);
$('#photo_crop_x').val(c.x);
$('#photo_crop_y').val(c.y);
$('#photo_crop_w').val(c.w);
$('#photo_crop_h').val(c.h);
};
function checkCoords() {
if (parseInt($('#avatar_crop_w').val())) return true;
if (parseInt($('#photo_crop_w').val())) return true;
alert('Please select a crop region then press submit.');
return false;
};
......
This diff is collapsed.
/* is this stuff defined? */
if (!document.ELEMENT_NODE) {
document.ELEMENT_NODE = 1;
document.ATTRIBUTE_NODE = 2;
document.TEXT_NODE = 3;
document.CDATA_SECTION_NODE = 4;
document.ENTITY_REFERENCE_NODE = 5;
document.ENTITY_NODE = 6;
document.PROCESSING_INSTRUCTION_NODE = 7;
document.COMMENT_NODE = 8;
document.DOCUMENT_NODE = 9;
document.DOCUMENT_TYPE_NODE = 10;
document.DOCUMENT_FRAGMENT_NODE = 11;
document.NOTATION_NODE = 12;
}
document._importNode = function(node, allChildren) {
/* find the node type to import */
switch (node.nodeType) {
case document.ELEMENT_NODE:
/* create a new element */
var newNode = document.createElement(node.nodeName);
/* does the node have any attributes to add? */
if (node.attributes && node.attributes.length > 0)
/* add all of the attributes */
for (var i = 0, il = node.attributes.length; i < il;) {
if (node.attributes[i].nodeName == 'class') {
newNode.className = node.getAttribute(node.attributes[i++].nodeName);
} else {
newNode.setAttribute(node.attributes[i].nodeName, node.getAttribute(node.attributes[i++].nodeName));
}
}
/* are we going after children too, and does the node have any? */
if (allChildren && node.childNodes && node.childNodes.length > 0)
/* recursively get all of the child nodes */
for (var i = 0, il = node.childNodes.length; i < il;)
newNode.appendChild(document._importNode(node.childNodes[i++], allChildren));
return newNode;
break;
case document.TEXT_NODE:
case document.CDATA_SECTION_NODE:
case document.COMMENT_NODE:
return document.createTextNode(node.nodeValue);
break;
}
};
......@@ -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
*
......
......@@ -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
}
......@@ -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 {
......@@ -295,21 +317,6 @@ class NoticeListItem
common_element_end('p');
}
/**
* 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
*
......@@ -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');
}
}
......@@ -441,17 +460,6 @@ class NoticeListItem
}
}
/**
* end the time section
*
* @return void
*/
function endTimeSection()
{
common_element_end('p');
}
/**
* finish the notice
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment