diff --git a/app/assets/javascripts/rss.js b/app/assets/javascripts/rss.js index 5c17622f3..7b132c0d3 100644 --- a/app/assets/javascripts/rss.js +++ b/app/assets/javascripts/rss.js @@ -379,12 +379,14 @@ modalWindow : function(settings,callbackFn){ var maxwidth = (rgmaskWidth*85)/100; if(typeof tempheight!="undefined"){ + tempheight = tempheight.toString(); if(tempheight.charAt(tempheight.length-1)=='%') tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100; if(tempheight>maxheight) tempheight=maxheight; }else{tempheight="auto";} if(typeof tempwidth!="undefined"){ + tempwidth = tempwidth.toString(); if(tempwidth.charAt(tempwidth.length-1)=='%') tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; if(tempwidth>maxwidth) @@ -462,13 +464,14 @@ modalWindowUpdate : function(settings,callbackFn){ var maxheight = (rgmaskHeight*85)/100; var maxwidth = (rgmaskWidth*85)/100; if(typeof tempheight!="undefined"){ + tempheight = tempheight.toString(); if(tempheight.charAt(tempheight.length-1)=='%') tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100; if(tempheight>maxheight) tempheight=maxheight; }else{tempheight="auto";} - if(typeof tempwidth!="undefined"){ + tempwidth = tempwidth.toString(); if(tempwidth.charAt(tempwidth.length-1)=='%') tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; if(tempwidth>maxwidth) @@ -493,7 +496,7 @@ modalWindowUpdate : function(settings,callbackFn){ if(tempheight!="auto") rgWTop = (rgmaskHeight-tempheight)/2; else{ - tempheight=$rss("#rgwindow_temp_div").height(); + tempheight=$rss("#rgwindow_temp_div").height()+30; if(tempheight>maxheight) tempheight=maxheight; rgWTop=(rgmaskHeight-tempheight)/2; diff --git a/app/uploaders/gallery_uploader.rb b/app/uploaders/gallery_uploader.rb new file mode 100644 index 000000000..773d86d89 --- /dev/null +++ b/app/uploaders/gallery_uploader.rb @@ -0,0 +1,62 @@ +# encoding: utf-8 + +class GalleryUploader < CarrierWave::Uploader::Base + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "gallery/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + version :thumb do + process :resize_to_fit => [120, 90] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # "something.jpg" if original_filename + # end + +# def manipulate! +# raise current_path.inspect +# image = ::MiniMagick::Image.open(current_path) +# image = yield(image) +# image.write(current_path) +# ::MiniMagick::Image.open(current_path) +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") +# end + +end diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/albumframe.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/albumframe.png new file mode 100755 index 000000000..531087bca Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/albumframe.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/default.jpg b/vendor/built_in_modules/gallery/app/assets/images/gallery/default.jpg new file mode 100755 index 000000000..9c925d34f Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/default.jpg differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100 copy.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100 copy.png new file mode 100755 index 000000000..46dc5a051 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100 copy.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100.png new file mode 100755 index 000000000..46dc5a051 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_100.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_128.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_128.png new file mode 100755 index 000000000..fecbd9f28 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_128.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_48.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_48.png new file mode 100755 index 000000000..7b43f298b Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_48.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_75.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_75.png new file mode 100755 index 000000000..1bf4b3871 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/icon_75.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/inputui.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/inputui.png new file mode 100755 index 000000000..cfb2ca923 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/inputui.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/pbar-ani.gif b/vendor/built_in_modules/gallery/app/assets/images/gallery/pbar-ani.gif new file mode 100755 index 000000000..6edd17420 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/pbar-ani.gif differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/playall.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/playall.png new file mode 100755 index 000000000..1ec2d3da4 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/playall.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/rgui.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/rgui.png new file mode 100755 index 000000000..28d4d9b4e Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/rgui.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/sample.jpg b/vendor/built_in_modules/gallery/app/assets/images/gallery/sample.jpg new file mode 100755 index 000000000..0fa645cfe Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/sample.jpg differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/sampleb.jpg b/vendor/built_in_modules/gallery/app/assets/images/gallery/sampleb.jpg new file mode 100755 index 000000000..a71a2471a Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/sampleb.jpg differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/slidelistbg.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidelistbg.png new file mode 100755 index 000000000..8d468d000 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidelistbg.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/slidenav.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidenav.png new file mode 100755 index 000000000..79fd32ea0 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidenav.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/slidetitlebg.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidetitlebg.png new file mode 100755 index 000000000..f6de34e92 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/slidetitlebg.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/slideui.gif b/vendor/built_in_modules/gallery/app/assets/images/gallery/slideui.gif new file mode 100755 index 000000000..1a3df3681 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/slideui.gif differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/upicon.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/upicon.png new file mode 100755 index 000000000..0a16ebe0c Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/upicon.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/uploadbg.gif b/vendor/built_in_modules/gallery/app/assets/images/gallery/uploadbg.gif new file mode 100755 index 000000000..e5fac4244 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/uploadbg.gif differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/uppt.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/uppt.png new file mode 100755 index 000000000..b1c0db0a6 Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/uppt.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/images/gallery/upsep.png b/vendor/built_in_modules/gallery/app/assets/images/gallery/upsep.png new file mode 100755 index 000000000..314f8ac9c Binary files /dev/null and b/vendor/built_in_modules/gallery/app/assets/images/gallery/upsep.png differ diff --git a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js index e05fb2eb9..0eb8e6d77 100644 --- a/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js +++ b/vendor/built_in_modules/gallery/app/assets/javascripts/galleryAPI.js @@ -1,27 +1,173 @@ var galleryAPI = function(){ g = this; - + this.urlVars = rcom.getUrlVars(); + this.albumArea = $("#orbit_gallery"); + this.loadArea = ""; this.initialize = function(){ $(document).ready(function(){ - bindHandlers() + bindHandlers(); + if(typeof g.urlVars['cat']!= "undefined"){ + g.loadAlbums(g.urlVars['cat']); + g.loadArea = "albums"; + }else if(typeof g.urlVars['album']!= "undefined"){ + g.loadImages(g.urlVars['album']); + g.loadArea = "images"; + }else if(typeof g.urlVars['theater']!= "undefined"){ + g.loadTheater(g.urlVars['theater']); + g.loadArea = "theater"; + }else{ + g.loadAlbums("all"); + g.loadArea = "albums"; + } }) var bindHandlers = function(){ $("#gallery_panel a.btn").click(function(){ - rcom.modalWindow({loadDiv:"#"+$(this).attr("href"),width:"400"},function(dom){ - console.log(dom) - dom.find("#category_save_btn").click(function(){ - var lang = { - "en" : dom.find("#category_name_en").val(), - "zh_tw" : dom.find("#category_name_zh_tw").val() - } - $.post("gallery_category_save",{"category":lang},function(){ - - }) - return false; - }) - }); - return false; + switch ($(this).attr("href")){ + case "categories": + g.initializeCategories(); + break; + } + }); + $("select#category_filter").change(function(){ + var val = $(this).val(); + window.location = "orbit_gallery?cat="+val; }) } } -} \ No newline at end of file + + this.initializeCategories = function(){ + var deleteCategory = function(a){ + var cid = a.attr("href"); + $.post("gallery_category_delete",{id:cid},function(response){ + if(response.success) + a.parent().hide("slide",function(){a.parent().remove();}) + }) + } + + $.get("categorylist",function(html){ + rcom.modalWindow({loadHtml:html,width:"400","closeBtn":false},function(dom){ + dom.find("ul#category_list a.delete").click(function(){ + var a = $(this); + deleteCategory(a); + }) + dom.find("#category_save_btn").click(function(){ + var lang = { + "en" : dom.find("#category_name_en").val(), + "zh_tw" : dom.find("#category_name_zh_tw").val() + }; + $.post("gallery_category_save",{"category":lang},function(response){ + if(response.success){ + var $li = $("