aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pages/photos/image/upload.php5
-rw-r--r--start.php8
-rw-r--r--views/default/forms/photos/ajax_upload.php72
-rw-r--r--views/default/js/photos/uploading.php28
-rw-r--r--views/default/photos/css.php23
5 files changed, 62 insertions, 74 deletions
diff --git a/pages/photos/image/upload.php b/pages/photos/image/upload.php
index 7d9db5ed8..0c327d53e 100644
--- a/pages/photos/image/upload.php
+++ b/pages/photos/image/upload.php
@@ -14,7 +14,7 @@ if (!$album_guid) {
forward();
}
-if (elgg_get_plugin_setting('uploader', 'tidypics') != "disabled") {
+if (elgg_get_plugin_setting('uploader', 'tidypics')) {
$uploader = get_input('uploader', 'ajax');
} else {
$uploader = 'basic';
@@ -48,6 +48,9 @@ elgg_push_breadcrumb(elgg_echo('album:addpix'));
if ($uploader == 'basic') {
$content = elgg_view('forms/photos/basic_upload', array('entity' => $album));
} else {
+ elgg_load_js('swfobject');
+ elgg_load_js('jquery.uploadify');
+ elgg_load_js('tidypics:uploading');
$content = elgg_view('forms/photos/ajax_upload', array('entity' => $album));
}
diff --git a/start.php b/start.php
index cebd033b0..8b336d2ba 100644
--- a/start.php
+++ b/start.php
@@ -37,7 +37,13 @@ function tidypics_init() {
$js = elgg_get_simplecache_url('js', 'photos/tagging');
elgg_register_simplecache_view('js/photos/tagging');
elgg_register_js('tidypics:tagging', $js, 'footer');
+ $js = elgg_get_simplecache_url('js', 'photos/uploading');
+ elgg_register_simplecache_view('js/photos/uploading');
+ elgg_register_js('tidypics:uploading', $js, 'footer');
+
elgg_register_js('tidypics:slideshow', 'mod/tidypics/vendors/PicLensLite/piclens_optimized.js', 'footer');
+ elgg_register_js('swfobject', 'mod/tidypics/vendors/uploadify/swfobject.js', 'footer');
+ elgg_register_js('jquery.uploadify', 'mod/tidypics/vendors/uploadify/jquery.uploadify.v2.1.1.min.js', 'footer');
// Add photos link to owner block/hover menus
elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tidypics_owner_block_menu');
@@ -189,7 +195,7 @@ function tidypics_page_handler($page) {
case "upload": // upload images to album
set_input('guid', $page[1]);
- set_input('uploader', elgg_extract(2, $page, 'basic'));
+ set_input('uploader', elgg_extract(2, $page, 'ajax'));
require "$base/image/upload.php";
break;
diff --git a/views/default/forms/photos/ajax_upload.php b/views/default/forms/photos/ajax_upload.php
index a1d13e80b..f0738994a 100644
--- a/views/default/forms/photos/ajax_upload.php
+++ b/views/default/forms/photos/ajax_upload.php
@@ -5,8 +5,6 @@
* @uses $vars['album']
*/
-elgg_extend_view('metatags', 'tidypics/js/uploader');
-
$album = $vars['album'];
$ts = time();
@@ -69,73 +67,3 @@ if ($quota) {
</li>
</ul>
</div>
-
-<script type="text/javascript">
-
-$("#uploadify").uploadify({
- 'uploader' : '<?php echo $vars['url']; ?>mod/tidypics/vendors/uploadify/uploadify.swf',
- 'script' : '<?php echo $upload_endpoint_url; ?>',
- 'scriptData' : {
- 'album_guid' : '<?php echo $album->guid; ?>',
- 'user_guid' : '<?php echo get_loggedin_userid(); ?>',
- '__elgg_token' : '<?php echo $token; ?>',
- '__elgg_ts' : '<?php echo $ts; ?>',
- 'Elgg' : '<?php echo session_id(); ?>',
- 'tidypics_token' : '<?php echo $tidypics_token; ?>',
- 'batch' : '<?php echo $batch; ?>'
- },
- 'fileDataName' : 'Image',
- 'cancelImg' : '<?php echo $vars['url']; ?>_graphics/icon_customise_remove.gif',
- 'multi' : true,
- 'auto' : false,
- 'wmode' : 'transparent',
- 'buttonImg' : " ",
- 'height' : 20,
- 'width' : 130,
- 'onEmbedFlash' : function(event) {
- $("#" + event.id).hover(
- function(){
- $("#tidypics_choose_button").addClass('tidypics_choose_button_hover');
- },
- function(){
- $("#tidypics_choose_button").removeClass('tidypics_choose_button_hover');
- }
- );
- },
- 'onSelectOnce' : function() {
- $("#tidypics_upload_button").removeClass('tidypics_disable');
- },
- 'onAllComplete' : function() {
- $("#tidypics_choose_button").addClass('tidypics_disable');
- $("#tidypics_upload_button").addClass('tidypics_disable');
- $("#tidypics_choose_button").attr("href", "javascript:void(0)");
- $("#tidypics_upload_button").attr("href", "javascript:void(0)");
-
- $("#tidypics_describe_button").removeClass('tidypics_disable');
- $.post(
- '<?php echo $upload_complete_url; ?>',
- {
- album_guid : '<?php echo $album->guid; ?>',
- __elgg_token : '<?php echo $token; ?>',
- __elgg_ts : '<?php echo $ts; ?>',
- batch : '<?php echo $batch; ?>'
- }
- );
- },
- 'onComplete' : function(event, queueID, fileObj, response) {
- // check for errors here
- if (response != 'success') {
- $("#uploadify" + queueID + " .percentage").text(" - " + response);
- $("#uploadify" + queueID).addClass('uploadifyError');
- }
- $("#uploadify" + queueID + " > .cancel").remove();
- return false;
- },
- 'onCancel' : function(event, queueID, fileObj, data) {
- if (data.fileCount == 0) {
- $("#tidypics_upload_button").addClass('tidypics_disable');
- }
- }
-
-});
-</script>
diff --git a/views/default/js/photos/uploading.php b/views/default/js/photos/uploading.php
new file mode 100644
index 000000000..59448dd46
--- /dev/null
+++ b/views/default/js/photos/uploading.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ *
+ */
+
+$site_url = elgg_get_site_url();
+$upload_endpoint_url = "{$site_url}action/tidypics/ajax_upload/";
+$upload_complete_url = "{$site_url}action/tidypics/ajax_upload_complete/";
+
+?>
+
+elgg.provide('elgg.tidypics.uploading');
+
+elgg.tidypics.uploading.init = function() {
+ $("#uploadify").uploadify({
+ 'uploader' : '<?php echo $site_url; ?>mod/tidypics/vendors/uploadify/uploadify.swf',
+ 'script' : '<?php echo $upload_endpoint_url; ?>',
+ 'fileDataName' : 'Image',
+ 'multi' : true,
+ 'auto' : false,
+ 'wmode' : 'transparent',
+ 'buttonImg' : " ",
+ 'height' : 20,
+ 'width' : 130
+ });
+}
+
+elgg.register_hook_handler('init', 'system', elgg.tidypics.uploading.init); \ No newline at end of file
diff --git a/views/default/photos/css.php b/views/default/photos/css.php
index 4429ca0c7..3e448f27a 100644
--- a/views/default/photos/css.php
+++ b/views/default/photos/css.php
@@ -126,6 +126,29 @@
color: #666;
}
+/* ***************************************
+ Tagging
+*************************************** */
+#tidypics_uploader {
+position:relative;
+width:400px;
+min-height:20px;
+}
+
+#tidypics_choose_button {
+position:absolute;
+top:0;
+left:0;
+z-index:0;
+display:block;
+float:left;
+}
+
+#tidypics_flash_uploader {
+position:relative;
+z-index:100;
+}
+
<?php
return true;
?>