aboutsummaryrefslogtreecommitdiff
path: root/views/default/tidypics/forms/upload.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2010-07-25 02:01:36 +0000
committerCash Costello <cash.costello@gmail.com>2010-07-25 02:01:36 +0000
commit73403645808a81425381f43c25e0ea2c92705312 (patch)
tree83fb73e9a122054f6f4c2e1c44e399572ee13e28 /views/default/tidypics/forms/upload.php
parent791ec4925346cb38ecca9a2f2574b012ab64a88a (diff)
downloadelgg-73403645808a81425381f43c25e0ea2c92705312.tar.gz
elgg-73403645808a81425381f43c25e0ea2c92705312.tar.bz2
first go at brining tidypics up to code standards
Diffstat (limited to 'views/default/tidypics/forms/upload.php')
-rw-r--r--views/default/tidypics/forms/upload.php123
1 files changed, 64 insertions, 59 deletions
diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php
index 6e755612c..691d9701b 100644
--- a/views/default/tidypics/forms/upload.php
+++ b/views/default/tidypics/forms/upload.php
@@ -1,78 +1,83 @@
<?php
- global $CONFIG;
-
- //this is for image uploads only. Image edits are handled by edit.php form
-
- $container_guid = get_input('container_guid');
- $album = get_entity($vars['album']);
- $access_id = $album->access_id;
+global $CONFIG;
- $maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
- if (!$maxfilesize)
- $maxfilesize = 5;
-
- $quota = get_plugin_setting('quota','tidypics');
- if ($quota) {
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
- $image_repo_size = $image_repo_size / 1024 / 1024;
- $quote_percentage = round(100 * ($image_repo_size / $quota));
- // for small quotas, so one decimal place
- if ($quota < 10) {
- $image_repo_size = sprintf('%.1f', $image_repo_size);
- } else {
- $image_repo_size = round($image_repo_size);
- }
- if ($image_repo_size > $quota) {
- $image_repo_size = $quota;
- }
+//this is for image uploads only. Image edits are handled by edit.php form
+
+$container_guid = get_input('container_guid');
+$album = get_entity($vars['album']);
+$access_id = $album->access_id;
+
+$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
+if (!$maxfilesize) {
+ $maxfilesize = 5;
+}
+
+$quota = get_plugin_setting('quota','tidypics');
+if ($quota) {
+ $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
+ $image_repo_size = (int)$image_repo_size_md->value;
+ $image_repo_size = $image_repo_size / 1024 / 1024;
+ $quote_percentage = round(100 * ($image_repo_size / $quota));
+ // for small quotas, so one decimal place
+ if ($quota < 10) {
+ $image_repo_size = sprintf('%.1f', $image_repo_size);
+ } else {
+ $image_repo_size = round($image_repo_size);
+ }
+ if ($image_repo_size > $quota) {
+ $image_repo_size = $quota;
}
+}
?>
<div id="tidypics_ref"></div>
<div class="contentWrapper">
-<?php
+ <?php
ob_start();
-?>
-<p style="line-height:1.6em;">
- <label><?php echo elgg_echo("images:upload"); ?></label><br />
- <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br />
-<?php
- if ($quota) {
-?>
- <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br />
-<?php
- }
-?>
+ ?>
+ <p style="line-height:1.6em;">
+ <label><?php echo elgg_echo("images:upload"); ?></label><br />
+ <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br />
+ <?php
+ if ($quota) {
+ ?>
+ <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br />
+ <?php
+ }
+ ?>
<div class="tidypics_popup">
- <?php echo elgg_echo("tidypics:uploading:images"); ?><br />
+ <?php echo elgg_echo("tidypics:uploading:images"); ?><br />
<div style="margin:20px 0px 20px 80px;"><img id="progress" alt="..." border="0" src="<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>" /></div>
</div>
<ol id="tidypics_image_upload_list">
-<?php
+ <?php
for ($x = 0; $x < 10; $x++) {
echo '<li>' . elgg_view("input/file",array('internalname' => "upload_$x")) . '</li>';
- }
-?>
+ }
+ ?>
</ol>
</p>
<p>
-<?php
- if ($container_guid)
- echo '<input type="hidden" name="container_guid" value="' . $container_guid . '" />';
- if ($access_id)
- echo '<input type="hidden" name="access_id" value="' . $access_id . '" />';
-?>
+ <?php
+ if ($container_guid) {
+ echo '<input type="hidden" name="container_guid" value="' . $container_guid . '" />';
+ }
+ if ($access_id) {
+ echo '<input type="hidden" name="access_id" value="' . $access_id . '" />';
+ }
+ ?>
<input type="submit" value="<?php echo elgg_echo("save"); ?>" onclick="displayProgress();" />
</p>
<?php
- $form_body = ob_get_clean();
-
- echo elgg_view('input/form', array( 'action' => "{$vars['url']}action/tidypics/upload",
- 'body' => $form_body,
- 'internalid' => 'tidypicsUpload',
- 'enctype' => 'multipart/form-data',
- 'method' => 'post',));
+$form_body = ob_get_clean();
+
+echo elgg_view('input/form', array(
+ 'action' => "{$vars['url']}action/tidypics/upload",
+ 'body' => $form_body,
+ 'internalid' => 'tidypicsUpload',
+ 'enctype' => 'multipart/form-data',
+ 'method' => 'post',)
+);
?>
</div>
<script type="text/javascript">
@@ -81,11 +86,11 @@
{
offsetY = 60;
offsetX = 120;
-
+
divWidth = $('#tidypics_ref').width();
imgOffset = $('#tidypics_ref').offset();
imgWidth = $('#tidypics_ref').width();
-
+
_top = imgOffset.top + offsetY;
_left = imgOffset.left + offsetX;
@@ -93,7 +98,7 @@
"top": _top + "px",
"left": _left + "px"
});
-
- setTimeout('document.images["progress"].src = "<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>"', 200);
+
+ setTimeout('document.images["progress"].src = "<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>"', 200);
}
</script> \ No newline at end of file