Skip to content

Commit

Permalink
Added media uploads to the embed request form
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Mar 7, 2012
1 parent 4dd08e4 commit e9e845c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 8 additions & 3 deletions blocks/html/embed/requestForm.inc
Expand Up @@ -27,7 +27,7 @@ foreach (Endpoint::$optionalOpen311Fields as $field) {
<h2><?php echo $service_name; ?></h2>
<p class="service_description"><?php echo $service_description; ?></p>

<form method="post" action="<?php echo BASE_URI; ?>/embed">
<form method="post" action="<?php echo BASE_URI; ?>/embed" enctype="multipart/form-data">
<fieldset><legend>Location</legend>
<div>
<span id="location"><?php echo $address_string; ?></span>
Expand Down Expand Up @@ -139,6 +139,11 @@ foreach (Endpoint::$optionalOpen311Fields as $field) {
</ul>
</fieldset>

<fieldset><legend>Media</legend>
<p>Upload a photo</p>
<input type="file" name="media" />
</fieldset>

<fieldset>
<input name="client" type="hidden" value="<?php echo $this->client->getId(); ?>" />
<input name="service_code" type="hidden" value="<?php echo $service_code; ?>" />
Expand All @@ -160,6 +165,6 @@ foreach (Endpoint::$optionalOpen311Fields as $field) {
</script>
<?php
$this->template->addToAsset('scripts',YUI.'/yui/yui-min.js');
$this->template->addToAsset('scripts','http://maps.googleapis.com/maps/api/js?sensor=true');
$this->template->addToAsset('scripts','https://maps.googleapis.com/maps/api/js?sensor=true');
$this->template->addToAsset('scripts',BASE_URL.'/js/map_picker.js');
?>
?>
5 changes: 4 additions & 1 deletion models/Endpoint.php
Expand Up @@ -220,6 +220,9 @@ public function postServiceRequest(array $post, Client $client=null)
}
}
}
if (isset($_FILES['media']['name'])) {
$request['media'] = "@{$_FILES['media']['tmp_name']};type={$_FILES['media']['type']};filename={$_FILES['media']['name']}";
}
$open311 = curl_init("{$this->getUrl()}/requests.xml");
curl_setopt_array($open311, array(
CURLOPT_POST=>true,
Expand Down Expand Up @@ -273,4 +276,4 @@ private function queryServer($url)
throw new Exception('endpoints/open311ServerUnReachable');
}
}
}
}

0 comments on commit e9e845c

Please sign in to comment.