]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Edit page placeholder, link on main profile to details
authorBrion Vibber <brion@pobox.com>
Thu, 3 Feb 2011 00:38:01 +0000 (16:38 -0800)
committerBrion Vibber <brion@pobox.com>
Thu, 3 Feb 2011 00:38:54 +0000 (16:38 -0800)
plugins/ExtendedProfile/ExtendedProfilePlugin.php
plugins/ExtendedProfile/extendedprofilewidget.php
plugins/ExtendedProfile/profiledetailaction.php

index 36c8eaa2328453f270fb37987dab2031e9325360..c981a7e2fb3e40914324903b46b6933328a3ab51 100644 (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;
+    }
+
 }
index 2ec99b1992c92a61a60f69829265168f693e4d19..bf9b4056cd2177bff8367b4c6cb5ba1e48456400 100644 (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");
+        }
+    }
 }
index 8c907eec2ac03d32931497c20c1862d9935e655e..a4bb12956e5e002016c661809c9febd6a56740a7 100644 (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();
     }
 }