wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r19611: merged with 'fotki' branch

Committer: gprochaev
merged with 'fotki' branch
U   trunk/bin/upgrading/en.dat
U   trunk/htdocs/js/ck/plugins/livejournal/plugin.js
U   trunk/htdocs/js/livejournal.js
U   trunk/htdocs/update.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2011-08-05 06:30:18 UTC (rev 19610)
+++ trunk/bin/upgrading/en.dat	2011-08-05 07:08:50 UTC (rev 19611)
@@ -2727,6 +2727,213 @@
 
 feeds.title.friends=friends page feed
 
+fotki.album.albums=albums
+
+fotki.album.album_cover=Album cover
+
+fotki.album.albums_of=albums of
+
+fotki.album.default_album_name=Unsorted
+
+fotki.album.edit.save=Save
+
+fotki.album.edit.cancel=Cancel
+
+fotki.album.edit.empty= 
+
+fotki.album.edit.empty.photo.title=(no title)
+
+fotki.album.edit.empty.photo.desc=(no description)
+
+fotki.album.edit.empty.album.title=(no title)
+
+fotki.album.edit.empty.album.desc=(no description)
+
+fotki.album.create.new=(Create new)
+
+fotki.album.add.photos=You can add one or more photos at once using "Ctrl" button or "Shift"
+
+fotki.album.add.images=Add images
+
+fotki.album.add.image.name=Add image name
+
+fotki.album.add.five.images=Add 5 images to your LiveJournal entry
+
+fotki.album.add.more=Add more
+
+fotki.album.btn.add=Add photos
+
+fotki.album.btn.remove=Remove
+
+fotki.album.btn.save=Save
+
+fotki.album.add.to.entry=Add to entry
+
+fotki.album.btn.upload=Upload
+
+fotki.album.upload.unknown.error=Unknown error
+
+fotki.album.stop.upload.confirm=Do you really want to stop upload and close without saving?
+
+fotki.album.close.without.saving.confirm=Do you really want to close without saving?
+
+fotki.album.click.image=Click on image to remove it
+
+fotki.album.uploading.image=Uploading image
+
+fotki.album.available.now=Available now
+
+fotki.album.description=Add your description
+
+fotki.album.no.photo=No photo
+
+fotki.album.resize.to.post=Resize to post:
+
+fotki.album.remove=Remove
+
+fotki.album.remove_album=Remove album
+
+fotki.album.remove_image=Remove image
+
+fotki.album.remove.this.image=Remove this image
+
+fotki.album.remove_album_desc=Images will be deleted and disappear from all related posts in your blog
+
+fotki.album.title=Title
+
+fotki.album.create_album=Create album
+
+fotki.album.save_all=Save all
+
+fotki.album.index.title=PhotoAlbums
+
+fotki.album.index.title.beta=beta
+
+fotki.album.index.windowtitle=PhotoAlbums
+
+fotki.album.view.title=Album [[album_name]] view
+
+fotki.album.link.album_list=Albums
+
+fotki.album.link.cancel=Cancel
+
+fotki.album.link.click.to.upload=Click to upload <br> new images
+
+fotki.album.link.edit=Edit
+
+fotki.album.link.edit_album=Edit album
+
+fotki.album.link.add.to.post=Add to post
+
+fotki.album.link.add.to.entry=Add to entry
+
+fotki.album.link.manage=Manage
+
+fotki.album.link.album_view=Album view
+
+fotki.album.link.original.size=Original size
+
+fotki.album.link.remove=Remove
+
+fotki.album.link.remove.album=Remove album
+
+fotki.album.link.photo_view=View photo
+
+fotki.album.link.upload=Upload
+
+fotki.album.link.upload.new=Upload new
+
+fotki.album.edit.update.button=Update
+
+fotki.album.manage.albums=Manage albums
+
+fotki.album.new.album.name=New album name
+
+fotki.album.post.images=Add to post
+
+fotki.album.save.images=Save images
+
+fotki.album.remove.image=Remove this image
+
+fotki.album.select_album=Select album:
+
+fotki.album.select.image.size=Select image size:
+
+fotki.album.select.images.size=Select images size:
+
+fotki.album.storage.title=Photo album: not enough space
+
+fotki.album.storage.used=Used
+
+fotki.album.your.friends.updates=Your friends updates
+
+fotki.album.your_albums=Your albums
+
+fotki.album.upgrade=Upgrade
+
+fotki.promo.slogan=Organise your photos and images with LiveJournal PhotoAlbums...
+
+fotki.promo.description=Discover and share your photos with your friends and community.
+
+fotki.promo.description_other=Discover and share your photos with your friends and community (2).
+
+fotki.promo.add_foto.button=Add your photos now
+
+fotki.promo.about.title=LJ PhotoAlbums
+
+fotki.promo.about.list<<
+ 
+<li>1Gb space for your files</li>
+<li>Free upload 30 photos a day</li>
+<li>Easy posting access to LiveJournal</li>
+<li>Include titles, tags and location</li>
+<li>Mobile uploading</li>
+.
+
+fotki.promo.about.list.more=and many more...
+
+fotki.photo.upload.title=Upload photo
+
+fotki.photo.upload.photo_desc=Photo description
+
+fotki.photo.upload.select_album.title=Select album for upload
+
+fotki.photo.cancel.removing=Cancel removing
+
+fotki.photo.edit.title=Photo edit
+
+fotki.photo.edit.tags.label=Edit tags
+
+fotki.photo.view.title=Photo view
+
+fotki.photo.edit.link=Edit photo
+
+fotki.photo.edit.update.button=Update
+
+fotki.photo.delete.button=Delete
+
+fotki.photo.edit.make_main.label=Make a main photo
+
+fotki.photo.upload.alien.error=You can'n upload to alien albums
+
+fotki.photo.edit.move_to_album.label=Move photo to album:
+
+fotki.photo.edit.photo=Edit photo
+
+fotki.photo.recover=You can recover it, before you clicking "Save all" button
+
+fotki.photo.remove_photo=Remove photo
+
+fotki.photo.removed=This image will be removed
+
+fotki.privacy=Privacy
+
+fotki.privacy.private=Private
+
+fotki.privacy.friends_only=Friends only
+
+fotki.privacy.public=Public
+
 gender.female|staleness=1
 gender.female=Female
 

Modified: trunk/htdocs/js/ck/plugins/livejournal/plugin.js
===================================================================
--- trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-05 06:30:18 UTC (rev 19610)
+++ trunk/htdocs/js/ck/plugins/livejournal/plugin.js	2011-08-05 07:08:50 UTC (rev 19611)
@@ -476,14 +476,22 @@
 			//////////  LJ Image Button //////////////
 			editor.addCommand('LJImage', {
 				exec : function(editor){
-					if(ljphotoEnabled){
-						// call LJImage
-					} else {
-						if(ljNoteData.LJImage.node){
-							editor.getSelection().selectElement(ljNoteData.LJImage.node);
-						}
-						editor.getCommand('image').exec();
-					}
+                    if (window.ljphotoEnabled){
+                        jQuery('#updateForm')
+                            .photouploader({
+                                type: 'upload'
+                            })
+                            .photouploader('show')
+                                .bind('htmlready', function (event, html) {
+                                    editor.insertHtml(html);
+                                });
+                    } else {
+                        if (ljNoteData.LJImage.node){
+                            editor.getSelection().selectElement(ljNoteData.LJImage.node);
+                        }
+
+                        editor.getCommand('image').exec();
+                    }                                       
 				}
 			});
 
@@ -1084,4 +1092,5 @@
 		requires : [ 'fakeobjects' ]
 	});
 
-})();
\ No newline at end of file
+})();
+

Modified: trunk/htdocs/js/livejournal.js
===================================================================
--- trunk/htdocs/js/livejournal.js	2011-08-05 06:30:18 UTC (rev 19610)
+++ trunk/htdocs/js/livejournal.js	2011-08-05 07:08:50 UTC (rev 19611)
@@ -329,3 +329,348 @@
 
 	return str;
 }
+
+LiveJournal.String = {
+	supplant: function(s, o) {
+		return s.replace(/{([^{}]*)}/g,
+			function (a, b) {
+				var r = o[b];
+				return typeof r === 'string' || typeof r === 'number' ? r : a;
+			});		
+	}
+}
+
+if (window.JSON && window.JSON.parse && window.JSON.stringify) {
+	LiveJournal.JSON = (function() {
+		var endsWith___ = /___$/;
+		return {
+			/* documented below */
+			'parse': function(str) {
+				try {
+					return window.JSON.parse(str);
+				} catch (e) {
+					return false;
+				}
+			},
+			/* documented below */
+			'stringify': function(obj) {
+				try {
+					return window.JSON.stringify(obj, function(k,v) {
+						return !endsWith___.test(k) ? v : null;
+					});
+				} catch (e) {
+					return null;
+				}
+			}
+		};
+	})();
+} else {
+	LiveJournal.JSON = function() {
+		/**
+		 * Formats integers to 2 digits.
+		 * @param {number} n
+		 * @private
+		 */
+		function f(n) {
+			return n < 10 ? '0' + n : n;
+		}
+
+		Date.prototype.toJSON = function() {
+			return [this.getUTCFullYear(), '-',
+				f(this.getUTCMonth() + 1), '-',
+				f(this.getUTCDate()), 'T',
+				f(this.getUTCHours()), ':',
+				f(this.getUTCMinutes()), ':',
+				f(this.getUTCSeconds()), 'Z'].join('');
+		};
+
+		// table of character substitutions
+		/**
+		 * @const
+		 * @enum {string}
+		 */
+		var m = {
+			'\b': '\\b',
+			'\t': '\\t',
+			'\n': '\\n',
+			'\f': '\\f',
+			'\r': '\\r',
+			'"' : '\\"',
+			'\\': '\\\\'
+		};
+
+		/**
+		 * Converts a json object into a string.
+		 * @param {*} value
+		 * @return {string}
+		 * @member gadgets.json
+		 */
+		function stringify(value) {
+			var 	a,					// The array holding the partial texts.
+					i,					// The loop counter.
+					k,					// The member key.
+					l,					// Length.
+					r = /["\\\x00-\x1f\x7f-\x9f]/g,
+					v;					// The member value.
+
+			switch (typeof value) {
+				case 'string':
+					// If the string contains no control characters, no quote characters, and no
+					// backslash characters, then we can safely slap some quotes around it.
+					// Otherwise we must also replace the offending characters with safe ones.
+					return r.test(value) ?
+							'"' + value.replace(r, function(a) {
+								var c = m[a];
+								if (c) {
+									return c;
+								}
+								c = a.charCodeAt();
+								return '\\u00' + Math.floor(c / 16).toString(16) +
+									 (c % 16).toString(16);
+							}) + '"' : '"' + value + '"';
+				case 'number':
+					// JSON numbers must be finite. Encode non-finite numbers as null.
+					return isFinite(value) ? String(value) : 'null';
+				case 'boolean':
+				case 'null':
+					return String(value);
+				case 'object':
+					// Due to a specification blunder in ECMAScript,
+					// typeof null is 'object', so watch out for that case.
+					if (!value) {
+						return 'null';
+					}
+					// toJSON check removed; re-implement when it doesn't break other libs.
+					a = [];
+					if (typeof value.length === 'number' &&
+							!value.propertyIsEnumerable('length')) {
+						// The object is an array. Stringify every element. Use null as a
+						// placeholder for non-JSON values.
+						l = value.length;
+						for (i = 0; i < l; i += 1) {
+							a.push(stringify(value[i]) || 'null');
+						}
+						// Join all of the elements together and wrap them in brackets.
+						return '[' + a.join(',') + ']';
+					}
+					// Otherwise, iterate through all of the keys in the object.
+					for (k in value) {
+						if (k.match('___$'))
+							continue;
+						if (value.hasOwnProperty(k)) {
+							if (typeof k === 'string') {
+								v = stringify(value[k]);
+								if (v) {
+									a.push(stringify(k) + ':' + v);
+								}
+							}
+						}
+					}
+					// Join all of the member texts together and wrap them in braces.
+					return '{' + a.join(',') + '}';
+			}
+			return '';
+		}
+
+		return {
+			'stringify': stringify,
+			'parse': function(text) {
+				// Parsing happens in three stages. In the first stage, we run the text against
+				// regular expressions that look for non-JSON patterns. We are especially
+				// concerned with '()' and 'new' because they can cause invocation, and '='
+				// because it can cause mutation. But just to be safe, we want to reject all
+				// unexpected forms.
+
+				// We split the first stage into 4 regexp operations in order to work around
+				// crippling inefficiencies in IE's and Safari's regexp engines. First we
+				// replace all backslash pairs with '@' (a non-JSON character). Second, we
+				// replace all simple value tokens with ']' characters. Third, we delete all
+				// open brackets that follow a colon or comma or that begin the text. Finally,
+				// we look to see that the remaining characters are only whitespace or ']' or
+				// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+				if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/b-u]/g, '@').
+						replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+						replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+					return eval('(' + text + ')');
+				}
+				// If the text is not JSON parseable, then return false.
+
+				return false;
+			}
+		};
+	}();	
+}
+
+LiveJournal.String = {
+	supplant: function(s, o) {
+		return s.replace(/{([^{}]*)}/g,
+			function (a, b) {
+				var r = o[b];
+				return typeof r === 'string' || typeof r === 'number' ? r : a;
+			});		
+	}
+}
+
+if (window.JSON && window.JSON.parse && window.JSON.stringify) {
+	LiveJournal.JSON = (function() {
+		var endsWith___ = /___$/;
+		return {
+			/* documented below */
+			'parse': function(str) {
+				try {
+					return window.JSON.parse(str);
+				} catch (e) {
+					return false;
+				}
+			},
+			/* documented below */
+			'stringify': function(obj) {
+				try {
+					return window.JSON.stringify(obj, function(k,v) {
+						return !endsWith___.test(k) ? v : null;
+					});
+				} catch (e) {
+					return null;
+				}
+			}
+		};
+	})();
+} else {
+	LiveJournal.JSON = function() {
+		/**
+		 * Formats integers to 2 digits.
+		 * @param {number} n
+		 * @private
+		 */
+		function f(n) {
+			return n < 10 ? '0' + n : n;
+		}
+
+		Date.prototype.toJSON = function() {
+			return [this.getUTCFullYear(), '-',
+				f(this.getUTCMonth() + 1), '-',
+				f(this.getUTCDate()), 'T',
+				f(this.getUTCHours()), ':',
+				f(this.getUTCMinutes()), ':',
+				f(this.getUTCSeconds()), 'Z'].join('');
+		};
+
+		// table of character substitutions
+		/**
+		 * @const
+		 * @enum {string}
+		 */
+		var m = {
+			'\b': '\\b',
+			'\t': '\\t',
+			'\n': '\\n',
+			'\f': '\\f',
+			'\r': '\\r',
+			'"' : '\\"',
+			'\\': '\\\\'
+		};
+
+		/**
+		 * Converts a json object into a string.
+		 * @param {*} value
+		 * @return {string}
+		 * @member gadgets.json
+		 */
+		function stringify(value) {
+			var 	a,					// The array holding the partial texts.
+					i,					// The loop counter.
+					k,					// The member key.
+					l,					// Length.
+					r = /["\\\x00-\x1f\x7f-\x9f]/g,
+					v;					// The member value.
+
+			switch (typeof value) {
+				case 'string':
+					// If the string contains no control characters, no quote characters, and no
+					// backslash characters, then we can safely slap some quotes around it.
+					// Otherwise we must also replace the offending characters with safe ones.
+					return r.test(value) ?
+							'"' + value.replace(r, function(a) {
+								var c = m[a];
+								if (c) {
+									return c;
+								}
+								c = a.charCodeAt();
+								return '\\u00' + Math.floor(c / 16).toString(16) +
+									 (c % 16).toString(16);
+							}) + '"' : '"' + value + '"';
+				case 'number':
+					// JSON numbers must be finite. Encode non-finite numbers as null.
+					return isFinite(value) ? String(value) : 'null';
+				case 'boolean':
+				case 'null':
+					return String(value);
+				case 'object':
+					// Due to a specification blunder in ECMAScript,
+					// typeof null is 'object', so watch out for that case.
+					if (!value) {
+						return 'null';
+					}
+					// toJSON check removed; re-implement when it doesn't break other libs.
+					a = [];
+					if (typeof value.length === 'number' &&
+							!value.propertyIsEnumerable('length')) {
+						// The object is an array. Stringify every element. Use null as a
+						// placeholder for non-JSON values.
+						l = value.length;
+						for (i = 0; i < l; i += 1) {
+							a.push(stringify(value[i]) || 'null');
+						}
+						// Join all of the elements together and wrap them in brackets.
+						return '[' + a.join(',') + ']';
+					}
+					// Otherwise, iterate through all of the keys in the object.
+					for (k in value) {
+						if (k.match('___$'))
+							continue;
+						if (value.hasOwnProperty(k)) {
+							if (typeof k === 'string') {
+								v = stringify(value[k]);
+								if (v) {
+									a.push(stringify(k) + ':' + v);
+								}
+							}
+						}
+					}
+					// Join all of the member texts together and wrap them in braces.
+					return '{' + a.join(',') + '}';
+			}
+			return '';
+		}
+
+		return {
+			'stringify': stringify,
+			'parse': function(text) {
+				// Parsing happens in three stages. In the first stage, we run the text against
+				// regular expressions that look for non-JSON patterns. We are especially
+				// concerned with '()' and 'new' because they can cause invocation, and '='
+				// because it can cause mutation. But just to be safe, we want to reject all
+				// unexpected forms.
+
+				// We split the first stage into 4 regexp operations in order to work around
+				// crippling inefficiencies in IE's and Safari's regexp engines. First we
+				// replace all backslash pairs with '@' (a non-JSON character). Second, we
+				// replace all simple value tokens with ']' characters. Third, we delete all
+				// open brackets that follow a colon or comma or that begin the text. Finally,
+				// we look to see that the remaining characters are only whitespace or ']' or
+				// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
+
+				if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/b-u]/g, '@').
+						replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
+						replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
+					return eval('(' + text + ')');
+				}
+				// If the text is not JSON parseable, then return false.
+
+				return false;
+			}
+		};
+	}();	
+}
+

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2011-08-05 06:30:18 UTC (rev 19610)
+++ trunk/htdocs/update.bml	2011-08-05 07:08:50 UTC (rev 19611)
@@ -200,6 +200,36 @@
         
     }
 
+    # in case of insert one photo or photo album
+    my $insert_photos = [];
+    if ($remote) {
+        my $albums_id = $POST{'albums_id'} || $GET{'albums_id'};
+        my $photos_id = $POST{'photos_id'} || $GET{'photos_id'};
+
+        my @photos = grep { $_ } map {
+            my $photo = LJ::Fotki::Photo->new ( url_id => $_, userid => $remote->userid );
+            $photo;
+        } split (/,/, $photos_id);
+
+        foreach my $album_id (split /,/, $albums_id) {
+            my $album = LJ::Fotki::Album->new ( url_id => $album_id, userid => $remote->userid );
+            next unless $album;
+            push @photos, @{$album->get_all_photos() || []};
+        }
+
+        $insert_photos = [ grep { $_ } map {
+                my $photo = $_;
+                
+                my $res = $photo->is_valid ? {
+                    photo_desc  => $photo->desc,
+                    photo_title => $photo->title,
+                    photo_url   => @photos > 1 ? $photo->u100_url : $photo->u600_url,
+                    photo_id    => $photo->url_id,
+                } : undef;
+                $res;
+            } @photos ];
+    }
+
     # try to call a hook to fill in the fields
     my $override_fields = LJ::run_hook('update_fields', \%GET);
     my $opt_preformatted = 0;
@@ -349,6 +379,36 @@
         }
 
         $$body .= "\n\n<form method='post' action='update.bml$getextra' id='updateForm' name='updateForm'>\n\n";
+        my $remote = LJ::get_remote ();
+        my $photo_sizes = LJ::JSON->to_json ( LJ::Fotki::Photo->get_photo_sizes() );
+        my $album_list = [];
+        my $album_list_json = '';
+		my $available_space = '';
+        if ($remote) {
+            $album_list = LJ::Fotki::Album->get_albums ($remote->userid);
+            $album_list = [
+                map {
+                    my $album = $_;
+                    my $main_photo = $album->main_photo_url;
+                    {
+                        album_title     => $album->title,
+                        album_id        => $album->url_id,
+                    }
+                } @$album_list
+            ];
+            $album_list_json = LJ::JSON->to_json ( $album_list );
+            my $spaces = LJ::Fotki::Photo->get_spaces ( $remote );
+            $available_space = $spaces->[2] || 0;
+        }
+        #####
+        # TODO If remote not exist?
+        #####
+        my $auth_token = LJ::Auth->sessionless_auth_token ($LJ::DOMAIN_WEB."/pics/upload", user => $remote ? $remote->user : undef);
+        my $user_groups = LJ::JSON->to_json (LJ::Widget::Fotki::Photo->get_user_groups ($remote));
+		my $comm = LJ::load_user($LJ::LJPHOTO_ALLOW_FROM_COMMUNITY);
+		my $ljphoto_enabled = $remote && $remote->is_mutual_friend($comm) ? 1 : 0;
+        LJ::need_res('stc/pics/pics.css', 'js/swfupload/swfupload.js', 'js/swfupload/swfupload.queue.js', 'js/jquery/jquery.lj.photouploader.js');
+		
         $$body .= LJ::form_auth();
 
         if ($reposted_from) {
@@ -361,6 +421,70 @@
 
         $$body .= LJ::entry_form($entry, \$$head, $onload, $errors);
         $$body .= "</form><!-- end #updateForm -->\n";
+		
+        $$body .= <<JS;
+<script type="text/javascript">
+	window.ljphotoEnabled = $ljphoto_enabled;
+    jQuery('#updateForm').photouploader({
+		availableSpace: '$available_space',
+		sizesData: $photo_sizes,
+        albumsData: $album_list_json,
+        privacyData: $user_groups,
+        type: 'upload',
+        guid: '$auth_token',
+		
+        ml: {
+JS
+            $$body .= "'fotki.album.add.images': '".BML::ml('fotki.album.albums')."',"
+            ."'fotki.album.link.click.to.upload': '".BML::ml('fotki.album.link.click.to.upload')."',"
+            ."'fotki.album.add.photos': '".BML::ml('fotki.album.add.photos')."',"
+            ."'fotki.album.upgrade': '".BML::ml('fotki.album.upgrade')."',"
+            ."'fotki.album.add.image.name': '".BML::ml('fotki.album.add.image.name')."',"
+            ."'fotki.album.description': '".BML::ml('fotki.album.description')."',"
+            ."'fotki.album.album_cover': '".BML::ml('fotki.album.album_cover')."',"
+            ."'fotki.album.remove.this.image': '".BML::ml('fotki.album.remove.this.image')."',"
+            ."'fotki.album.select_album': '".BML::ml('fotki.album.select_album')."',"
+            ."'fotki.album.new.album.name': '".BML::ml('fotki.album.new.album.name')."',"
+            ."'fotki.album.post.images': '".BML::ml('fotki.album.post.images')."',"
+            ."'fotki.album.save.images': '".BML::ml('fotki.album.save.images')."',"
+            ."'fotki.privacy': '".BML::ml('fotki.privacy')."',"
+            ."'fotki.album.resize.to.post': '".BML::ml('fotki.album.resize.to.post')."',"
+            ."'fotki.album.stop.upload.confirm': '".BML::ml('fotki.album.stop.upload.confirm')."',"
+            ."'fotki.album.close.without.saving.confirm': '".BML::ml('fotki.album.close.without.saving.confirm')."',"
+            ."'fotki.album.upload.unknown.error': '".BML::ml('fotki.album.upload.unknown.error')."',"
+            ."'fotki.album.uploading.image': '".BML::ml('fotki.album.uploading.image')."',"
+            ."'fotki.album.available.now': '".BML::ml('fotki.album.available.now')."',"
+			."'fotki.album.click.image': '".BML::ml('fotki.album.click.image')."',"
+			."'fotki.album.remove.image': '".BML::ml('fotki.album.remove.image')."',"
+            ."'fotki.album.create.new': '".BML::ml('fotki.album.create.new')."'";
+        $$body .= <<JS;
+        }
+    });
+</script>
+JS
+        
+        if (@$insert_photos) {
+            my $insert_photos_json = LJ::JSON->to_json ( $insert_photos );
+			$$body .= <<JS;
+<script type="text/javascript">
+    jQuery('#updateForm')
+		.photouploader({
+			insertPhotosData: $insert_photos_json,
+	
+	        type: 'add'
+	    })
+		.bind('htmlready', function (event, htmlOutput) {
+			if (window.switchedRteOn) {
+				CKEDITOR.instances.draft.insertHtml(htmlOutput);
+			} else {
+				jQuery('#draft').val(jQuery('#draft').val() + htmlOutput);
+			}
+		})
+		.photouploader('show');		
+</script>
+JS
+			
+        }
 
         $$body .= LJ::Widget::SettingWindow->render;
 

Tags: bml, dat, js, livejournal, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments