summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-01-07 01:55:57 -0800
committerZach Copley <zach@status.net>2010-01-24 16:36:02 -0800
commit48e5f2b3c5164aa9e47289e5b243e2e1189b71ef (patch)
treead51926e5ad079da446ce1e0492a045b15e1b698 /lib
parent1e5b2a497e3c70e4af5f93e2326c93beed15fed1 (diff)
Add icons/icon upload to Oauth apps
Diffstat (limited to 'lib')
-rw-r--r--lib/applicationeditform.php43
-rw-r--r--lib/applicationlist.php4
2 files changed, 44 insertions, 3 deletions
diff --git a/lib/applicationeditform.php b/lib/applicationeditform.php
index ed187ba0b..4d3bb06e7 100644
--- a/lib/applicationeditform.php
+++ b/lib/applicationeditform.php
@@ -82,6 +82,21 @@ class ApplicationEditForm extends Form
}
/**
+ * HTTP method used to submit the form
+ *
+ * For image data we need to send multipart/form-data
+ * so we set that here too
+ *
+ * @return string the method to use for submitting
+ */
+
+ function method()
+ {
+ $this->enctype = 'multipart/form-data';
+ return 'post';
+ }
+
+ /**
* class of the form
*
* @return string of the form class
@@ -134,6 +149,7 @@ class ApplicationEditForm extends Form
{
if ($this->application) {
$id = $this->application->id;
+ $icon = $this->application->icon;
$name = $this->application->name;
$description = $this->application->description;
$source_url = $this->application->source_url;
@@ -144,6 +160,7 @@ class ApplicationEditForm extends Form
$this->access_type = $this->application->access_type;
} else {
$id = '';
+ $icon = '';
$name = '';
$description = '';
$source_url = '';
@@ -154,11 +171,31 @@ class ApplicationEditForm extends Form
$this->access_type = '';
}
+ $this->out->hidden('token', common_session_token());
+
$this->out->elementStart('ul', 'form_data');
- $this->out->elementStart('li');
+
+ $this->out->elementStart('li');
+
+ if (!empty($icon)) {
+ $this->out->element('img', array('src' => $icon));
+ }
+
+ $this->out->element('label', array('for' => 'app_icon'),
+ _('Icon'));
+ $this->out->element('input', array('name' => 'app_icon',
+ 'type' => 'file',
+ 'id' => 'app_icon'));
+ $this->out->element('p', 'form_guide', _('Icon for this application'));
+ $this->out->element('input', array('name' => 'MAX_FILE_SIZE',
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => ImageFile::maxFileSizeInt()));
+ $this->out->elementEnd('li');
+
+ $this->out->elementStart('li');
$this->out->hidden('application_id', $id);
- $this->out->hidden('token', common_session_token());
$this->out->input('name', _('Name'),
($this->out->arg('name')) ? $this->out->arg('name') : $name);
@@ -215,7 +252,7 @@ class ApplicationEditForm extends Form
// Default to Browser
if ($this->application->type == Oauth_application::$browser
- || empty($this->applicaiton->type)) {
+ || empty($this->application->type)) {
$attrs['checked'] = 'checked';
}
diff --git a/lib/applicationlist.php b/lib/applicationlist.php
index 3141ea974..5392ddab8 100644
--- a/lib/applicationlist.php
+++ b/lib/applicationlist.php
@@ -93,6 +93,10 @@ class ApplicationList extends Widget
$this->out->elementStart('li', array('class' => 'application',
'id' => 'oauthclient-' . $this->application->id));
+ if (!empty($this->application->icon)) {
+ $this->out->element('img', array('src' => $this->application->icon));
+ }
+
$this->out->elementStart('a',
array('href' => common_local_url(
'showapplication',