Edit page placeholder, link on main profile to details

This commit is contained in:
Brion Vibber 2011-02-02 16:38:01 -08:00
parent 7a97243abf
commit 59f4734985
3 changed files with 43 additions and 3 deletions

View File

@ -95,4 +95,14 @@ class ExtendedProfilePlugin extends Plugin
$widget->showMenuItem('profiledetailsettings',_m('Details'),$title);
return true;
}
function onEndProfilePageProfileElements(HTMLOutputter $out, Profile $profile) {
$user = User::staticGet('id', $profile->id);
if ($user) {
$url = common_local_url('profiledetail', array('nickname' => $user->nickname));
$out->element('a', array('href' => $url), _m('More details...'));
}
return;
}
}

View File

@ -63,10 +63,40 @@ class ExtendedProfileWidget extends Widget
$this->out->element('th', null, $field['label']);
$this->out->elementStart('td');
// @fixme field value
$this->out->text($name);
if ($this->editable) {
$this->showEditableField($name, $field);
} else {
$this->showFieldValue($name, $field);
}
$this->out->elementEnd('td');
$this->out->elementEnd('tr');
}
protected function showFieldValue($name, $field)
{
$this->out->text($name);
}
protected function showEditableField($name, $field)
{
$out = $this->out;
//$out = new HTMLOutputter();
// @fixme
$type = strval(@$field['type']);
$id = "extprofile-" . $name;
$value = 'placeholder';
switch ($type) {
case '':
case 'text':
$out->input($id, null, $value);
break;
case 'textarea':
$out->textarea($id, null, $value);
break;
default:
$out->input($id, null, "TYPE: $type");
}
}
}

View File

@ -65,7 +65,7 @@ class ProfileDetailAction extends ProfileAction
$this->elementEnd('div');
}
$widget = new ExtendedProfileWidget($this, $this->profile, ExtendedProfileWidget::EDITABLE);
$widget = new ExtendedProfileWidget($this, $this->profile);
$widget->show();
}
}