From: Brion Vibber Date: Thu, 3 Feb 2011 00:38:01 +0000 (-0800) Subject: Edit page placeholder, link on main profile to details X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=59f47349853fbd20ce74fbb2d6cb8f4b30e53f6f;p=quix0rs-gnu-social.git Edit page placeholder, link on main profile to details --- diff --git a/plugins/ExtendedProfile/ExtendedProfilePlugin.php b/plugins/ExtendedProfile/ExtendedProfilePlugin.php index 36c8eaa232..c981a7e2fb 100644 --- a/plugins/ExtendedProfile/ExtendedProfilePlugin.php +++ b/plugins/ExtendedProfile/ExtendedProfilePlugin.php @@ -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; + } + } diff --git a/plugins/ExtendedProfile/extendedprofilewidget.php b/plugins/ExtendedProfile/extendedprofilewidget.php index 2ec99b1992..bf9b4056cd 100644 --- a/plugins/ExtendedProfile/extendedprofilewidget.php +++ b/plugins/ExtendedProfile/extendedprofilewidget.php @@ -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"); + } + } } diff --git a/plugins/ExtendedProfile/profiledetailaction.php b/plugins/ExtendedProfile/profiledetailaction.php index 8c907eec2a..a4bb12956e 100644 --- a/plugins/ExtendedProfile/profiledetailaction.php +++ b/plugins/ExtendedProfile/profiledetailaction.php @@ -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(); } }