diff --git a/.gitignore b/.gitignore index 412920612..c86ad0d31 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,8 @@ log/*.log tmp/**/* public/uploads/**/* uploads/**/* - +public/panel/**/* +public/index.html .DS_Store *.swp diff --git a/Gemfile b/Gemfile index abf87c594..906fa408b 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem "brakeman" gem 'bson_ext' gem 'carrierwave' gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid' +gem "net-ldap", "~> 0.3.1" gem 'devise', '1.5.3' gem 'exception_notification' # Send error trace gem 'execjs' @@ -14,27 +15,48 @@ gem 'jquery-ui-rails' gem 'kaminari', :git => 'git://github.com/amatsuda/kaminari.git' +# gem "memcached", "~> 1.4.3" +# gem "memcache-client" + gem 'mini_magick' gem 'mongoid' gem 'mongoid-tree', :require => 'mongoid/tree' gem "mongo_session_store-rails3" +gem 'mysql2' gem 'nokogiri' gem 'radius' gem 'rake' +# gem 'remotipart' gem 'resque' # background jobs gem 'resque-scheduler' # job scheduling gem 'resque-restriction' +#gem 'rb-readline' gem 'ruby-debug19' gem 'rubyzip' + +gem 'sunspot_mongo' +gem 'sunspot_solr' +gem 'progress_bar' + gem 'sinatra' #gem 'sinatra-contrib' gem 'sprockets' +gem 'social-share-button' + gem 'tinymce-rails' gem 'therubyracer' if RUBY_PLATFORM.downcase.include?("linux") gem 'mongoid-encryptor', :require => 'mongoid/encryptor' -#gem 'contacts' +gem 'rb-readline' if RUBY_PLATFORM.downcase.include?("linux") -gem "impressionist", :require => "impressionist", :path => "vendor/impressionist" + +gem "impressionist", :git => 'git://github.com/charlotte-ruby/impressionist.git' + +gem 'redis','>= 2.1.1' +gem 'chinese_pinyin', '0.4.1' +# add rmmseg if you need search by segment words +gem 'rmmseg-cpp-huacnlee', '0.2.9' +gem 'redis-namespace','~> 1.0.2' +gem 'redis-search', '0.7.1' # Gems used only for assets and not required # in production environments by default. @@ -46,6 +68,7 @@ end group :test, :development do + gem "sunspot-rails-tester" gem 'spork' gem 'database_cleaner' #Strategies for cleaning databases. Can be used to ensure a clean state for testing. gem "rspec", "~> 2.0" diff --git a/Gemfile.lock b/Gemfile.lock index afec15c8c..4e6e42c8b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,8 +6,9 @@ GIT actionpack (>= 3.0.0) activesupport (>= 3.0.0) -PATH - remote: vendor/impressionist +GIT + remote: git://github.com/charlotte-ruby/impressionist.git + revision: 7a93fff25568cd3edcc63c1a3c4b60dc6b81d2b7 specs: impressionist (1.1.1) httpclient (~> 2.2) @@ -65,6 +66,7 @@ GEM carrierwave-mongoid (0.1.3) carrierwave (>= 0.5.6) mongoid (~> 2.1) + chinese_pinyin (0.4.1) chronic (0.6.7) coffee-rails (3.1.1) coffee-script (>= 2.2.0) @@ -95,7 +97,9 @@ GEM factory_girl (~> 2.6.0) railties (>= 3.0.0) fastercsv (1.5.4) + fattr (2.2.1) haml (3.1.4) + highline (1.6.13) hike (1.2.1) hoe (2.16.1) rake (~> 0.8) @@ -133,13 +137,22 @@ GEM mongoid-tree (0.7.0) mongoid (~> 2.0) multi_json (1.1.0) + mysql2 (0.3.11) + mysql2 (0.3.11-x86-mingw32) + net-ldap (0.3.1) nokogiri (1.5.2) nokogiri (1.5.2-x86-mingw32) + options (2.3.0) + fattr orm_adapter (0.0.6) pdf-writer (1.1.8) color (>= 1.4.0) transaction-simple (~> 1.3) polyglot (0.3.3) + pr_geohash (1.0.0) + progress_bar (0.4.0) + highline (~> 1.6.1) + options (~> 2.3.0) rack (1.3.6) rack-cache (1.2) rack (>= 0.4) @@ -173,6 +186,10 @@ GEM redis (2.2.2) redis-namespace (1.0.3) redis (< 3.0.0) + redis-search (0.7.1) + chinese_pinyin (>= 0.3.0) + redis (>= 2.1.1) + redis-namespace (~> 1.0.2) resque (1.20.0) multi_json (~> 1.0) redis-namespace (~> 1.0.2) @@ -184,6 +201,9 @@ GEM redis (>= 2.0.1) resque (>= 1.8.0) rufus-scheduler + rmmseg-cpp-huacnlee (0.2.9) + rsolr (1.0.8) + builder (>= 2.1.2) rspec (2.8.0) rspec-core (~> 2.8.0) rspec-expectations (~> 2.8.0) @@ -234,6 +254,7 @@ GEM rack (~> 1.3, >= 1.3.6) rack-protection (~> 1.2) tilt (~> 1.3, >= 1.3.3) + social-share-button (0.0.6) spork (0.9.0) spork (0.9.0-x86-mingw32) win32-process @@ -242,6 +263,17 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) subexec (0.2.1) + sunspot (1.3.3) + pr_geohash (~> 1.0) + rsolr (~> 1.0.7) + sunspot-rails-tester (0.0.4) + sunspot_rails (~> 1.2) + sunspot_mongo (1.0.1) + sunspot_rails + sunspot_rails (1.3.3) + nokogiri + sunspot (= 1.3.3) + sunspot_solr (1.3.3) thor (0.14.6) tilt (1.3.3) tinymce-rails (3.4.8) @@ -278,6 +310,7 @@ DEPENDENCIES bson_ext carrierwave carrierwave-mongoid + chinese_pinyin (= 0.4.1) coffee-rails database_cleaner delorean @@ -294,13 +327,20 @@ DEPENDENCIES mongoid mongoid-encryptor mongoid-tree + mysql2 + net-ldap (~> 0.3.1) nokogiri + progress_bar radius rails (>= 3.1.0, < 3.2.0) rake + redis (>= 2.1.1) + redis-namespace (~> 1.0.2) + redis-search (= 0.7.1) resque resque-restriction resque-scheduler + rmmseg-cpp-huacnlee (= 0.2.9) rspec (~> 2.0) rspec-rails (~> 2.0) ruby-debug19 @@ -309,8 +349,12 @@ DEPENDENCIES shoulda-matchers simplecov sinatra + social-share-button spork sprockets + sunspot-rails-tester + sunspot_mongo + sunspot_solr tinymce-rails uglifier watchr diff --git a/app/assets/fonts/fontawesome-webfont.eot b/app/assets/fonts/fontawesome-webfont.eot new file mode 100644 index 000000000..89070c1e6 Binary files /dev/null and b/app/assets/fonts/fontawesome-webfont.eot differ diff --git a/app/assets/fonts/fontawesome-webfont.svg b/app/assets/fonts/fontawesome-webfont.svg new file mode 100644 index 000000000..1245f92c2 --- /dev/null +++ b/app/assets/fonts/fontawesome-webfont.svg @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/assets/fonts/fontawesome-webfont.ttf b/app/assets/fonts/fontawesome-webfont.ttf new file mode 100644 index 000000000..c17e9f8d1 Binary files /dev/null and b/app/assets/fonts/fontawesome-webfont.ttf differ diff --git a/app/assets/fonts/fontawesome-webfont.woff b/app/assets/fonts/fontawesome-webfont.woff new file mode 100644 index 000000000..09f2469a1 Binary files /dev/null and b/app/assets/fonts/fontawesome-webfont.woff differ diff --git a/app/assets/images/news_alt.jpg b/app/assets/images/news_alt.jpg new file mode 100644 index 000000000..a7b1fb329 Binary files /dev/null and b/app/assets/images/news_alt.jpg differ diff --git a/app/assets/images/social-share-button.png b/app/assets/images/social-share-button.png new file mode 100644 index 000000000..3507161c7 Binary files /dev/null and b/app/assets/images/social-share-button.png differ diff --git a/app/assets/javascripts/ajax_form.js b/app/assets/javascripts/ajax_form.js deleted file mode 100644 index d9b5abfec..000000000 --- a/app/assets/javascripts/ajax_form.js +++ /dev/null @@ -1,7 +0,0 @@ -$(document).on('click', '#ajax_form_submit', function(){ - $('#ajaxForm').ajaxSubmit({ - beforeSubmit: function(a,f,o) { - o.dataType = 'script'; - } - }); -}); \ No newline at end of file diff --git a/app/assets/javascripts/ajax_form.js.erb b/app/assets/javascripts/ajax_form.js.erb new file mode 100644 index 000000000..917c352df --- /dev/null +++ b/app/assets/javascripts/ajax_form.js.erb @@ -0,0 +1,111 @@ +<%#= encoding: utf-8 %> +$(document).on('click', '#ajax_form_submit', function(){ + // $('#ajaxForm').ajaxSubmit({ + // beforeSubmit: function(a,f,o) { + // o.dataType = 'script'; + // if (o.dataType == 'script') { + // o.url = o.url.split('?'); // split on GET params + // if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js + // o.url = o.url.join('?'); // join on GET params + // } + // }, + // success: function(response,status,xhr){ + // alert(response); + // alert(status); + // alert(xhr); + // }, + // error:function(){ + // alert("error"); + // } + // }); + + + var o = { + // dataType: 'script', + dataType: 'html', + url:$("#ajaxForm").attr("action"), + beforeSubmit: function(){ + var sub = true; + $("span.error").remove(); + $("#dyn_error").empty(); + $("#ajaxForm input").each(function(){ + if($(this).val() == ""){ + $(" *").insertAfter($(this)); + sub = false; + } + }) + if(!sub){ + $("#dyn_error").text("Cannot be empty."); + $("#dyn_error").text("<%= I18n.t('cant_empty_star') %>"); + return false; + } + }, + success: function(response,status,xhr){ + if(typeof tinyMCEPopup != "undefined"){ + var x = response.split("#"); + var returnurl = x[0], + returntitle = x[1], + returndescription = x[2]; + var win = tinyMCEPopup.getWindowArg("window"); + win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = returnurl; + win.document.getElementById(tinyMCEPopup.getWindowArg("alt")).value = returndescription; + win.document.getElementById(tinyMCEPopup.getWindowArg("title")).value = returntitle; + if (typeof(win.ImageDialog) != "undefined") { + // we are, so update image dimensions... + if (win.ImageDialog.getImageData) + win.ImageDialog.getImageData(); + + // ... and preview if necessary + if (win.ImageDialog.showPreviewImage) + win.ImageDialog.showPreviewImage(returnurl); + } + tinyMCEPopup.close(); + }else{ + //incase if we want to do something for quick edit file upload + // var modalvalues = ""; + // var r = ""; + // if(rcom.getInternetExplorerVersion() > -1){ + // r = "" + response + ""; + // r = r.replace("**",""); + // r = r.replace("**",""); + // r = $(r); + // modalvalues = r.find("span").attr("data-content").split("#"); + // r.attr("id",r.find("span").attr("for")); + // var table=document.getElementById(modalvalues[0]); + // //var tbody = table.getElementsByTagName("tbody"); + // var row = table.insertRow(table.rows.length-1); + // var c1 = row.insertCell(0), + // c2 = row.insertCell(1), + // c3 = row.insertCell(2); + // c1.innerHTML = r.find("td").eq(0).html(); + // c2.innerHTML = r.find("td").eq(1).html(); + // c3.innerHTML = r.find("td").eq(2).html(); + // var trow = $("#bulletin_files tfoot").find("tr").eq(0); + // $("#bulletin_files tbody").append(trow); + // }else{ + + // response = response.replace("**",""); + // response = response.replace("**",""); + // r = $(response); + // modalvalues = r.find("span").attr("data-content").split("#"); + // $('#' + modalvalues[0]+ ' tbody').append(r); + // } + // console.log(modalvalues[1]); + // $("#"+modalvalues[1]).modal('hide'); + //$('#bulletin_files tbody').append(r); + //$(response).fadeIn(); + } + }, + error:function(){ + alert("error"); + } + } + + if (o.dataType == 'script') { + o.url = o.url.split('?'); // split on GET params + if (o.url[0].substr(-3) != '.js') o.url[0] += '.js'; // force rails to respond to respond to the request with :format = js + o.url = o.url.join('?'); // join on GET params + } + $('#ajaxForm').ajaxSubmit(o); + +}); \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 13d92690e..f3c799cf2 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -6,4 +6,5 @@ // //= require jquery //= require jquery_ujs -//= require_tree . \ No newline at end of file +//= require_tree . +//= social-share-button \ No newline at end of file diff --git a/app/assets/javascripts/bootstrap.js b/app/assets/javascripts/bootstrap.js index af3bc7270..5c158c64b 100644 --- a/app/assets/javascripts/bootstrap.js +++ b/app/assets/javascripts/bootstrap.js @@ -129,7 +129,6 @@ var that = this this.isShown = false - //alert(this.isShown+":"+this.$element.attr('class')) $('body').removeClass('modal-open') @@ -1250,8 +1249,8 @@ var that = this , complete = function () { if (startEvent == 'show') that.reset() - that.$element.trigger(completeEvent) - mainTablePosition(); + that.$element.trigger(completeEvent) + setTimeout(mainTablePosition,150); } this.$element diff --git a/app/assets/javascripts/bulletin_form.js.erb b/app/assets/javascripts/bulletin_form.js.erb index cf2dfd69c..18e8e375b 100644 --- a/app/assets/javascripts/bulletin_form.js.erb +++ b/app/assets/javascripts/bulletin_form.js.erb @@ -1,3 +1,6 @@ +<%#= encoding: utf-8 %> +$(document).ready(function(){ +//alert("Anc Loaded"); $('.bulletin_links_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); @@ -7,8 +10,10 @@ $('.bulletin_files_block a.delete').live('click', function(){ }); $(document).on('click', '.action a.remove_existing_record', function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr #" + $(this).prev().attr('value')).hide(); + if(confirm("<%= I18n.t('announcement.sure?')%>")){ + $(this).next('.should_destroy').attr('value', 1); + $("tr#" + $(this).prev().attr('value')).hide(); + } }); $(document).on('click', '.quick_edit_cancel', function(){ @@ -16,4 +21,8 @@ $(document).on('click', '.quick_edit_cancel', function(){ $('#' + tr).hide(); $("tr#bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#bulletin_link_" + $(this).prev().attr('value')).hide(); +}); +$('.reject_info').tooltip({ + placement : 'bottom' +}); }); \ No newline at end of file diff --git a/app/assets/javascripts/lib/jquery.masonry.min.js b/app/assets/javascripts/lib/jquery.masonry.min.js new file mode 100644 index 000000000..67be98867 --- /dev/null +++ b/app/assets/javascripts/lib/jquery.masonry.min.js @@ -0,0 +1,10 @@ +/** + * jQuery Masonry v2.1.05 + * A dynamic layout plugin for jQuery + * The flip-side of CSS Floats + * http://masonry.desandro.com + * + * Licensed under the MIT license. + * Copyright 2012 David DeSandro + */ +(function(a,b,c){"use strict";var d=b.event,e;d.special.smartresize={setup:function(){b(this).bind("resize",d.special.smartresize.handler)},teardown:function(){b(this).unbind("resize",d.special.smartresize.handler)},handler:function(a,c){var d=this,f=arguments;a.type="smartresize",e&&clearTimeout(e),e=setTimeout(function(){b.event.handle.apply(d,f)},c==="execAsap"?0:100)}},b.fn.smartresize=function(a){return a?this.bind("smartresize",a):this.trigger("smartresize",["execAsap"])},b.Mason=function(a,c){this.element=b(c),this._create(a),this._init()},b.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},b.Mason.prototype={_filterFindBricks:function(a){var b=this.options.itemSelector;return b?a.filter(b).add(a.find(b)):a},_getBricks:function(a){var b=this._filterFindBricks(a).css({position:"absolute"}).addClass("masonry-brick");return b},_create:function(c){this.options=b.extend(!0,{},b.Mason.settings,c),this.styleQueue=[];var d=this.element[0].style;this.originalStyle={height:d.height||""};var e=this.options.containerStyle;for(var f in e)this.originalStyle[f]=d[f]||"";this.element.css(e),this.horizontalDirection=this.options.isRTL?"right":"left",this.offset={x:parseInt(this.element.css("padding-"+this.horizontalDirection),10),y:parseInt(this.element.css("padding-top"),10)},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var g=this;setTimeout(function(){g.element.addClass("masonry")},0),this.options.isResizable&&b(a).bind("smartresize.masonry",function(){g.resize()}),this.reloadItems()},_init:function(a){this._getColumns(),this._reLayout(a)},option:function(a,c){b.isPlainObject(a)&&(this.options=b.extend(!0,this.options,a))},layout:function(a,b){for(var c=0,d=a.length;c')).load(handler).error(handler).bind('abort',handler).each(fetch);function handler(e){data.element=this;data.found=e.type=='load';data.image=this.src;data.index=this.index;var a=data.original=c[this.index];data[data.found?'loaded':'failed']++;data.done++;if(d.enforceCache)h.cache.push($('').attr('src',data.image)[0]);if(d.placeholder&&a.src)a.src=data.found?data.image:d.notFound||a.src;if(d.onComplete)d.onComplete(data);if(data.done + window.open(url) + false + + share : (el) -> + site = $(el).data('site') + title = encodeURIComponent($(el).parent().data('title')) + img = encodeURIComponent($(el).parent().data("img")) + fb_url = encodeURIComponent($(el).parent().data("fb_url")) + url = encodeURIComponent(location.href) + switch site + when "weibo" + SocialShareButton.openUrl("http://v.t.sina.com.cn/share/share.php?url=#{url}&pic=#{img}&title=#{title}&content=utf-8") + when "twitter" + SocialShareButton.openUrl("https://twitter.com/home?status=#{title}: #{url}") + when "douban" + SocialShareButton.openUrl("http://www.douban.com/recommend/?url=#{url}&title=#{title}&image=#{img}") + when "facebook" + SocialShareButton.openUrl("http://www.facebook.com/sharer.php?t=#{title}&u=#{fb_url}") + when "qq" + SocialShareButton.openUrl("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=#{url}&title=#{title}&pics=#{img}") + when "tqq" + SocialShareButton.openUrl("http://share.v.t.qq.com/index.php?c=share&a=index&url=#{url}&title=#{title}&pic=#{img}") + when "baidu" + SocialShareButton.openUrl("http://apps.hi.baidu.com/share/?url=#{url}&title=#{title}&content=") + when "kaixin001" + SocialShareButton.openUrl("http://www.kaixin001.com/rest/records.php?url=#{url}&content=#{title}&style=11&pic=#{img}") + when "renren" + SocialShareButton.openUrl("http://widget.renren.com/dialog/share?resourceUrl=#{url}&title=#{title}&description=") + when "google_plus" + SocialShareButton.openUrl("https://plus.google.com/share?url=#{url}&t=#{title}") + false \ No newline at end of file diff --git a/app/assets/javascripts/news_bulletin_form.js b/app/assets/javascripts/news_bulletin_form.js.erb similarity index 64% rename from app/assets/javascripts/news_bulletin_form.js rename to app/assets/javascripts/news_bulletin_form.js.erb index 6f0f9ac56..092bbfffd 100644 --- a/app/assets/javascripts/news_bulletin_form.js +++ b/app/assets/javascripts/news_bulletin_form.js.erb @@ -1,3 +1,7 @@ +<%#= encoding: utf-8 %> +$(document).ready(function(){ +//alert("News Loaded"); + $('.news_bulletin_links_block a.delete').live('click', function(){ $(this).parents('.list_item').remove(); }); @@ -7,8 +11,10 @@ $('.news_bulletin_files_block a.delete').live('click', function(){ }); $(document).on('click', '.action a.remove_existing_record', function(){ - $(this).next('.should_destroy').attr('value', 1); - $("tr #" + $(this).prev().attr('value')).hide(); + if(confirm("<%= I18n.t('news.sure?')%>")){ + $(this).next('.should_destroy').attr('value', 1); + $("tr#" + $(this).prev().attr('value')).hide(); + } }); $(document).on('click', '.quick_edit_cancel', function(){ @@ -16,4 +22,8 @@ $(document).on('click', '.quick_edit_cancel', function(){ $('#' + tr).hide(); $("tr#news_bulletin_file_" + $(this).prev().attr('value')).hide(); $("tr#news_bulletin_link_" + $(this).prev().attr('value')).hide(); +}); +$('.reject_info').tooltip({ + placement : 'bottom' +}); }); \ No newline at end of file diff --git a/app/assets/javascripts/sort_header.js b/app/assets/javascripts/sort_header.js deleted file mode 100644 index 25a163449..000000000 --- a/app/assets/javascripts/sort_header.js +++ /dev/null @@ -1,7 +0,0 @@ -$(document).on('click', '.list-remove', function(){ - $('#delete_all').submit(); -}); - -$(document).on('click', '#check_all', function(){ - $('.checkbox_in_list').attr("checked", this.checked); -}); \ No newline at end of file diff --git a/app/assets/javascripts/sort_header.js.erb b/app/assets/javascripts/sort_header.js.erb new file mode 100644 index 000000000..34add9fcc --- /dev/null +++ b/app/assets/javascripts/sort_header.js.erb @@ -0,0 +1,19 @@ +<%#= encoding: utf-8 %> +$(document).on('click', '.list-remove', function(){ + if(confirm("<%= I18n.t('sure?') %>")){ + var a = []; + $('.checkbox_in_list').each(function(){ + if (this.checked) a.push("ids[]=" + this.value); + }); + var url = $(this).attr('rel'); + if (url.indexOf('?') > -1){ + $.getScript(url + '&' + a.join('&')); + }else{ + $.getScript(url + '?' + a.join('&')); + } + } +}); + +$(document).on('click', '#check_all', function(){ + $('.checkbox_in_list').attr("checked", this.checked); +}); \ No newline at end of file diff --git a/app/assets/javascripts/tinymce_orbit.js.erb b/app/assets/javascripts/tinymce_orbit.js.erb index fda57e29a..50bcc2321 100644 --- a/app/assets/javascripts/tinymce_orbit.js.erb +++ b/app/assets/javascripts/tinymce_orbit.js.erb @@ -47,7 +47,7 @@ function myFileBrowser(field_name, url, type, win) { var cmsURL = window.location.toString(); cmsURL = cmsURL.split("/"); cmsURL = "<%= Rails.application.routes.url_helpers.file_upload_admin_assets_path %>"; - + // script URL - use an absolute path! if (cmsURL.indexOf("?") < 0) { //add the type as the only query parameter diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 9833ffda0..c0c227fe5 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -3,5 +3,5 @@ *and any sub-directories. You're free to add application-wide styles to this file and they'll appear at *the top of the compiled file, but it's generally better to create a new file per style scope. *= require_self - + *= require social-share-button */ diff --git a/app/assets/stylesheets/bootstrap.css.erb b/app/assets/stylesheets/bootstrap.css.erb index 62a0afe8e..2bdf4556b 100644 --- a/app/assets/stylesheets/bootstrap.css.erb +++ b/app/assets/stylesheets/bootstrap.css.erb @@ -1116,381 +1116,959 @@ table .span12 { width: 924px; margin-left: 0; } -[class^="icon-"] { +/* Font Awesome + the iconic font designed for use with Twitter Bootstrap + ------------------------------------------------------- + The full suite of pictographic icons, examples, and documentation + can be found at: http://fortawesome.github.com/Font-Awesome/ + + License + ------------------------------------------------------- + The Font Awesome webfont, CSS, and LESS files are licensed under CC BY 3.0: + http://creativecommons.org/licenses/by/3.0/ A mention of + 'Font Awesome - http://fortawesome.github.com/Font-Awesome' in human-readable + source code is considered acceptable attribution (most common on the web). + If human readable source code is not available to the end user, a mention in + an 'About' or 'Credits' screen is considered acceptable (most common in desktop + or mobile software). + + Contact + ------------------------------------------------------- + Email: dave@davegandy.com + Twitter: http://twitter.com/fortaweso_me + Work: http://lemonwi.se co-founder + + */ +@font-face { + font-family: "FontAwesome"; + src: url(<%= asset_path 'fontawesome-webfont.eot' %>); + src: url(<%= asset_path 'fontawesome-webfont.eot?#iefix' %>) format('eot'), url(<%= asset_path 'fontawesome-webfont.woff' %>) format('woff'), url(<%= asset_path 'fontawesome-webfont.ttf' %>) format('truetype'), url(<%= asset_path 'fontawesome-webfont.svg#FontAwesome' %>) format('svg'); + font-weight: normal; + font-style: normal; +} + +/* Font Awesome styles + ------------------------------------------------------- */ +[class^="icon-"]:before, [class*=" icon-"]:before { + font-family: FontAwesome; + font-weight: normal; + font-style: normal; display: inline-block; - width: 14px; - height: 14px; - vertical-align: text-top; - background-image: url(<%= asset_path 'glyphicons-halflings.png' %>); - background-position: 14px 14px; - background-repeat: no-repeat; - *margin-right: .3em; + text-decoration: inherit; } -[class^="icon-"]:last-child { - *margin-left: 0; +a [class^="icon-"], a [class*=" icon-"] { + display: inline-block; + text-decoration: inherit; } -.icon-white { - background-image: url(<%= asset_path 'glyphicons-halflings-white.png' %>); +/* makes the font 33% larger relative to the icon container */ +.icon-large:before { + vertical-align: top; + font-size: 1.3333333333333333em; +} +.btn [class^="icon-"], .btn [class*=" icon-"] { + /* keeps button heights with and without icons the same */ + + line-height: .9em; +} +li [class^="icon-"], li [class*=" icon-"] { + display: inline-block; + width: 1.25em; + text-align: center; +} +li .icon-large[class^="icon-"], li .icon-large[class*=" icon-"] { + /* 1.5 increased font size for icon-large * 1.25 width */ + + width: 1.875em; +} +li[class^="icon-"], li[class*=" icon-"] { + margin-left: 0; + list-style-type: none; +} +li[class^="icon-"]:before, li[class*=" icon-"]:before { + text-indent: -2em; + text-align: center; +} +li[class^="icon-"].icon-large:before, li[class*=" icon-"].icon-large:before { + text-indent: -1.3333333333333333em; +} +/* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen + readers do not read off random characters that represent icons */ +.icon-glass:before { content: "\f000"; } +.icon-music:before { content: "\f001"; } +.icon-search:before { content: "\f002"; } +.icon-envelope:before { content: "\f003"; } +.icon-heart:before { content: "\f004"; } +.icon-star:before { content: "\f005"; } +.icon-star-empty:before { content: "\f006"; } +.icon-user:before { content: "\f007"; } +.icon-film:before { content: "\f008"; } +.icon-th-large:before { content: "\f009"; } +.icon-th:before { content: "\f00a"; } +.icon-th-list:before { content: "\f00b"; } +.icon-ok:before { content: "\f00c"; } +.icon-remove:before { content: "\f00d"; } +.icon-zoom-in:before { content: "\f00e"; } + +.icon-zoom-out:before { content: "\f010"; } +.icon-off:before { content: "\f011"; } +.icon-signal:before { content: "\f012"; } +.icon-cog:before { content: "\f013"; } +.icon-trash:before { content: "\f014"; } +.icon-home:before { content: "\f015"; } +.icon-file:before { content: "\f016"; } +.icon-time:before { content: "\f017"; } +.icon-road:before { content: "\f018"; } +.icon-download-alt:before { content: "\f019"; } +.icon-download:before { content: "\f01a"; } +.icon-upload:before { content: "\f01b"; } +.icon-inbox:before { content: "\f01c"; } +.icon-play-circle:before { content: "\f01d"; } +.icon-repeat:before { content: "\f01e"; } + +/* \f020 doesn't work in Safari. all shifted one down */ +.icon-refresh:before { content: "\f021"; } +.icon-list-alt:before { content: "\f022"; } +.icon-lock:before { content: "\f023"; } +.icon-flag:before { content: "\f024"; } +.icon-headphones:before { content: "\f025"; } +.icon-volume-off:before { content: "\f026"; } +.icon-volume-down:before { content: "\f027"; } +.icon-volume-up:before { content: "\f028"; } +.icon-qrcode:before { content: "\f029"; } +.icon-barcode:before { content: "\f02a"; } +.icon-tag:before { content: "\f02b"; } +.icon-tags:before { content: "\f02c"; } +.icon-book:before { content: "\f02d"; } +.icon-bookmark:before { content: "\f02e"; } +.icon-print:before { content: "\f02f"; } + +.icon-camera:before { content: "\f030"; } +.icon-font:before { content: "\f031"; } +.icon-bold:before { content: "\f032"; } +.icon-italic:before { content: "\f033"; } +.icon-text-height:before { content: "\f034"; } +.icon-text-width:before { content: "\f035"; } +.icon-align-left:before { content: "\f036"; } +.icon-align-center:before { content: "\f037"; } +.icon-align-right:before { content: "\f038"; } +.icon-align-justify:before { content: "\f039"; } +.icon-list:before { content: "\f03a"; } +.icon-indent-left:before { content: "\f03b"; } +.icon-indent-right:before { content: "\f03c"; } +.icon-facetime-video:before { content: "\f03d"; } +.icon-picture:before { content: "\f03e"; } + +.icon-pencil:before { content: "\f040"; } +.icon-map-marker:before { content: "\f041"; } +.icon-adjust:before { content: "\f042"; } +.icon-tint:before { content: "\f043"; } +.icon-edit:before { content: "\f044"; } +.icon-share:before { content: "\f045"; } +.icon-check:before { content: "\f046"; } +.icon-move:before { content: "\f047"; } +.icon-step-backward:before { content: "\f048"; } +.icon-fast-backward:before { content: "\f049"; } +.icon-backward:before { content: "\f04a"; } +.icon-play:before { content: "\f04b"; } +.icon-pause:before { content: "\f04c"; } +.icon-stop:before { content: "\f04d"; } +.icon-forward:before { content: "\f04e"; } + +.icon-fast-forward:before { content: "\f050"; } +.icon-step-forward:before { content: "\f051"; } +.icon-eject:before { content: "\f052"; } +.icon-chevron-left:before { content: "\f053"; } +.icon-chevron-right:before { content: "\f054"; } +.icon-plus-sign:before { content: "\f055"; } +.icon-minus-sign:before { content: "\f056"; } +.icon-remove-sign:before { content: "\f057"; } +.icon-ok-sign:before { content: "\f058"; } +.icon-question-sign:before { content: "\f059"; } +.icon-info-sign:before { content: "\f05a"; } +.icon-screenshot:before { content: "\f05b"; } +.icon-remove-circle:before { content: "\f05c"; } +.icon-ok-circle:before { content: "\f05d"; } +.icon-ban-circle:before { content: "\f05e"; } + +.icon-arrow-left:before { content: "\f060"; } +.icon-arrow-right:before { content: "\f061"; } +.icon-arrow-up:before { content: "\f062"; } +.icon-arrow-down:before { content: "\f063"; } +.icon-share-alt:before { content: "\f064"; } +.icon-resize-full:before { content: "\f065"; } +.icon-resize-small:before { content: "\f066"; } +.icon-plus:before { content: "\f067"; } +.icon-minus:before { content: "\f068"; } +.icon-asterisk:before { content: "\f069"; } +.icon-exclamation-sign:before { content: "\f06a"; } +.icon-gift:before { content: "\f06b"; } +.icon-leaf:before { content: "\f06c"; } +.icon-fire:before { content: "\f06d"; } +.icon-eye-open:before { content: "\f06e"; } + +.icon-eye-close:before { content: "\f070"; } +.icon-warning-sign:before { content: "\f071"; } +.icon-plane:before { content: "\f072"; } +.icon-calendar:before { content: "\f073"; } +.icon-random:before { content: "\f074"; } +.icon-comment:before { content: "\f075"; } +.icon-magnet:before { content: "\f076"; } +.icon-chevron-up:before { content: "\f077"; } +.icon-chevron-down:before { content: "\f078"; } +.icon-retweet:before { content: "\f079"; } +.icon-shopping-cart:before { content: "\f07a"; } +.icon-folder-close:before { content: "\f07b"; } +.icon-folder-open:before { content: "\f07c"; } +.icon-resize-vertical:before { content: "\f07d"; } +.icon-resize-horizontal:before { content: "\f07e"; } + +.icon-bar-chart:before { content: "\f080"; } +.icon-twitter-sign:before { content: "\f081"; } +.icon-facebook-sign:before { content: "\f082"; } +.icon-camera-retro:before { content: "\f083"; } +.icon-key:before { content: "\f084"; } +.icon-cogs:before { content: "\f085"; } +.icon-comments:before { content: "\f086"; } +.icon-thumbs-up:before { content: "\f087"; } +.icon-thumbs-down:before { content: "\f088"; } +.icon-star-half:before { content: "\f089"; } +.icon-heart-empty:before { content: "\f08a"; } +.icon-signout:before { content: "\f08b"; } +.icon-linkedin-sign:before { content: "\f08c"; } +.icon-pushpin:before { content: "\f08d"; } +.icon-external-link:before { content: "\f08e"; } + +.icon-signin:before { content: "\f090"; } +.icon-trophy:before { content: "\f091"; } +.icon-github-sign:before { content: "\f092"; } +.icon-upload-alt:before { content: "\f093"; } +.icon-lemon:before { content: "\f094"; } +.icon-phone:before { content: "\f095"; } +.icon-check-empty:before { content: "\f096"; } +.icon-bookmark-empty:before { content: "\f097"; } +.icon-phone-sign:before { content: "\f098"; } +.icon-twitter:before { content: "\f099"; } +.icon-facebook:before { content: "\f09a"; } +.icon-github:before { content: "\f09b"; } +.icon-unlock:before { content: "\f09c"; } +.icon-credit-card:before { content: "\f09d"; } +.icon-rss:before { content: "\f09e"; } + +.icon-hdd:before { content: "\f0a0"; } +.icon-bullhorn:before { content: "\f0a1"; } +.icon-bell:before { content: "\f0a2"; } +.icon-certificate:before { content: "\f0a3"; } +.icon-hand-right:before { content: "\f0a4"; } +.icon-hand-left:before { content: "\f0a5"; } +.icon-hand-up:before { content: "\f0a6"; } +.icon-hand-down:before { content: "\f0a7"; } +.icon-circle-arrow-left:before { content: "\f0a8"; } +.icon-circle-arrow-right:before { content: "\f0a9"; } +.icon-circle-arrow-up:before { content: "\f0aa"; } +.icon-circle-arrow-down:before { content: "\f0ab"; } +.icon-globe:before { content: "\f0ac"; } +.icon-wrench:before { content: "\f0ad"; } +.icon-tasks:before { content: "\f0ae"; } + +.icon-filter:before { content: "\f0b0"; } +.icon-briefcase:before { content: "\f0b1"; } +.icon-fullscreen:before { content: "\f0b2"; } + +.icon-group:before { content: "\f0c0"; } +.icon-link:before { content: "\f0c1"; } +.icon-cloud:before { content: "\f0c2"; } +.icon-beaker:before { content: "\f0c3"; } +.icon-cut:before { content: "\f0c4"; } +.icon-copy:before { content: "\f0c5"; } +.icon-paper-clip:before { content: "\f0c6"; } +.icon-save:before { content: "\f0c7"; } +.icon-sign-blank:before { content: "\f0c8"; } +.icon-reorder:before { content: "\f0c9"; } +.icon-list-ul:before { content: "\f0ca"; } +.icon-list-ol:before { content: "\f0cb"; } +.icon-strikethrough:before { content: "\f0cc"; } +.icon-underline:before { content: "\f0cd"; } +.icon-table:before { content: "\f0ce"; } + +.icon-magic:before { content: "\f0d0"; } +.icon-truck:before { content: "\f0d1"; } +.icon-pinterest:before { content: "\f0d2"; } +.icon-pinterest-sign:before { content: "\f0d3"; } +.icon-google-plus-sign:before { content: "\f0d4"; } +.icon-google-plus:before { content: "\f0d5"; } +.icon-money:before { content: "\f0d6"; } +.icon-caret-down:before { content: "\f0d7"; } +.icon-caret-up:before { content: "\f0d8"; } +.icon-caret-left:before { content: "\f0d9"; } +.icon-caret-right:before { content: "\f0da"; } +.icon-columns:before { content: "\f0db"; } +.icon-sort:before { content: "\f0dc"; } +.icon-sort-down:before { content: "\f0dd"; } +.icon-sort-up:before { content: "\f0de"; } + +.icon-envelope-alt:before { content: "\f0e0"; } +.icon-linkedin:before { content: "\f0e1"; } +.icon-undo:before { content: "\f0e2"; } +.icon-legal:before { content: "\f0e3"; } +.icon-dashboard:before { content: "\f0e4"; } +.icon-comment-alt:before { content: "\f0e5"; } +.icon-comments-alt:before { content: "\f0e6"; } +.icon-bolt:before { content: "\f0e7"; } +.icon-sitemap:before { content: "\f0e8"; } +.icon-umbrella:before { content: "\f0e9"; } +.icon-paste:before { content: "\f0ea"; } +.icon-user-md:before { content: "\f200"; } + + + + + + + +[class^="icon-"], +[class*=" icon-"] { + font-family: FontAwesome; + font-style: normal; + font-weight: normal; +} +.btn.dropdown-toggle [class^="icon-"], +.btn.dropdown-toggle [class*=" icon-"] { + /* keeps button heights with and without icons the same */ + + line-height: 1.4em; +} +.icon-large { + font-size: 1.3333em; } .icon-glass { - background-position: 0 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-music { - background-position: -24px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-search { - background-position: -48px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-envelope { - background-position: -72px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-heart { - background-position: -96px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-star { - background-position: -120px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-star-empty { - background-position: -144px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-user { - background-position: -168px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-film { - background-position: -192px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-th-large { - background-position: -216px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-th { - background-position: -240px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-th-list { - background-position: -264px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-ok { - background-position: -288px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-remove { - background-position: -312px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-zoom-in { - background-position: -336px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-zoom-out { - background-position: -360px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-off { - background-position: -384px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-signal { - background-position: -408px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-cog { - background-position: -432px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-trash { - background-position: -456px 0; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-home { - background-position: 0 -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-file { - background-position: -24px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-time { - background-position: -48px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-road { - background-position: -72px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-download-alt { - background-position: -96px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-download { - background-position: -120px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-upload { - background-position: -144px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-inbox { - background-position: -168px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-play-circle { - background-position: -192px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-repeat { - background-position: -216px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-refresh { - background-position: -240px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-list-alt { - background-position: -264px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-lock { - background-position: -287px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-flag { - background-position: -312px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-headphones { - background-position: -336px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-volume-off { - background-position: -360px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-volume-down { - background-position: -384px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-volume-up { - background-position: -408px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-qrcode { - background-position: -432px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-barcode { - background-position: -456px -24px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-tag { - background-position: 0 -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-tags { - background-position: -25px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-book { - background-position: -48px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-bookmark { - background-position: -72px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-print { - background-position: -96px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-camera { - background-position: -120px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-font { - background-position: -144px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-bold { - background-position: -167px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-italic { - background-position: -192px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-text-height { - background-position: -216px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-text-width { - background-position: -240px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-align-left { - background-position: -264px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-align-center { - background-position: -288px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-align-right { - background-position: -312px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-align-justify { - background-position: -336px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-list { - background-position: -360px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-indent-left { - background-position: -384px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-indent-right { - background-position: -408px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-facetime-video { - background-position: -432px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-picture { - background-position: -456px -48px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-pencil { - background-position: 0 -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-map-marker { - background-position: -24px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-adjust { - background-position: -48px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-tint { - background-position: -72px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-edit { - background-position: -96px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-share { - background-position: -120px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-check { - background-position: -144px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-move { - background-position: -168px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-step-backward { - background-position: -192px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-fast-backward { - background-position: -216px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-backward { - background-position: -240px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-play { - background-position: -264px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-pause { - background-position: -288px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-stop { - background-position: -312px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-forward { - background-position: -336px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-fast-forward { - background-position: -360px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-step-forward { - background-position: -384px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-eject { - background-position: -408px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-chevron-left { - background-position: -432px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-chevron-right { - background-position: -456px -72px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-plus-sign { - background-position: 0 -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-minus-sign { - background-position: -24px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-remove-sign { - background-position: -48px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-ok-sign { - background-position: -72px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-question-sign { - background-position: -96px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-info-sign { - background-position: -120px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-screenshot { - background-position: -144px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-remove-circle { - background-position: -168px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-ok-circle { - background-position: -192px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-ban-circle { - background-position: -216px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-arrow-left { - background-position: -240px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-arrow-right { - background-position: -264px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-arrow-up { - background-position: -289px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-arrow-down { - background-position: -312px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-share-alt { - background-position: -336px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-resize-full { - background-position: -360px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-resize-small { - background-position: -384px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-plus { - background-position: -408px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-minus { - background-position: -433px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-asterisk { - background-position: -456px -96px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-exclamation-sign { - background-position: 0 -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-gift { - background-position: -24px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-leaf { - background-position: -48px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-fire { - background-position: -72px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-eye-open { - background-position: -96px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-eye-close { - background-position: -120px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-warning-sign { - background-position: -144px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-plane { - background-position: -168px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-calendar { - background-position: -192px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-random { - background-position: -216px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-comment { - background-position: -240px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-magnet { - background-position: -264px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-chevron-up { - background-position: -288px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-chevron-down { - background-position: -313px -119px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-retweet { - background-position: -336px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-shopping-cart { - background-position: -360px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-folder-close { - background-position: -384px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-folder-open { - background-position: -408px -120px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-resize-vertical { - background-position: -432px -119px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .icon-resize-horizontal { - background-position: -456px -118px; + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-bar-chart { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-twitter-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-facebook-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-camera-retro { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-key { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-cogs { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-comments { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-thumbs-up { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-thumbs-down { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-star-half { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-heart-empty { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-signout { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-linkedin-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-pushpin { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-external-link { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-signin { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-trophy { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-github-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-upload-alt { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-lemon { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-phone { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-check-empty { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-bookmark-empty { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-phone-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-twitter { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-facebook { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-github { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-unlock { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-credit-card { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-rss { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-hdd { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-bullhorn { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-bell { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-certificate { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-hand-right { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-hand-left { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-hand-up { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-hand-down { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-circle-arrow-left { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-circle-arrow-right { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-circle-arrow-up { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-circle-arrow-down { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-globe { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-wrench { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-tasks { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-filter { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-briefcase { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-fullscreen { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-group { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-link { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-cloud { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-beaker { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-cut { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-copy { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-paper-clip { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-save { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-sign-blank { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-reorder { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-list-ul { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-list-ol { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-strikethrough { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-underline { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-table { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-magic { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-truck { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-pinterest { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-pinterest-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-google-plus-sign { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-google-plus { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-money { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-caret-down { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-caret-up { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-caret-left { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-caret-right { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-columns { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-sort { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-sort-down { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-sort-up { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-envelope-alt { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-linkedin { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-undo { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-legal { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-dashboard { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-comment-alt { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-comments-alt { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-bolt { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-sitemap { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-umbrella { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-paste { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); +} +.icon-user-md { + *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); } .dropdown { position: relative; @@ -2665,15 +3243,6 @@ button.btn.small, input[type="submit"].btn.small { .pagination li { display: inline; } - -/*.pagination .page{ - float: left; - padding: 0 14px; - line-height: 34px; - text-decoration: none; - border: 1px solid #ddd; - border-left-width: 0; -}*/ .pagination a { float: left; padding: 0 14px; @@ -3100,6 +3669,15 @@ a.thumbnail:hover { .label-info { background-color: #3a87ad; } +.label-teacher { + background-color: #0071A9; +} +.label-student { + background-color: #AF0045; +} +.label-staff { + background-color: #219C6B; +} @-webkit-keyframes progress-bar-stripes { from { background-position: 0 0; diff --git a/app/assets/stylesheets/inc/permission-checkbox.css.erb.css b/app/assets/stylesheets/inc/permission-checkbox.css.erb.css new file mode 100644 index 000000000..5a2deb601 --- /dev/null +++ b/app/assets/stylesheets/inc/permission-checkbox.css.erb.css @@ -0,0 +1,77 @@ +.checkblock { + display: inline-block; + float: left; + width: 200px; +} +.check[type="checkbox"]{ + display:none; +} +.checkbox{ + padding: 5px; + margin: 5px 5px 10px; + display: inline-block; + color:#777777; + text-shadow: 0 1px 0px rgba(255,255,255,.4); + border-radius: 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + height: 30px; + position: relative; + cursor: pointer; + background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) ); + background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% ); + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf'); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); +} +.checkbox .check-icon { + display: none; + position: absolute; + width: 26px; + height: 26px; + background: url(<%= asset_path "check.png" %>) no-repeat left top; + right: -10px; + top: -5px; +} +.checkbox .member-name { + cursor: pointer; + font-family: helvetica; + font-size: 12px; + line-height: 30px; + padding: 0 10px 0 40px; + color: #333333; + display: inline-block; + margin-bottom: 0; +} +.member-avatar { + position: absolute; + width: 34px; + height: 34px; + overflow: hidden; + margin-top: -2px; +} +img.member-img { + max-width: 100%; +} +.checked .check-icon { + display: block; +} +.popover-inner { + width: auto; + display: inline-block; + text-align: center; +} +.popover-title { + display: block; + font-size: 12px; + font-weight: normal; + padding: 3px 10px; +} +.popover-content { + padding: 3px 10px; + color: #898989; +} +.popover-content p { + font-size: 12px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/list.css b/app/assets/stylesheets/list.css index 4d7c11b1f..52e26185d 100644 --- a/app/assets/stylesheets/list.css +++ b/app/assets/stylesheets/list.css @@ -1,203 +1,222 @@ -/*list*/ - -.table th.select { - border-bottom:2px solid #0088CC; -} -.main-list { - margin-bottom: 0; -} -.main-wrap>.main-list thead th { - background-color: transparent; - border-right: medium none; -} -.main-list thead th:last-child { - border-right: none; -} -.main-list .span1 { - min-width: 32px; -} -.main-list .span7 { - min-width: 300px; -} -.main-list .nav-pills > li > a { - border-radius: 5px 5px 5px 5px; - margin: 2px; - padding:5px; -} -.main-list tbody .quick-edit { - position:relative; - height:20px; -} -.main-list tbody .quick-edit .nav { - /*left: -55px;*/ - position: absolute; - /*top: -3px;*/ - width: 350px; - left: -8px; -} -.main-list tr:first-child td { - border-top: 1px solid #DDDDDD; -} -.main-list td { - background-color: #FFFFFF; - border-bottom: 1px solid #DDDDDD; - border-top: medium none; -} -.main-list .nav { - margin-top: 0; - margin-bottom: 3px; -} -.main-list tr.with_action:hover .hide { - display:block !important; -} -.main-list .label-group { - position: relative; - height: 40px; -} -.main-list .label-group .label { - margin-bottom: 1px; - display: inline-block; - padding: 0 3px; -} -.main-list .label-td { - background-color: rgba(255, 255, 255, 1); - height: 40px; - overflow: hidden; - position: absolute; - width: 100%; - left: 0; - z-index: 1; -} -.main-list .label-td:hover { - height: auto; - padding: 5px 5px 8px; - left: -40px; - top: -6px; - border: 1px solid rgba(0, 0, 0, 0.2); - box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - -moz-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - -webkit-box-shadow: 0px 5px 10px rgba(0,0,0,0.2); - border-radius: 3px; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - z-index: 5; - width: 200px; -} -.qe-edit-div .table-condensed { - background-color: #F2F2F2; -} -.table-label { - background-color: #F2F2F2; - position: relative; -} -.table-label .main-list thead th { - background-color: #F2F2F2; - border-right: 1px solid #DDDDDD; - border-top: 1px solid #DDDDDD !important; -} -.route-group .route { - padding: 0; -} -.route-group .route .breadcrumb { - border-width: 0!important; -} -.qe-block td { - height:auto; - padding: 0; - /*background-color: #dedede;*/ -} -.qe-block legend { - padding-left: 8px; - margin-bottom: 0; - padding-bottom: 0; -} -.qe-block .control-group { - margin-bottom: 0; -} -.qe-block .controls, .qe-block .control-label { - margin-top: 10px; - margin-bottom: 10px; -} -.qe-block .table td, .qe-block .table th { - padding: 8px; -} -.qe-block .form-horizontal { - margin-bottom: 0; -} -.qe-block .form-actions { - margin-bottom: 0; -} -legend { - font-size: 15px; - line-height: 30px; - margin-bottom: 15px; - padding-bottom: 5px; -} -.subnav { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - border-left: none; - border-right: none; - position: fixed; - top: 30px; - z-index: 50; -} -.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover { - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; -} -.dropdown-menu.tags { - max-width: none; -} -.dropdown-menu.tags .tags-cloud { - width: 300px; - padding:10px; -} -.dropdown-menu.tags .tags-cloud .active { - background-color: #0088CC; - color: #FFFFFF; -} -.dropdown-menu.tags .tags-cloud a { - display: inline-block; - margin-bottom: 3px; -} -.dropdown-menu.tags li:last-child a { - display: block; - text-align:center; -} -.sort-header th { - padding: 0 8px; - vertical-align: inherit; - position: relative; -} -.sort-header th a { - display: block; - padding: 10px 0; - white-space: nowrap; -} -.sort-header th a:hover { - text-decoration: none; -} -.list-remove { - position: absolute; - top: 0; - padding-top: 9px !important; - left: 25px; -} -.form-fixed { - position: fixed; - margin: 0; - padding: 10px; - bottom: 0; - z-index: 2; -} -.form-fixed .btn { - margin-top: 4px; -} -.paginationFixed { -} -.paginationFixed .pagination { - margin-top: 0 !important; +/*list*/ + +.table th.select { + border-bottom:2px solid #0088CC; +} +.main-list { + margin-bottom: 0; +} +.main-wrap>.main-list thead th { + background-color: transparent; + border-right: medium none; +} +.main-list thead th:last-child { + border-right: none; +} +.main-list .span1 { + min-width: 32px; +} +.main-list .span7 { + min-width: 300px; +} +.main-list .nav-pills > li > a { + border-radius: 5px 5px 5px 5px; + margin: 2px; + padding:5px; +} +.main-list tbody .quick-edit { + position:relative; + height:20px; +} +.main-list tbody .quick-edit .nav { + position: absolute; + width: 350px; + left: -8px; +} +.main-list tr:first-child td { + border-top: 1px solid #DDDDDD; +} +.main-list td { + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; +} +.main-list .nav { + margin-top: 0; + margin-bottom: 3px; +} +.main-list tr.with_action>td { + -webkit-transition: all 0.1s linear; + -moz-transition: all 0.1s linear; +} +.main-list tr.with_action:hover>td { + color: #333333; + background-color: #E6E6E6; + -webkit-transition: all 0.2s linear; + -moz-transition: all 0.2s linear; +} +.main-list tr.with_action:hover .hide { + display:block !important; +} +.main-list .label-group { + position: relative; + height: 40px; +} +.main-list .label-group .label { + margin-bottom: 1px; + display: inline-block; + padding: 0 3px; +} +.main-list .label-td { + height: 40px; + overflow: hidden; + position: absolute; + width: 100%; + left: 0; + z-index: 1; +} +.main-list .label-td:hover { + background-color: #fff; + height: auto; + padding: 7px; + left: -55px; + top: -8px; + border: 1px solid #333; + border-radius: 3px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + z-index: 5; + width: 160px; + min-height: 40px; +} +.qe-edit-div .table-condensed { + background-color: #F2F2F2; +} +.table-label { + background-color: #F2F2F2; + position: relative; +} +.table-label .main-list thead th { + background-color: #F2F2F2; + border-right: 1px solid #DDDDDD; + border-top: 1px solid #DDDDDD !important; + line-height: 20px; +} +.route-group .route { + padding: 0; +} +.route-group .route .breadcrumb { + border-width: 0!important; +} +.qe-block td { + height:auto; + padding: 0; + /*background-color: #dedede;*/ +} +.qe-block legend { + padding-left: 8px; + margin-bottom: 0; + padding-bottom: 0; +} +.qe-block .control-group { + margin-bottom: 0; +} +.qe-block .controls, .qe-block .control-label { + margin-top: 10px; + margin-bottom: 10px; +} +.qe-block .table td, .qe-block .table th { + padding: 8px; +} +.qe-block .form-horizontal { + margin-bottom: 0; +} +.qe-block .form-actions { + margin-bottom: 0; +} +legend { + font-size: 15px; + line-height: 30px; + margin-bottom: 15px; + padding-bottom: 5px; +} +.subnav { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + border-left: none; + border-right: none; + position: fixed; + top: 30px; + z-index: 50; +} +.subnav .nav > li:first-child > a, .subnav .nav > li:first-child > a:hover { + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; +} +.dropdown-menu.tags { + max-width: none; +} +.dropdown-menu.tags .tags-cloud { + width: 300px; + padding:10px; +} +.dropdown-menu.tags .tags-cloud .active { + background-color: #0088CC; + color: #FFFFFF; +} +.dropdown-menu.tags .tags-cloud a { + display: inline-block; + margin-bottom: 3px; +} +.dropdown-menu.tags li:last-child a { + display: block; + text-align:center; +} +.sort-header th { + padding: 0 8px; + vertical-align: inherit; + position: relative; +} +.sort-header th a { + display: block; + padding: 10px 0; + white-space: nowrap; +} +.sort-header th a:hover { + text-decoration: none; +} +.list-remove { + position: absolute; + top: 0; + padding-top: 11px !important; + left: 25px; + font-size: 19px; + color: #333; +} +.list-remove:hover { + color: #333; + text-decoration: none; +} +.form-fixed { + position: fixed; + margin: 0; + padding: 10px; + bottom: 0; + z-index: 2; +} +.form-fixed .btn { + margin-top: 4px; +} +.paginationFixed { +} +.paginationFixed .pagination { + margin-top: 0 !important; +} +.member-list td:last-child { + position: relative; +} +.member-list td:last-child .gender { + border-radius: 0; } \ No newline at end of file diff --git a/app/assets/stylesheets/message.css b/app/assets/stylesheets/message.css index 7206bd727..ffa954f1b 100644 --- a/app/assets/stylesheets/message.css +++ b/app/assets/stylesheets/message.css @@ -11,3 +11,7 @@ .warning{ color:orange; } +label#dyn_error { + + margin-left: 50%; +} \ No newline at end of file diff --git a/app/assets/stylesheets/social-share-button.css b/app/assets/stylesheets/social-share-button.css new file mode 100644 index 000000000..1acc138e3 --- /dev/null +++ b/app/assets/stylesheets/social-share-button.css @@ -0,0 +1,90 @@ +.social-share-button-baidu { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") 0px 0px no-repeat; +} +.social-share-button-delicious { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -16px 0px no-repeat; +} +.social-share-button-douban { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") 0px -16px no-repeat; +} +.social-share-button-email { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -16px -16px no-repeat; +} +.social-share-button-facebook { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -32px 0px no-repeat; +} +.social-share-button-flickr { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -32px -16px no-repeat; +} +.social-share-button-google { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") 0px -32px no-repeat; +} +.social-share-button-google_plus { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -16px -32px no-repeat; +} +.social-share-button-kaixin001 { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -32px -32px no-repeat; +} +.social-share-button-qq { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -48px 0px no-repeat; +} +.social-share-button-renren { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -48px -16px no-repeat; +} +.social-share-button-tqq { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -48px -32px no-repeat; +} +.social-share-button-twitter { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") 0px -48px no-repeat; +} +.social-share-button-weibo { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -16px -48px no-repeat; +} +.social-share-button-rss { + display:inline-block; + width:16px; + height:16px; + background:url("/assets/social-share-button.png") -32px -48px no-repeat; +} \ No newline at end of file diff --git a/app/assets/stylesheets/style.css.erb b/app/assets/stylesheets/style.css.erb index 835975e16..0ab84c3f5 100644 --- a/app/assets/stylesheets/style.css.erb +++ b/app/assets/stylesheets/style.css.erb @@ -1,1351 +1,1684 @@ -/*style*/ - -@import url(http://fonts.googleapis.com/css?family=Cuprum); -@font-face{ - font-family: 'WebSymbolsRegular'; - src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); - src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), - url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), - url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), - url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); -} -.login-logo { - text-indent: -9999px; - background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 40px; - padding-top: 40px; - height: 160px; -} -#orbit-bar { - margin-bottom: 0; - position:fixed; - width:100%; - z-index: 99; - top: 0; - left: 0; -} -#orbit-bar .navbar-inner { - height: 28px; - -moz-border-radius: 0px; - -webkit-border-radius: 0px; - border-radius: 0px; - padding-top: 2px; - padding-bottom: 1px; - -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; - - /* - background-image: -moz-linear-gradient(top, #5282A6, #133757); - background-image: -ms-linear-gradient(top, #5282A6, #133757); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); - background-image: -webkit-linear-gradient(top, #5282A6, #133757); - background-image: -o-linear-gradient(top, #5282A6, #133757); - background-image: linear-gradient(top, #5282A6, #133757); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); - */ - - background-image: -moz-linear-gradient(top, #545b60, #191a1c); - background-image: -ms-linear-gradient(top, #545b60, #191a1c); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#545b60), to(#191a1c)); - background-image: -webkit-linear-gradient(top, #545b60, #191a1c); - background-image: -o-linear-gradient(top, #545b60, #191a1c); - background-image: linear-gradient(top, #545b60, #191a1c); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#545b60', endColorstr='#191a1c', GradientType=0); - -} -#orbit-bar .navbar-search { - left: 28px; - margin: 0; - position: absolute; - text-align: right; - top: -1px; -} -#orbit-bar .nav.pull-right { - margin-right: -20px; -} -#orbit-bar .search-query { - padding: 7px 9px 5px; - height: 10px; - margin-top: 3px; - border: 1px solid #333333; - font-size: 11px; - /*background-color: rgba(255, 255, 255, 0.8); - color: #333; - text-shadow: 0px 1px 0px #FFF;*/ - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); -} -#orbit-bar .search-query:focus { - /*background-color: rgba(255, 255, 255, 0.9); - text-shadow: 0px 1px 0px #FFF;*/ - background-position: 5px 2px; -} -#orbit-bar .container { - width:100%; -} -#orbit-bar .orbit-logo .brand { - background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px; - /* background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; */ - text-indent:-9999px; - padding: 5px 20px 4px; -} -#orbit-bar .orbit-logo .brand:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo.open .brand { - background-color: rgba(0,157,220,1); -} -#orbit-bar .orbit-logo .dropdown-menu { - left: -15px; -} -#orbit-bar .nav > li { - height: 28px; -} -#orbit-bar .nav > li > a:hover { - background-color: rgba(0,157,220,1); -} -#orbit-bar .nav > li > a { - background-image: url(<%= asset_path 'orbit-bar.png' %>); - background-repeat:no-repeat; - display: inline-block; - width: 16px; - height: 16px; - text-indent: -9999px; - padding:6px; -} -#orbit-bar .nav > li.search { - overflow: hidden; - width: 28px; - position: relative; -} -#orbit-bar .nav > li > a.orbit-bar-home { - background-position: -10px -10px; -} -#orbit-bar .nav > li > a.orbit-bar-desktop { - background-position: -106px -10px; - width: 16px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -4px -37px; -} -#orbit-bar .nav > li > a.orbit-bar-member { - background-position: -10px -43px; -} -#orbit-bar .nav > li > a.orbit-bar-language { - background-position: -42px -42px; -} -#orbit-bar .nav > li > a.orbit-bar-search { - background-position: -75px -10px; - overflow: hidden; -} -.language-menu .active { - color: #ffffff; - text-decoration: none; - background-color: #0088cc; -} -#orbit-bar .nav > li > a.orbit-bar-account { - background-image: none; - height: 22px; - padding: 3px; - text-indent: inherit; - min-width: 110px; - width: auto !important; - text-align: left; -} -#orbit-bar .nav span.member-name { - display: inline-block; - line-height: 22px; - padding: 0 10px; -} -#orbit-bar .nav img.member-img { - display: inline-block; - float: left; - max-width: 22px; -} -#orbit-bar .clear { - clear: none; -} -#orbit-bar .account-menu { - right: 5px; -} -#orbit-bar .bar-login { - -} -#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { - background-color: #009DDC; -} -#orbit-bar .bar-login .dropdown-menu { - padding: 0 0 10px; - max-width: 260px; -} -#orbit-bar .bar-login .dropdown-menu .log { - margin: 10px 15px 0; - list-style: none outside none; -} -#orbit-bar .bar-login .dropdown-menu .log .title { - background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; - height: 70px; -} -#orbit-bar .bar-login .dropdown-menu .log form { - margin: 0 0 8px; -} -#orbit-bar .bar-login .dropdown-menu .log input { - display: inline-block; - margin: 0; -} -#orbit-bar .bar-login .dropdown-menu .log .span2 { - width: 183px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot { - margin-bottom: 20px; - padding: 3px 0 0; - float: right; - display: inline-block; - color: #0088CC; -} -#orbit-bar .bar-login .dropdown-menu .log .input-prepend { - margin-top: 20px; -} -#orbit-bar .bar-login .dropdown-menu .log .remember { - margin-top: 5px; -} -#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { - padding: 3px 0 0; - float: right; - display: inline-block; - color: #005580; - text-decoration: underline; - background-color: transparent; -} -#orbit-bar .bar-login .dropdown-menu .log .btn { - width: 220px; -} -#orbit-bar .bar-login .dropdown-menu .log .divider { - position:relative; - overflow: inherit; - margin: 20px 0; -} -#orbit-bar .bar-login .dropdown-menu .log .divider span { - position: absolute; - width: 20px; - height: 20px; - background-color: #FFF; - color: #666; - top: -9px; - left: 100px; - font-size:16px; - text-align: center; -} -#orbit-bar .bar-login .dropdown-menu .register { - color: #FFFFFF; - margin: 0 15px; - width: 188px; -} -#main-sidebar { - background: url(<%= asset_path 'background.jpg' %>) repeat left top; - width: 155px; - padding-right: 4px; - border-right: 1px solid rgba(0,0,0,.2); - position:fixed; - top: 31px; - z-index: 88; -} -#main-sidebar .nav { - padding-top: 5px; -} -#main-sidebar .nav > li.active > a [class^="icons-"] { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -#main-sidebar .nav > li > .nav { - margin-left: -14px; - margin-bottom: 5px; - width: 155px; - padding: 0; - background-color: #FFF; - /*border-radius: 0px 0px 8px 0px; - -webkit-border-radius: 0px 0px 8px 0px; - -moz-border-radius: 0px 0px 8px 0px;*/ - box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); - display: none; -} -#main-sidebar .nav > li.active > .nav { - display: block; -} -#main-sidebar .nav > li > .nav > li > a { - margin-left: 0; - padding-left: 19px; - color: #999; -} -#main-sidebar .nav > li > .nav > li > a:hover { - color: #000; - background-color: #d7eeff; -} -#main-sidebar .nav > li > .nav > li.active > a { - background-color: #b7b7b7; - color: #fff; -} -#main-wrap { - background-color: #FFF; - margin-left:160px; - padding-top: 32px; - /*padding-bottom: 18px;*/ - position: relative; - padding-bottom: 45px; - /*min-height: 100%;*/ -} -/*#main-wrap > .form-actions { - background-color: #FFF; - text-align: center; - padding: 17px 20px 0; - margin: 0; - border-top: none; -}*/ -#main-wrap .subnav { - height: auto; - min-height: 36px; -} -#main-wrap .pagination { - margin: 18px 0 0; - text-align: center; -} -.main-list .route-group td { - border: none; -} -#main-wrap .route-group .breadcrumb { - background-image: none; - border-radius: 0; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-width: 0 0 1px 0; - box-shadow: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - margin-bottom: 0px; - padding: 7px 8px 5px; -} -#main-wrap .breadcrumb li { - font-size: 12px; - color: #999; -} -.form-actions .btn { - margin-bottom: 0; -} -#sub-wiget { - clear: right; - float: right; - padding-right: 10px; - padding-top: 8px; - position: relative; - margin-bottom: 13px; - width: 304px; -} -.main-wiget .widget-box { - margin: 5px 0; - width: 100%; -} -#poststuff .form-actions { - background-color: transparent; - text-align: right; - padding-left: 10px; - padding-right: 10px; - margin-bottom: -50px; - clear: both; -} -#poststuff form { - margin-bottom: 0; -} -#post-body { - float: left; - clear: left; - width: 100%; - margin-right: -340px; -} -#post-body .title input[type=text] { - margin-bottom: 0; - width: 100%; - height: 30px; -} -#post-body .btn-group { - margin-left: 5px; -} -#post-body .well { - margin: 0; - border-radius: 0px; - -moz-border-radius: 0px; - box-shadow: none; - -moz-box-shadow: none; - -webkit-box-shadow: none; - border-top: none; -} -#post-body .editor { -} -#post-body-content { - /*margin-right: 320px;*/ - padding: 8px 0 8px 6px; -} -.filter .accordion-heading > a:hover { - text-decoration: none; -} -.filter .accordion-group { - border-bottom: none; - border-top: none; - border-left: 1px solid rgba(0,0,0,0.07); - border-right: none; - -moz-border-radius: 0; - -webkit-border-radius: 0; - border-radius: 0; - margin-bottom: -1px; - position: relative; - left: 0; - top: 0; -} -.filter .accordion-group:last-child { - border-right: 1px solid rgba(0,0,0,0.07); -} -.filter .accordion-heading .accordion-toggle { - padding: 9px 15px; -} -.accordion-group .accordion-toggle .caret { - border-top-color: #0088CC; - margin-top: 6px; -} -.filter .active { - background-color: #0088CC; -} -.filter .active a { - color: #FFF; -} -.filter form { - margin: 5px 10px; -} -.filters { - background-color: rgba(0,0,0,0.075); - -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); - box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); -} -.filters > div { - background-color: #dadada; -} -.filters .btn { - margin-bottom: 5px; -} -.filters .accordion-inner { - border-top: none; - padding: 9px 15px 4px; -} -.filters .filter-clear { - padding: 5px 5px 0; - border-top: 1px solid rgba(0,0,0,0.1); - text-align: right; - margin: 0 5px; - -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); - box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); -} -.filters .in { - /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ -} -#tags { -} -#tags .tag { - line-height: 32px; - padding: 0 10px; - background-color: #FFFFFF; - border-bottom: 1px solid #DDDDDD; - border-top: medium none; -} -#tags .tag form, #tags .tag form input { - margin:0; -} -#tags .tagitem { - display: inline-block; - float: left; -} -#tags .action { - display: inline-block; - float: right; -} -.sign-in { - width: 360px; - margin: 0 auto 70px; - background-color: #FFF; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-radius: 0 0 5px 5px; - border-radius: 0 0 5px 5px; - -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); - border-width: 0px 1px 1px 1px; - border-style: none solid solid solid; - border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; -} -#signin-header { - width: 340px; - margin: 30px auto 0; - line-height: 25px; - padding: 5px 10px; - border-width: 1px 1px 0px 1px; - border-style: solid solid none solid; - border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); - background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); - background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); - background-image: -o-linear-gradient(top, #dadada, #c0c0c0); - background-image: linear-gradient(top, #dadada, #c0c0c0); - -moz-border-radius: 5px 5px 0px 0px ; - -webkit-border-radius: 5px 5px 0px 0px; - border-radius: 5px 5px 0px 0px; - -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); - box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); -} -#signin-header h3 { - color: #848484; - text-shadow: 0 1px 0 #e9e9e9; -} -#sign-footer { - width: 100%; - position:fixed; - bottom: 0; - height: 40px; - background-color: #dadada; - color: #7a7a7a; - box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); - -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); -} -#sign-footer p { - line-height: 40px; - padding: 0 10px; - text-align: right; -} -.sign-in .control-group label { - text-align: left; - width: auto; - font-size: 15px; -} -.sign-in .forgot { - padding-top: 5px; -} -.sign-in .content { - padding: 10px; -} -.sign-in .form-actions { - padding: 17px 10px 18px; - margin: 0; - -moz-border-radius: 0px 0px 5px 5px; - -webkit-border-radius: 0px 0px 5px 5px; - border-radius: 0px 0px 5px 5px; -} -.sign-in form { - margin: 0; -} -.sign-in .control-group .help-inline { - display:none; -} -.sign-in .error .help-inline { - display:inline-block; -} -.web-symbol:after { - font-family: 'WebSymbolsRegular'; - content: "{"; - margin-left: 2px; - margin-top: 8px; -} -.active .web-symbol:after { - content: "}"; -} -.img-peview { - margin-left: 12px; -} -.popover img { - max-height: 120px; - max-width: 100%; -} -.popover-inner { - width: auto; -} -.popover-title { - padding: 5px; -} -.popover-content { - -webkit-border-radius: 0 0 3px 3px; - -moz-border-radius: 0 0 3px 3px; - border-radius: 0 0 3px 3px; - padding: 5px; -} -.popover-title { - display: none; -} - -/*show link and file*/ -.linkAndFile { - clear: both; -} -.linkAndFile>div { - margin-top: 20px; -} -.linkAndFile [class^="icons-"] { - float: left; - margin-top: 10px; -} -.linkAndFile .showLink, .linkAndFile .showFile { - background-color: #ededed; - padding: 5px; - border-radius: 5px; - margin-left: 25px; -} -.linkAndFile .showLink a, .linkAndFile .showFile a { - display: inline-block; - margin: 5px 10px; -} -.linkAndFile>div>a:last-child { - margin-right: 5px -} -.news_paragraph p { - line-height: 20px; -} -.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover { - background-color: #333; - color: #FFF; - padding-right: 12px; -} -.nav-tabs li .icons-pencil { - float: right; - margin-top: 8px; -} -.nav-tabs li a { - padding-right: 32px; -} - - -/*icons*/ -.the-icons i:after { - content: attr(class); - display: block; - font-style: normal; - margin-left: 20px; - width: 140px; -} -.the-icons i { - display: block; - margin-bottom: 5px; -} -[class^="text-"] { - font-size: 15px !important; -} -.text-blue { - color: #0088CC !important; -} -.text-red { - color: #CC3300 !important; -} -.text-yellow { - color: #ffcc00 !important; -} -.text-orange { - color: #f7941d !important; -} -.text-purple { - color: #a864a8 !important; -} -.text-palm { - color: #a67c52 !important; -} -.text-green { - color: #39b54a !important; -} -.adbanner-setup { - margin-right: 10px; - margin-bottom: 30px !important; -} -.adbanner-list { - border-top: 1px solid #AAA; - margin-right: 10px; - padding-top: 10px; - position: relative; -} -.adbanner-list ul { - margin: 0px; -} -.adbanner-list ul li { - list-style: none; - margin-left: 0; - margin-right: 20px; -} -.adbanner-action { - margin-bottom: 20px; -} -.textarea-height-s { - resize: none; - max-height: 150px; -} -.textarea-height-m { - resize: none; - max-height: 250px; -} -.textarea-height-l { - resize: none; - max-height: 350px; -} -.textarea-height-xl { - resize: none; - max-height: 500px; -} -#banner [id^="slideshow-"] { - z-index: 2 !important; -} - -#back_main .editable { - position: relative; -} -#back_main .editable:after { - content: ''; - clear: both; - display: block; - visibility: hidden; - height: 0; -} - -#back_main .edit_link a { - position: absolute; - z-index: 10; - width: 100%; - height: 100%; - top: 0; - left: 0; - text-indent: -9999px; - background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8); - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); - -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); -} - -#category_id, #module_app_id { - width: auto; -} - -[class^="icons-"] { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: text-top; - background-image: url(<%= asset_path 'icons_pack.png' %>); - background-position: 16px 16px; - background-repeat: no-repeat; - *margin-right: .3em; - margin-right:10px; -} -[class^="icons-"]:last-child { - *margin-left: 0; -} -.icons-white { - background-image: url(<%= asset_path 'icons_pack_white.png' %>); -} -/*1*/ -.icons-pencil { - background-position: 0 0; -} -.icons-brush { - background-position: -32px 0; -} -.icons-pen { - background-position: -64px 0; -} -.icons-brush-large { - background-position: -128px 0; -} -.icons-pen-small { - background-position: -96px 0; -} -.icons-bucket { - background-position: -160px 0; -} -.icons-eye { - background-position: -192px 0; -} -.icons-ban { - background-position: -224px 0; -} -.icons-trash { - background-position: -256px 0; -} -.icons-zoom { - background-position: -288px 0; -} -.icons-zoom-out { - background-position: -320px 0; -} -.icons-zoom-in { - background-position: -352px 0; -} -.icons-magic { - background-position: -384px 0; -} -.icons-aim { - background-position: -416px 0; -} -/*2*/ -.icons-flag { - background-position: 0 -32px; -} -.icons-paperclip { - background-position: -32px -32px; -} -.icons-share { - background-position: -64px -32px; -} -.icons-link { - background-position: -96px -32px; -} -.icons-tag { - background-position: -128px -32px; -} -.icons-lock { - background-position: -160px -32px; -} -.icons-unlock { - background-position: -192px -32px; -} -.icons-thumbtack { - background-position: -224px -32px; -} -.icons-pin { - background-position: -257px -32px; -} -.icons-shield { - background-position: -288px -32px; -} -.icons-key { - background-position: -320px -32px; -} -.icons-fire { - background-position: -352px -32px; -} -.icons-bulls-eye { - background-position: -384px -32px; -} -.icons-flash { - background-position: -416px -32px; -} -.icons-time { - background-position: -448px -32px; -} -.icons-halo { - background-position: -480px -32px; -} -.icons-hourglass { - background-position: -513px -32px; -} -.icons-alarm-clock { - background-position: -545px -32px; -} -.icons-paper { - background-position: -577px -32px; -} -.icons-banner { - background-position: -608px -32px; -} -/*3*/ -.icons-phone { - background-position: 0px -64px; -} -.icons-mobile { - background-position: -32px -64px; -} -.icons-mail { - background-position: -64px -64px; -} -.icons-mail-open { - background-position: -96px -64px; -} -.icons-mail-read { - background-position: -128px -64px; -} -.icons-content { - background-position: -160px -64px; -} -.icons-content-out { - background-position: -192px -64px; -} -.icons-content-in { - background-position: -224px -64px; -} -.icons-projector { - background-position: -256px -64px; -} -.icons-tape { - background-position: -288px -64px; -} -.icons-chat-a { - background-position: -320px -64px; -} -.icons-chat-b { - background-position: -352px -64px; -} -.icons-chat-c { - background-position: -384px -64px; -} -.icons-comment { - background-position: -416px -64px; -} -.icons-rss { - background-position: -448px -64px; -} -.icons-ship { - background-position: -480px -64px; -} -.icons-send { - background-position: -512px -64px; -} -.icons-bell { - background-position: -544px -64px; -} -.icons-announcement { - background-position: -576px -64px; -} -/*4*/ -.icons-contact { - background-position: 0 -96px; -} -.icons-roll { - background-position: -32px -96px; -} -.icons-member { - background-position: -288px -96px; -} -.icons-member-user { - background-position: -64px -96px; -} -.icons-member-admin { - background-position: -96px -96px; -} -.icons-member-manager{ - background-position: -128px -96px; -} -.icons-member-plus{ - background-position: -160px -96px; -} -.icons-member-minus{ - background-position: -192px -96px; -} -.icons-member-blockade{ - background-position: -224px -96px; -} -.icons-carte { - background-position: -256px -96px; -} -.icons-building { - background-position: -320px -96px; -} -.icons-calendar { - background-position: -352px -96px; -} -.icons-calendars { - background-position: -384px -96px; -} -.icons-out { - background-position: -416px -96px; -} -.icons-desktop { - background-position: -448px -96px; -} -/*5*/ -.icons-page-blank { - background-position: 0px -128px; -} -.icons-page { - background-position: -32px -128px; -} -.icons-page-copy { - background-position: -64px -128px; -} -.icons-folder { - background-position: -96px -128px; -} -.icons-folder-open { - background-position: -128px -128px; -} -.icons-folder-lock { - background-position: -160px -128px; -} -.icons-folder-plus { - background-position: -192px -128px; -} -.icons-folder-minus { - background-position: -224px -128px; -} -.icons-page-plus { - background-position: -256px -128px; -} -.icons-page-minus { - background-position: -288px -128px; -} -.icons-page-edit { - background-position: -320px -128px; -} -.icons-page-download { - background-position: -352px -128px; -} -/*6*/ -.icons-house-w { - background-position: 0px -160px; -} -.icons-house-b { - background-position: -32px -160px; -} -.icons-signs { - background-position: -64px -160px; -} -.icons-globe { - background-position: -96px -160px; -} -.icons-map { - background-position: -128px -160px; -} -.icons-markers { - background-position: -160px -160px; -} -.icons-barrier { - background-position: -192px -160px; -} -.icons-assist { - background-position: -224px -160px; -} -.icons-cones { - background-position: -256px -160px; -} -.icons-group { - background-position: -288px -160px; -} -.icons-cuble { - background-position: -320px -160px; -} -.icons-structure { - background-position: -352px -160px; -} -.icons-layer { - background-position: -384px -160px; -} -/*7*/ -.icons-shopcar-a { - background-position: 0px -192px; -} -.icons-shopcar-b { - background-position: -34px -192px; -} -.icons-purchase { - background-position: -64px -192px; -} -.icons-shopcart { - background-position: -96px -192px; -} -.icons-van { - background-position: -128px -192px; -} -.icons-form { - background-position: -160px -192px; -} -.icons-gift { - background-position: -192px -192px; -} -.icons-credit-card { - background-position: -224px -192px; -} -.icons-cash { - background-position: -256px -192px; -} -.icons-assets { - background-position: -288px -192px; -} -.icons-computer { - background-position: -320px -192px; -} -.icons-library { - background-position: -352px -192px; -} -/*8*/ -.icons-dashboard { - background-position: 0 -224px; -} -.icons-cog { - background-position: -32px -224px; -} -.icons-cogs { - background-position: -64px -224px; -} -.icons-tool { - background-position: -96px -224px; -} -.icons-screwdriver { - background-position: -128px -224px; -} -.icons-wrench { - background-position: -160px -224px; -} -.icons-toolbox { - background-position: -192px -224px; -} -.icons-switch { - background-position: -224px -224px; -} -.icons-valve { - background-position: -256px -224px; -} -/*9*/ -.icons-book-cover { - background-position: 0px -256px; -} -.icons-book-make { - background-position: -32px -256px; -} -.icons-binder { - background-position: -64px -256px; -} -.icons-album { - background-position: -96px -256px; -} -.icons-camera { - background-position: -128px -256px; -} -.icons-video-camera { - background-position: -160px -256px; -} -.icons-pillar { - background-position: -192px -256px; -} -.icons-chart { - background-position: -224px -256px; -} -.icons-picture { - background-position: -256px -256px; -} -.icons-pictures { - background-position: -288px -256px; -} -.icons-brief { - background-position: -320px -256px; -} -.icons-film { - background-position: -352px -256px; -} -.icons-asset { - background-position: -384px -256px; -} -.icons-asset-download { - background-position: -416px -256px; -} -.icons-asset-upload { - background-position: -448px -256px; -} -.icons-music { - background-position: -480px -256px; -} -.icons-book-open-w { - background-position: -512px -256px; -} -.icons-book-open-b { - background-position: -544px -256px; -} -.icons-clapper-board { - background-position: -576px -256px; -} -/*10*/ -.icons-date { - background-position: 0px -288px; -} -.icons-screen { - background-position: -32px -288px; -} -.icons-iphone { - background-position: -64px -288px; -} -.icons-ipad { - background-position: -96px -288px; -} -.icons-ipod { - background-position: -128px -288px; -} -.icons-battery-low { - background-position: -160px -288px; -} -.icons-battery-mid { - background-position: -192px -288px; -} -.icons-battery-full { - background-position: -224px -288px; -} -.icons-battery-charge { - background-position: -256px -288px; -} -/*11*/ -.icons-pie { - background-position: 0px -320px; -} -.icons-histogram { - background-position: -32px -320px; -} -.icons-window { - background-position: -64px -320px; -} -.icons-window-line{ - background-position: -96px -320px; -} -.icons-window-command{ - background-position: -128px -320px; -} -.icons-window-list{ - background-position: -160px -320px; -} -.icons-window-block{ - background-position: -192px -320px; -} -.icons-terminal{ - background-position: -224px -320px; -} -/*12*/ -.icons-heart-w { - background-position: 0px -352px; -} -.icons-heart-b { - background-position: -32px -352px; -} -.icons-like { - background-position: -64px -352px; -} -.icons-hate { - background-position: -96px -352px; -} -.icons-medal { - background-position: -128px -352px; -} -.icons-warning { - background-position: -160px -352px; -} -.icons-check { - background-position: -192px -352px; -} -.icons-check-box-solid { - background-position: -224px -352px; -} -.icons-check-box-dot { - background-position: -256px -352px; -} -.icons-check-2 { - background-position: -288px -352px; -} -.icons-check-circle-solid { - background-position: -320px -352px; -} -.icons-check-circle-dot { - background-position: -352px -352px; -} -.icons-check-circle-b { - background-position: -384px -352px; -} -.icons-star-thin { - background-position: -416px -352px; -} -.icons-star { - background-position: -448px -352px; -} -/*13*/ -.icons- { - background-position: -0px -384px; -} -/*14*/ -.icons- { - background-position: -0px -416px; -} -/*15*/ -.icons- { - background-position: -0px -448px; -} -/*16*/ -.icons- { - background-position: -0px -480px; -} -/*17*/ -.icons- { - background-position: -0px -512px; -} -/*18*/ -.icons-help { - background-position: -160px -544px; -} -.icons- { - background-position: -0px -544px; -} -/*19*/ -.icons-plus-cube { - background-position: -192px -576px; -} -.icons-plus { - background-position: -288px -576px; -} -/*20*/ -.icons-power { - background-position: -0px -608px; -} -.icons-output { - background-position: -32px -608px; -} -.icons-col-resize { - background-position: -64px -608px; -} -.icons-move { - background-position: -96px -608px; -} -.icons-size-out { - background-position: -128px -608px; -} -.icons-size-in { - background-position: -160px -608px; -} -.icons-slash { - background-position: -192px -608px; -} -.icons-level { - background-position: -224px -608px; -} -.icons-share { - background-position: -256px -608px; -} -.icons-share2 { - background-position: -288px -608px; -} -.icons-re { - background-position: -320px -608px; -} -.icons-insert { - background-position: -352px -608px; -} -.icons-insert2 { - background-position: -384px -608px; -} -.icons-download { - background-position: -416px -608px; -} -.icons-tag-rignt { - background-position: -448px -608px; -} -.icons-tag-top { - background-position: -480px -608px; -} -.icons-tag-bottom { - background-position: -512px -608px; -} -.icons-tag-left { - background-position: -544px -608px; -} -.icons-moves { - background-position: -576px -608px; -} -/*21*/ -.icons- { - background-position: -0px -640px; +/*style*/ + +@font-face{ + font-family: 'WebSymbolsRegular'; + src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); + src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), + url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), + url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), + url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); +} +.login-logo { + text-indent: -9999px; + background: url(<%= asset_path 'sign-in-logo.png' %>) no-repeat center 80px; + padding-top: 40px; + height: 160px; +} +#orbit-bar { + margin-bottom: 0; + position:fixed; + width:100%; + z-index: 99; + top: 0; + left: 0; +} +#orbit-bar .navbar-inner { + height: 28px; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + padding-top: 2px; + padding-bottom: 1px; + -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(127, 149, 165, 1), 0 -1px 0 rgba(31, 32, 36, 1) inset; + background-image: -moz-linear-gradient(top, #5282A6, #133757); + background-image: -ms-linear-gradient(top, #5282A6, #133757); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#5282A6), to(#133757)); + background-image: -webkit-linear-gradient(top, #5282A6, #133757); + background-image: -o-linear-gradient(top, #5282A6, #133757); + background-image: linear-gradient(top, #5282A6, #133757); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5282A6', endColorstr='#133757', GradientType=0); +} +#orbit-bar .navbar-search { + left: 28px; + margin: 0; + position: absolute; + text-align: right; + top: -1px; +} +#orbit-bar .nav.pull-right { + margin-right: -20px; +} +#orbit-bar .search-query { + padding: 7px 9px 5px; + height: 11px; + margin-top: 3px; + border: 1px solid #333333; + font-size: 11px; + line-height: 21px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); +} +#orbit-bar .search-query:focus { + background-position: 5px 2px; +} +#orbit-bar .container { + width:100%; +} +#orbit-bar .orbit-logo .brand { + background: url(<%= asset_path 'nccu_logo.png' %>) no-repeat 6px 0px; + text-indent:-9999px; + padding: 5px 20px 4px; +} +#orbit-bar .orbit-logo .brand:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo.open .brand { + background-color: rgba(0,157,220,1); +} +#orbit-bar .orbit-logo .dropdown-menu { + left: -15px; +} +#orbit-bar .nav > li { + height: 28px; +} +#orbit-bar .nav > li > a:hover { + background-color: rgba(0,157,220,1); +} +#orbit-bar .nav > li > a { + background-image: url(<%= asset_path 'orbit-bar.png' %>); + background-repeat:no-repeat; + display: inline-block; + width: 16px; + height: 16px; + text-indent: -9999px; + padding:6px; +} +#orbit-bar .nav > li.search { + overflow: hidden; + width: 28px; + position: relative; +} +#orbit-bar .nav > li > a.orbit-bar-home { + background-position: -10px -10px; +} +#orbit-bar .nav > li > a.orbit-bar-desktop { + background-position: -73px -42px;width: 48px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -4px -37px; +} +#orbit-bar .nav > li > a.orbit-bar-member { + background-position: -10px -43px; +} +#orbit-bar .nav > li > a.orbit-bar-language { + background-position: -42px -42px; +} +#orbit-bar .nav > li > a.orbit-bar-search { + background-position: -75px -10px; + overflow: hidden; +} +.language-menu .active { + color: #ffffff; + text-decoration: none; + background-color: #0088cc; +} +#orbit-bar .nav > li > a.orbit-bar-account { + background-image: none; + height: 22px; + padding: 3px; + text-indent: inherit; + min-width: 110px; + width: auto !important; + text-align: left; +} +#orbit-bar .nav span.member-name { + display: inline-block; + line-height: 22px; + padding: 0 10px; +} +#orbit-bar .nav img.member-img { + display: inline-block; + float: left; + max-width: 22px; +} +#orbit-bar .clear { + clear: none; +} +#orbit-bar .account-menu { + right: 5px; +} +#orbit-bar .bar-login { + +} +#orbit-bar .bar-login .open, #orbit-bar .open .orbit-bar-account { + background-color: #009DDC; +} +#orbit-bar .bar-login .dropdown-menu { + padding: 0 0 10px; + max-width: 260px; +} +#orbit-bar .bar-login .dropdown-menu .log { + margin: 10px 15px 0; + list-style: none outside none; +} +#orbit-bar .bar-login .dropdown-menu .log .title { + background: url(<%= asset_path 'sign-in-logo2.png' %>) no-repeat center center; + height: 70px; +} +#orbit-bar .bar-login .dropdown-menu .log form { + margin: 0 0 8px; +} +#orbit-bar .bar-login .dropdown-menu .log input { + display: inline-block; + margin: 0; +} +#orbit-bar .bar-login .dropdown-menu .log .span2 { + width: 182px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot { + margin-bottom: 20px; + padding: 3px 0 0; + float: right; + display: inline-block; + color: #0088CC; +} +#orbit-bar .bar-login .dropdown-menu .log .input-prepend { + margin-top: 20px; +} +#orbit-bar .bar-login .dropdown-menu .log .remember { + margin-top: 5px; +} +#orbit-bar .bar-login .dropdown-menu .log .forgot:hover { + padding: 3px 0 0; + float: right; + display: inline-block; + color: #005580; + text-decoration: underline; + background-color: transparent; +} +#orbit-bar .bar-login .dropdown-menu .log .btn { + width: 220px; +} +#orbit-bar .bar-login .dropdown-menu .log .divider { + position:relative; + overflow: inherit; + margin: 20px 0; +} +#orbit-bar .bar-login .dropdown-menu .log .divider span { + position: absolute; + width: 20px; + height: 20px; + background-color: #FFF; + color: #666; + top: -9px; + left: 100px; + font-size:16px; + text-align: center; +} +#orbit-bar .bar-login .dropdown-menu .register { + color: #FFFFFF; + margin: 0 15px; + width: 188px; +} +#main-sidebar { + background: url(<%= asset_path 'background.jpg' %>) repeat left top; + width: 155px; + padding-right: 4px; + border-right: 1px solid rgba(0,0,0,.2); + position:fixed; + top: 31px; + z-index: 88; +} +#main-sidebar .nav { + padding-top: 5px; +} +#main-sidebar .nav > li.active > a [class^="icons-"] { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +#main-sidebar .nav > li > .nav { + margin-left: -14px; + margin-bottom: 5px; + width: 155px; + padding: 0; + background-color: #FFF; + /*border-radius: 0px 0px 8px 0px; + -webkit-border-radius: 0px 0px 8px 0px; + -moz-border-radius: 0px 0px 8px 0px;*/ + box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -moz-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + -webkit-box-shadow: 0px 2px 1px rgba(0,0,0,0.1); + display: none; +} +#main-sidebar .nav > li.active > .nav { + display: block; +} +#main-sidebar .nav > li > .nav > li > a { + margin-left: 0; + padding-left: 19px; + color: #999; +} +#main-sidebar .nav > li > .nav > li > a:hover { + color: #000; + background-color: #d7eeff; +} +#main-sidebar .nav > li > .nav > li.active > a { + background-color: #b7b7b7; + color: #fff; +} +#main-wrap { + background-color: #FFF; + margin-left:160px; + padding-top: 32px; + padding-bottom: 45px; + position: relative; +} +#main-wrap .subnav { + height: auto; + min-height: 36px; +} +#main-wrap .pagination { + margin: 18px 0 0; + text-align: center; +} +.main-list .route-group td { + border: none; +} +#main-wrap .route-group .breadcrumb { + background-image: none; + border-radius: 0; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-width: 0 0 1px 0; + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + margin-bottom: 0px; + padding: 7px 8px 5px; +} +#main-wrap .breadcrumb li { + font-size: 12px; + color: #999; +} +.form-actions .btn { + margin-bottom: 0; +} +#sub-wiget { + clear: right; + float: right; + padding-right: 10px; + padding-top: 8px; + position: relative; + margin-bottom: 13px; + width: 304px; +} +.main-wiget .widget-box { + margin: 5px 0; + width: 100%; +} +#poststuff .form-actions { + background-color: transparent; + text-align: right; + padding-left: 10px; + padding-right: 10px; + margin-bottom: -50px; + clear: both; +} +#poststuff form { + margin-bottom: 0; +} +#post-body { + float: left; + clear: left; + width: 100%; + margin-right: -340px; +} +#post-body .title input[type=text] { + margin-bottom: 0; + width: 100%; + height: 30px; +} +#post-body .btn-group { + margin-left: 5px; +} +#post-body .well { + margin: 0; + border-radius: 0px; + -moz-border-radius: 0px; + box-shadow: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + border-top: none; +} +#post-body .editor { +} +#post-body-content { + padding: 8px 0 8px 6px; +} +.filter .accordion-heading > a:hover { + text-decoration: none; +} +.filter .accordion-group { + border-bottom: none; + border-top: none; + border-left: 1px solid rgba(0,0,0,0.07); + border-right: none; + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + margin-bottom: -1px; + position: relative; + left: 0; + top: 0; +} +.filter .accordion-group:last-child { + border-right: 1px solid rgba(0,0,0,0.07); +} +.filter .accordion-heading .accordion-toggle { + padding: 9px 15px; +} +.accordion-group .accordion-toggle .caret { + border-top-color: #0088CC; + margin-top: 6px; +} +.filter .active { + background-color: #0088CC; +} +.filter .active a { + color: #FFF; +} +.filter form { + margin: 5px 10px; +} +.filters { + background-color: rgba(0,0,0,0.075); + -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); + box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); +} +.filters > div { + background-color: #dadada; +} +.filters .btn { + margin-bottom: 5px; +} +.filters .accordion-inner { + border-top: none; + padding: 9px 15px 4px; +} +.filters .filter-clear { + padding: 5px 5px 0; + border-top: 1px solid rgba(0,0,0,0.1); + text-align: right; + margin: 0 5px; + -webkit-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + -moz-box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); + box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); +} +.filters .in { + /*border-bottom: 1px solid rgba(0,0,0,0.07)*/ +} +#tags { +} +#tags .tag { + line-height: 32px; + padding: 0 10px; + background-color: #FFFFFF; + border-bottom: 1px solid #DDDDDD; + border-top: medium none; +} +#tags .tag form, #tags .tag form input { + margin:0; +} +#tags .tagitem { + display: inline-block; + float: left; +} +#tags .action { + display: inline-block; + float: right; +} +.sign-in { + width: 360px; + margin: 0 auto 70px; + background-color: #FFF; + -moz-border-radius: 0 0 5px 5px; + -webkit-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; + -moz-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + -webkit-box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + box-shadow: 0 2px 2px rgba(143, 143, 143, 0.38); + border-width: 0px 1px 1px 1px; + border-style: none solid solid solid; + border-color: transparent #c6c6c6 #c6c6c6 #c6c6c6; +} +#signin-header { + width: 340px; + margin: 30px auto 0; + line-height: 25px; + padding: 5px 10px; + border-width: 1px 1px 0px 1px; + border-style: solid solid none solid; + border-color: #c6c6c6 #c6c6c6 transparent #c6c6c6; + background-color: #006dcc; + background-image: -moz-linear-gradient(top, #dadada, #c0c0c0); + background-image: -ms-linear-gradient(top, #dadada, #c0c0c0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dadada), to(#c0c0c0)); + background-image: -webkit-linear-gradient(top, #dadada, #c0c0c0); + background-image: -o-linear-gradient(top, #dadada, #c0c0c0); + background-image: linear-gradient(top, #dadada, #c0c0c0); + -moz-border-radius: 5px 5px 0px 0px ; + -webkit-border-radius: 5px 5px 0px 0px; + border-radius: 5px 5px 0px 0px; + -moz-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + -webkit-box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); + box-shadow: 0 1px 0px rgba(20, 20, 20, 0.3); +} +#signin-header h3 { + color: #848484; + text-shadow: 0 1px 0 #e9e9e9; +} +#sign-footer { + width: 100%; + position:fixed; + bottom: 0; + height: 40px; + background-color: #dadada; + color: #7a7a7a; + box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -moz-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); + -webkit-box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3); +} +#sign-footer p { + line-height: 40px; + padding: 0 10px; + text-align: right; +} +.sign-in .control-group label { + text-align: left; + width: auto; + font-size: 15px; +} +.sign-in .forgot { + padding-top: 5px; +} +.sign-in .content { + padding: 10px; +} +.sign-in .form-actions { + padding: 17px 10px 18px; + margin: 0; + -moz-border-radius: 0px 0px 5px 5px; + -webkit-border-radius: 0px 0px 5px 5px; + border-radius: 0px 0px 5px 5px; +} +.sign-in form { + margin: 0; +} +.sign-in .control-group .help-inline { + display:none; +} +.sign-in .error .help-inline { + display:inline-block; +} +.web-symbol:after { + font-family: 'WebSymbolsRegular'; + content: "{"; + margin-left: 2px; + margin-top: 8px; +} +.active .web-symbol:after { + content: "}"; +} +.img-peview { + margin-left: 12px; +} +.popover img { + max-height: 120px; + max-width: 100%; +} +.popover-inner { + width: auto; +} +.popover-title { + padding: 5px; +} +.popover-content { + border-radius: 3px; + padding: 5px; +} +.popover-title { + display: none; +} + +.member td.teacher { + /*background-color: #AF0045; + border-left: 2px solid #AF0045;*/ +} +.gender { + position: absolute; + border-radius: 0 0 5px 0; + border-width: 10px; + margin: 0; + border-style: solid; + z-index: 10; + bottom: 0; + right: 0; +} +.gender.male { + border-color: transparent #41B1D5 #41B1D5 transparent; +} +.gender.female { + border-color: transparent #DB186E #DB186E transparent; +} +.user-info .roles-nav { + margin: 0; + position: relative; + clear: both; +} +.user-info .roles-nav li { + float: left; + list-style: none; + background-color: #FFFFFF; +} +.user-info .roles-nav li a { + text-indent: -9999px; + display: block; + height: 15px; + width: 100px; + margin-top: 3px; + opacity: 0.3; + -moz-opacity: 0.3; + filter:alpha(opacity=3); +} +.user-info .roles-nav li:first-child a { + border-radius: 0 0 0 4px; +} +.user-info .roles-nav li:last-child a { + border-radius: 0 0 4px 0; +} +.user-info .roles-nav li hr { + position: absolute; + top: 0; + left: 0; + right: 0; + height: 3px; + margin: 0; + border: none; + display: none; +} +.user-info .roles-nav li.teacher a { + background-color: #F36F08; +} +.user-info .roles-nav li.student a { + background-color: #186AB6; +} +.user-info .roles-nav li.staff a { + background-color: #139E2F; +} +.user-info .roles-nav li.active a { + border-bottom: none; + height: 18px; + margin-top: 0; + opacity: 1; + -moz-opacity: 1; + filter:alpha(opacity=10); +} +.user-info .roles-nav li.active hr { + display: block; +} +.user-info-basic { + padding: 20px; + min-width: 220px; + display: inline-block; + float: left; + position: relative; +} +.user-info-basic .gender { + border-radius: 0; + top: 0; + left: 0; + right: auto; + bottom: auto; +} +.user-info-basic .gender.male { + border-color: #41B1D5 transparent transparent #41B1D5; +} +.user-info-basic .gender.female { + border-color: #DB186E transparent transparent #DB186E; +} +.user-info-roles { + padding: 20px; +} +.user-avatar { + overflow: hidden; + width: 80px; + height: 80px; + border-radius: 5px; + box-shadow: 0 1px 3px rgba(0,0,0,.8); + margin-right: 10px; +} +.user-avatar .reflective { + background-image: url(<%= asset_path 'reflective.png' %>); + background-repeat: no-repeat; + background-position: 0; + height: 80px; + width: 80px; + position: absolute; +} +.user .user-avatar .reflective { + background-image: url(<%= asset_path 'reflective.png' %>); + background-repeat: no-repeat; + background-position: 0 -20px; + height: 80px; + width: 80px; + position: absolute; + top: 10px; + left: 10px; + opacity: 0; + -moz-opacity: 0; + filter:alpha(opacity=0); +} +.user:hover .user-avatar .reflective { + background-position: 0 0; + opacity: 1; + -moz-opacity: 1; + filter:alpha(opacity=10); +} +.user-name { + font-size: 22px; + line-height: 24px; + color: #555; + margin: 0 0 3px; + font-family: Helvetica, "微軟正黑體"; +} +.user-data { + padding: 20px; + position: relative; +} +.data-block hr { + background-color: #666; + height: 8px; + border: none; + margin: 0; + border-radius: 5px 5px 0px 0px; + -moz-border-radius: 5px 5px 0px 0px; + -webkit-border-radius: 5px 5px 0px 0px; +} +.data-block .info_input { + margin-bottom:50px; + position:relative; + padding: 10px; + background-color: rgba(227,227,227,1); + border-radius: 0px 0px 5px 5px; + -moz-border-radius: 0px 0px 5px 5px; + -webkit-border-radius: 0px 0px 5px 5px; + -moz-box-shadow: 0px 1px 0px rgba(0,0,0,.3); /* Firefox */ + -webkit-box-shadow: 0px 1px 0px rgba(0,0,0,.3);/* Safari 和 Chrome */ + box-shadow: 0px 1px 0px rgba(0,0,0,.3); /* Opera 10.5 + */ +} +.data-block .info_input table { + width: 100%; +} +.data-block .info_input table .list_head td { + border-bottom: 1px solid #AAA; +} +.teacher hr { + background-color: #F36F08; +} +.student hr { + background-color: #186AB6; +} +.staff hr { + background-color: #139E2F; +} +.view-mode { + margin: 4px 20px 0 0; +} +.view-mode i { + font-size: 14px; + line-height: 6px !important; +} +.member-abstract, .member-large { + padding: 15px; +} +.member-abstract ul, .member-large ul { + margin: 0; + padding: 0; + list-style: none; +} +.member-abstract>ul>li, .member-large>ul>li { + margin: 5px; + overflow: hidden; + border-radius: 5px; + box-shadow: 0 1px 3px rgba(0,0,0,.3); +} +.member-abstract .user *, .member-large .user * { + -webkit-transition: all .3s ease; + -moz-transition: all .3s ease; + -o-transition: all .3s ease; + transition: all .3s ease; +} +.member-abstract .user, .member-large .user { + background-color: #EDEDED; + padding: 10px; + position: relative; + border-radius: 0 0 5px 5px; + width: 360px; + -webkit-transition: all .3s ease; + -moz-transition: all .3s ease; + -o-transition: all .3s ease; + transition: all .3s ease; +} +.member-abstract .user:hover, .member-large .user:hover { + background-color: #333333; +} +.member-abstract .user:hover .user-name, .member-large .user:hover .user-name { + color: #DDD; +} +.member-abstract .user .user-meta { + margin-left: 90px; +} +.member-abstract .user .user-title span { + color: #5e5e5e; + font-size: 13px; + padding-right: 10px; +} +.member-abstract .user:hover .user-title span { + color: #AAA; +} +.member-abstract .user ul.user-itemborder { + margin-top: 8px; + border-top: 1px solid #D5D5D5; + padding: 4px 0 0; +} +.member-abstract .user ul.user-itemborder li, .member-abstract .user ul.user-itemborder li span { + color: #333; +} +.member-abstract .user:hover ul.user-itemborder { + color: #EDEDED; + border-top: 1px solid #666; +} +.member-abstract .user:hover ul.user-itemborder li, .member-abstract .user:hover ul.user-itemborder li span { + color: #EDEDED; +} +.member-abstract .user ul.user-itemborder li { + width: 33%; + font-size: 11px; + text-align: center; +} +.member-abstract .user ul.user-itemborder li span { + font-size: 13px; + font-weight: bold; + padding-right: 5px; +} +.member-large .user { + width: 80px; + min-height: 125px; +} +.member-large .user-avatar { + margin-right: 0; +} +.member-large .user-name { + font-weight: bold; + font-size: 13px; + width: 80px; + line-height: 18px; + padding-top: 5px; + text-align: center; +} +.rolesTag { + width: 100%; +} +.rolesTag td { + height: 6px; + background-color: #333; +} +.rolesTag td.teacher { + background-color: #F38C08; +} +.rolesTag td.student { + background-color: #186AB6; +} +.rolesTag td.staff { + background-color: #139E2F; +} +.site-map { + padding: 15px; +} +.site-map .map-block { + width: 250px; + min-height: 20px; + border: 1px solid #dedede; + background-color: #E6E6E6; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + margin-bottom: 10px; +} +.site-map .map-block ul { + margin: 0px; + list-style: none; + width: 220px \9; +} +.site-map .map-block li { + font-size: 12px; + background-color: #F7F7F7; + padding: 5px 15px; + border-top: 1px solid #FFF; + border-bottom: 1px solid #dedede; + display: table; + width: 100%; +} +.site-map .map-block li span { + width: 170px; + display: block; +} +.site-map .map-block li:last-child { + border-radius: 0 0 4px 4px; + border-bottom: none; +} +.site-map .map-block li:hover a {; + text-decoration: none; +} +.site-map .map-block li.disabled { + color: #C9C9C9; +} +.site-map .map-block li.disabled .onoff { + box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(0,0,0,.2) inset; + background-color: #9C9C9C; + color: #CACACA; +} +.site-map .map-block h4 { + line-height: 18px; + min-height: 20px; + padding: 5px 15px; + border-radius: 4px 4px 0 0; + box-shadow: 0px 1px 2px #A8A8A8; + position: relative; + background-image: -moz-linear-gradient(top, #FCFCFC, #DFDFDF); + background-image: -ms-linear-gradient(top, #FCFCFC, #DFDFDF); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#FCFCFC), to(#DFDFDF)); + background-image: -webkit-linear-gradient(top, #FCFCFC, #DFDFDF); + background-image: -o-linear-gradient(top, #FCFCFC, #DFDFDF); + background-image: linear-gradient(top, #FCFCFC, #DFDFDF); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FCFCFC', endColorstr='#DFDFDF', GradientType=0); +} +.site-map .map-block h4 span { + width: 170px; + display: block; +} +.site-map .map-block h4 .onoff { +} +.site-map .disabled h4 { + color: #CACACA; +} +.site-map .disabled h4 .onoff { + box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(0,0,0,.2) inset; + background-color: #9C9C9C; + color: #CACACA; +} +.onoff { + display: block; + background-color: #5EB92B; + font-size: 9px; + padding: 0px 10px; + border-radius: 8px; + line-height: 16px; + height: 15px; + color: #FFF; + width: 38px; + border: none; + box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5), 0 0 5px rgba(13, 75, 23, 0.5) inset; + margin-top: 2px; +} + +.modal.alert-error { + color: #B94A48; + background-color: #F2DEDE; + border-color: #EED3D7; +} +.news_paragraph p { + line-height: 20px; +} +.nav-tabs>li>.edit, .nav-tabs>li>.edit:hover { + background-color: #333; + color: #FFF; + padding-right: 12px; +} +.nav-tabs li .icons-pencil { + float: right; + margin-top: 8px; +} +.nav-tabs li a { + padding-right: 32px; +} + + +/*icons*/ +.the-icons i:after { + content: attr(class); + display: block; + font-style: normal; + margin-left: 20px; + width: 140px; +} +.the-icons i { + display: block; + margin-bottom: 5px; +} +[class^="text-"] { + font-size: 15px !important; +} +.text-blue { + color: #0088CC !important; +} +.text-red { + color: #CC3300 !important; +} +.text-yellow { + color: #ffcc00 !important; +} +.text-orange { + color: #f7941d !important; +} +.text-purple { + color: #a864a8 !important; +} +.text-palm { + color: #a67c52 !important; +} +.text-green { + color: #39b54a !important; +} +.adbanner-setup { + margin-right: 10px; + margin-bottom: 30px !important; +} +.adbanner-list { + border-top: 1px solid #AAA; + margin-right: 10px; + padding-top: 10px; + position: relative; +} +.adbanner-list ul { + margin: 0px; +} +.adbanner-list ul li { + list-style: none; + margin-left: 0; + margin-right: 20px; +} +.adbanner-action { + margin-bottom: 20px; +} +.textarea-height-s { + resize: none; + max-height: 150px; +} +.textarea-height-m { + resize: none; + max-height: 250px; +} +.textarea-height-l { + resize: none; + max-height: 350px; +} +.textarea-height-xl { + resize: none; + max-height: 500px; +} +#banner [id^="slideshow-"] { + z-index: 2 !important; +} + +#back_main .editable { + position: relative; +} +#back_main .editable:after { + content: ''; + clear: both; + display: block; + visibility: hidden; + height: 0; +} + +#back_main .edit_link a { + position: absolute; + z-index: 10; + width: 100%; + height: 100%; + top: 0; + left: 0; + text-indent: -9999px; + background: url(<%= asset_path 'editicon.png' %>) no-repeat center center rgba(255,255,255,.8); + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); + -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 1); +} + +#category_id, #module_app_id { + width: auto; +} + +[class^="icons-"] { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: text-top; + background-image: url(<%= asset_path 'icons_pack.png' %>); + background-position: 16px 16px; + background-repeat: no-repeat; + *margin-right: .3em; + margin-right:10px; +} +[class^="icons-"]:last-child { + *margin-left: 0; +} +.icons-white { + background-image: url(<%= asset_path 'icons_pack_white.png' %>); +} +/*1*/ +.icons-pencil { + background-position: 0 0; +} +.icons-brush { + background-position: -32px 0; +} +.icons-pen { + background-position: -64px 0; +} +.icons-brush-large { + background-position: -128px 0; +} +.icons-pen-small { + background-position: -96px 0; +} +.icons-bucket { + background-position: -160px 0; +} +.icons-eye { + background-position: -192px 0; +} +.icons-ban { + background-position: -224px 0; +} +.icons-trash { + background-position: -256px 0; +} +.icons-zoom { + background-position: -288px 0; +} +.icons-zoom-out { + background-position: -320px 0; +} +.icons-zoom-in { + background-position: -352px 0; +} +.icons-magic { + background-position: -384px 0; +} +.icons-aim { + background-position: -416px 0; +} +/*2*/ +.icons-flag { + background-position: 0 -32px; +} +.icons-paperclip { + background-position: -32px -32px; +} +.icons-share { + background-position: -64px -32px; +} +.icons-link { + background-position: -96px -32px; +} +.icons-tag { + background-position: -128px -32px; +} +.icons-lock { + background-position: -160px -32px; +} +.icons-unlock { + background-position: -192px -32px; +} +.icons-thumbtack { + background-position: -224px -32px; +} +.icons-pin { + background-position: -257px -32px; +} +.icons-shield { + background-position: -288px -32px; +} +.icons-key { + background-position: -320px -32px; +} +.icons-fire { + background-position: -352px -32px; +} +.icons-bulls-eye { + background-position: -384px -32px; +} +.icons-flash { + background-position: -416px -32px; +} +.icons-time { + background-position: -448px -32px; +} +.icons-halo { + background-position: -480px -32px; +} +.icons-hourglass { + background-position: -513px -32px; +} +.icons-alarm-clock { + background-position: -545px -32px; +} +.icons-paper { + background-position: -577px -32px; +} +.icons-banner { + background-position: -608px -32px; +} +/*3*/ +.icons-phone { + background-position: 0px -64px; +} +.icons-mobile { + background-position: -32px -64px; +} +.icons-mail { + background-position: -64px -64px; +} +.icons-mail-open { + background-position: -96px -64px; +} +.icons-mail-read { + background-position: -128px -64px; +} +.icons-content { + background-position: -160px -64px; +} +.icons-content-out { + background-position: -192px -64px; +} +.icons-content-in { + background-position: -224px -64px; +} +.icons-projector { + background-position: -256px -64px; +} +.icons-tape { + background-position: -288px -64px; +} +.icons-chat-a { + background-position: -320px -64px; +} +.icons-chat-b { + background-position: -352px -64px; +} +.icons-chat-c { + background-position: -384px -64px; +} +.icons-comment { + background-position: -416px -64px; +} +.icons-rss { + background-position: -448px -64px; +} +.icons-ship { + background-position: -480px -64px; +} +.icons-send { + background-position: -512px -64px; +} +.icons-bell { + background-position: -544px -64px; +} +.icons-announcement { + background-position: -576px -64px; +} +/*4*/ +.icons-contact { + background-position: 0 -96px; +} +.icons-roll { + background-position: -32px -96px; +} +.icons-member { + background-position: -288px -96px; +} +.icons-member-user { + background-position: -64px -96px; +} +.icons-member-admin { + background-position: -96px -96px; +} +.icons-member-manager{ + background-position: -128px -96px; +} +.icons-member-plus{ + background-position: -160px -96px; +} +.icons-member-minus{ + background-position: -192px -96px; +} +.icons-member-blockade{ + background-position: -224px -96px; +} +.icons-carte { + background-position: -256px -96px; +} +.icons-building { + background-position: -320px -96px; +} +.icons-calendar { + background-position: -352px -96px; +} +.icons-calendars { + background-position: -384px -96px; +} +.icons-out { + background-position: -416px -96px; +} +.icons-desktop { + background-position: -448px -96px; +} +/*5*/ +.icons-page-blank { + background-position: 0px -128px; +} +.icons-page { + background-position: -32px -128px; +} +.icons-page-copy { + background-position: -64px -128px; +} +.icons-folder { + background-position: -96px -128px; +} +.icons-folder-open { + background-position: -128px -128px; +} +.icons-folder-lock { + background-position: -160px -128px; +} +.icons-folder-plus { + background-position: -192px -128px; +} +.icons-folder-minus { + background-position: -224px -128px; +} +.icons-page-plus { + background-position: -256px -128px; +} +.icons-page-minus { + background-position: -288px -128px; +} +.icons-page-edit { + background-position: -320px -128px; +} +.icons-page-download { + background-position: -352px -128px; +} +/*6*/ +.icons-house-w { + background-position: 0px -160px; +} +.icons-house-b { + background-position: -32px -160px; +} +.icons-signs { + background-position: -64px -160px; +} +.icons-globe { + background-position: -96px -160px; +} +.icons-map { + background-position: -128px -160px; +} +.icons-markers { + background-position: -160px -160px; +} +.icons-barrier { + background-position: -192px -160px; +} +.icons-assist { + background-position: -224px -160px; +} +.icons-cones { + background-position: -256px -160px; +} +.icons-group { + background-position: -288px -160px; +} +.icons-cuble { + background-position: -320px -160px; +} +.icons-structure { + background-position: -352px -160px; +} +.icons-layer { + background-position: -384px -160px; +} +/*7*/ +.icons-shopcar-a { + background-position: 0px -192px; +} +.icons-shopcar-b { + background-position: -34px -192px; +} +.icons-purchase { + background-position: -64px -192px; +} +.icons-shopcart { + background-position: -96px -192px; +} +.icons-van { + background-position: -128px -192px; +} +.icons-form { + background-position: -160px -192px; +} +.icons-gift { + background-position: -192px -192px; +} +.icons-credit-card { + background-position: -224px -192px; +} +.icons-cash { + background-position: -256px -192px; +} +.icons-assets { + background-position: -288px -192px; +} +.icons-computer { + background-position: -320px -192px; +} +.icons-library { + background-position: -352px -192px; +} +/*8*/ +.icons-dashboard { + background-position: 0 -224px; +} +.icons-cog { + background-position: -32px -224px; +} +.icons-cogs { + background-position: -64px -224px; +} +.icons-tool { + background-position: -96px -224px; +} +.icons-screwdriver { + background-position: -128px -224px; +} +.icons-wrench { + background-position: -160px -224px; +} +.icons-toolbox { + background-position: -192px -224px; +} +.icons-switch { + background-position: -224px -224px; +} +.icons-valve { + background-position: -256px -224px; +} +/*9*/ +.icons-book-cover { + background-position: 0px -256px; +} +.icons-book-make { + background-position: -32px -256px; +} +.icons-binder { + background-position: -64px -256px; +} +.icons-album { + background-position: -96px -256px; +} +.icons-camera { + background-position: -128px -256px; +} +.icons-video-camera { + background-position: -160px -256px; +} +.icons-pillar { + background-position: -192px -256px; +} +.icons-chart { + background-position: -224px -256px; +} +.icons-picture { + background-position: -256px -256px; +} +.icons-pictures { + background-position: -288px -256px; +} +.icons-brief { + background-position: -320px -256px; +} +.icons-film { + background-position: -352px -256px; +} +.icons-asset { + background-position: -384px -256px; +} +.icons-asset-download { + background-position: -416px -256px; +} +.icons-asset-upload { + background-position: -448px -256px; +} +.icons-music { + background-position: -480px -256px; +} +.icons-book-open-w { + background-position: -512px -256px; +} +.icons-book-open-b { + background-position: -544px -256px; +} +.icons-clapper-board { + background-position: -576px -256px; +} +/*10*/ +.icons-date { + background-position: 0px -288px; +} +.icons-screen { + background-position: -32px -288px; +} +.icons-iphone { + background-position: -64px -288px; +} +.icons-ipad { + background-position: -96px -288px; +} +.icons-ipod { + background-position: -128px -288px; +} +.icons-battery-low { + background-position: -160px -288px; +} +.icons-battery-mid { + background-position: -192px -288px; +} +.icons-battery-full { + background-position: -224px -288px; +} +.icons-battery-charge { + background-position: -256px -288px; +} +/*11*/ +.icons-pie { + background-position: 0px -320px; +} +.icons-histogram { + background-position: -32px -320px; +} +.icons-window { + background-position: -64px -320px; +} +.icons-window-line{ + background-position: -96px -320px; +} +.icons-window-command{ + background-position: -128px -320px; +} +.icons-window-list{ + background-position: -160px -320px; +} +.icons-window-block{ + background-position: -192px -320px; +} +.icons-terminal{ + background-position: -224px -320px; +} +/*12*/ +.icons-heart-w { + background-position: 0px -352px; +} +.icons-heart-b { + background-position: -32px -352px; +} +.icons-like { + background-position: -64px -352px; +} +.icons-hate { + background-position: -96px -352px; +} +.icons-medal { + background-position: -128px -352px; +} +.icons-warning { + background-position: -160px -352px; +} +.icons-check { + background-position: -192px -352px; +} +.icons-check-box-solid { + background-position: -224px -352px; +} +.icons-check-box-dot { + background-position: -256px -352px; +} +.icons-check-2 { + background-position: -288px -352px; +} +.icons-check-circle-solid { + background-position: -320px -352px; +} +.icons-check-circle-dot { + background-position: -352px -352px; +} +.icons-check-circle-b { + background-position: -384px -352px; +} +.icons-star-thin { + background-position: -416px -352px; +} +.icons-star { + background-position: -448px -352px; +} +/*13*/ +.icons- { + background-position: -0px -384px; +} +/*14*/ +.icons- { + background-position: -0px -416px; +} +/*15*/ +.icons- { + background-position: -0px -448px; +} +/*16*/ +.icons- { + background-position: -0px -480px; +} +/*17*/ +.icons- { + background-position: -0px -512px; +} +/*18*/ +.icons-help { + background-position: -160px -544px; +} +.icons- { + background-position: -0px -544px; +} +/*19*/ +.icons-plus-cube { + background-position: -192px -576px; +} +.icons-plus { + background-position: -288px -576px; +} +/*20*/ +.icons-power { + background-position: -0px -608px; +} +.icons-output { + background-position: -32px -608px; +} +.icons-col-resize { + background-position: -64px -608px; +} +.icons-move { + background-position: -96px -608px; +} +.icons-size-out { + background-position: -128px -608px; +} +.icons-size-in { + background-position: -160px -608px; +} +.icons-slash { + background-position: -192px -608px; +} +.icons-level { + background-position: -224px -608px; +} +.icons-share { + background-position: -256px -608px; +} +.icons-share2 { + background-position: -288px -608px; +} +.icons-re { + background-position: -320px -608px; +} +.icons-insert { + background-position: -352px -608px; +} +.icons-insert2 { + background-position: -384px -608px; +} +.icons-download { + background-position: -416px -608px; +} +.icons-tag-rignt { + background-position: -448px -608px; +} +.icons-tag-top { + background-position: -480px -608px; +} +.icons-tag-bottom { + background-position: -512px -608px; +} +.icons-tag-left { + background-position: -544px -608px; +} +.icons-moves { + background-position: -576px -608px; +} +/*21*/ +.icons- { + background-position: -0px -640px; } \ No newline at end of file diff --git a/app/assets/stylesheets/widgets.css b/app/assets/stylesheets/widgets.css index 86088fee1..a44824c0a 100644 --- a/app/assets/stylesheets/widgets.css +++ b/app/assets/stylesheets/widgets.css @@ -53,11 +53,11 @@ display:inline-block; margin-right: 5px; opacity: 0.8; - filter: alpha(opacity=80); + filter: alpha(opacity=80); } .action:hover { opacity: 1; - filter: alpha(opacity=100); + filter: alpha(opacity=80); cursor: pointer; } .select-role { diff --git a/app/controllers/admin/assets_controller.rb b/app/controllers/admin/assets_controller.rb index f465523b2..6a847a12f 100644 --- a/app/controllers/admin/assets_controller.rb +++ b/app/controllers/admin/assets_controller.rb @@ -30,17 +30,19 @@ class Admin::AssetsController < OrbitBackendController def create @asset = Asset.new(params[:asset]) - @asset.filename = @asset.title[I18n.locale] rescue nil + @asset.filename = @asset.title rescue nil if @asset.filename && @asset.save - respond_to do |format| - format.js { - if params[:uploader] - render "create" - else - render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} - end - } - end + # respond_to do |format| + # format.js { + # if params[:uploader] + # render 'create' + # else + # render 'js/remove_pop_up_and_reload_content', :locals => {:function => 'replaceWith', :id => "asset_#{@asset.id}", :value => @asset, :values => nil, :partial => 'admin/assets/asset', :locals => nil} + # end + # } + # end + # render :json=>{"url"=>@asset.data.url,"title"=>"xxx","desc"=>"sss"}.to_json + render :layout=>false else flash[:error] = t(:create_fail) @asset_categories = AssetCategory.all @@ -85,8 +87,8 @@ class Admin::AssetsController < OrbitBackendController end def delete - if params[:to_delete] - asset = Asset.any_in(:_id => params[:to_delete]).delete_all + if params[:ids] + asset = Asset.any_in(:_id => params[:ids]).delete_all end redirect_to assets_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) end diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb index 84f2b770a..9d434ff8d 100644 --- a/app/controllers/admin/designs_controller.rb +++ b/app/controllers/admin/designs_controller.rb @@ -86,8 +86,8 @@ class Admin::DesignsController < OrbitBackendController end def delete - if params[:to_delete] - designs = Design.any_in(:_id => params[:to_delete]).delete_all + if params[:ids] + designs = Design.any_in(:_id => params[:ids]).delete_all end redirect_to admin_designs_url(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) end diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index 3d0fd8962..cec6133fd 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -10,6 +10,7 @@ class Admin::ModuleAppsController < ApplicationController def reload_frontend_pages + @categories =[] @module_app = ModuleApp.find(params[:id]) @frontend_path = @module_app.widgets.keys[0] if ( !@module_app.widgets.blank? && @module_app.widgets[0].blank? ) diff --git a/app/controllers/admin/module_apps_new_interface_controller.rb b/app/controllers/admin/module_apps_new_interface_controller.rb index d9989fab1..863af5609 100644 --- a/app/controllers/admin/module_apps_new_interface_controller.rb +++ b/app/controllers/admin/module_apps_new_interface_controller.rb @@ -39,7 +39,7 @@ class Admin::ModuleAppsNewInterfaceController < OrbitBackendController def update_setting_by_params user_sat = [] ma = ModuleApp.find params[:module_app][:id] - user_sat = User.find params[:users].keys if params.has_key? :users + user_sat += User.find params[:users].keys if params.has_key?('users') users_to_new = user_sat - ma.managing_users users_to_remove = ma.managing_users - user_sat @@ -56,7 +56,7 @@ class Admin::ModuleAppsNewInterfaceController < OrbitBackendController def get_categorys(id = nil) @bulletin_categorys = [] if(is_manager? || is_admin?) - @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) + @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.all) elsif is_sub_manager? @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') end diff --git a/app/controllers/admin/object_auths_new_interface_controller.rb b/app/controllers/admin/object_auths_new_interface_controller.rb index 42e82b479..31c5e9007 100644 --- a/app/controllers/admin/object_auths_new_interface_controller.rb +++ b/app/controllers/admin/object_auths_new_interface_controller.rb @@ -49,7 +49,7 @@ class Admin::ObjectAuthsNewInterfaceController < OrbitBackendController # def get_categorys(id = nil) # @bulletin_categorys = [] # if(is_manager? || is_admin?) - # @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) + # @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.all) # elsif is_sub_manager? # @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') # end diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index 294715dac..2e5e038c9 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -56,6 +56,12 @@ class Admin::PagePartsController < ApplicationController if @part.update_attributes(params[:page_part]) set_children_sub_menu(@part) if @part.public_r_tag && @part.public_r_tag.eql?('sub_menu') flash.now[:notice] = t('admin.update_success_content') + + if @part.page.name == 'home' + expire_page '/' + else + expire_page page_path(@part.page.name) + end respond_to do |format| format.html { redirect_to admin_page_url( @part.page ) @@ -76,12 +82,13 @@ class Admin::PagePartsController < ApplicationController end def reload_widgets + @categories =[] @module_app = ModuleApp.find(params[:id]) @widget_path = @module_app.widgets.keys[0] if ( @module_app.widgets[0].blank? ) @widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? ) - + case @module_app.key when 'announcement' @categories = BulletinCategory.all @@ -93,6 +100,7 @@ class Admin::PagePartsController < ApplicationController @categories = WebLinkCategory.all @tags = WebResourceTag.all end + respond_to do |format| format.js {} end diff --git a/app/controllers/admin/purchases_controller.rb b/app/controllers/admin/purchases_controller.rb index 00980cec0..ab5b047de 100644 --- a/app/controllers/admin/purchases_controller.rb +++ b/app/controllers/admin/purchases_controller.rb @@ -32,7 +32,7 @@ class Admin::PurchasesController < ApplicationController public_key = OpenSSL::PKey::RSA.new(File.read(APP_CONFIG['main_public_key'])) encrypted_data = public_key.public_encrypt({:purchase_id => purchase.purchase_id, - :purchase_type => purchase._type, + :purchase_type => purchase.class.to_s, :roaming_id => Site.find(session[:site]).roaming_id, :url => url}.to_json) @@ -43,7 +43,7 @@ class Admin::PurchasesController < ApplicationController temp_file.write response.body temp_file.rewind zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue '' - case purchase._type + case purchase.class.to_s when 'Pdesign' unzip_design(temp_file, zip_name) when 'PModuleApp' diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 1a19aebd9..ffdec04af 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,8 +1,8 @@ class Admin::SitesController < ApplicationController layout "new_admin" - before_filter :authenticate_user! - before_filter :is_admin? + before_filter :authenticate_user!, :except => [:sitemap_frontend] + before_filter :is_admin?, :except => [:sitemap_frontend] before_filter :get_site # def index @@ -19,22 +19,40 @@ class Admin::SitesController < ApplicationController redirect_to :back end + def mail_setting + + end + def site_info end + def sitemap + @items = get_homepage.children rescue [] + end + + def sitemap_frontend + @items = get_homepage.children.excludes(sitemap_enabled: false) rescue [] + render :layout => false + end + + def sitemap_toggle + @item = Item.find(params[:id]) + @item.sitemap_enabled = !@item.sitemap_enabled + @item.save + if params[:parent] + @item.children.each do |child| + child.sitemap_enabled = @item.sitemap_enabled + child.save + end + end + render :nothing => true + end + def system_info end - def language - - end - - def mail_setting - - end - def ui_theme end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5fd9de5c9..74274eebf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -101,11 +101,23 @@ class ApplicationController < ActionController::Base # Render the page def render_page if @item - render :text => parse_page_noko(@item), :layout => 'page_layout' + respond_to do |format| + format.html { render :text => parse_page_noko(@item), :layout => 'page_layout' } + format.rss { render_main_rss } + end else render :text => '404 Not Found' end end + + def render_share + object_class = params[:model].classify.constantize + @object = object_class.find(params[:id]) + module_app = ModuleApp.first(:conditions => {:key => params[:key]}) + @item = Item.where(module_app_id: module_app.id).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first + @orig_url = "http://#{request.host_with_port}/#{@item.path}?id=#{@object.id}" + render 'shared/render_share', :layout => false + end protected @@ -178,4 +190,12 @@ class ApplicationController < ActionController::Base end end + def render_main_rss + ret = '' + ret << "/panel/#{@item.module_app.key}/front_end/#{@item.app_frontend_url}.rss" + ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(@item.id.to_s) + ret << "?inner=true&category_id=#{params[:category]}&tag_id=#{params[:tag]}&page_main=#{params[:page_main]}" + redirect_to ret + end + end diff --git a/app/controllers/orbit_backend_controller.rb b/app/controllers/orbit_backend_controller.rb index 28f99fa20..b43a6b9af 100644 --- a/app/controllers/orbit_backend_controller.rb +++ b/app/controllers/orbit_backend_controller.rb @@ -39,11 +39,10 @@ class OrbitBackendController< ApplicationController options = [options] if !options.class.eql?(Array) options.each do |option| if object_class.fields.include?(option) - case object_class.fields[option].type.to_s - when 'BigDecimal', 'Boolean', 'Date', 'DateTime', 'Float', 'Integer', 'String', 'Symbol', 'Time' - (objects = objects.order_by(option, params[:direction])) rescue nil - when 'Object' - objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + if object_class.fields[option].type.to_s.eql?('Object') && !object_class.relations[option].nil? + objects = get_objects_from_referenced_objects(object_class.fields[option].options[:class_name].constantize, objects, option) + else + (objects = objects.order_by(option, params[:direction])) rescue nil end elsif object_class.relations.include?(option) case object_class.relations[option].macro @@ -92,20 +91,11 @@ class OrbitBackendController< ApplicationController end def get_string_value_from_object(object) - s = object[I18n.locale] rescue nil - s = object.i18n_variable unless s rescue nil + s = object.name_translations[I18n.locale.to_s] unless s rescue nil + s = object.title_translations[I18n.locale.to_s] unless s rescue nil s = object.name unless s rescue nil s = object.title unless s rescue nil - if s - case s.class.to_s - when "String" - s.downcase rescue '' - when "I18nVariable" - s[I18n.locale].downcase rescue '' - else - nil - end - end + s.downcase rescue '' end def get_objects_from_referenced_objects(object_class, objects, option) @@ -113,7 +103,7 @@ class OrbitBackendController< ApplicationController referenced_objects = object_class.find(referer_ids) rescue nil if referenced_objects a = Array.new - referenced_objects.each { |referer| a << [get_string_value_from_object(referer), referer.id] } + referenced_objects.to_a.each { |referer| a << [get_string_value_from_object(referer), referer.id] } sorted = params[:direction].eql?('asc') ? a.sort : a.sort.reverse! sorted_objects = sorted.collect {|x| objects.where(option => x[1]).entries } sorted_objects.flatten! @@ -154,15 +144,17 @@ class OrbitBackendController< ApplicationController end - def get_viewable(object_class) - objects = get_objects(object_class).order_by(:created_at, :desc) + def get_viewable(object_class, query=nil) + objects = get_objects(object_class,query).order_by(:created_at, :desc) Kaminari.paginate_array(objects).page(params[:page]).per(10) end def get_objects(object_class, query=nil) object_class = object_class.classify.constantize + # debugger + # a=1 if query - objects = object_class.all.where(query) + objects = object_class.where(query) else objects = object_class.all end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 8758563e8..bfc4f403b 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,14 +1,14 @@ class PagesController < ApplicationController - include ApplicationHelper - before_filter :get_item, :only => [:index_from_link, :show_from_link] - + # caches_page :index + def index @item = Page.find_by_name('home') + if @item impressionist(@item) - render_page + render_page else render :text => 'You need a home page' end @@ -17,13 +17,13 @@ class PagesController < ApplicationController def show #begin @item = Item.first(:conditions => {:path => params[:page_name]}) - if @item && @item.is_published && (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) + if @item && @item.is_published #&& (@item.enabled_for.nil? ? true : @item.enabled_for.include?(I18n.locale.to_s)) impressionist(@item) - case @item._type - when 'Page' - render_page + case @item.class.to_s + when 'Page' + render_page unless save_from_no_lang_for_page when 'Link' - redirect_to @item[:url] + redirect_to(@item[:url]) unless save_from_no_lang_for_page end else render :file => "#{Rails.root}/public/404.html", :status => :not_found @@ -39,14 +39,20 @@ class PagesController < ApplicationController options << "?page_main=#{params[:page_main]}" unless params[:page_main].blank? options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank? options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank? - redirect_to url + options + options << "#{options.blank? ? '?' : '&'}search_query=#{params[:search_query]}" unless params[:search_query].blank? + options << "#{options.blank? ? '?' : '&'}name=#{params[:name]}" unless params[:name].blank? + uri = URI::escape(url + options) + #uri = URI::escape("#{url}?" + params.collect{|k,v| "#{k}=#{v}"}.join('&')) + redirect_to(uri)unless save_from_no_lang_for_page end def show_from_link url = "/#{@item.path}?id=#{params[:id]}" options = '' + options << "#{options.blank? ? '?' : '&'}category_id=#{params[:category_id]}" unless params[:category_id].blank? + options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank? options << "&preview=#{params[:preview]}" unless params[:preview].blank? - redirect_to url + options + redirect_to(url + options) unless save_from_no_lang_for_page end def load_orbit_bar @@ -57,7 +63,26 @@ class PagesController < ApplicationController def get_item module_app = ModuleApp.first(:conditions => {:key => params[:app_name]}) - @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action]}) + if !params[:category_id].blank? && !params[:tag_id].blank? + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => params[:tag_id]}) + @item = Item.first(:conditions => {:module_app_id => module_app.id, :app_frontend_url => params[:app_action], :category => params[:category_id], :tag => ''}) unless @item + elsif !params[:category_id].blank? + @item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],category: params[:category_id]).any_in(tag: [nil,'']).first + elsif !params[:tag_id].blank? + @item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action],tag: params[:tag_id]).any_in(category: [nil,'']).first + end + @item = Item.where(module_app_id: module_app.id,app_frontend_url:params[:app_action]).all_of("tag" => {"$in" => [nil,'']},"category" => { "$in" => [nil,'']}).first unless @item + #TODO 需要做 error handler 處理沒有新增該模組頁面導致錯誤的可能性 end + protected + def save_from_no_lang_for_page + if @item.nil? or !@item.enabled_for_lang(I18n.locale.to_s) + flash[:error] = t('sys.module_page_lang_not_support') + redirect_to '/' + return true + else + return false + end + end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 000000000..39904a1c2 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,85 @@ +class SessionsController < Devise::SessionsController + prepend_before_filter :require_no_authentication, :only => [ :new, :create ] + include Devise::Controllers::InternalHelpers + + # POST /resource/sign_in + def create + # login_password = params[:user][:password] + # login_uid = params[:user][:nccu_ldap_uid] + login_password = params[:user][:password] + login_uid = params[:user][:nccu_ldap_uid] + result = false + ldap_filter = "(uid=#{login_uid})" + if /@rulingcom.com$/.match(login_uid).nil? + MiddleSiteConnection.establish + NccuLdapConnection.establish + + if ($nccu_ldap_connection.bind rescue false) + logger.info "=LDAP Binded password ok..." + result =check_auth_with_ldap(login_uid,login_password) + if result && login_password!='' + logger.info "==LDAP password passed..." + nccu_id = get_nccu_id_from_mid_site(login_uid) + resource = nccu_id.nil? ? nil : (User.first(conditions:{ nccu_ldap_uid: nccu_id })) + # resource = env['warden'].authenticate!(:check_nccu_ldap) + # resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new") + set_flash_message(:notice, :signed_in) if is_navigational_format? + if (resource.nil? || nccu_id.nil?) + logger.error "===LDAP passed local block... resource:#{resource.inspect}\n nccu_id:#{nccu_id} \t login_uid:#{login_uid}" + flash[:notice] = t('devise.failure.ldap_pass_but_account_not_in_orbit') + render :action => "new" + else + logger.info "===ALL passed" + resource_name = resource.class.to_s.downcase + sign_in(resource_name, resource) + respond_with resource, :location => redirect_location(resource_name, resource) + end + else + logger.error "==password LDAP fail..." + flash[:notice] = t('devise.failure.ldap_invalid') + render :action => "new" + end + else + logger.error "=LDAP fail..." + flash[:notice] = t('devise.failure.ldap_connection_failed') + render :action => "new" + end + else #if rulingcom account + logger.info "=======Rulingcom account======" + resource = User.first(conditions:{email: login_uid}) + if resource.valid_password?(login_password) + resource_name = resource.class.to_s.downcase + sign_in(resource_name, resource) + respond_with resource, :location => redirect_location(resource_name, resource) + else + logger.error "==password Local fail..." + flash[:notice] = t('devise.failure.invalid') + render :action => "new" + end + end + logger.info "=======End Debugging======" + + end +private + def check_auth_with_ldap(login_uid,login_password) + ldap_filter = "(uid=#{login_uid})" + $nccu_ldap_connection.bind_as(:base => NccuLdapConnection::BASE,:filter => ldap_filter,:password=> login_password) rescue false + end + + def get_nccu_id_from_mid_site(ldap_id) + nccu_id = $mid_site_connection.query("SELECT nccu_id FROM rss_aaldap_view WHERE ldap_id='#{ldap_id}' LIMIT 1").first['nccu_id'] rescue nil + # + # if nccu_id.nil? + # #show_error + # p 'account not exist' + # #should return? + # end + # # User.first(conditions: { }) + # rss_pautlst_ut = $mid_site_connection.query("SELECT * FROM rss_pautlst_ut WHERE nccu_id='#{nccu_id}' LIMIT 1").first rescue nil + # # rss_paunit = client.query("SELECT * FROM rss_paunit LIMIT 1").first rescue nil + # user = User.find_or_create_by(:nccu_id => nccu_id) + # p user + # # p rss_paunit + # + end +end diff --git a/app/helpers/admin/asset_helper.rb b/app/helpers/admin/asset_helper.rb index 818a23401..7ed6fa158 100644 --- a/app/helpers/admin/asset_helper.rb +++ b/app/helpers/admin/asset_helper.rb @@ -3,7 +3,7 @@ module Admin::AssetHelper def show_all_fields(asset, field) a = [] @site_valid_locales.each do |locale| - a << asset.send(field)[locale] rescue nil + a << asset.send("#{field}_translations")[locale] rescue nil end a.join(' - ') end diff --git a/app/helpers/admin/dashboard_helper.rb b/app/helpers/admin/dashboard_helper.rb index dfe5763fb..bbfde4483 100644 --- a/app/helpers/admin/dashboard_helper.rb +++ b/app/helpers/admin/dashboard_helper.rb @@ -14,7 +14,7 @@ module Admin::DashboardHelper end def get_link_to_object(object) - case object._type.underscore + case object.class.to_s.underscore when 'bulletin' panel_announcement_front_end_bulletin_path(object) when 'news_bulletin' diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index 78e911b92..f5b8589a3 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -3,7 +3,7 @@ module Admin::ItemHelper def render_node_and_children(node) ret = '' if node - case node._type + case node.class.to_s when 'Page' dest = admin_page_path(node) when 'Link' @@ -13,12 +13,12 @@ module Admin::ItemHelper ret << "
  • " # ret << "" ret << "
    " - ret << (link_to node.i18n_variable[I18n.locale], dest, :class => 'js_history') + ret << (link_to node.title, dest, :class => 'js_history') ret << "
    " - ret << (link_to t('admin.edit'), eval("edit_admin_#{node._type.downcase}_path(node)"), :class => 'js_history') if node._type.eql?('Page') - ret << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node._type.eql?('Page') - ret << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node._type.eql?('Page') - ret << (link_to t(:delete), eval("delete_admin_#{node._type.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history') + ret << (link_to t('admin.edit'), eval("edit_admin_#{node.class.to_s.downcase}_path(node)"), :class => 'js_history') if node.class.to_s.eql?('Page') + ret << (link_to t('admin.new_page'), new_admin_page_path(:parent_id => node.id), :class => 'new_page js_history') if node.class.to_s.eql?('Page') + ret << (link_to t('admin.new_link'), new_admin_link_path(:parent_id => node.id), :class => 'new_link js_history') if node.class.to_s.eql?('Page') + ret << (link_to t(:delete), eval("delete_admin_#{node.class.to_s.downcase}_path(node, :authenticity_token => form_authenticity_token)"), :confirm => t('sure?'), :class => 'delete js_history') ret << "
    " ret << "
    " ret << render_children(node) diff --git a/app/helpers/admin/web_link_helper.rb b/app/helpers/admin/web_link_helper.rb index 813bc48c5..0498f31b0 100644 --- a/app/helpers/admin/web_link_helper.rb +++ b/app/helpers/admin/web_link_helper.rb @@ -6,6 +6,6 @@ module Admin::WebLinkHelper web_link.object_auths.new(title: type ).save oa = web_link.get_object_auth_by_title(type) end - link_to t('admin.web_link.cate_auth'),admin_object_auth_ob_auth_path(oa) + link_to t('web_resource.cate_auth'),admin_object_auth_ob_auth_path(oa) end end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0ed5a1bd6..6d5b896f8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -122,11 +122,11 @@ module ApplicationHelper def page_title(page) res = "" - page_title = page.title ? page.title[I18n.locale] : page.i18n_variable[I18n.locale] + page_title = page.page_title ? page.page_title : page.title if page.root? && @site.title - res << @site.title[I18n.locale] + res << @site.title elsif @site.title && @site.title_always_on - res << @site.title[I18n.locale] + ' - ' + page_title + res << @site.title + ' - ' + page_title else res << page_title end @@ -140,6 +140,7 @@ module ApplicationHelper stylesheets << "<link href='/assets/bootstrap-orbit.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='/assets/style.css' rel='stylesheet' type='text/css' />\n" end + stylesheets << "<link href='/assets/social-share-button.css' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='#{page.design.reset_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.reset_css stylesheets << "<link href='#{asset_path 'banner_nav.css'}' rel='stylesheet' type='text/css' />\n" stylesheets << "<link href='#{page.design.default_css.file.url}' rel='stylesheet' type='text/css' />\n" if page.design.default_css @@ -159,8 +160,11 @@ module ApplicationHelper javascripts << "<script type='text/javascript' src='/assets/orbit_bar.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/orbit-bar-search.js'></script>\n" end + javascripts << "<script type='text/javascript' src='/assets/lib/jquery.preload-min.js'></script>\n" javascripts << "<script type='text/javascript' src='/static/jquery.cycle.all.latest.js'></script>\n" javascripts << "<script type='text/javascript' src='/static/kernel.js'></script>\n" + # javascripts << "<script type='text/javascript' src='/assets/social-share-button.js'></script>\n" + javascripts << "<script type='text/javascript' src='/assets/lib/social-share-button.js'></script>\n" javascripts << "<script type='text/javascript' src='/assets/event.js'></script>\n" page.design.javascripts.each do |js| # javascripts << "<script type='text/javascript' src='#{js.file.url}'></script>" @@ -212,4 +216,20 @@ module ApplicationHelper object.strftime("%Y-%m-%d") end + def share_links(object, key) + js = '' + js << "<meta property='og:title' content='#{object.title}' />\n" rescue '' + js << "<meta property='og:description' content='#{object.subtitle}' />\n" rescue '' + js << "<meta property='og:image' content='#{object.image.url}' />\n" rescue '' + content_tag :div, :class => 'fb' do + concat social_share_button_tag(object.title, :fb_url => "http://#{request.env['HTTP_HOST']}/share/#{object.class.to_s.underscore}/#{object.id}?key=#{key}", :image => "http://#{request.env['HTTP_HOST']}#{object.image.url}") + # concat javascript_tag "$('head').append('#{j js}');" + end + end + + def wrap_string_with(str,options={}) + line_width = options[:line_width] || 12 + wrap_mark = options[:wrap_mark] || "<br />" + str.scan((/.{0,#{line_width}}/)).join(wrap_mark) + end end diff --git a/app/helpers/orbit_backend_helper.rb b/app/helpers/orbit_backend_helper.rb index 5d47e414a..3bc4d31b4 100644 --- a/app/helpers/orbit_backend_helper.rb +++ b/app/helpers/orbit_backend_helper.rb @@ -20,13 +20,13 @@ module OrbitBackendHelper ' active' if (@filter[type].include?(id.to_s) rescue nil) end - def render_sort_bar(delete_all, *titles) + def render_sort_bar(delete_all, url, *titles) content_tag :table, :class => "table main-list" do content_tag :thead do content_tag :tr, :class => "sort-header" do concat (content_tag :th, :class => "span1 strong" do concat check_box_tag :check_all - concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove" + concat link_to content_tag(:i, nil, :class => "icon-trash"), '#', :class => "list-remove", :rel => url end) if (delete_all && (is_admin? || (is_manager? rescue nil))) titles.each do |title| concat render_title(title[0], title[1], title[2], title[3]) @@ -42,4 +42,8 @@ module OrbitBackendHelper end end + def show_toggle_archive_btn(object) + object.disable ? t("object_disable.change_to_false") : t("object_disable.change_to_true") + end + end \ No newline at end of file diff --git a/app/jobs/backup_server.rb b/app/jobs/backup_server.rb new file mode 100644 index 000000000..3f0ae6b71 --- /dev/null +++ b/app/jobs/backup_server.rb @@ -0,0 +1,13 @@ +class BackupServer + @queue = :high + + def self.perform() + #CronMail.time_check("Going to backup Orbit").deliver + dbhost = Mongoid.config.database.connection.primary.join ':' + dbname = Mongoid.config.database.name + dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M") + %x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ] + + # %x[touch #{Rails.root}/tmp/restart] + end +end diff --git a/app/jobs/nccu_calendar.rb b/app/jobs/nccu_calendar.rb index 1848c6918..8756029d1 100644 --- a/app/jobs/nccu_calendar.rb +++ b/app/jobs/nccu_calendar.rb @@ -1,12 +1,21 @@ class NccuCalendar require 'open-uri' + require 'tempfile' + @queue = :high def self.perform() - File.open(File.join(Rails.root, 'public/static', 'nccu_calendar.rss'),'w') do |file| - file << open('http://events.nccu.edu.tw/Feed').read - CronMail.time_check("NCCU Calendar synced").deliver - end - puts "NccuCalendar Synced" + # temp_file = Tempfile.new('new_cal') + # open('http://events.nccu.edu.tw/Month').read{|data| + # temp_file << data + # } + +open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo| + fo.print open('http://events.nccu.edu.tw/Month').read +end + + # FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml')) + + puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced" end end diff --git a/app/jobs/restart_server.rb b/app/jobs/restart_server.rb deleted file mode 100644 index 53167fea1..000000000 --- a/app/jobs/restart_server.rb +++ /dev/null @@ -1,8 +0,0 @@ -class RestartServer - @queue = :high - - def self.perform() - CronMail.time_check("Going to restarting Orbit").deliver - %x[touch #{Rails.root}/tmp/restart] - end -end diff --git a/app/jobs/sync_db.rb b/app/jobs/sync_db.rb index 4f47b8d07..9c92e816d 100644 --- a/app/jobs/sync_db.rb +++ b/app/jobs/sync_db.rb @@ -3,7 +3,9 @@ class SyncDb @queue = :high def self.perform() + puts "[ #{DateTime.now.strftime("%Y %D %H:%M") }]\t SyncDb Starting" self.start_sync + self.set_admin end def self.start_sync @@ -11,6 +13,13 @@ class SyncDb args = [] %x[rake #{task} --trace >> #{Rails.root}/log/rake.log] User.all.each{|ur| ur.create_dept_cache} - puts "SyncDb Synced" + puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tSyncDb Synced" + end + + def self.set_admin + task = 'mid_site:install_admin' + args = [] + %x[rake #{task} --trace >> #{Rails.root}/log/rake.log] + puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tAdmin done" end end diff --git a/app/models/ad_banner.rb b/app/models/ad_banner.rb index 18c6d4481..dcae4aea9 100644 --- a/app/models/ad_banner.rb +++ b/app/models/ad_banner.rb @@ -21,6 +21,8 @@ attr_writer :transition_sec APP_NAME = 'ad_banners' ObjectAuthTitlesOptions = %W{edit} + + def pp_object title end diff --git a/app/models/ad_image.rb b/app/models/ad_image.rb index 9d7fe55b7..c01bc6b4f 100644 --- a/app/models/ad_image.rb +++ b/app/models/ad_image.rb @@ -4,8 +4,8 @@ class AdImage mount_uploader :file, ImageUploader - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true + field :context, localize: true field :direct_to_after_click,type: Boolean @@ -26,6 +26,9 @@ class AdImage # validates_format_of :out_link, with: /(http:\/\/.*|)/ ,:message => 'Need a valid URL' attr_reader :parse_post_date,:parse_unpost_date + before_validation :add_http + validates :out_link, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix, :allow_blank => true + def parse_post_date=(att) self.post_date = (Date.parse att.gsub(/\s+/, "") rescue nil) end @@ -52,4 +55,12 @@ class AdImage end time end + + protected + + def add_http + unless self.out_link[/^http:\/\//] || self.out_link[/^https:\/\//] || self.out_link.blank? + self.out_link = 'http://' + self.out_link + end + end end diff --git a/app/models/app_manager.rb b/app/models/app_manager.rb index 46cbbb913..0d81a0ec2 100644 --- a/app/models/app_manager.rb +++ b/app/models/app_manager.rb @@ -1,7 +1,7 @@ class AppManager include Mongoid::Document include Mongoid::Timestamps - + belongs_to :user belongs_to :managing_app, :polymorphic => true #,:class_name => 'ModuleApp',:inverse_of => :managers,:foreign_key => "user_id" diff --git a/app/models/asset.rb b/app/models/asset.rb index e20fcb9e7..f8751d57b 100644 --- a/app/models/asset.rb +++ b/app/models/asset.rb @@ -6,40 +6,28 @@ class Asset mount_uploader :data, FileAssetUploader field :filename - field :description - - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + field :description, localize: true + field :title, localize: true - validates_presence_of :title, :data, :description + validates :title, :at_least_one => true + validates :description, :at_least_one => true + validates_presence_of :data + belongs_to :asset_category belongs_to :assetable, polymorphic: true has_and_belongs_to_many :tags, :class_name => "AssetTag" - before_save :set_key - - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def description - @description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end + before_save :clean_tags def sorted_tags tags.order_by(I18n.locale, :asc) end protected - - def set_key - if title && title.new_record? - title.key = 'title' - end - if description && description.new_record? - description.key = 'description' - end + + def clean_tags + self.tag_ids.delete('') end end diff --git a/app/models/asset_category.rb b/app/models/asset_category.rb index 89bceaf7b..f12575ce7 100644 --- a/app/models/asset_category.rb +++ b/app/models/asset_category.rb @@ -4,8 +4,7 @@ class AssetCategory field :key field :display - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true has_many :assets diff --git a/app/models/i18n_variable.rb b/app/models/i18n_variable.rb index 563ba791e..ee0897f80 100644 --- a/app/models/i18n_variable.rb +++ b/app/models/i18n_variable.rb @@ -2,11 +2,14 @@ class I18nVariable include Mongoid::Document include Mongoid::Timestamps - - field :key - field :document_class, :type => String + + field :key, :index => true + field :document_class, :type => String, :index => true field :parent_id, :type => BSON::ObjectId, :index => true + + + belongs_to :language_value, polymorphic: true def method_missing(*field) diff --git a/app/models/item.rb b/app/models/item.rb index 8dd5c0b45..ae086c7d3 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -10,8 +10,9 @@ class Item field :is_published, :type => Boolean, :default => false field :enabled_for, :type => Array, :default => nil field :menu_enabled_for, :type => Array, :default => nil + field :title, localize: true + field :sitemap_enabled, :type => Boolean, :default => true - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/ validates :name, :exclusion => { :in => LIST[:forbidden_item_names] } @@ -20,9 +21,12 @@ class Item validates_associated :parent, :children before_destroy :destroy_children - after_rearrange :rebuild_path - + after_rearrange :rebuild_path, :if => "parent_id_changed? || name_changed?" + def enabled_for_lang(lang) + enabled_for.include?(lang) + end + def self.find_by_name(item_name) Item.first(:conditions => { :name => item_name, :is_published => true }) end diff --git a/app/models/meta/meta.rb b/app/models/meta/meta.rb index cd713d83f..7a34212ec 100644 --- a/app/models/meta/meta.rb +++ b/app/models/meta/meta.rb @@ -4,16 +4,15 @@ class Meta include Mongoid::Timestamps field :key + field :title, localize: true field :value, :default => nil - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy - def get_name_content [self.key, get_content] end def get_content - self.value ? self.value : self.i18n_variable[I18n.locale] + self.value ? self.value : self.title end end diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 007467de6..88a5ce83e 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -4,7 +4,7 @@ class ModuleApp include OrbitCoreLib::ObjectTokenUnility field :key - field :title + field :title field :version field :organization field :author @@ -18,8 +18,8 @@ class ModuleApp field :widgets ,type: Hash field :widget_fields ,type: Array - has_many :managers,as: :managing_app ,:class_name => "AppManager" #,:dependent => :destroy,:foreign_key => "managing_app_id",:inverse_of => :managing_app - has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager"#, :dependent => :destroy,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app + has_many :managers,as: :managing_app ,:class_name => "AppManager" ,:dependent => :destroy#,:foreign_key => "managing_app_id",:inverse_of => :managing_app + has_many :sub_managers,as: :sub_managing_app ,:class_name => "AppManager", :dependent => :destroy#,:foreign_key => "sub_managing_app_id",:inverse_of => :sub_managing_app has_many :tags has_many :page_parts diff --git a/app/models/page.rb b/app/models/page.rb index 9c7a7e304..32a205f78 100644 --- a/app/models/page.rb +++ b/app/models/page.rb @@ -6,9 +6,10 @@ class Page < Item field :content field :app_frontend_url field :theme_id, :type => BSON::ObjectId, :default => nil - field :category - field :tag + field :category, :default => '' + field :tag, :default => '' field :view_count, :type => Integer, :default => 0 + field :page_title, localize: true field :frontend_style field :frontend_field , :type => Array @@ -16,59 +17,48 @@ class Page < Item belongs_to :design belongs_to :module_app - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy has_many :page_parts, :autosave => true, :dependent => :destroy has_many :page_contexts, :autosave => true, :dependent => :destroy has_many :page_metas, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :page_parts, :allow_destroy => true - - before_save :create_parts, :set_key , :delete_empty_frontend_field + + before_save :create_parts, :delete_empty_frontend_field # embeds_many :custom_images, :class_name => 'Image', as: :design_image - - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end protected def create_parts - page_design = self.design - parent = self.parent - menu_part = parent.page_parts.detect{|page_part| page_part.kind.eql?('public_r_tag') && page_part.public_r_tag.eql?('sub_menu') && page_part.public_r_tag_object_id.eql?(parent.id.to_s)} if parent - page_design.layout.layout_parts.each do |layout_part| - current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)} - current_part = self.page_parts.build(:name => layout_part.name) unless current_part - if menu_part && current_part.name.eql?(menu_part.name) - if current_part.new_record? - current_part.kind = menu_part.kind - current_part.public_r_tag = menu_part.public_r_tag - current_part.public_r_tag_object_id = menu_part.public_r_tag_object_id - else - current_part.update_attributes(:kind => menu_part.kind, :public_r_tag => menu_part.public_r_tag, :public_r_tag_object_id => menu_part.public_r_tag_object_id) + if self.new_record? || self.design.changed? + page_design = self.design + parent = self.parent + menu_part = parent.page_parts.detect{|page_part| page_part.kind.eql?('public_r_tag') && page_part.public_r_tag.eql?('sub_menu') && page_part.public_r_tag_object_id.eql?(parent.id.to_s)} if parent + page_design.layout.layout_parts.each do |layout_part| + current_part = self.page_parts.detect{|page_part| page_part.name.eql?(layout_part.name)} + current_part = self.page_parts.build(:name => layout_part.name) unless current_part + if menu_part && current_part.name.eql?(menu_part.name) + if current_part.new_record? + current_part.kind = menu_part.kind + current_part.public_r_tag = menu_part.public_r_tag + current_part.public_r_tag_object_id = menu_part.public_r_tag_object_id + else + current_part.update_attributes(:kind => menu_part.kind, :public_r_tag => menu_part.public_r_tag, :public_r_tag_object_id => menu_part.public_r_tag_object_id) + end end end end end - - def set_key - if title && title.new_record? - title.key = 'title' - end - end - + def delete_empty_frontend_field - - if self.frontend_field - self.frontend_field.reject! { |ff| (ff[0].blank? || ff[1].blank?) } - # self.frontend_field.each do | ff | - # if ff[0].blank? || ff[1].blank? - # self.frontend_field.delete("") if self.frontend_field - # self.frontend_field.delete(ff) - # end - # end - end - + if self.frontend_field + self.frontend_field.reject! { |ff| (ff[0].blank? || ff[1].blank?) } + # self.frontend_field.each do | ff | + # if ff[0].blank? || ff[1].blank? + # self.frontend_field.delete("") if self.frontend_field + # self.frontend_field.delete(ff) + # end + # end + end end end diff --git a/app/models/page_part.rb b/app/models/page_part.rb index 8226426cc..595d5fb33 100644 --- a/app/models/page_part.rb +++ b/app/models/page_part.rb @@ -4,45 +4,29 @@ class PagePart include Mongoid::Timestamps field :name - field :content + field :content, localize: true field :kind field :public_r_tag field :public_r_tag_object_id, :default => nil field :public_r_tag_option, :default => nil + field :page_title, localize: true field :widget_path field :widget_style field :widget_field , :type => Array field :widget_data_count - - has_one :i18n_variable, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy belongs_to :page belongs_to :module_app - before_save :set_key, :delete_empty_widget_field - - def i18n_variable - @i18n_variable ||= I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end + before_save :delete_empty_widget_field protected - def set_key - title.key = 'title' if title && (title.key.blank? rescue true) - i18n_variable.key = 'i18n_variable' if i18n_variable && (i18n_variable.key.blank? rescue true) - end - def delete_empty_widget_field - - if self.widget_field - self.widget_field.reject! { |wf| (wf[0].blank? || wf[1].blank?) } - end + if self.widget_field + self.widget_field.reject! { |wf| (wf[0].blank? || wf[1].blank?) } + end # self.widget_field.delete("") if self.widget_field end diff --git a/app/models/site.rb b/app/models/site.rb index 0baa743fb..af3b3239f 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -20,12 +20,13 @@ class Site mount_uploader :default_image, ImageUploader - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :footer, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :sub_menu, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_many :site_metas, :autosave => true, :dependent => :destroy + field :search,:type => Hash + + field :title, localize: true + field :footer, localize: true + field :sub_menu, localize: true - before_save :set_key + has_many :site_metas, :autosave => true, :dependent => :destroy def generate_keys private_key = OpenSSL::PKey::RSA.generate(2048) @@ -42,39 +43,17 @@ class Site res.eql?('local out of date') ? false : true end - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def footer - @footer ||= I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def sub_menu - @sub_menu ||= I18nVariable.first(:conditions => {:key => 'sub_menu', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - METAS.each do |meta| - define_method meta do + define_method meta do |locale| fetch_meta = self.site_metas.where(key: meta).limit(1) - fetch_meta.blank? ? nil : fetch_meta[0].i18n_variable + fetch_meta.blank? ? nil : fetch_meta[0].title_translations[locale] end define_method "#{meta}=" do |values| - if a = self.send(meta) - a.update_attributes(values) - else - a = self.site_metas.build(key: meta) - a.build_i18n_variable(values) - end + fetch_meta = self.site_metas.where(key: meta).limit(1)[0] rescue nil + fetch_meta = self.site_metas.build(key: meta) if fetch_meta.blank? + fetch_meta.title_translations = values + fetch_meta.save end end - - protected - - def set_key - title.key = 'title' if title && (title.key.blank? rescue true) - footer.key = 'footer' if footer && (footer.key.blank? rescue true) - sub_menu.key = 'sub_menu' if sub_menu && (sub_menu.key.blank? rescue true) - end end diff --git a/app/models/tag.rb b/app/models/tag.rb index f621de6a5..eb7e1f77d 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,10 +1,41 @@ class Tag - include Mongoid::Document include Mongoid::Timestamps + include Impressionist::Impressionable + + is_impressionable :counter_cache => { :column_name => :view_count } field :key - + field :view_count, :type => Integer, :default => 0 + #field :cloud_amper,:type: Integer,:default=> 0 belongs_to :module_app + + def self.sorted_for_cloud + tags = {} + self.all.each{ |tag| + tags.merge!({tag => self.get_impressionist(tag)}) + } + if !tags.blank? + sorted_tags = tags.sort{|a,b| a[1]<=>b[1]}.reverse + sorted_tags[0][1] = :hot1 + offset = (sorted_tags.size - 1) / 3 + i = 1 + class_i = 2 + sorted_tags[1..-1].collect!{ |x| + x[1] = "hot#{class_i}" + i == offset ? i = 1 : i += 1 if class_i < 4 + class_i += 1 if i == offset && class_i < 4 + } + sorted_tags + else + [] + end + end + + protected + def self.get_impressionist(item_tag = self) + item_tag.impressions.where(:created_at.gte=> 14.days.ago,:created_at.lte => Time.now).count + end + end diff --git a/app/models/user/attribute.rb b/app/models/user/attribute.rb index af8a11064..faa5876a0 100644 --- a/app/models/user/attribute.rb +++ b/app/models/user/attribute.rb @@ -6,9 +6,9 @@ class Attribute field :key field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false + field :title, localize: true has_many :attribute_fields, :autosave => true, :dependent => :destroy - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy accepts_nested_attributes_for :attribute_fields, :allow_destroy => true def is_built_in? diff --git a/app/models/user/attribute_field.rb b/app/models/user/attribute_field.rb index 42bbf9109..2a227d27d 100644 --- a/app/models/user/attribute_field.rb +++ b/app/models/user/attribute_field.rb @@ -9,9 +9,9 @@ class AttributeField field :list_options, :type => Array field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false + field :title, localize: true belongs_to :attribute - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_many :attribute_values # validates_uniqueness_of :key diff --git a/app/models/user/role.rb b/app/models/user/role.rb index 86f7266fc..bbcedfc7e 100644 --- a/app/models/user/role.rb +++ b/app/models/user/role.rb @@ -6,11 +6,10 @@ class Role field :key field :built_in, :type => Boolean, :default => false field :disabled, :type => Boolean, :default => false + field :title, localize: true has_many :sub_roles, :autosave => true, :dependent => :destroy - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy has_many :users - accepts_nested_attributes_for :i18n_variable, :allow_destroy => true accepts_nested_attributes_for :sub_roles, :allow_destroy => true def is_built_in? diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 0f808a06f..3df40a3bf 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -9,6 +9,7 @@ class User field :admin, :type => Boolean, :default => true field :active_role + field :nccu_ldap_uid # field :cache_dept # has_one :cache_dept, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy @@ -16,10 +17,10 @@ class User has_many :attribute_values, :autosave => true, :dependent => :destroy has_many :app_auths,as: :privilege_apps,:inverse_of => :privilege_lists - has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth" - has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth" - - has_many :managing_apps,:class_name => "AppManager" + has_many :blocked_apps, :inverse_of => :blocked_users, :class_name => "AppAuth", :dependent => :destroy + has_many :privilege_apps, :inverse_of => :privilege_users, :class_name => "AppAuth", :dependent => :destroy + + has_many :managing_apps,:class_name => "AppManager", :dependent => :destroy has_one :desktop, :autosave => true, :dependent => :destroy has_many :other_accounts, :autosave => true, :dependent => :destroy has_many :journals, :autosave => true, :dependent => :destroy @@ -27,19 +28,17 @@ class User belongs_to :role has_and_belongs_to_many :sub_roles - accepts_nested_attributes_for :attribute_values, :allow_destroy => true + accepts_nested_attributes_for :attribute_values, :allow_destroy => true + + before_create :initialize_desktop + scope :remote_account, where(:nccu_id.ne => nil) def create_dept_cache dept_hash = {} VALID_LOCALES.each do |loc| locale = loc.to_sym - # debugger - # if(self.cache_dept.nil?) - # self.build_cache_dept key: "dept_cache_user_#{self.id}" - # end - dept_hash[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',') - # self.cache_dept[locale] = sub_roles.collect{|sr| sr.i18n_variable[locale]}.join(',') + dept_hash[locale] = sub_roles.collect{|sr| sr.title}.join(',') end self.cache_dept = dept_hash self.save! @@ -48,13 +47,11 @@ class User def self.current Thread.current[:user] end - + def self.current=(user) Thread.current[:user] = user end - before_create :initialize_desktop - def avb_apps sub_role_ids_ary=self.sub_roles.collect{|t| t.id} query1 = AppAuth.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: self.id) @@ -67,7 +64,7 @@ class User if info first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil - return "#{first_name} #{last_name}" + return "#{last_name} #{first_name}" else return nil end diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index ed1424050..41480fd53 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -3,6 +3,7 @@ class ImageUploader < CarrierWave::Uploader::Base require 'mime/types' + include Sprockets::Helpers::RailsHelper process :set_content_type @@ -31,7 +32,7 @@ class ImageUploader < CarrierWave::Uploader::Base # "/images/fallback/" + [version_name, "default.png"].compact.join('_') # end def default_url - Site.first.default_image.url rescue "-sign-in-logo.png" + Site.first.default_image.url rescue "-sign-in-logo.png" end # Process files as they are uploaded: diff --git a/app/views/admin/ad_banners/_modal_preview.html.erb b/app/views/admin/ad_banners/_modal_preview.html.erb index ffc841074..3dc985216 100644 --- a/app/views/admin/ad_banners/_modal_preview.html.erb +++ b/app/views/admin/ad_banners/_modal_preview.html.erb @@ -8,7 +8,7 @@ <div class="modal-body"> <p class="ad_banner_slideshow"> <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%> - <%= image_tag ad_image.file,:alt => (ad_image.title[locale] || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %> + <%= image_tag ad_image.file,:alt => (ad_image.title || " "),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || " ")) %> <% end -%> </p> </div> diff --git a/app/views/admin/ad_banners/_preview_block.html.erb b/app/views/admin/ad_banners/_preview_block.html.erb index 47646f6f1..afa9125de 100644 --- a/app/views/admin/ad_banners/_preview_block.html.erb +++ b/app/views/admin/ad_banners/_preview_block.html.erb @@ -9,7 +9,7 @@ <div class="modal-body"> <p class="ad_banner_slideshow"> <% preview_block_ad_images_helper(ad_banner).each do |ad_image| -%> - <%= image_tag ad_image.file,:alt => (ad_image.title[locale] || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %> + <%= image_tag ad_image.file,:alt => (ad_image.title || ' '),:time_to_next => ad_banner.transition_msec,:link_open=> ad_image.link_open, :link_url =>((ad_image.out_link || ad_banner.context || ' ')) %> <% end -%> </p> </div> diff --git a/app/views/admin/ad_images/_form.html.erb b/app/views/admin/ad_images/_form.html.erb index edbb2563d..3ecda29b7 100644 --- a/app/views/admin/ad_images/_form.html.erb +++ b/app/views/admin/ad_images/_form.html.erb @@ -142,14 +142,14 @@ <% @site_valid_locales.each do |locale|%> <%= content_tag :div,:class => "tab-pane #{active_when_current_locale_eq locale}",:id=>"#{locale}" do%> <div class="title"> - <%= f.fields_for :title,@ad_image.title do |f| %> - <%= f.text_field locale,:class=>"ad_image-title post-title",:placeholder => "輸入標題"%> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class=>"ad_image-title post-title", :placeholder => "輸入標題", :value => (@ad_image.title_translations[locale] rescue nil) %> <% end %> </div> <br/> <div class="context editor"> - <%= f.fields_for :context, @ad_image.context do |f| %> - <%= f.text_area locale,:style => "width:100%", :class => "tinymce_textarea post-title" %> + <%= f.fields_for :context_translations, @ad_image.context do |f| %> + <%= f.text_area locale, :style => "width:100%", :class => "tinymce_textarea post-title", :value => (@ad_image.context_translations[locale] rescue nil) %> <% end %> </div> diff --git a/app/views/admin/asset_categories/_asset_category.html.erb b/app/views/admin/asset_categories/_asset_category.html.erb index d7047e36f..64a931da5 100644 --- a/app/views/admin/asset_categories/_asset_category.html.erb +++ b/app/views/admin/asset_categories/_asset_category.html.erb @@ -12,6 +12,6 @@ </div> </td> <% @site_valid_locales.each do |locale| %> - <td><%= asset_category.i18n_variable[locale] rescue nil %></td> + <td><%= asset_category.title_translations[locale] rescue nil %></td> <% end %> </tr> diff --git a/app/views/admin/asset_categories/_form.html.erb b/app/views/admin/asset_categories/_form.html.erb index 5c64146f0..76df5c003 100644 --- a/app/views/admin/asset_categories/_form.html.erb +++ b/app/views/admin/asset_categories/_form.html.erb @@ -10,12 +10,12 @@ </div> <div id="widget-title"> - <%= f.fields_for :i18n_variable, (@asset_category.new_record? ? @asset_category.build_i18n_variable : @asset_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> <div class="control-group"> <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %> <div class="controls"> - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (@asset_category.title_translations[locale] rescue nil) %> </div> </div> <% end %> diff --git a/app/views/admin/assets/_asset.html.erb b/app/views/admin/assets/_asset.html.erb index 3a8dc4396..a45e9a4b4 100644 --- a/app/views/admin/assets/_asset.html.erb +++ b/app/views/admin/assets/_asset.html.erb @@ -1,6 +1,6 @@ <tr id="asset_<%= asset.id %>" class="with_action"> <td><%= check_box_tag 'to_delete[]', asset.id, false, :class => "checkbox_in_list" %></td> - <td><%= asset.title.i18n_variable[I18n.locale] rescue nil %></td> + <td><%= asset.title rescue nil %></td> <td> <i class="icons-picture img-peview" rel="popover" data-content="<img src='<%= asset.data.url %>' />" data-original-title="<%= asset.data.filename %>"></i> <div class="quick-edit"> @@ -12,7 +12,7 @@ </td> <td><%= asset.data.file.content_type %></td> <td><%= number_to_human_size(asset.data.file.file_length) %></td> - <td><%= asset.description.i18n_variable[I18n.locale] rescue nil %></td> + <td><%= asset.description rescue nil %></td> <td> <div class="label-group"> <div class="label-td"> diff --git a/app/views/admin/assets/_form.html.erb b/app/views/admin/assets/_form.html.erb index 4e1589f47..756556045 100644 --- a/app/views/admin/assets/_form.html.erb +++ b/app/views/admin/assets/_form.html.erb @@ -1,12 +1,12 @@ <div class="control-group"> <label for="title" class="control-label"><%= t 'admin.title' %></label> <div class="controls"> - <%= f.fields_for :i18n_variable, (@asset.new_record? ? @asset.build_i18n_variable : @asset.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> <%= content_tag :label do -%> <div> <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale, :class => "input-large" %> + <%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %> </div> <% end %> <% end %> @@ -16,7 +16,7 @@ <div class="control-group"> <label class="control-label"><%= f.label :category, t('admin.category') %></label> <div class="controls"> - <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-large" %> + <%= f.select :asset_category_id, @asset_categories.collect{|t| [ t.title, t.id ]}, {}, :class => "input-large" %> </div> </div> <div class="control-group"> @@ -26,6 +26,7 @@ <%= content_tag :label, :class => "checkbox inline" do -%> <%= check_box_tag 'asset[tag_ids][]', tag.id, @asset.tag_ids.include?(tag.id) %> <%= tag[I18n.locale] %> + <%= hidden_field_tag 'asset[tag_ids][]', '' %> <% end %> <% end %> </div> diff --git a/app/views/admin/assets/_sort_headers.html.erb b/app/views/admin/assets/_sort_headers.html.erb index 43cb5927d..d266a086a 100644 --- a/app/views/admin/assets/_sort_headers.html.erb +++ b/app/views/admin/assets/_sort_headers.html.erb @@ -1,4 +1,5 @@ -<%= render_sort_bar(true, ['title', 'title','span4', 'admin.title'], +<%= render_sort_bar(true, delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), + ['title', 'title','span4', 'admin.title'], ['description', 'description', 'span1-2', 'admin.data'], ['intro', 'intro', 'span1-2', 'admin.file_type'], ['intro', 'intro', 'span1-2', 'admin.file_length'], diff --git a/app/views/admin/assets/create.html.erb b/app/views/admin/assets/create.html.erb new file mode 100644 index 000000000..6d98706fb --- /dev/null +++ b/app/views/admin/assets/create.html.erb @@ -0,0 +1 @@ +<%= @asset.data.url %>#<%= show_all_fields(@asset, 'title') %>#<%= show_all_fields(@asset, 'description') %> \ No newline at end of file diff --git a/app/views/admin/assets/create.js.erb b/app/views/admin/assets/create.js.erb index 9247373e9..d2e2550a3 100644 --- a/app/views/admin/assets/create.js.erb +++ b/app/views/admin/assets/create.js.erb @@ -1,7 +1,7 @@ // Uncomment and change this document.domain value if you are loading the script cross subdomains // document.domain = 'moxiecode.com'; -var tinymce=null,tinyMCEPopup,tinyMCE;tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},10)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false&&b.editor.settings.language_load!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait(); + var returnurl = "<%= @asset.data.url %>"; var returntitle = "<%= show_all_fields(@asset, 'title') %>"; var returndescription = "<%= show_all_fields(@asset, 'description') %>"; diff --git a/app/views/admin/assets/file_upload.html.erb b/app/views/admin/assets/file_upload.html.erb index ff21935c7..5e19a1ad5 100644 --- a/app/views/admin/assets/file_upload.html.erb +++ b/app/views/admin/assets/file_upload.html.erb @@ -1,23 +1,26 @@ <%= javascript_include_tag "new_admin" %> <%= stylesheet_link_tag "new_admin" %> +<%= javascript_include_tag "tinymce/tiny_mce_popup" %> + <%= flash_messages %> - +<body onload="tinyMCEPopup.executeOnLoad('init();')"> <%= form_for :asset, :url => admin_assets_path(:uploader => true), :html => {:id => 'ajaxForm', :multipart => true } do |f| %> <div class="modal-header"> <h3><%= t 'admin.file_upload' %></h3> </div> + <label class="control-label error" id="dyn_error"></label> <div class="modal-body form-horizontal"> <div class="control-group"> <label for="title" class="control-label error"><%= t 'admin.title' %></label> <div class="controls"> - <%= f.fields_for :title, (@asset.new_record? ? @asset.build_title : @asset.title) do |f| %> + <%= f.fields_for :title_translations do |f| %> <div> <% @site_valid_locales.each do |locale| %> <%= content_tag :label do -%> <div> <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale, :class => "input-large" %> + <%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %> </div> <% end %> <% end %> @@ -28,13 +31,13 @@ <div class="control-group"> <label for="description" class="control-label error"><%= t 'admin.description' %></label> <div class="controls"> - <%= f.fields_for :description, (@asset.new_record? ? @asset.build_description : @asset.description) do |f| %> + <%= f.fields_for :description_translations do |f| %> <div> <% @site_valid_locales.each do |locale| %> <%= content_tag :label do -%> <div> <%= I18nVariable.from_locale(locale) %> - <%= f.text_field locale, :class => "input-large" %> + <%= f.text_field locale, :class => "input-large", :value => (@asset.title_translations[locale] rescue nil) %> </div> <% end %> <% end %> @@ -43,7 +46,7 @@ </div> </div> <div class="control-group"> - <%= f.label :data, t('admin.data'), :class => "control-label" %> + <%#= f.label :data, t('admin.data'), :class => "control-label" %> <div class="controls"> <%= f.file_field :data, :class => 'upload' %> </div> @@ -55,4 +58,5 @@ </div> </div> -<% end %> \ No newline at end of file +<% end %> +</body> diff --git a/app/views/admin/assets/index.html.erb b/app/views/admin/assets/index.html.erb index 394e18e8a..38ec6b5e0 100644 --- a/app/views/admin/assets/index.html.erb +++ b/app/views/admin/assets/index.html.erb @@ -1,22 +1,20 @@ -<%= form_for :assets, :url => delete_admin_assets_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> - <%= render 'filter' %> - <table id="asset_sort_list" class="table main-list"> - <thead> - <tr> - <th class="span1"></th> - <th class="span4"></th> - <th class="span1-2"></th> - <th class="span1-2"></th> - <th class="span1-2"></th> - <th class="span1-2"></th> - <th class="span1-2"></th> - </tr> - </thead> - <tbody id="tbody_assets" class="sort-holder"> - <%= render :partial => 'asset', :collection => @assets %> - </tbody> - </table> -<% end %> +<%= render 'filter' %> +<table id="asset_sort_list" class="table main-list"> + <thead> + <tr> + <th class="span1"></th> + <th class="span4"></th> + <th class="span1-2"></th> + <th class="span1-2"></th> + <th class="span1-2"></th> + <th class="span1-2"></th> + <th class="span1-2"></th> + </tr> + </thead> + <tbody id="tbody_assets" class="sort-holder"> + <%= render :partial => 'asset', :collection => @assets %> + </tbody> +</table> <div class="form-actions form-fixed pagination-right"> <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_asset_path, :remote => true, :class => 'btn btn-primary pull-right' %> diff --git a/app/views/admin/attributes/_attribute_field.html.erb b/app/views/admin/attributes/_attribute_field.html.erb index 63ee5953b..b2e94344c 100644 --- a/app/views/admin/attributes/_attribute_field.html.erb +++ b/app/views/admin/attributes/_attribute_field.html.erb @@ -3,9 +3,9 @@ <td class='select_mulitlingual' style='text-align:center'> <%= f.check_box :locale %> </td> - <%= f.fields_for :i18n_variable, (attribute_field.new_record? ? attribute_field.build_i18n_variable : attribute_field.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> - <td><%= f.text_field locale, :style => "width:130px" %></td> + <td><%= f.text_field locale, :style => "width:130px", :value => (attribute_field.title_translations[locale] rescue nil) %></td> <% end %> <% end %> <td class='select_type'> diff --git a/app/views/admin/attributes/index.html.erb b/app/views/admin/attributes/index.html.erb index 71ec1699d..83ded4ebc 100644 --- a/app/views/admin/attributes/index.html.erb +++ b/app/views/admin/attributes/index.html.erb @@ -16,7 +16,7 @@ <tbody> <% @attributes.each do |attribute| %> <tr id="attribute_<%= attribute.id %>" class="have <%= "#{attribute.is_disabled? ? 'disable' : ''}" %>"> - <td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.i18n_variable[I18n.locale] %></span> + <td class="<%= @attribute_type %>s <%= attribute.key.downcase %>"><%= attribute.title %></span> <td class="action"> <%= link_to t(:edit), eval("edit_admin_#{@attribute_type}_path(attribute)"), :class => 'edit' %> diff --git a/app/views/admin/dashboards/index.html.erb b/app/views/admin/dashboards/index.html.erb index dbca5aa69..4fe3f18ec 100644 --- a/app/views/admin/dashboards/index.html.erb +++ b/app/views/admin/dashboards/index.html.erb @@ -514,8 +514,8 @@ <tbody> <% @recent_updated.each do |object| %> <tr> - <td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td> - <td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td> + <td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td> + <td class="span2"><%= link_to t("dashboard.#{object[0].class.to_s.underscore}"), get_link(object[0].class.to_s.underscore) %></td> </tr> <% end %> </tbody> @@ -552,8 +552,8 @@ <tbody> <% @most_visited.each do |object| %> <tr> - <td><%= link_to ((object[0].title[I18n.locale] rescue nil) || (object[0].page.i18n_variable[I18n.locale] rescue nil)), get_link_to_object(object[0]) %></td> - <td class="span2"><%= link_to t("dashboard.#{object[0]._type.underscore}"), get_link(object[0]._type.underscore) %></td> + <td><%= link_to ((object[0].title rescue nil) || (object[0].page.title rescue nil)), get_link_to_object(object[0]) %></td> + <td class="span2"><%= link_to t("dashboard.#{object[0].class.to_s.underscore}"), get_link(object[0].class.to_s.underscore) %></td> <td class="span2"><%= object[1] %></td> </tr> <% end %> diff --git a/app/views/admin/designs/_sort_headers.html.erb b/app/views/admin/designs/_sort_headers.html.erb index 15f5481f6..fb6971434 100644 --- a/app/views/admin/designs/_sort_headers.html.erb +++ b/app/views/admin/designs/_sort_headers.html.erb @@ -1,3 +1,4 @@ -<%= render_sort_bar(true, ['title', 'title','span7', 'admin.title'], +<%= render_sort_bar(true, delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), + ['title', 'title','span7', 'admin.title'], ['author', 'author', 'span2', 'admin.author'], ['intro', 'intro', 'span2', 'admin.intro']).html_safe %> diff --git a/app/views/admin/designs/index.html.erb b/app/views/admin/designs/index.html.erb index 968b1914c..ab672b09c 100644 --- a/app/views/admin/designs/index.html.erb +++ b/app/views/admin/designs/index.html.erb @@ -2,13 +2,11 @@ <%= render 'admin/sites/side_bar' %> <% end %> -<%= form_for :news_bulletins, :url => delete_admin_designs_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> - <%= render 'filter' %> - <table class="table main-list"> - <%= render 'designs' %> - </table> -<% end %> +<%= render 'filter' %> +<table class="table main-list"> + <%= render 'designs' %> +</table> <div class="form-actions form-fixed pagination-right"> - <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary' %> + <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_admin_design_path, :class => 'btn btn-primary pull-right' %> </div> \ No newline at end of file diff --git a/app/views/admin/infos/_form.html.erb b/app/views/admin/infos/_form.html.erb index 103c7af1d..a499784a7 100644 --- a/app/views/admin/infos/_form.html.erb +++ b/app/views/admin/infos/_form.html.erb @@ -13,9 +13,9 @@ <tbody> <tr class="list_item"> <td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td> - <%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> - <td><%= f.text_field locale, :style => "width:150px" %></td> + <td><%= f.text_field locale, :style => "width:150px", :value => (@attribute.title_translations[locale] rescue nil) %></td> <% end %> <% end %> </tr> diff --git a/app/views/admin/items/index.html.erb b/app/views/admin/items/index.html.erb index 2a8a12bbc..92af4611d 100644 --- a/app/views/admin/items/index.html.erb +++ b/app/views/admin/items/index.html.erb @@ -2,4 +2,4 @@ <%= render 'admin/items/site_map_left_bar' %> <% end -%> -<%= render "admin/#{@item._type.downcase.pluralize}/show" %> +<%= render "admin/#{@item.class.to_s.downcase.pluralize}/show" %> diff --git a/app/views/admin/items/index.js.erb b/app/views/admin/items/index.js.erb index 1ff6abb58..bc701ca2a 100644 --- a/app/views/admin/items/index.js.erb +++ b/app/views/admin/items/index.js.erb @@ -1,5 +1,5 @@ $('#back_main').empty(); -<% case @item._type %> +<% case @item.class.to_s %> <% when 'Page' %> $('#back_main').append("<%= escape_javascript(render(:partial => 'admin/pages/show')) %>"); <% when 'Link' %> diff --git a/app/views/admin/links/_form.html.erb b/app/views/admin/links/_form.html.erb index 2f03b9689..f1415e98b 100644 --- a/app/views/admin/links/_form.html.erb +++ b/app/views/admin/links/_form.html.erb @@ -6,11 +6,11 @@ <%= f.text_field :name, :class => 'text' %> </p> -<%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %> +<%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> <p> <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> - <%= f.text_field locale %> + <%= f.text_field locale, :value => (@item.title_translations[locale] rescue nil) %> </p> <% end %> <% end %> diff --git a/app/views/admin/links/_show.html.erb b/app/views/admin/links/_show.html.erb index 33ca0c20b..85927a85a 100644 --- a/app/views/admin/links/_show.html.erb +++ b/app/views/admin/links/_show.html.erb @@ -7,7 +7,7 @@ <% @site_valid_locales.each do |locale| %> <p> <b><%= "#{t('admin.title')} #{locale}" %></b> - <%= @item.i18n_variable[locale] if @item.i18n_variable %> + <%= @item.title_translations[locale] if @item.title %> </p> <% end %> diff --git a/app/views/admin/module_apps/_app_selector.html.erb b/app/views/admin/module_apps/_app_selector.html.erb new file mode 100644 index 000000000..c20a38858 --- /dev/null +++ b/app/views/admin/module_apps/_app_selector.html.erb @@ -0,0 +1 @@ +<%= f.select :module_app_id, @apps.collect { |t| [t.title.capitalize, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %> diff --git a/app/views/admin/module_apps/reload_frontend_pages.js.erb b/app/views/admin/module_apps/reload_frontend_pages.js.erb index 863e64b20..dd7dc96cb 100644 --- a/app/views/admin/module_apps/reload_frontend_pages.js.erb +++ b/app/views/admin/module_apps/reload_frontend_pages.js.erb @@ -2,4 +2,4 @@ $('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url' $('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>"); $('#app_page_category').html("<%= j (select 'page', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, {:include_blank => true}) if @categories %>"); $('#app_page_tag').html("<%= j (select 'page', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, {:include_blank => true}) if @tags %>"); -$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>") \ No newline at end of file +$('#app_page_frontend_field').html("<%= j render '../admin/pages/frontend_fields' %>") diff --git a/app/views/admin/page_parts/_module_widget.html.erb b/app/views/admin/page_parts/_module_widget.html.erb index 76f06db83..833e14359 100644 --- a/app/views/admin/page_parts/_module_widget.html.erb +++ b/app/views/admin/page_parts/_module_widget.html.erb @@ -1,9 +1,9 @@ <div> - <%= f.fields_for :title, @part.title do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> <p> <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}" %> - <%= f.text_field locale %> + <%= f.text_field locale, :value => (@part.title_translations[locale] rescue nil) %> </p> <% end %> <% end %> @@ -48,4 +48,4 @@ <div id="widget_data_count"> <%= f.label :widget_data_count %> <%= f.text_field :widget_data_count %> -</div> \ No newline at end of file +</div> diff --git a/app/views/admin/page_parts/_public_r_tag.html.erb b/app/views/admin/page_parts/_public_r_tag.html.erb index d2d4d9b97..68f91dbc8 100644 --- a/app/views/admin/page_parts/_public_r_tag.html.erb +++ b/app/views/admin/page_parts/_public_r_tag.html.erb @@ -5,7 +5,8 @@ <span id='name_list'> <% if @r_tag.eql?('sub_menu') %> <%= f.hidden_field :public_r_tag_object_id, :value => @part.page.id %> - <%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> + <%#= f.select :public_r_tag_object_id, options_for_select([t(:horizontal), t(:vertical)], t(:horizontal)) %> + <% elsif @r_tag.eql?('sitemap') %> <% else %> <%= f.select :public_r_tag_object_id, options_from_collection_for_select(@tag_objects, :id, :title, :selected => @part.public_r_tag_object_id) %> <% end %> diff --git a/app/views/admin/page_parts/_text.html.erb b/app/views/admin/page_parts/_text.html.erb index c7386623a..1eb572053 100644 --- a/app/views/admin/page_parts/_text.html.erb +++ b/app/views/admin/page_parts/_text.html.erb @@ -1,8 +1,8 @@ -<%= f.fields_for :i18n_variable, (@part.i18n_variable ? @part.i18n_variable : @part.build_i18n_variable) do |f| %> +<%= f.fields_for :content_translations do |f| %> <% @site_valid_locales.each do |locale| %> <div> <%= I18nVariable.from_locale(locale) %> - <%= f.text_area locale, :class => 'tinymce_textarea' %> + <%= f.text_area locale, :class => 'tinymce_textarea', :value => (@part.content_translations[locale] rescue nil) %> </div> <% end %> <% end %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_widget_categories.html.erb b/app/views/admin/page_parts/_widget_categories.html.erb index 60659036b..7db04e3ed 100644 --- a/app/views/admin/page_parts/_widget_categories.html.erb +++ b/app/views/admin/page_parts/_widget_categories.html.erb @@ -1 +1 @@ - <%= select 'page_part', 'category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %> \ No newline at end of file + <%= select 'page_part', 'category', @categories.collect{|category| [category.title, category.id]}, :selected => (@part ? @part[:category] : nil), :include_blank => true if @categories && @categories.size > 0 %> \ No newline at end of file diff --git a/app/views/admin/page_parts/_widget_tags.html.erb b/app/views/admin/page_parts/_widget_tags.html.erb index bb78f118d..688ac3cbd 100644 --- a/app/views/admin/page_parts/_widget_tags.html.erb +++ b/app/views/admin/page_parts/_widget_tags.html.erb @@ -1 +1 @@ - <%= select 'page_part', 'tag', @tags.collect{|category| [category[I18n.locale], category.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %> \ No newline at end of file + <%= select 'page_part', 'tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => (@part ? @part[:tag] : nil), :include_blank => true if @tags && @tags.size > 0 %> \ No newline at end of file diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb index 8b429e55b..8089cdcd2 100644 --- a/app/views/admin/pages/_form.html.erb +++ b/app/views/admin/pages/_form.html.erb @@ -9,12 +9,12 @@ </div> </div> -<%= f.fields_for :i18n_variable, (@item.new_record? ? @item.build_i18n_variable : @item.i18n_variable) do |f| %> +<%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> <div class="control-group"> <%= f.label :locale, "#{t('admin.title')} #{I18nVariable.from_locale(locale)}", :class => 'control-label' %> <div class="controls"> - <%= f.text_field locale, :class => 'text input-xlarge' %> + <%= f.text_field locale, :class => 'text input-xlarge', :value => (@item.title_translations[locale] rescue nil) %> <!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> --> </div> </div> @@ -46,7 +46,7 @@ <%= select('page','frontend_style', @frontend_style, :selected => @item[:frontend_style], :include_blank => true ) rescue ''%> </span> <span id="app_page_category"> - <%= select('page','category', @categories.collect{|category| [category.i18n_variable[I18n.locale], category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> + <%= select('page','category', @categories.collect{|category| [category.title, category.id]}, :selected => @item[:category], :include_blank => true ) rescue ''%> </span> <span id="app_page_tag"> <%= select('page','tag', @tags.collect{|tag| [tag[I18n.locale], tag.id]}, :selected => @item[:tag], :include_blank => true ) rescue ''%> diff --git a/app/views/admin/roles/_form.html.erb b/app/views/admin/roles/_form.html.erb index b744f20c4..1dd889cc0 100644 --- a/app/views/admin/roles/_form.html.erb +++ b/app/views/admin/roles/_form.html.erb @@ -14,9 +14,9 @@ <tbody> <tr class="list_item"> <td><%= is_new ? (f.text_field :key, {:style => "width:150px"}) : @attribute.key %></td> - <%= f.fields_for :i18n_variable, (@attribute.new_record? ? @attribute.build_i18n_variable : @attribute.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> - <td><%= f.text_field locale, :style => "width:150px" %></td> + <td><%= f.text_field locale, :style => "width:150px", :value => (@attribute.title_translations[locale] rescue nil) %></td> <% end %> <% end %> </tr> diff --git a/app/views/admin/roles/_sub_role.html.erb b/app/views/admin/roles/_sub_role.html.erb index ca20890f7..d4236dfc2 100644 --- a/app/views/admin/roles/_sub_role.html.erb +++ b/app/views/admin/roles/_sub_role.html.erb @@ -11,9 +11,9 @@ <tbody> <tr class="list_item"> <td><%= sub_role.new_record? ? (f.text_field :key, {:style => "width:150px"}) : sub_role.key %></td> - <%= f.fields_for :i18n_variable, (sub_role.new_record? ? sub_role.build_i18n_variable : sub_role.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %> - <td><%= f.text_field locale, :style => "width:150px" %></td> + <td><%= f.text_field locale, :style => "width:150px", :value => (sub_role.title_translations[locale] rescue nil) %></td> <% end %> <% end %> </tr> diff --git a/app/views/admin/sites/_side_bar.html.erb b/app/views/admin/sites/_side_bar.html.erb index 1b6b8ba4a..bf214a0ed 100644 --- a/app/views/admin/sites/_side_bar.html.erb +++ b/app/views/admin/sites/_side_bar.html.erb @@ -7,6 +7,7 @@ <%#= content_tag :li, link_to(t('admin.site_language'), admin_site_language_path(@site)), :class => active_for_action('sites', 'language') %> <%= content_tag :li, link_to(t('admin.mail_setting'), admin_site_mail_setting_path(@site)), :class => active_for_action('sites', 'mail_setting') %> <%#= content_tag :li, link_to(t('admin.ui_theme'), admin_site_ui_theme_path(@site)), :class => active_for_action('sites', 'ui_theme') %> + <%= content_tag :li, link_to(t('site_map'), admin_site_sitemap_path(@site)), :class => active_for_action('sites', 'sitemap') %> <% end -%> <% end -%> diff --git a/app/views/admin/sites/_sitemap_block.html.erb b/app/views/admin/sites/_sitemap_block.html.erb new file mode 100644 index 000000000..1d91f5ac3 --- /dev/null +++ b/app/views/admin/sites/_sitemap_block.html.erb @@ -0,0 +1,16 @@ +<div class="map-block <%= 'disabled' if !sitemap_block.sitemap_enabled %>"> + <h4> + <button id="<%= sitemap_block.id %>" class="onoff pull-right"><%= sitemap_block.sitemap_enabled ? t('on_upcase') : t('off_upcase') %></button> + <span><%= sitemap_block_counter + 1 %> <%= sitemap_block.title %></span> + </h4> + <ul> + <% sitemap_block.children.each_with_index do |child, i| %> + <li class="clear <%= 'disabled' if !child.sitemap_enabled %>"> + <%= content_tag :button, :id => child.id, :class => "onoff pull-right", :disabled => !sitemap_block.sitemap_enabled do %> + <%= child.sitemap_enabled ? t('on_upcase') : t('off_upcase') %> + <% end %> + <span><%= "#{sitemap_block_counter + 1}-#{i + 1}" %> <%= child.title %></span> + </li> + <% end if sitemap_block.children %> + </ul> +</div> diff --git a/app/views/admin/sites/site_info.html.erb b/app/views/admin/sites/site_info.html.erb index 1dccac313..7a198c041 100644 --- a/app/views/admin/sites/site_info.html.erb +++ b/app/views/admin/sites/site_info.html.erb @@ -27,21 +27,30 @@ <div class="control-group"> <label class="control-label"><%= t 'admin.site_title' %></label> <div class="controls"> - <%= f.fields_for :title, @site.title do |f| %> - <%= f.text_field locale, :class => "input-xxlarge" %> + <%= f.fields_for :title_translations do |f| %> + <%= f.text_field locale, :class => "input-xxlarge", :value => (@site.title_translations[locale] rescue nil) %> <% end %> <p class="help-block"><%= (t 'admin.site_title_help').html_safe %></p> </div> </div> <% end %> <% end %> + <div class="control-group"> + <label class="control-label"><%= t 'search.site_search' %></label> + <div class="controls"> + <%= text_field_tag 'site[search][domains]',(@site.search["domains"] rescue nil), {:class => "input-xxlarge" ,:placeholder => t("search.domains") }%> + <%= text_field_tag 'site[search][sitesearch]',(@site.search["sitesearch"] rescue nil),{ :class => "input-xxlarge" ,:placeholder => t("search.sitesearch") }%> + <p class="help-block"><%= (t 'search.site_setting_help').html_safe %></p> + </div> + </div> + <% @site_valid_locales.each do |locale|%> <%= content_tag :div, :class => "tab-pane fade #{active_when_current_locale_eq locale} #{locale}" do %> <div class="control-group"> <label class="control-label"><%= t 'admin.site_keywords' %></label> <div class="controls"> - <%= f.fields_for :keywords, @site.keywords do |f| %> - <%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %> + <%= f.fields_for :keywords do |f| %> + <%= f.text_area locale, :class => "input-xxlarge textarea-height-s", :value => (@site.keywords(locale) rescue nil) %> <% end %> <p class="help-block"><%= (t 'admin.site_keywords_help').html_safe %></p> </div> @@ -49,8 +58,8 @@ <div class="control-group"> <label class="control-label"><%= t 'admin.site_description' %></label> <div class="controls"> - <%= f.fields_for :description, @site.description do |f| %> - <%= f.text_area locale, :class => "input-xxlarge textarea-height-s" %> + <%= f.fields_for :description do |f| %> + <%= f.text_area locale, :class => "input-xxlarge textarea-height-s", :value => (@site.description(locale) rescue nil) %> <% end %> <p class="help-block"><%= (t 'admin.site_description_help').html_safe %></p> </div> @@ -58,8 +67,8 @@ <div class="control-group"> <label class="control-label"><%= t 'admin.site_footer' %></label> <div class="controls"> - <%= f.fields_for :footer, @site.footer do |f| %> - <%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %> + <%= f.fields_for :footer_translations do |f| %> + <%= f.text_area locale, :class => "tinymce_textarea input-xxlarge", :value => (@site.footer_translations[locale] rescue nil) %> <% end %> <p class="help-block"><%= (t 'admin.site_footer_help').html_safe %></p> </div> @@ -67,8 +76,8 @@ <div class="control-group"> <label class="control-label"><%= t 'admin.site_sub_menu' %></label> <div class="controls"> - <%= f.fields_for :sub_menu, @site.sub_menu do |f| %> - <%= f.text_area locale, :class => "tinymce_textarea input-xxlarge" %> + <%= f.fields_for :sub_menu_translations do |f| %> + <%= f.text_area locale, :class => "tinymce_textarea input-xxlarge", :value => (@site.sub_menu_translations[locale] rescue nil) %> <% end %> </div> </div> diff --git a/app/views/admin/sites/sitemap.html.erb b/app/views/admin/sites/sitemap.html.erb new file mode 100644 index 000000000..453f73f0f --- /dev/null +++ b/app/views/admin/sites/sitemap.html.erb @@ -0,0 +1,45 @@ +<% content_for :side_bar do %> + <%= render 'side_bar' %> +<% end %> + + +<div class="site-map"> + <%= render :partial => 'sitemap_block', :collection => @items %> +</div> + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/jquery.masonry.min.js" %> + <script> + $(document).ready(function(){ + $('.site-map').masonry({ + itemSelector: '.map-block', + columnWidth: 260, + isAnimated: true + }); + }); + $(document).on('click', 'li .onoff', function () { + $(this).parents("li").toggleClass("disabled"); + if($(this).parents("li").attr("class").indexOf("disabled") > 0){ + $(this).text("<%= t('off_upcase') %>") + } else { + $(this).text("<%= t('on_upcase') %>") + } + $.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle'); + }); + $(document).on('click', 'h4 .onoff', function () { + $(this).parents(".map-block").toggleClass("disabled"); + if($(this).parents("h4").parents("div").attr("class").indexOf("disabled") > 0){ + $(this).text("<%= t('off_upcase') %>") + $(this).parents(".map-block").find('li').addClass('disabled') + $(this).parents(".map-block").find('button').text("<%= t('off_upcase') %>") + $(this).parents(".map-block").find('li button').attr('disabled', 'disabled') + } else { + $(this).text("<%= t('on_upcase') %>") + $(this).parents(".map-block").find('li').removeClass('disabled') + $(this).parents(".map-block").find('button').text("<%= t('on_upcase') %>") + $(this).parents(".map-block").find('li button').removeAttr("disabled") + } + $.getScript('<%= admin_sites_path %>' + '/' + $(this).attr('id') + '/sitemap_toggle?parent=true'); + }); + </script> +<% end %> \ No newline at end of file diff --git a/app/views/admin/sites/sitemap_frontend.html.erb b/app/views/admin/sites/sitemap_frontend.html.erb new file mode 100644 index 000000000..bf126c90d --- /dev/null +++ b/app/views/admin/sites/sitemap_frontend.html.erb @@ -0,0 +1,23 @@ +<div class="site-map"> + <% @items.each_with_index do |item, i| %> + <div class="map-block"> + <h4><%= i+1 %> <a href='<%= item.path %>'><%= item.title %></a></h4> + <ul> + <% item.children.each_with_index do |child, ii| %> + <li class="clear"><%= "#{i+1}-#{ii+1}" %> <a href='<%= child.path %>'><%= child.title %></a></span></li> + <% end if item.children %> + </ul> + </div> + <% end %> +</div> + +<%= javascript_include_tag "lib/jquery.masonry.min.js" %> +<script> + $(document).ready(function(){ + $('.site-map').masonry({ + itemSelector: '.map-block', + columnWidth: 220, + isAnimated: true + }); + }); +</script> \ No newline at end of file diff --git a/app/views/admin/users/_form.html.erb b/app/views/admin/users/_form.html.erb index 37ee9d28d..c0cb194e4 100644 --- a/app/views/admin/users/_form.html.erb +++ b/app/views/admin/users/_form.html.erb @@ -16,7 +16,7 @@ </label> <label> <span><%= t('admin.role') %>:</span> - <%= f.select :role_id, @roles.sort_by{|role| role.key }.collect {|role| [ role.i18n_variable[I18n.locale], role.id ]}, :selected => (@user.role_id || Role.get_role_from_key('student')) %> + <%= f.select :role_id, @roles.sort_by{|role| role.key }.collect {|role| [ role.title, role.id ]}, :selected => (@user.role_id || Role.get_role_from_key('student')) %> </label> </div> @@ -27,7 +27,7 @@ <div id='roles'> <% @roles.each do |role| %> <div id="<%= role.id %>_block" class="attributes_block <%= @class %>" <%= raw(' style="display: none;"') unless ((@user.role.id.eql?(role.id) rescue nil) || (role.key.eql?('student') && @user.new_record?)) %>> - <h2><%= role.i18n_variable[I18n.locale] %></h2> + <h2><%= role.title %></h2> <hr class="<#%= @user.role.key %>_block"> <%= render :partial => 'sub_role_selector', :locals => {:f => f, :role => role} %> <%= render :partial => 'sub_role', :collection => role.sub_roles, :locals => {:f => f, :role => role} %> diff --git a/app/views/admin/users/_info.html.erb b/app/views/admin/users/_info.html.erb index a7d44ea9e..53a044d45 100644 --- a/app/views/admin/users/_info.html.erb +++ b/app/views/admin/users/_info.html.erb @@ -1,5 +1,5 @@ <div id="basic_block" class="attributes_block <%= @class %>"> - <h2><%= info.i18n_variable[I18n.locale] %></h2> + <h2><%= info.title %></h2> <hr> <div class="info_input"> <table border="0" cellspacing="0" cellpadding="0"> @@ -15,7 +15,7 @@ <% info.get_enabled_attribute_fields.each do |attr| %> <%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %> <tr class="list_item"> - <td><%= attr.i18n_variable[I18n.locale] %></td> + <td><%= attr.title %></td> <% if attr["locale"] && attr["markup"] == 'text_field' %> <% @site_valid_locales.each do |locale| %> <td><%= f.text_field locale %></td> diff --git a/app/views/admin/users/_show_attribute.html.erb b/app/views/admin/users/_show_attribute.html.erb index ec33f84b9..98e8713c3 100644 --- a/app/views/admin/users/_show_attribute.html.erb +++ b/app/views/admin/users/_show_attribute.html.erb @@ -9,7 +9,7 @@ <tbody> <% show_attribute.get_enabled_attribute_fields.each do |attr| %> <tr class="list_item"> - <td><%= attr.i18n_variable[I18n.locale] %></td> + <td><%= attr.title %></td> <% @site_valid_locales.each do |locale| %> <td> <% if attr["locale"] && attr["markup"] == 'text_field' %> diff --git a/app/views/admin/users/_show_sub_role.html.erb b/app/views/admin/users/_show_sub_role.html.erb index 4968b2db6..3f60aa648 100644 --- a/app/views/admin/users/_show_sub_role.html.erb +++ b/app/views/admin/users/_show_sub_role.html.erb @@ -1,4 +1,4 @@ <div id="sub_role_<%= show_sub_role.id %>" class="group"> - <h2><%= show_sub_role.i18n_variable[I18n.locale] %></h2> + <h2><%= show_sub_role.title %></h2> <%= render :partial => 'show_attribute', :object => show_sub_role %> </div> \ No newline at end of file diff --git a/app/views/admin/users/_sub_role.html.erb b/app/views/admin/users/_sub_role.html.erb index 7bc555848..36c8b0b78 100644 --- a/app/views/admin/users/_sub_role.html.erb +++ b/app/views/admin/users/_sub_role.html.erb @@ -1,5 +1,5 @@ <div id="sub_role_<%= sub_role.id %>" class="group" <%= raw(' style="display: none;"') unless @user.sub_role_ids.include?(sub_role.id) %>> - <h2><%= sub_role.i18n_variable[I18n.locale] %></h2> + <h2><%= sub_role.title %></h2> <div class="info_input"> <table border="0" cellspacing="0" cellpadding="0"> <thead class="list_head"> @@ -14,7 +14,7 @@ <% sub_role.get_enabled_attribute_fields.each do |attr| %> <%= f.fields_for :attribute_values, @user.get_value_from_field_id(attr.id) do |f| %> <tr class="list_item"> - <td><%= attr.i18n_variable[I18n.locale] %></td> + <td><%= attr.title %></td> <% if attr["locale"] && attr["markup"] == 'text_field' %> <% @site_valid_locales.each do |locale| %> <td><%= f.text_field locale %></td> diff --git a/app/views/admin/users/_sub_role_selector.html.erb b/app/views/admin/users/_sub_role_selector.html.erb index 2305cb475..4ab201c0c 100644 --- a/app/views/admin/users/_sub_role_selector.html.erb +++ b/app/views/admin/users/_sub_role_selector.html.erb @@ -1,4 +1,4 @@ <% role.sub_roles.each do |sub_role| %> - <%= f.label sub_role.i18n_variable[I18n.locale], :for => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %> + <%= f.label sub_role.title, :for => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %> <%= check_box_tag "user[sub_role_ids][]", sub_role.id, @user.sub_role_ids.include?(sub_role.id), :id => "check_sub_role_#{sub_role.id}", :class => 'sub_role_select' %> <% end %> \ No newline at end of file diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index cb794ccf7..7f58cbf85 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -20,7 +20,7 @@ <tbody> <% @users.each do |user| %> <tr class="have"> - <td class="roles <%= user.role.key.downcase rescue nil %>"><%= user.role.i18n_variable[I18n.locale] rescue nil %></td> + <td class="roles <%= user.role.key.downcase rescue nil %>"><%= user.role.title rescue nil %></td> <td class="name"><%= user.name ? user.name : 'bob' %></td> <td class="email"><%= user.email %></td> <td class="admin"><%= user.admin ? t(:yes_) : t(:no_) %></td> diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index c9b3d696b..ca5fb7e06 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -14,14 +14,14 @@ </div> <% @infos.each do |a| %> <div id="basic_block" class="roles_block <%= @class %>"> - <h2><%= a.i18n_variable[I18n.locale] %></h2> + <h2><%= a.title %></h2> <hr> <%= render :partial => 'show_attribute', :object => a %> </div> <% end -%> <div id="basic_block" class="roles_block <%= @class %>"> - <h2><%= @user.role.i18n_variable[I18n.locale] %></h2> + <h2><%= @user.role.title %></h2> <hr class="<%= @user.role.key %>_block"> <%= render :partial => 'show_sub_role', :collection => @user.sub_roles %> </div> diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index 00ac2cd0f..91ad0047b 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,3 +1,4 @@ + <h1 class="login-logo"><%= t(:ruling_site) %></h1> <div id="signin-header"> <h3><%= t(:forgot_password) %></h3> @@ -18,4 +19,4 @@ <%= content_tag :button, "Send me reset password instructions", :type => :submit, :class => 'btn btn-primary pull-right' %> </div> <% end %> -</div> \ No newline at end of file +</div> diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index 76425f45a..26ca75993 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -11,12 +11,12 @@ <p class="alert hide">You need to sign in or sign up before continuing.</p> <div class="main"> <div class="control-group clear"> - <%= f.label :email %> - <%= f.email_field :email, :placeholder => t(:email), :style => "width: 330px;" %> + <%= f.label :nccu_ldap_uid ,t("nccu_c.nccu_ldap_uid")%> + <%= f.text_field :nccu_ldap_uid, :placeholder => t("nccu_c.nccu_ldap_uid"), :style => "width: 330px;" %> <span class="help-inline">Please correct the error</span> </div> <div class="control-group clear"> - <%= f.label :password %> + <%= f.label :password,t("password") %> <%= f.password_field :password, :placeholder => t(:dots), :style => "width: 330px;" %> <span class="help-inline">Please correct the error</span> <%= link_to t(:forgot_password), new_user_password_path, :class => 'pull-right forgot hide' %> @@ -24,15 +24,7 @@ </div> </div> <div class="form-actions clear"> - <div class=" pull-left"> - <label for="user_remember_me"> - <%= f.check_box :remember_me, :style => "display: inline-block;" %> - <span style="display: inline-block;height: 10px;"><%= t(:remember_me) %></span> - </label> - </div> <%= content_tag :button, t(:login), :type => :submit, :class => 'btn btn-primary pull-right' %> </div> <% end %> </div> - - diff --git a/app/views/layouts/_orbit_bar.html.erb b/app/views/layouts/_orbit_bar.html.erb index 45a19aa95..ae8517ee5 100644 --- a/app/views/layouts/_orbit_bar.html.erb +++ b/app/views/layouts/_orbit_bar.html.erb @@ -2,6 +2,7 @@ <div class="navbar-inner"> <div class="container clear"> <div class="dropdown orbit-logo pull-left"> + <% if !current_user.nil? %> <a class="brand dropdown-toggle" data-toggle="dropdown" href="#">Orbit</a> <ul class="dropdown-menu"> <li><%= link_to content_tag(:i, nil, :class => 'icons-dashboard') + t('admin.dashboard'), admin_dashboards_path %></li> @@ -13,6 +14,9 @@ <li><%= link_to content_tag(:i, nil, :class => 'icons-cog') + t('admin.site_settings'), admin_site_site_info_path(@site) %></li> <li><%#= link_to content_tag(:i, nil, :class => 'icons-plus-cube') + t('admin.add_item') %></li> </ul> + <% else %> + <a class="brand dropdown-toggle" data-toggle="dropdown" href="/">Orbit</a> + <% end -%> </div> <ul class="nav"> <li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li> @@ -30,8 +34,14 @@ <li class="search clear" title="<%= t :search_google %>"> <a class="orbit-bar-search" href="#">search</a> - <form class="navbar-search" action=""> - <input class="search-query span3" type="text" placeholder="<%= t(:search_google) %>"> + <form class="navbar-search" method="get" action="http://www.google.com/custom"> + <input type="hidden" name="client" value="pub-&" /> + <input type="hidden" name="ie" id="ie" value="utf-8" /> + <input type="hidden" name="oe" id="oe" value="utf-8" /> + <input type="hidden" name="cof" id="cof" value="AH:center;AWFID:03de271f1940eea3;" /> + <input type='hidden' name='domains' value='<%= @site.search["domains"] rescue ''%>'> + <input type='hidden' name='sitesearch' value='<%= @site.search["sitesearch"] rescue '' %>'> + <%= text_field_tag 'q','',{:class => "search-query span3",:placeholder=> t(:search_nccu) ,:disabled=> ((@site.search["sitesearch"] || @site.search["domains"] ).blank? rescue true)}%> </form> </li> <% if user_signed_in? %> @@ -76,7 +86,7 @@ <li> <div class="input-prepend"> <span class="add-on"><i class="icon-user"></i></span> - <%= f.text_field :email, :class => 'span2', :placeholder => t(:email), :size => 16 %> + <%= f.text_field :nccu_ldap_uid, :class => 'span2', :placeholder => t('nccu_c.nccu_ldap_uid'), :size => 16 %> </div> </li> <li> @@ -90,10 +100,7 @@ </li> <li> <%= content_tag :button, t(:login), :type => :submit, :class => 'btn btn-primary' %> - <label class="remember" for="user_remember_me"> - <%= f.check_box :remember_me %> - <span style="display: inline-block;height: 10px;"><%= t(:remember_me) %></span> - </label> + </li> <li class="divider hide"><span><%= t(:or_lower) %></span></li> <% end %> diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index c6b5cf5c0..6673863db 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -12,7 +12,7 @@ <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_announcement_back_end_bulletin_path), :class => active_for_action('bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class =>( active_for_action('bulletin_categorys', 'index') || active_for_ob_auths_object("BulletinCategory") ) %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue true) %> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_app_auth('Announcement') if (is_admin? rescue nil) %> <% end -%> @@ -26,7 +26,7 @@ <%= content_tag :li, link_to(t('announcement.add_new'), new_panel_news_back_end_news_bulletin_path), :class => active_for_action('news_bulletins', 'new') %> <%= content_tag :li, link_to(t('announcement.categories'), panel_news_back_end_news_bulletin_categorys_path), :class => active_for_action('news_bulletin_categorys', 'index') || active_for_ob_auths_object("NewsBulletinCategory") %> <%= content_tag :li, link_to(t('announcement.tags'), panel_news_back_end_tags_path), :class => active_for_action('/panel/news/back_end/tags', 'index') %> - <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_news_back_end_approval_setting_path), :class => active_for_action('news_approvals', 'setting') if (is_manager? rescue true) %> <%= content_tag :li, link_to(t('admin.module.authorization'),admin_module_app_manager_auth_proc_path(ModuleApp.first(conditions: {key: "news"}))), :class => active_for_app_auth('news') if (is_admin? rescue nil) %> <% end -%> @@ -87,3 +87,8 @@ <%# end -%> <%# end -%> +<div class="content"> + <% flash.each do |key, msg| %> + <%= content_tag :span, msg, :class => [key, "notice label label-warning"] %> + <% end%> +</div> diff --git a/app/views/layouts/page_layout.html.erb b/app/views/layouts/page_layout.html.erb index 0a7240ef3..b8894891e 100644 --- a/app/views/layouts/page_layout.html.erb +++ b/app/views/layouts/page_layout.html.erb @@ -1,5 +1,5 @@ <!DOCTYPE HTML> -<html> +<html class="<%= I18n.locale.to_s %>"> <head> <meta charset="utf-8"> <%= page_title(@item).html_safe %> @@ -12,6 +12,15 @@ <%= page_javascripts(@item).html_safe %> </head> <body> - <%= yield %> + <%= yield %> + <% if flash[:error] %> + <div class="modal alert alert-error hide" id="myModal"> + <p type="button" class="close" data-dismiss="modal">×</p> + <%= "<strong>#{flash[:error]}</strong><br/>".html_safe%> + </div> + <script> + $('#myModal').modal('show') + </script> + <% end -%> </body> </html> diff --git a/app/views/shared/_addthis_toolbox b/app/views/shared/_addthis_toolbox new file mode 100644 index 000000000..c58ff2eb8 --- /dev/null +++ b/app/views/shared/_addthis_toolbox @@ -0,0 +1,14 @@ +<!-- AddThis Button BEGIN --> +<div class="addthis_toolbox addthis_default_style "> +<a href="http://www.addthis.com/bookmark.php?v=250&username=ra-4fc5b9b95a5e9034" class="addthis_button_compact"><%= t("addthis_tools.add_to_bookmark")%></a> +<span class="addthis_separator">|</span> +<a class="addthis_button_facebook" style="cursor:Pointer"></a> +<a class="addthis_button_twitter" style="cursor:Pointer"></a> +<a class="addthis_button_plurk" style="cursor:Pointer"></a> +<a class="addthis_button_email" style="cursor:Pointer"></a> +<!--<a href="<?php echo 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] ?>&print=friendly"><img src="../images/print.jpg" alt="友善列印" +></a>--> +</div> +<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script> +<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4fc5b9b95a5e9034"></script> +<!-- AddThis Button END --> diff --git a/app/views/shared/_privilege_user.html.erb b/app/views/shared/_privilege_user.html.erb index 9d49be356..ba68996f4 100644 --- a/app/views/shared/_privilege_user.html.erb +++ b/app/views/shared/_privilege_user.html.erb @@ -1,6 +1,6 @@ <div class="checkblock"> - <div class="for_unit" style="display:none;"> <%= user.cache_dept[I18n.locale.to_s] %></div> - <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => user.cache_dept[I18n.locale.to_s]},:class=>"checkbox clear" do %> + <div class="for_unit" style="display:none;"> <%= user.cache_dept[I18n.locale.to_s] rescue ''%></div> + <%= content_tag :div,:data=>{'original-title'=>t('announcement.bulletin.approval_setting_window_title'),:content => (user.cache_dept[I18n.locale.to_s] rescue '')},:class=>"checkbox clear" do %> <div class="check-icon"> </div> <div class='member-avatar'> diff --git a/app/views/shared/_search_not_found.html.erb b/app/views/shared/_search_not_found.html.erb new file mode 100644 index 000000000..43d8c7ddb --- /dev/null +++ b/app/views/shared/_search_not_found.html.erb @@ -0,0 +1 @@ +<tr> <%= t("search.not_found") %> </tr> \ No newline at end of file diff --git a/app/views/shared/render_share.html.erb b/app/views/shared/render_share.html.erb new file mode 100644 index 000000000..f8d3c9302 --- /dev/null +++ b/app/views/shared/render_share.html.erb @@ -0,0 +1,15 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta property="og:title" content="<%= @object.title %>" /> + <meta property="og:description" content="<%= strip_tags @object.subtitle %>" /> + <meta property="og:image" content="<%= ('http://' + request.env['HTTP_HOST'] + @object.image.url) unless @object.image.blank? %>" /> + <script type="text/javascript"> + <!-- + window.location = "<%= @orig_url %>" + //--> + </script> +</head> +<body> +</body> +</html> \ No newline at end of file diff --git a/config/application.rb b/config/application.rb index 00dad7e82..9faef5d4a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -21,7 +21,6 @@ module Orbit config.paths["vendor/plugins"] += %W(#{config.root}/vendor/downloaded_modules) config.paths["app/views"] += %W(#{config.root}/app/views/devise) - # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/config.yml b/config/config.yml index 71234da0a..439386fb1 100644 --- a/config/config.yml +++ b/config/config.yml @@ -5,4 +5,6 @@ defaults: &defaults ruling_digital: 'RulingDigital' development: - <<: *defaults \ No newline at end of file + <<: *defaults +production: + <<: *defaults diff --git a/config/environments/development.rb b/config/environments/development.rb index 2dac58e9a..1ae657f60 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -12,7 +12,7 @@ Orbit::Application.configure do # Show full error reports and disable caching config.consider_all_requests_local = false #config.action_view.debug_rjs = true - config.action_controller.perform_caching = false + config.action_controller.perform_caching = true # Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false @@ -23,6 +23,8 @@ Orbit::Application.configure do # Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin + # config.cache_store = :mem_cache_store + config.assets.debug = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 001ff2c68..ad900d0eb 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,22 +1,34 @@ Orbit::Application.configure do # Settings specified here will take precedence over those in config/application.rb - # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests - config.cache_classes = true + config.cache_classes = false # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false + + # Compress JavaScripts and CSS + config.assets.compress = true + + # Don't fallback to assets pipeline if a precompiled asset is missed + config.assets.compile = true + + # Generate digests for assets URLs + config.assets.digest = true + + # Defaults to Rails.root.join("public/assets") + # config.assets.manifest = YOUR_PATH + # Specifies the header that your server uses for sending files - config.action_dispatch.x_sendfile_header = "X-Sendfile" + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx - # For nginx: - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' - - # If you have no front-end server that supports something like X-Sendfile, - # just comment this out and Rails will serve the files + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true # See everything in the log (default is :info) # config.log_level = :debug @@ -27,13 +39,13 @@ Orbit::Application.configure do # Use a different cache store in production # config.cache_store = :mem_cache_store - # Disable Rails's static asset server - # In production, Apache or nginx will already do this - config.serve_static_assets = false - - # Enable serving of images, stylesheets, and javascripts from an asset server + # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + config.assets.precompile += %w( *.js *.css *.js.* *.css.* tinymce/tiny_mce_popup.js ) + # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false @@ -46,9 +58,4 @@ Orbit::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify - - - #compress both stylesheets and Javascripts - config.assets.js_compressor = :uglifier - config.assets.css_compressor = :scss end diff --git a/vendor/impressionist/test_app/config/environments/production.rb b/config/environments/production.rb.bak similarity index 50% rename from vendor/impressionist/test_app/config/environments/production.rb rename to config/environments/production.rb.bak index c33789b26..f52ead13c 100644 --- a/vendor/impressionist/test_app/config/environments/production.rb +++ b/config/environments/production.rb.bak @@ -1,6 +1,7 @@ -TestApp::Application.configure do +PrototypeR4::Application.configure do # Settings specified here will take precedence over those in config/application.rb + # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true @@ -8,45 +9,30 @@ TestApp::Application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_assets = false - - # Compress JavaScripts and CSS - config.assets.compress = true - - # Don't fallback to assets pipeline if a precompiled asset is missed - config.assets.compile = false - - # Generate digests for assets URLs - config.assets.digest = true - - # Defaults to Rails.root.join("public/assets") - # config.assets.manifest = YOUR_PATH - # Specifies the header that your server uses for sending files - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + config.action_dispatch.x_sendfile_header = "X-Sendfile" - # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. - # config.force_ssl = true + # For nginx: + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' + + # If you have no front-end server that supports something like X-Sendfile, + # just comment this out and Rails will serve the files # See everything in the log (default is :info) # config.log_level = :debug - # Prepend all log lines with the following tags - # config.log_tags = [ :subdomain, :uuid ] - # Use a different logger for distributed setups - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # config.logger = SyslogLogger.new # Use a different cache store in production # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server - # config.action_controller.asset_host = "http://assets.example.com" + # Disable Rails's static asset server + # In production, Apache or nginx will already do this + config.serve_static_assets = false - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - # config.assets.precompile += %w( search.js ) + # Enable serving of images, stylesheets, and javascripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false @@ -61,7 +47,8 @@ TestApp::Application.configure do # Send deprecation notices to registered listeners config.active_support.deprecation = :notify - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - # config.active_record.auto_explain_threshold_in_seconds = 0.5 + + #compress both stylesheets and Javascripts + config.assets.js_compressor = :uglifier + config.assets.css_compressor = :scss end diff --git a/config/environments/production.rb.cp_from_dev_work b/config/environments/production.rb.cp_from_dev_work new file mode 100644 index 000000000..d1b671e55 --- /dev/null +++ b/config/environments/production.rb.cp_from_dev_work @@ -0,0 +1,44 @@ +PrototypeR4::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the webserver when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = false + #config.action_view.debug_rjs = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false + + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + + config.middleware.use ExceptionNotifier, + :email_prefix => "[R4_error]", + :sender_address => %{"notifier" <redmine@rulingcom.com>}, + :exception_recipients => %w{chris@rulingcom.com} + + config.action_mailer.delivery_method = :smtp + config.action_mailer.smtp_settings = { + :tls => true, + :enable_starttls_auto => true, + :address => "smtp.gmail.com", + :port => '587', + :domain => "smtp.gmail.com", + :authentication => "plain", + :user_name => "redmine@rulingcom.com", + :password => "rulingredmine" } + +end + diff --git a/config/initializers/custom_validators.rb b/config/initializers/custom_validators.rb new file mode 100644 index 000000000..1b3a9f2cb --- /dev/null +++ b/config/initializers/custom_validators.rb @@ -0,0 +1,7 @@ +class AtLeastOneValidator < ActiveModel::EachValidator + + def validate_each(record, attribute, value) + record.errors[attribute] << (options[:message] || I18n.t("errors.at_least_one")) if (value.blank? || value.values.join.eql?('')) + end + +end \ No newline at end of file diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 03480dbe1..ea19b137b 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -21,6 +21,8 @@ Devise.setup do |config| # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # config.authentication_keys = [ :email ] + config.authentication_keys = [ :nccu_ldap_uid ] + # Tell if authentication through request.params is enabled. True by default. # config.params_authenticatable = true diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb index 46b175b5f..0d22eac87 100644 --- a/config/initializers/load_config.rb +++ b/config/initializers/load_config.rb @@ -1 +1,2 @@ -APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env] \ No newline at end of file +APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env] +LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env] \ No newline at end of file diff --git a/config/initializers/middle_site_connection.rb b/config/initializers/middle_site_connection.rb new file mode 100644 index 000000000..345ad4641 --- /dev/null +++ b/config/initializers/middle_site_connection.rb @@ -0,0 +1,21 @@ +#encoding: utf-8 +require 'mysql2' + +$mid_site_connection + +module MiddleSiteConnection + + @mid_host = { + :host => 'mruling.nccu.edu.tw', #mruling.nccu.edu.tw or 127.0.0.1 + :port => 3306, #3306 or 8005 + :username => "rulingcom", + :password => "5w3iJQ9OJQMGhJibKP6YQje8", + :database => "RSS23_NCCU_MIDDLE", + :encoding => "UTF8" + } + + def self.establish + $mid_site_connection = Mysql2::Client.new(@mid_host) + end + +end \ No newline at end of file diff --git a/config/initializers/nccu_ldap_connection.rb b/config/initializers/nccu_ldap_connection.rb new file mode 100644 index 000000000..00e033670 --- /dev/null +++ b/config/initializers/nccu_ldap_connection.rb @@ -0,0 +1,16 @@ +#encoding: utf-8 +require 'mysql2' + +$nccu_ldap_connection + +module NccuLdapConnection + BASE = 'ou=People,dc=nccu,dc=edu,dc=tw' + + def self.establish + $nccu_ldap_connection = Net::LDAP.new + $nccu_ldap_connection.port =LDAP_CONFIG["port"] + $nccu_ldap_connection.host = LDAP_CONFIG["host"] + $nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"]) + end + +end \ No newline at end of file diff --git a/config/initializers/override_and_new_class_methods.rb b/config/initializers/override_and_new_class_methods.rb index 8170d674f..075158042 100644 --- a/config/initializers/override_and_new_class_methods.rb +++ b/config/initializers/override_and_new_class_methods.rb @@ -3,3 +3,24 @@ Integer.class_eval do !self.zero? end end + +module SocialShareButton + module Helper + def social_share_button_tag(title = "", opts = {}) + rel = opts[:rel] + html = [] + html << "<div class='social-share-button' data-title='#{title}' data-img='#{opts[:image]}' data-fb_url='#{opts[:fb_url]}'>" + + SocialShareButton.config.allow_sites.each do |name| + link_title = t "social_share_button.share_to", :name => t("social_share_button.#{name.downcase}") + html << link_to("","#", :rel => "nofollow #{rel}", + "data-site" => name, + :class => "social-share-button-#{name}", + :onclick => "return SocialShareButton.share(this);", + :title => h(link_title)) + end + html << "</div>" + raw html.join("\n") + end + end +end \ No newline at end of file diff --git a/config/initializers/resque_auth.rb b/config/initializers/resque_auth.rb new file mode 100644 index 000000000..6f31043d8 --- /dev/null +++ b/config/initializers/resque_auth.rb @@ -0,0 +1,3 @@ +Resque::Server.use(Rack::Auth::Basic) do |user, password| + password == "SD-7506D" +end \ No newline at end of file diff --git a/config/initializers/rulingcom_ldap.rb b/config/initializers/rulingcom_ldap.rb new file mode 100644 index 000000000..28625797c --- /dev/null +++ b/config/initializers/rulingcom_ldap.rb @@ -0,0 +1,19 @@ +# Warden::Strategies.add(:check_nccu_ldap) do +# def valid? +# # code here to check whether to try and authenticate using this strategy; +# params['nccu_ldap_uid'] && params['password'] +# end +# def authenticate! +# debugger +# user = User.first(conditions:{ nccu_ldap_uid: "901001" }) +# if user +# success! user +# else +# success! User.create +# +# # fail!(message) +# # User.create +# end +# end +# +# end \ No newline at end of file diff --git a/config/initializers/social_share_button.rb b/config/initializers/social_share_button.rb new file mode 100644 index 000000000..28df7d3b4 --- /dev/null +++ b/config/initializers/social_share_button.rb @@ -0,0 +1,3 @@ +SocialShareButton.configure do |config| + config.allow_sites = %w(twitter facebook) +end diff --git a/config/ldap.yml b/config/ldap.yml new file mode 100644 index 000000000..5c48fc1ab --- /dev/null +++ b/config/ldap.yml @@ -0,0 +1,12 @@ +defaults: &defaults + authenticate_info: 'cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw' + authenticate_pwd: 'nccu2ucc' + +development: + <<: *defaults + host: '127.0.0.1' + port: 8001 +production: + <<: *defaults + host: '140.119.166.23' + port: 389 diff --git a/config/list.yml b/config/list.yml index f723c5ffe..8615c60f4 100644 --- a/config/list.yml +++ b/config/list.yml @@ -10,6 +10,7 @@ markups: public_r_tags: - ad_banner - sub_menu + - sitemap page_part_kinds: - text @@ -37,4 +38,4 @@ widget_field_type: - status - tag - viewcount - - poster \ No newline at end of file + - poster diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 5e4e43321..800f6c7a4 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -9,6 +9,9 @@ en: failure: unauthenticated: 'You need to sign in or sign up before continuing.' unconfirmed: 'You have to confirm your account before continuing.' + ldap_invalid: 'Your LDAP account is invalid' + ldap_connection_failed: 'LDAP connection failed' + ldap_pass_but_account_not_in_orbit: 'LDAP account is not supported to sign up this site.' locked: 'Your account is locked.' invalid: 'Invalid email or password.' invalid_token: 'Invalid authentication token.' diff --git a/config/locales/devise.zh_tw.yml b/config/locales/devise.zh_tw.yml index bd5c4a432..4cb8c3170 100644 --- a/config/locales/devise.zh_tw.yml +++ b/config/locales/devise.zh_tw.yml @@ -9,6 +9,9 @@ zh_tw: failure: unauthenticated: '您需要先註冊、登入後才能繼續。' unconfirmed: '您的帳號需需要經過確認後,才能繼續。' + ldap_invalid: '您的LDAP帳號錯誤' + ldap_connection_failed: '與LDAP之間連線異常' + ldap_pass_but_account_not_in_orbit: '很抱歉,您的LDAP帳號並不支援在此網站登入' locked: '您的帳號已被鎖定。' invalid: 'Email 或密碼是無效的。' invalid_token: '無效的認證代碼。' diff --git a/config/locales/en.yml b/config/locales/en.yml index 44bdcb6fa..836c5ff9c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -11,6 +11,7 @@ en: back: Back browse: Browse cancel: Cancel + cant_empty_star: Cannot be empty (*) create_fail: Creation failed create: Create delete: Delete @@ -33,6 +34,8 @@ en: nccu: NCCU nccu_c: nccu_ldap_uid: NCCU LDAP Account + off_upcase: "OFF" + on_upcase: "ON" or_lower: or password: Password register: Register @@ -46,7 +49,8 @@ en: view: View view_count: View count yes_: "Yes" - + addthis_tools: + add_to_bookmark: Add this to bookmark all_content: All Content all_file: All File all_member: All Member @@ -65,6 +69,7 @@ en: role: Role site_info: Site Info site_name: Site Name + sitemap: Sitemap statistics: Statistics title: Title total_visitors: Total Visitors @@ -75,6 +80,9 @@ en: visitors_this_month: This month's visitors visitors_this_year: This year's visitors + errors: + at_least_one: must at least have one value + admin: access: denied: @@ -289,4 +297,18 @@ en: modal: close: Close preview: Preview - + sys: + not_previewable: "Preview not support" + limit_of_upload_file_size: "Upload file must be less than: %{best_size}" + preview_only_for_img: "Preview only supprt with file type:jpg,png,gif,bmp" + can_not_display_due_to_no_context: "Can not display due to no context for English" + module_page_lang_not_support: "We are sorry, this page is not available for English" + search: + not_found: "NOT FOUND" + domains: Google Search Domains + site_search: Site Search + sitesearch: Google Site Search + site_setting_help: Please Enter the search argument for Google search. + result_get: "Searched about ' %{search_word} ' Found %{item_num} items" + too_many: "Search about ' %{search_word} 'resulted more than %{exceed_num} items maybe try to search with more specific terms?" + unit_get: "Listed items created by :%{unit_name} Found %{item_num} items" diff --git a/config/locales/social_share_button.en.yml b/config/locales/social_share_button.en.yml new file mode 100644 index 000000000..7e3f1fb0e --- /dev/null +++ b/config/locales/social_share_button.en.yml @@ -0,0 +1,14 @@ +en: + social_share_button: + share_to: Share to %{name} + weibo: Sina Weibo + twitter: Twitter + facebook: Facebook + douban: Douban + qq: Qzone + tqq: Tqq + delicious: Delicious + baidu: Baidu.com + kaixin001: Kaixin001.com + renren: Renren.com + google_plus: Google+ diff --git a/config/locales/social_share_button.zh-tw.yml b/config/locales/social_share_button.zh-tw.yml new file mode 100644 index 000000000..b0321eb5a --- /dev/null +++ b/config/locales/social_share_button.zh-tw.yml @@ -0,0 +1,14 @@ +zh_tw: + social_share_button: + share_to: 分享到%{name} + weibo: 新浪微博 + twitter: Twitter + facebook: Facebook + douban: 豆瓣 + qq: QQ空間 + tqq: 腾讯微博 + delicious: Delicious + baidu: 百度收藏 + kaixin001: 開心網 + renren: 人人網 + google_plus: Google+ diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index c2e299f82..d8483ecef 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -8,6 +8,7 @@ zh_tw: back: 回上一步 browse: 選擇檔案 cancel: 取消 + cant_empty_star: 不能為空 (*) create: 新增 create_fail: 創建失敗 delete: 刪除 @@ -25,8 +26,13 @@ zh_tw: homepage: 首頁 login: 登入 logout: 登出 + nccu: 政大 + nccu_c: + nccu_ldap_uid: iNCCU帳號 no_: "No" nothing: 無 + off_upcase: "OFF" + on_upcase: "ON" or_lower: 或 password: 密碼 register: 註冊 @@ -41,6 +47,8 @@ zh_tw: view_count: 查看次數 yes_: "Yes" + addthis_tools: + add_to_bookmark: 加入書籤 all_content: 全部內容有 all_file: 全部檔案有 all_member: 成員總數 @@ -59,6 +67,7 @@ zh_tw: role: 角色 site_info: 網站資訊 site_name: 網站名稱 + sitemap: 網站地圖 statistics: 統計 title: 標題 total_visitors: 造訪次數 @@ -69,6 +78,9 @@ zh_tw: visitors_this_month: 本月造訪 visitors_this_year: 今年造訪 + errors: + at_least_one: 必須至少有一個值 + admin: access: denied: @@ -138,11 +150,12 @@ zh_tw: create_success_snippet: 片段已成功新增。 create_success_user: 用戶已成功新增。。 dashboard: 儀表板 - data: 資料數據 + data: 選擇檔案 delete_language: 刪除語言 description: 描述 design: 版型管理 disable_language: 禁用語言 + edit: 編輯 editing_home: 編輯首頁 editing_layout: 編輯樣板 editing_link: 編輯連結 @@ -198,6 +211,8 @@ zh_tw: no_layout: 您沒有佈局 name: 名稱 nccu: 政大客制 + nccu_c: + nccu_ldap_uid: NCCU LDAP 帳號 new_asset: 新增資產 new_component: 新增元件 new_design: 新設計 @@ -423,6 +438,17 @@ zh_tw: select: prompt: "請選擇" + search: + not_found: "沒有搜尋結果" + domains: Google Search Domains + site_search: "全站搜尋" + sitesearch: Google Site Search + site_setting_help: 請輸入送交Google搜尋的參數 + result_get: "搜尋有關 ' %{search_word} ' 共搜尋到%{item_num}筆資料" + too_many: "搜尋有關 ' %{search_word} ' 尋找到超過 %{exceed_num} 筆資料,請嘗試加入更多關鍵字縮小搜尋範圍,以作更精確的搜尋" + + result_get: "搜尋標題有關 ' %{search_word} ' 共搜尋到%{item_num}筆資料" + unit_get: "列出由:%{unit_name}發佈的資料,共有%{item_num}筆" activerecord: errors: template: # ~ 2.3.5 backward compatible @@ -500,4 +526,13 @@ zh_tw: submit: "儲存%{model}" modal: close: "關閉" - preview: "預覽" \ No newline at end of file + preview: "預覽" + sys: + not_previewable: "不支援預覽" + limit_of_upload_file_size: "上傳檔案大小限制: %{best_size}" + preview_only_for_img: "預覽僅支援:jpg,png,gif,bmp...等圖片格式" + can_not_display_due_to_no_context: "因為沒有中文版本,所以無法顯示" + module_page_lang_not_support: "很抱歉,本頁沒有開放中文版本" + object_disable: + change_to_true: "設為停用" + change_to_false: "重新啓用" diff --git a/config/mongoid.yml b/config/mongoid.yml index 0b1bf1bcc..79295ef24 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -21,4 +21,5 @@ production: # password: <%= ENV['MONGOID_PASSWORD'] %> # database: <%= ENV['MONGOID_DATABASE'] %> <<: *defaults - database: prototype_r4_development + database: prototype_r4_ldap0229 + slave_ok: true diff --git a/config/resque.god b/config/resque.god index 6c4e4bded..7622576cc 100644 --- a/config/resque.god +++ b/config/resque.god @@ -1,19 +1,31 @@ -rails_env = 'development' #ENV['RAILS_ENV'] || "production" -rails_root = ENV['RAILS_ROOT'] || "/Users/kaito/Documents/MyWorkspeace/orbit/orbit" +#developer pls change here +rails_root = "/home/nccu/NCCU/" #keep this blank when development + +development_uid = 'kaito' #when dev +development_gid = 'staff' #when dev + +#rails_env = "developement" +rails_env = "production" + +development_rails_root = File.expand_path("..",File.dirname(__FILE__)) +#rails_root = (rails_env == 'production' )? production_rails_root : development_rails_root num_workers = rails_env == 'production' ? 5 : 2 num_workers.times do |num| God.watch do |w| - w.dir = "#{rails_root}" - w.name = "resque-#{num}" - w.group = 'resque' - w.interval = 30.seconds - p "/usr/bin/rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}" -# w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env} - w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}" - w.uid = 'kaito' - w.gid = 'staff' + w.dir = rails_root + w.name = "resque-#{num}" + w.group = 'resque' + + w.interval = 30.seconds + w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env} + w.start = "rake -f #{rails_root}/Rakefile resque:work QUEUE=* RAILS_ENV=#{rails_env}" + + w.uid = (rails_env == 'production' )? "root" : development_uid + w.gid = (rails_env == 'production' )? "root" : development_gid + + w.log = (rails_env == 'production' )? "/var/log/#{w.name}.log":"#{rails_root}/log/#{w.name}.log" # restart if memory gets too high w.transition(:up, :restart) do |on| @@ -52,4 +64,5 @@ num_workers.times do |num| end end end -end \ No newline at end of file +end + diff --git a/config/resque_schedule.god b/config/resque_schedule.god new file mode 100644 index 000000000..34a6dff8c --- /dev/null +++ b/config/resque_schedule.god @@ -0,0 +1,63 @@ +#developer pls change here +rails_root = "/home/nccu/NCCU/" #keep this blank when development + +development_uid = 'kaito' #when dev +development_gid = 'staff' #when dev + +#rails_env = "developement" +rails_env = "production" + +development_rails_root = File.expand_path("..",File.dirname(__FILE__)) +#rails_root = (rails_env == 'production' )? production_rails_root : development_rails_root + + God.watch do |w| + w.dir = rails_root + w.name = "resque-scheduler" + w.group = 'resque' + w.interval = 30.seconds + w.env = {"QUEUE"=>"critical,high,low", "RAILS_ENV"=>rails_env} + w.start = "rake -f #{rails_root}/Rakefile resque:scheduler RAILS_ENV=#{rails_env}" + + w.uid = (rails_env == 'production' )? "root" : development_uid + w.gid = (rails_env == 'production' )? "root" : development_gid + + w.log = (rails_env == 'production' )? "/var/log/#{w.name}.log":"#{rails_root}/log/#{w.name}.log" + + # restart if memory gets too high + w.transition(:up, :restart) do |on| + on.condition(:memory_usage) do |c| + c.above = 350.megabytes + c.times = 2 + end + end + + # determine the state on startup + w.transition(:init, { true => :up, false => :start }) do |on| + on.condition(:process_running) do |c| + c.running = true + end + end + + # determine when process has finished starting + w.transition([:start, :restart], :up) do |on| + on.condition(:process_running) do |c| + c.running = true + c.interval = 5.seconds + end + + # failsafe + on.condition(:tries) do |c| + c.times = 5 + c.transition = :start + c.interval = 5.seconds + end + end + + # start if process is not running + w.transition(:up, :start) do |on| + on.condition(:process_running) do |c| + c.running = false + end + end + end + diff --git a/config/resque_schedule.yml b/config/resque_schedule.yml index 601941013..67d006ede 100644 --- a/config/resque_schedule.yml +++ b/config/resque_schedule.yml @@ -5,19 +5,19 @@ # description: Runs the perform method in FetchTime nccu_daily_ldap_sync: - cron: * * [0,12] * * * + cron: 0 0 [0,12] * * * class: SyncDb args: description: Sync NCCU middle site with Orbit for LDAP data -nccu_daily_restart: - cron: * * */3 * * * - class: RestartServer +nccu_daily_backup: + cron: 0 0 3 * * * + class: BackupServer args: - description: Restart NCCU site + description: Backup NCCU site nccu_claender_sync: - cron: * * [0,12] * * * + cron: 0 0 [0,12] * * * class: NccuCalendar args: description: Sync NCCU calendar RSS Feeds \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 3b08f7a53..64e2648ac 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,7 @@ Orbit::Application.routes.draw do + + devise_for :users,:controllers => {:sessions => 'sessions'} mount Resque::Server, :at => "/admin/resque" - devise_for :users # routes for sinatra app match '/site/set_registered', :to => CentralServerExchangeApp @@ -16,7 +17,7 @@ Orbit::Application.routes.draw do resources :assets do collection do get 'file_upload' - post 'delete' + get 'delete' end end resources :asset_categories @@ -52,7 +53,7 @@ Orbit::Application.routes.draw do resources :designs do collection do get 'upload_package' - post 'delete' + get 'delete' post 'upload_package' end member do @@ -114,10 +115,12 @@ Orbit::Application.routes.draw do get 'add_attribute_field' end resources :sites do - get 'site_info' - get 'system_info' - get 'language' get 'mail_setting' + get 'site_info' + get 'sitemap' + get 'sitemap_frontend' + get 'sitemap_toggle', :on => :member + get 'system_info' get 'ui_theme' end resources :snippets @@ -230,9 +233,12 @@ Orbit::Application.routes.draw do match '/panel/:app_name/front_end/:app_action' => 'pages#index_from_link', :constraints => lambda { |request| !request.query_string.include?("inner=true") } + + match '/share/:model/:id' => 'application#render_share' # routes for gridfs files - match "/gridfs/*path" => "gridfs#serve" + match "/gridfs/*path" => "gridfs#serve" + # match "/images/*path" => "gridfs#serve_images" # match "/admin/pages/images/*path" => "gridfs#serve_images" diff --git a/config/sunspot.yml b/config/sunspot.yml new file mode 100644 index 000000000..7bbd32c0f --- /dev/null +++ b/config/sunspot.yml @@ -0,0 +1,17 @@ +production: + solr: + hostname: localhost + port: 8983 + log_level: WARNING + +development: + solr: + hostname: localhost + port: 8982 + log_level: INFO + +test: + solr: + hostname: localhost + port: 8981 + log_level: WARNING \ No newline at end of file diff --git a/dump.rdb b/dump.rdb index 748293b8f..9ee1d38bb 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/lib/orbit_basis.rb b/lib/orbit_basis.rb new file mode 100644 index 000000000..3e0ec976a --- /dev/null +++ b/lib/orbit_basis.rb @@ -0,0 +1,28 @@ +module OrbitBasis + module BaseModel + extend ActiveSupport::Concern + + # included do + # scope :recent, desc(:_id) + # scope :exclude_ids, Proc.new { |ids| where(:_id.nin => ids.map(&:to_i)) } + # scope :by_week, where(:created_at.gte => 7.days.ago.utc) + # end + + module ClassMethods + + def find_in_batches(opts = {}) + batch_size = opts[:batch_size] || 1000 + start = opts.delete(:start).to_i || 0 + objects = self.limit(batch_size).skip(start) + t = Time.new + while objects.any? + yield objects + start += batch_size + # Rails.logger.debug("processed #{start} records in #{Time.new - t} seconds") if Rails.logger.debug? + break if objects.size < batch_size + objects = self.limit(batch_size).skip(start) + end + end + end + end +end diff --git a/lib/orbit_controller_lib.rb b/lib/orbit_controller_lib.rb new file mode 100644 index 000000000..e8fd8e051 --- /dev/null +++ b/lib/orbit_controller_lib.rb @@ -0,0 +1,44 @@ +module OrbitControllerLib + module DivisionForDisable + # def get_disable_object_by_user(object_class) + # if is_admin? or is_manager? + # object_class.admin_manager_all + # else + # object_class.all + # end + # end + + + def get_categories_for_index(object_class,id = nil) + class_ref = object_class.constantize + ivar_name = "@#{object_class.to_s.underscore.pluralize}" + instance_variable_set(ivar_name, []) + if(is_manager? || is_admin?) + instance_variable_set(ivar_name, (id ? class_ref.admin_manager_all.find(id).to_a : class_ref.admin_manager_all)) + elsif is_sub_manager? + instance_variable_set(ivar_name, (class_ref.all)) + end + instance_variable_get(ivar_name) + end + + def get_categorys(object_class,id = nil,func_authed_for_sub_manager = 'submit') + class_ref = object_class.constantize + # ivar_name = "@#{object_class.to_s.underscore.pluralize}" + ivar_name = "@#{object_class.to_s.underscore}s" + instance_variable_set(ivar_name, []) + @bulletin_categorys = [] + if(is_manager? || is_admin?) + #instance_variable_set(ivar_name, (id ? class_ref.admin_manager_all.find(id).to_a : class_ref.admin_manager_all)) + instance_variable_set(ivar_name, (id ? class_ref.all.find(id).to_a : class_ref.all)) + elsif is_sub_manager? + instance_variable_set(ivar_name, class_ref.all.authed_for_user(current_user,func_authed_for_sub_manager)) + end + if instance_variable_get(ivar_name).empty? && params[:action] != "index" + flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + redirect_to :action => :index + end + end + + + end +end diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index f3cd2cd51..8aea2b8ca 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -1,4 +1,60 @@ module OrbitCoreLib + module BelongsToCategoryMayDisable + def self.included(base) + base.instance_eval("belongs_to :#{base::BelongsToCategory.to_s}") + base.instance_eval(" + scope :currently_available_by_category, lambda { |category| + check_data = category.to_a.collect{|cate| cate.id} + any_in(#{ base::BelongsToCategory.to_s}_id: check_data) + } + ") + base.instance_eval("scope :admin_manager_all,find(:all)") + # base.instance_eval("scope :all,where(disable: false)") + base.instance_eval(" + scope :all, lambda { + category = base::BelongsToCategory.to_s.classify.constantize.all + check_data = category.to_a.collect{|cate| cate.id} + any_in(#{ base::BelongsToCategory.to_s}_id: check_data) + } + ") + base.class_eval(" + def disable? + #{base::BelongsToCategory.to_s}.disable? + end + ") + end + + + # end + + + end + module ObjectDisable + def self.included(base) + + base.instance_eval("field :disable,type: Boolean,:default => false") + base.instance_eval("scope :all,where(disable: false)") + base.instance_eval("scope :admin_manager_all,find(:all)") + + base.define_singleton_method :find do |*args| + if args ==[:all] + unscoped + else + res = unscoped.find(args) + res.count == 1 ? res[0] : res + end + end + + base.define_singleton_method :first do |*args| + all.first + end + + base.define_singleton_method :last do |*args| + all.last + end + + end + end module ObjectAuthable def self.included(base) base.instance_eval("has_many :object_auths,as: :obj_authable,dependent: :delete") @@ -14,7 +70,7 @@ module OrbitCoreLib query1 = auth_object_space.any_in({sub_role_ids: sub_role_ids_ary}).excludes(blocked_user_ids: user.id) query2 = auth_object_space.any_of({all: true},{privilege_user_ids: user.id},{role_ids: user.role.id}).excludes(blocked_user_ids: user.id) result = (query1 + query2).uniq - result.collect{|t| t.obj_authable} + result.collect{|t| t.obj_authable}.delete_if{|val| val==nil} end end diff --git a/lib/orbit_search_lib.rb b/lib/orbit_search_lib.rb new file mode 100644 index 000000000..e98ecb536 --- /dev/null +++ b/lib/orbit_search_lib.rb @@ -0,0 +1,46 @@ +# coding: utf-8 +# this is from : https://github.com/jugyo/sunspot_mongoid +# this file is special for mongoid_auto_increment_id +require 'sunspot' +require 'mongoid' +require 'sunspot/rails' + +# == Examples: +# +# class Post +# include Mongoid::Document +# field :title +# +# include Sunspot::Mongoid +# searchable do +# text :title +# end +# end +# +module OrbitSearchLib + module ObjectSearchable + def self.included(base) + base.class_eval do + extend Sunspot::Rails::Searchable::ActsAsMethods + Sunspot::Adapters::DataAccessor.register(DataAccessor, base) + Sunspot::Adapters::InstanceAdapter.register(InstanceAdapter, base) + end + end + + class InstanceAdapter < Sunspot::Adapters::InstanceAdapter + def id + @instance.id + end + end + + class DataAccessor < Sunspot::Adapters::DataAccessor + def load(id) + @clazz.where(:_id => id).first + end + + def load_all(ids) + @clazz.where(:_id.in => ids.collect { |id| id.to_i }) + end + end + end +end diff --git a/lib/parsers/parser_back_end.rb b/lib/parsers/parser_back_end.rb index aed8f36bd..2a5904173 100644 --- a/lib/parsers/parser_back_end.rb +++ b/lib/parsers/parser_back_end.rb @@ -17,7 +17,7 @@ module ParserBackEnd # item = Item.first(:conditions => { :path => tag.attr['name'] }) # ret = '' # ret << "<a href='" - # ret << eval("admin_#{item._type.downcase}_path(item.id)") + # ret << eval("admin_#{item.class.to_s.downcase}_path(item.id)") # ret << "' class='nav'>" # ret << item.i18n_variable[I18n.locale] # ret << "</a>" diff --git a/lib/parsers/parser_common.rb b/lib/parsers/parser_common.rb index 18140aa12..afb849e1c 100644 --- a/lib/parsers/parser_common.rb +++ b/lib/parsers/parser_common.rb @@ -9,13 +9,14 @@ module ParserCommon res << "'>" i = nil i = 1 if menu.values["li_incremental_#{current}"] - if menu.values['home'] && current == 1 - res << menu_li(page, current_page, current, menu, i, edit) - end - page.visible_children.each do |child| + children = current == 1 ? page.visible_children.reverse : page.visible_children + children.each do |child| res << menu_li(child, current_page, current, menu, i, edit) i += 1 if i end + if menu.values['home'] && current == 1 + res << menu_li(page, current_page, current, menu, i, edit) + end res << "</ul>" end res @@ -28,8 +29,8 @@ module ParserCommon res << " active" if (current_page.id.eql?(page.id) || current_page.descendant_of?(page)) res << "'>" root = "/" - res << "<a href='#{edit ? root + admin_page_path(page.id) : (page._type.eql?('Page') ? root + page.path : page.url)}'><span>#{page.i18n_variable[I18n.locale]}</span></a>" - if page.visible_children.size > 0 && current <= menu.levels + res << "<a href='#{edit ? root + admin_page_path(page.id) : (page.class.to_s.eql?('Page') ? root + page.path : page.url)}'><span>#{page.title}</span></a>" + if page.visible_children.size > 0 && current < menu.levels res << "<span class='dot'></span>" res << menu_level(page, current_page, current + 1, menu, edit) end unless (page.root? rescue nil) @@ -43,20 +44,26 @@ module ParserCommon ad_banner = AdBanner.find(banner["id"]) rescue nil if ad_banner res << "<script type='text/javascript'> - $(document).ready(function(){ - $('#slideshow-#{ad_banner.title.dehumanize}').cycle({ - delay: -1000, - fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}', - timeoutFn: getTimeout, - pager: '#banner_nav', - pagerAnchorBuilder: function(idx, slide) { - return \"<li><a href='#'>sfdsfsf</a></li>\"; - } + jQuery(function( $ ){ + $.preload( '#slideshow-#{ad_banner.title.dehumanize} img', { + onFinish:finish, + threshold: 2 //'2' is the default, how many at a time, to load. + }); + function finish(){ + $('#slideshow-#{ad_banner.title.dehumanize}').cycle({ + delay: -1000, + fx: '#{ad_banner.ad_fx.nil? ? 'fade': ad_banner.ad_fx}', + timeoutFn: getTimeout, + pager: '#banner_nav', + pagerAnchorBuilder: function(idx, slide) { + return \"<li><a href='#'></a></li>\"; + } + }); + }; }); - }); </script>" res << "<ul id='banner_nav' class='clear'></ul>" - res << "<div id='slideshow-#{ad_banner.title.dehumanize}'>" + res << "<div id='slideshow-#{ad_banner.title.dehumanize}' class='slideshow'>" printable_ad_images = [] ad_banner.ad_images.each do |ad_image| if ad_image.display? @@ -66,13 +73,15 @@ module ParserCommon end end printable_ad_images.shuffle! + hide = printable_ad_images.size > 1 printable_ad_images.each do |ad_image| #TODO Need Reflact res << "<img src='#{ad_image.file}' " - res << "alt='#{ad_image.title[I18n.locale] || ' '}' " + res << "alt='#{ad_image.title || ' '}' " res << "time_to_next='#{ad_banner.transition_msec}' " res << "link_open='#{ad_image.link_open}' " # res << "link_url='#{(ad_image.direct_to_after_click?? ad_image.out_link : ad_banner.context) || ' '}' " - res << "link_url='#{(ad_image.out_link || ad_banner.context || ' ')}' " + res << "link_url='#{(ad_image.out_link)}' " + res << "style='#{'display:none;' if hide} #{'cursor:pointer;' if !ad_image.out_link.blank?}'" res << "/>" end res << "</div>" @@ -116,12 +125,12 @@ module ParserCommon res = '' if menu_page && menu_page.visible_children.size > 0 res << "<div class='category_list'>" - res << "<h3 class='h3'>#{menu_page.i18n_variable[I18n.locale]}</h3>" + res << "<h3 class='h3'>#{menu_page.title}</h3>" res << "<ul class='list'>" menu_page.visible_children.each do |child| res << "<li class='#{page.id.eql?(child.id) ? 'active' : nil}'>" root = "/" - res << "<a href='#{edit ? root + admin_page_path(child.id) : (child._type.eql?('Page') ? root + child.path : child.url)}'>#{child.i18n_variable[I18n.locale]}</a>" + res << "<a href='#{edit ? root + admin_page_path(child.id) : (child.class.to_s.eql?('Page') ? root + child.path : child.url)}'>#{child.title}</a>" res << "</li>" end res << "</ul>" @@ -138,7 +147,7 @@ module ParserCommon page_footer = body.css('.page_footer').first if page_footer res = "<div id='#{page_footer['id']}', class='#{page_footer['class']}'>" - res << @site.footer[I18n.locale] rescue nil + res << @site.footer rescue nil res << "</div>" fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) page_footer.swap(fragment) rescue nil @@ -152,7 +161,7 @@ module ParserCommon page_sub_menu = body.css('.page_sub_menu').first if page_sub_menu res = "<div id='#{page_sub_menu['id']}', class='#{page_sub_menu['class']}'>" - res << @site.sub_menu[I18n.locale] rescue nil + res << @site.sub_menu rescue nil res << "</div>" fragment = Nokogiri::HTML::DocumentFragment.new(body ,res) page_sub_menu.swap(fragment) rescue nil @@ -161,6 +170,15 @@ module ParserCommon end end + # sitemap + def parse_sitemaps(body = nil, page = nil, edit=nil) + sitemap = body.css('sitemap').first + url = admin_site_sitemap_frontend_path(@site) + options = "?inner=true" + fragment = Nokogiri::HTML::DocumentFragment.new(body, "<div class='dymanic_load' path='#{url + options}'></div>") + sitemap.swap(fragment) + end + # page_contents def parse_contents(body, page, edit=nil) public_r_tags = [] @@ -171,11 +189,11 @@ module ParserCommon if (content["main"] == "true" && !page.module_app.nil?) ret << "<div id='appfrontend' class='dymanic_load' path='/panel/#{page.module_app.key}/front_end/#{page.app_frontend_url}" ret << "/#{params[:id]}" if params[:id] && !params[:id].eql?(page.id.to_s) - ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}" + ret << "?inner=true&page_id=#{page.id}&category_id=#{category}&tag_id=#{tag}&preview=#{params[:preview]}&page_main=#{params[:page_main]}&search_query=#{params[:search_query]}&name=#{params[:name]}" ret << "'></div>" else part = page.page_parts.detect{ |p| p.name.to_s == content['name'].to_s } rescue nil - part_title = part.title[I18n.locale] rescue nil + part_title = part.title rescue nil if edit ret << "<div id='#{content['name']}' part_id='#{part.id}' class='editable' style='border:solid 1px; margin:5px; padding:5px;'>" if part ret << "<div class='edit_link' style='display:none'>" @@ -184,11 +202,11 @@ module ParserCommon end case part.kind when 'text' - ret << part.i18n_variable[I18n.locale] rescue '' + ret << part.content rescue '' when 'module_widget' url = "/panel/#{part.module_app.key}/widget/#{part.widget_path}?inner=true" - options = "&category_id=#{!part[:category].blank? ? part[:category] : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" - ret << "<div class='dymanic_load' path='#{url + options}'></div>" + options = "&category_id=#{!part[:category].blank? ? part[:category].blank? : category}&tag_id=#{!part[:tag].blank? ? part[:tag] : tag}&page=#{params[:page]}&search_query=#{params[:search_query]}&part_title=#{Rack::Utils.escape(part_title).gsub("+", "%20") rescue nil}&part_id=#{part.id}" + ret << "<div class='dymanic_load widget' path='#{url + options}'></div>" when 'public_r_tag' ret << "<r:#{part.public_r_tag} id='#{part.public_r_tag_object_id}'/>" public_r_tags << part.public_r_tag diff --git a/lib/resque_ext.rb b/lib/resque_ext.rb new file mode 100644 index 000000000..9717aa9c0 --- /dev/null +++ b/lib/resque_ext.rb @@ -0,0 +1,8 @@ +module ResqueExt + # + # ResqueExt.unregister_workers_for_host("ec210-250-192-51") + # + def self.unregister_workers_for_host(host) + Resque.workers.select{|worker| worker.id.split(':').first==host}.each(&:unregister_worker) + end +end \ No newline at end of file diff --git a/lib/tasks/data_migration.rake b/lib/tasks/data_migration.rake new file mode 100644 index 000000000..624cf39c3 --- /dev/null +++ b/lib/tasks/data_migration.rake @@ -0,0 +1,99 @@ +# encoding: utf-8 +require 'resque_scheduler/tasks' + +namespace :data_migration do + + task :add_order_to_announcement_tag_0703 => :environment do + AnnouncementTag.first({conditions:{ key: 'students' }}).update_attributes(:order=>1) + AnnouncementTag.first({conditions:{ key: 'alumni' }}).update_attributes(:order=>2) + AnnouncementTag.first({conditions:{ key: 'employee' }}).update_attributes(:order=>3) + AnnouncementTag.first({conditions:{ key: 'guest' }}).update_attributes(:order=>4) + end + + task :add_archive_func_to_bulletin_category_0704 => :environment do + BulletinCategory.all.each{|bc| bc.disable=false;bc.save!} + end + + + task :add_archive_func_to_news_bulletin_category_0704 => :environment do + NewsBulletinCategory.all.each{|bc| bc.disable=false;bc.save!} + end + + task :add_search_widget_to_news_and_announcement => :environment do + app = ModuleApp.first({:conditions=>{:title => 'news'}}) + app.widgets << "news_bulletins_search_block" if !app.widgets.include?("news_bulletins_search_block") + app.save! + app = ModuleApp.first({:conditions=>{:title => 'Announcement'}}) + app.widgets << "bulletins_search_block" if !app.widgets.include?("bulletins_search_block") + app.save! + p "==DO NOT FORGET TO RUN: rake redis_search:index" + end + + task :add_search_func => :environment do + ModuleApp.create!(:key=>'search',:title => 'search',:enable_frontend=> true,:app_pages=>["full_search","optional_search"]) + end + + task :rename_test_role_name => :environment do + sr = SubRole.first({conditions:{key: 'good_teacher' }}) + sr.i18n_variable[:zh_tw] = '銳論數位' + sr.i18n_variable[:en] = 'RulingCom' + sr.save! + sr = SubRole.first({conditions:{key: 'bad_teacher' }}) + sr.i18n_variable[:zh_tw] = '銳論數位' + sr.i18n_variable[:en] = 'RulingCom' + sr.save! + end + + task :make_bulletins_and_news_has_language_flag => :environment do + a = [] + i = 0 + [Bulletin,NewsBulletin].each do |bulletin| + puts "="*10 + bulletin.to_s + "="*10 + bulletin.admin_manager_all.each do |bt| + result = if (bt.save(:validate => false) rescue false ) + "OK" + else + a << bt.id + 'Failed' + end + i += 1 + puts((bt.title.to_s rescue '') + "----------#{result}") + end + end + p a + p i + puts("#{'='*10}Finished#{'='*10}") + end + + task :make_web_link_has_language_flag => :environment do + a=[] + i=0 + WebLink.all.each do |wl| + result = if (wl.save(:validate => false) rescue false ) + "OK" + else + a << wl.id + 'Failed' + end + i += 1 + puts((wl.title.to_s rescue '') + "----------#{result}") + end + p a + p i + puts("#{'='*10}Finished#{'='*10}") + end + + task :make_bulletin_save_dept_data => :environment do + Bulletin.all.each{|bt| bt.save!} + end + + task :extend_exsisted_app_module_for_dept_search => :environment do + app = ModuleApp.first({:conditions=>{:title => 'news'}}) + app.app_pages << "index_by_unit" if !app.widgets.include?("index_by_unit") + app.save! + app = ModuleApp.first({:conditions=>{:title => 'Announcement'}}) + app.app_pages << "index_by_unit" if !app.widgets.include?("index_by_unit") + app.save! + end + +end \ No newline at end of file diff --git a/lib/tasks/items.rake b/lib/tasks/items.rake index 7d94332ed..8889567da 100644 --- a/lib/tasks/items.rake +++ b/lib/tasks/items.rake @@ -3,7 +3,7 @@ namespace :items do task :tree_changes => :environment do Item.all.each do |item| - item.position -= item.position > 5 ? 2 : 1 + item.position -= 1 item.parent_ids = ancestors(item) item.rename(:full_name, :path) item.save diff --git a/lib/tasks/matt_dev.rake b/lib/tasks/matt_dev.rake new file mode 100644 index 000000000..ce0cd5093 --- /dev/null +++ b/lib/tasks/matt_dev.rake @@ -0,0 +1,60 @@ +# encoding: UTF-8 +namespace :matt_dev do + desc 'Testing Searching' + task :searching_01 => :environment do + a= Redis::Search.query("Bulletin",'我',:conditions =>{:is_checked=>true,:is_hidden=>false}) + p a + a= Redis::Search.query("NewsBulletin",'社科院',:conditions =>{:is_checked=>true,:is_hidden=>false}) + p a + end + + task :searching_02 => :environment do + a= Bulletin.solr_search do #("Bulletin",'我',:conditions =>{:is_checked=>true,:is_hidden=>false}) + fulltext '關島' + with(:frontend_search,true) + #with(:is_hidden,true) + end + p a.results + a= NewsBulletin.solr_search do #("NewsBulletin",'社科院',:conditions =>{:is_checked=>true,:is_hidden=>false}) + fulltext '社科院' + with(:frontend_search,true) + #with(:is_hidden,true) + end + p a.results + end + task :testing_new_tag_cal do + ranges = [[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5],[1,2,3,4,5,6],[1,2,3,4,5,6,7],[1,2,3,4,5,6,7,8],[1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9,10],[1,2,3,4,5,6,7,8,9,10,11],[1,2,3,4,5,6,7,8,9,10,11,12],[-1,-2,-3,-4,5,6,7,8,9,10,11,12]] + + ranges.each{ |range| + cal(range) + } + end +def cal(range_t) + range = range_t.sort.reverse + puts '='*20 + puts range.to_s + puts '='*20 + offset_size = range.size+4 + section_3 = range.last..range[-(offset_size/4)] + puts(section_3) + section_2 = range[-(offset_size/4)-1]..range[-2*(offset_size/4)] rescue nil + puts(section_2) + section_1 = range[-2*(offset_size/4)-1]..range[1] rescue nil + puts(section_1) + + range.each{|num| + result= case num + when range.first + :heading1 + when section_1 + :heading2 + when section_2 + :heading3 + when section_3 + :heading4 + end + puts "Num:#{num} Result: #{result}" + } + puts("END") + end +end diff --git a/lib/tasks/mid_site_sync.rake b/lib/tasks/mid_site_sync.rake new file mode 100644 index 000000000..e009f8619 --- /dev/null +++ b/lib/tasks/mid_site_sync.rake @@ -0,0 +1,171 @@ +# encoding: utf-8 +# require 'ruby-debug' +require "#{Rails.root}/config/initializers/middle_site_connection" + +namespace :mid_site do + desc "mid_site Rake task" + attr_from_mid = %w{nccu_id psn_nam ut_cod up_ut_cod eml_adr off_tel_ext sta_num} + officer_posgrp_code = %w{02 06 10 05} #from RSS2 + admin_role = nil + sub_role = nil + test_account_ldap_id ='139716' + #MiddleSiteConnection.establish + + task :sync => :environment do + info_profile = Info.first(conditions: {:key => 'profile'}) + + def find_or_create_sub_role(role,ut_query=[],key='') + sub_role = role.sub_roles.get_sub_role_from_key(key) + if sub_role.nil? + ut_data = ut_query.find{|ut_data| ut_data["ut_cod"] == key } + sub_role = role.sub_roles.create!(:key => key) + sub_role.title_translations ={"en" => (ut_data["ut_eng_m"] rescue ''), "zh_tw" => (ut_data["ut_chi_m"] rescue '')} + sub_role.save! + p "Created SubRole(key: #{key}): EN: #{sub_role.title_translations['en']}, CH: #{sub_role.title_translations['zh_tw']} ParentRole(#{role.key}): #{role.title_translations['en']}" + end + sub_role + end + + users_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')})") + ut_data_from_mid = $mid_site_connection.query("SELECT ut_odr, ut_cod, up_ut_cod, ut_chi_m, ut_eng_m FROM rss_paunit WHERE ut_tpe = '1' AND ut_grp != '3' AND up_ut_cod != 'F00' ORDER BY ut_odr, ut_cod") + remote_list = users_from_mid.collect{|t| t["nccu_id"]} + + #remove delete user sho has been deleted at remote first + local_need_remove = User.all.collect{|t| t.nccu_id rescue nil}.uniq.delete_if {|x| x == nil} - remote_list + desc "Going to delete User with IDs: #{local_need_remove.inspect}" + local_need_remove = User.excludes(nccu_ldap_uid: test_account_ldap_id ).collect{|t| t.nccu_ldap_uid rescue nil}.uniq.delete_if {|x| x == nil} - remote_list + AppManager.all.collect{|am| am if am.user.nil? }.delete_if {|x| x == nil}.each{|am| am.destroy} + desc "Deletion completed! \n" + + #starting update user + desc "Updating and Newing Users" + + users_from_mid.each do |mid_user| + ut_item = ut_data_from_mid.find{|ut_data| ut_data["ut_cod"] == mid_user["ut_cod"]} + up_ut_item = ut_data_from_mid.find{|ut_data| ut_data["ut_cod"] == mid_user["up_ut_cod"] } + local_user = User.find_or_initialize_by(:nccu_ldap_uid => mid_user["nccu_id"]) + users_name_from_mid = $mid_site_connection.query("SELECT eng_nam_l,eng_nam_f,chi_nam_l,chi_nam_f FROM rss_zzperson_view WHERE nccu_id =#{mid_user["nccu_id"]}").first + + + first_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name') + last_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name') + + first_name['en'] = users_name_from_mid["eng_nam_f"] + first_name['zh_tw'] = users_name_from_mid["chi_nam_f"] + first_name.save + + last_name['en'] = users_name_from_mid["eng_nam_l"] + last_name['zh_tw'] = users_name_from_mid["chi_nam_l"] + last_name.save + + + user_model_mapper = Hash[:ut_cod => mid_user["ut_cod"] ,:up_ut_cod => mid_user["up_ut_cod"],:email => mid_user["eml_adr"],:off_tel_ext => mid_user["off_tel_ext"],:sta_num => mid_user["sta_num"]] + user_model_mapper[:admin] = false + local_user.update_attributes(user_model_mapper) + + + local_user.role = Role.find_or_create_by( :key => "department_admin",:build_in => true) + local_user.role.title_translations = {"en" => 'Department Admin', "zh_tw" => '系所使用者' } + + + unless local_user.ut_cod == local_user.up_ut_cod #if the ut_cod has additions info for up ut + local_user.sub_roles << find_or_create_sub_role(local_user.role,ut_data_from_mid,local_user.up_ut_cod) + end + + local_user.sub_roles << find_or_create_sub_role(local_user.role,ut_data_from_mid,local_user.ut_cod) + + local_user.save! + end + sys_users = User.all(conditions: {admin: false}).includes(:avatar).to_a + Rails.cache.write('user_setting', sys_users) + end + + + + task :install_admin => :before_instll_admin do + admins_nccu_id = '2772' + info_profile = Info.first(conditions: {:key => 'profile'}) + + user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE posgrp_cod IN (#{officer_posgrp_code.join(',')}) AND nccu_id = '#{admins_nccu_id}' limit 1") + admin_at_mid = user_from_mid.first + + local_user = User.find_or_initialize_by(:nccu_ldap_uid => admin_at_mid["nccu_id"]) + local_user.update_attributes(:email => admin_at_mid["eml_adr"], :admin => true, :role_id => admin_role.id, :sub_role_ids => [sub_role.id]) + users_name_from_mid = $mid_site_connection.query("SELECT eng_nam_l,eng_nam_f,chi_nam_l,chi_nam_f FROM rss_zzperson_view WHERE nccu_id =#{admin_at_mid["nccu_id"]}").first + + first_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name') + last_name = AttributeValue.find_or_create_by( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name') + + first_name['en'] = users_name_from_mid["eng_nam_f"] + first_name['zh_tw'] = users_name_from_mid["chi_nam_f"] + first_name.save + + last_name['en'] = users_name_from_mid["eng_nam_l"] + last_name['zh_tw'] = users_name_from_mid["chi_nam_l"] + last_name.save + + end + + task :install_test => :before_instll_admin do + admins_nccu_id = '139716' + # admin_role = Role.find_or_create_by( key: 'administrator') + # sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center') + info_profile = Info.first(conditions: {:key => 'profile'}) + + user_from_mid = $mid_site_connection.query("SELECT #{attr_from_mid.join(',')} FROM rss_pautlst_ut WHERE nccu_id = '#{admins_nccu_id}' limit 1") + admin_at_mid = user_from_mid.first + user_first_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][3..-1] : admin_at_mid["psn_nam"][1..-1] + user_last_name = admin_at_mid["psn_nam"].size > 3 ? admin_at_mid["psn_nam"][1..2] : admin_at_mid["psn_nam"][0] + local_user = User.find_or_initialize_by(:nccu_ldap_uid => admin_at_mid["nccu_id"]) + local_user.update_attributes(:email => admin_at_mid["eml_adr"], :admin => true, :role_id => admin_role.id, :sub_role_ids => [sub_role.id]) + + AttributeValue.create( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[0].id, :key => 'first_name', :en => user_first_name, :zh_tw => user_first_name ) + AttributeValue.create( :user_id => local_user.id, :attribute_field_id => info_profile.attribute_fields[1].id, :key => 'last_name', :en => user_last_name, :zh_tw => user_last_name ) + + end + + task :before_instll_admin => :environment do + + var_1 = {"en" => 'Administrator', "zh_tw" => '管理員' } + var_1_1 = {"en" => 'Computer Center', "zh_tw" => '計算機中心'} + + admin_role = Role.find_or_create_by( :key => 'administrator',:built_in => true) + admin_role.title_translations =var_1 + admin_role.save! + + sub_role = admin_role.sub_roles.find_or_create_by(:key => 'computer_center', :built_in => true) + sub_role.title_translations =var_1_1 + sub_role.save! + + #var_1_1_1 = I18nVariable.create!( :document_class => 'Attribute', :key => 'field', :en => 'Field', :zh_tw => '領域', :parent_id => var_1_1.id ) + #var_1_1_2 = I18nVariable.create!( :document_class => 'Attribute', :key => 'department', :en => 'Department', :zh_tw => '學系', :parent_id => var_1_1.id ) + + end + + + task :clean_local_account => :environment do + User.remote_account.each{|user| user.destroy} + end + + task :claen_cc => [:clean_i18n_vars,:clean_admin_role_and_sub_role] do + + end + + task :clean_i18n_vars => :environment do + i18ns = I18nVariable.any_in( key: ['administrator','computer_center']) + i18ns.each { |var| var.destroy } + end + + task :clean_ldap_users => :environment do + User.where(:nccu_ldap_uid.ne => nil ).each {|t| t.destroy} + end + + task :clean_admin_role_and_sub_role => :environment do + data = Role.any_in( key: ['administrator','computer_center']) + data.each { |var| var.destroy } + + data = SubRole.any_in( key: ['administrator','computer_center']) + data.each { |var| var.destroy } + + end +end diff --git a/lib/tasks/migrate.rake b/lib/tasks/migrate.rake new file mode 100644 index 000000000..8b92ea9eb --- /dev/null +++ b/lib/tasks/migrate.rake @@ -0,0 +1,359 @@ +# encoding: utf-8 + +namespace :migrate do + + task :i18n => :environment do + + p 'Start Bulletin' + bulletins = Bulletin.admin_manager_all + i = 1 + bulletins.each do |bulletin| + p "#{i}/#{bulletins.size} - #{bulletin.id}" + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle + text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => bulletin.id, :language_value_type => bulletin.class}) + bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text + p bulletin.save(:validate => false) + i += 1 + end + p 'End Bulletin' + + p '=====================================================' + + p 'Start BulletinCategory' + categories = BulletinCategory.admin_manager_all + i = 1 + categories.each do |category| + p "#{i}/#{categories.size} - #{category.id}" + title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class}) + category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p category.save(:validate => false) + i += 1 + end + p 'End BulletinCategory' + + p '=====================================================' + + p 'Start BulletinFile' + files = BulletinFile.all + i = 1 + files.each do |file| + p "#{i}/#{files.size} - #{file.id}" + description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description + title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p file.save(:validate => false) + i += 1 + end + p 'End BulletinFile' + + p '=====================================================' + + p 'Start BulletinLink' + links = BulletinLink.all + i = 1 + links.each do |link| + p "#{i}/#{links.size} - #{link.id}" + title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class}) + link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p link.save(:validate => false) + i += 1 + end + p 'End BulletinLink' + + p '=====================================================' + + p 'Start UnitListForAnc' + units = UnitListForAnc.all + i = 1 + units.each do |unit| + p "#{i}/#{units.size} - #{unit.id}" + title = I18nVariable.first(:conditions => {:language_value_id => unit.id, :language_value_type => unit.class}) + unit.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p unit.save(:validate => false) + i += 1 + end + p 'End UnitListForAnc' + + p '=====================================================' + p '=====================================================' + + p 'Start NewsBulletin' + news_bulletins = NewsBulletin.admin_manager_all + i = 1 + news_bulletins.each do |news_bulletin| + p "#{i}/#{news_bulletins.size} - #{news_bulletin.id}" + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class}) + news_bulletin.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + subtitle = I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class}) + news_bulletin.subtitle_translations = {'en' => subtitle['en'], 'zh_tw' => subtitle['zh_tw']} if subtitle + text = I18nVariable.first(:conditions => {:key => 'text', :language_value_id => news_bulletin.id, :language_value_type => news_bulletin.class}) + news_bulletin.text_translations = {'en' => text['en'], 'zh_tw' => text['zh_tw']} if text + p news_bulletin.save(:validate => false) + i += 1 + end + p 'End NewsBulletin' + + p '=====================================================' + + p 'Start NewsBulletinCategory' + categories = NewsBulletinCategory.admin_manager_all + i = 1 + categories.each do |category| + p "#{i}/#{categories.size} - #{category.id}" + title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class}) + category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p category.save(:validate => false) + i += 1 + end + p 'End NewsBulletinCategory' + + p '=====================================================' + + p 'Start NewsBulletinFile' + files = NewsBulletinFile.all + i = 1 + files.each do |file| + p "#{i}/#{files.size} - #{file.id}" + description = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description + title = I18nVariable.first(:conditions => {:language_value_id => file.id, :language_value_type => file.class}) + file.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p file.save(:validate => false) + i += 1 + end + p 'End NewsBulletinFile' + + p '=====================================================' + + p 'Start NewsBulletinLink' + links = NewsBulletinLink.all + i = 1 + links.each do |link| + p "#{i}/#{links.size} - #{link.id}" + title = I18nVariable.first(:conditions => {:language_value_id => link.id, :language_value_type => link.class}) + link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p link.save(:validate => false) + i += 1 + end + p 'End NewsBulletinLink' + + p '=====================================================' + p '=====================================================' + + p 'Start PageContext' + page_contexts = PageContext.all + i = 1 + page_contexts.each do |page_context| + p "#{i}/#{page_contexts.size} - #{page_context.id}" + context = I18nVariable.first(:conditions => {:language_value_id => page_context.id, :language_value_type => page_context.class}) + page_context.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context + p page_context.save(:validate => false) + i += 1 + end + p 'End PageContext' + + p '=====================================================' + p '=====================================================' + + p 'Start WebLink' + links = WebLink.all + i = 1 + links.each do |link| + p "#{i}/#{links.size} - #{link.id}" + # the original key was 'name' + title = I18nVariable.first(:conditions => {:key => 'name', :language_value_id => link.id, :language_value_type => link.class}) + link.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + context = I18nVariable.first(:conditions => {:key => 'context', :language_value_id => link.id, :language_value_type => link.class}) + link.context_translations = {'en' => context['en'], 'zh_tw' => context['zh_tw']} if context + p link.save(:validate => false) + i += 1 + end + p 'End WebLink' + + p '=====================================================' + + p 'Start WebLinkCategory' + categories = WebLinkCategory.admin_manager_all + i = 1 + categories.each do |category| + p "#{i}/#{categories.size} - #{category.id}" + title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class}) + category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p category.save(:validate => false) + i += 1 + end + p 'End WebLinkCategory' + + p '=====================================================' + p '=====================================================' + + p 'Start Meta' + metas = Meta.all + i = 1 + metas.each do |meta| + p "#{i}/#{metas.size} - #{meta.id}" + title = I18nVariable.first(:conditions => {:language_value_id => meta.id, :language_value_type => meta.class}) + meta.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p meta.save(:validate => false) + i += 1 + end + p 'End Meta' + + p '=====================================================' + p '=====================================================' + + p 'Start Attribute' + attributes = Attribute.all + i = 1 + attributes.each do |attribute| + p "#{i}/#{attributes.size} - #{attribute.id}" + title = I18nVariable.first(:conditions => {:language_value_id => attribute.id, :language_value_type => attribute.class}) + attribute.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p attribute.save(:validate => false) + i += 1 + end + p 'End Attribute' + + p '=====================================================' + + p 'Start AttributeField' + attribute_fields = AttributeField.all + i = 1 + attribute_fields.each do |attribute_field| + p "#{i}/#{attribute_fields.size} - #{attribute_field.id}" + title = I18nVariable.first(:conditions => {:language_value_id => attribute_field.id, :language_value_type => attribute_field.class}) + attribute_field.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p attribute_field.save(:validate => false) + i += 1 + end + p 'End AttributeField' + + p '=====================================================' + + p 'Start Role' + roles = Role.all + i = 1 + roles.each do |role| + p "#{i}/#{roles.size} - #{role.id}" + title = I18nVariable.first(:conditions => {:language_value_id => role.id, :language_value_type => role.class}) + role.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p role.save(:validate => false) + i += 1 + end + p 'End Role' + + p '=====================================================' + p '=====================================================' + + p 'Start AdImage' + ad_images = AdImage.all + i = 1 + ad_images.each do |image| + p "#{i}/#{ad_images.size} - #{image.id}" + # no key is set and title = context, this is due to original error in the code + title = I18nVariable.first(:conditions => {:language_value_id => image.id, :language_value_type => image.class}) + image.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + image.context_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p image.save(:validate => false) + i += 1 + end + p 'End AdImage' + + p '=====================================================' + p '=====================================================' + + p 'Start Asset' + assets = Asset.all + i = 1 + assets.each do |asset| + p "#{i}/#{assets.size} - #{asset.id}" + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => asset.id, :language_value_type => asset.class}) + asset.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + description = I18nVariable.first(:conditions => {:key => 'description', :language_value_id => asset.id, :language_value_type => asset.class}) + asset.description_translations = {'en' => description['en'], 'zh_tw' => description['zh_tw']} if description + p asset.save(:validate => false) + i += 1 + end + p 'End Asset' + + p '=====================================================' + + p 'Start AssetCategory' + categories = AssetCategory.all + i = 1 + categories.each do |category| + p "#{i}/#{categories.size} - #{category.id}" + title = I18nVariable.first(:conditions => {:language_value_id => category.id, :language_value_type => category.class}) + category.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p category.save(:validate => false) + i += 1 + end + p 'End AssetCategory' + + p '=====================================================' + p '=====================================================' + + p 'Start Item' + items = Item.all + i = 1 + items.each do |item| + p "#{i}/#{items.size} - #{item.id}" + title = I18nVariable.first(:conditions => {:language_value_id => item.id, :language_value_type => item.class}) + item.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p item.save(:validate => false) + i += 1 + end + p 'End Item' + + p '=====================================================' + + p 'Start Page' + pages = Page.all + i = 1 + pages.each do |item| + p "#{i}/#{pages.size} - #{item.id}" + # the key was originally 'title', changed to 'page_title' to avoit conflict with parent + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => item.id, :language_value_type => item.class}) + item.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + p item.save(:validate => false) + i += 1 + end + p 'End Page' + + p '=====================================================' + + p 'Start PagePart' + page_parts = PagePart.all + i = 1 + page_parts.each do |part| + p "#{i}/#{page_parts.size} - #{part.id}" + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => part.id, :language_value_type => part.class}) + part.page_title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + content = I18nVariable.first(:conditions => {:key => 'i18n_variable', :language_value_id => part.id, :language_value_type => part.class}) + part.content_translations = {'en' => content['en'], 'zh_tw' => content['zh_tw']} if content + p part.save(:validate => false) + i += 1 + end + p 'End PagePart' + + p '=====================================================' + p '=====================================================' + + p 'Start Site' + site = Site.first + title = I18nVariable.first(:conditions => {:key => 'title', :language_value_id => site.id, :language_value_type => site.class}) + site.title_translations = {'en' => title['en'], 'zh_tw' => title['zh_tw']} if title + footer = I18nVariable.first(:conditions => {:key => 'footer', :language_value_id => site.id, :language_value_type => site.class}) + site.footer_translations = {'en' => footer['en'], 'zh_tw' => footer['zh_tw']} if footer + sub_menu = I18nVariable.first(:conditions => {:key => 'sub_menu', :language_value_id => site.id, :language_value_type => site.class}) + site.sub_menu_translations = {'en' => sub_menu['en'], 'zh_tw' => sub_menu['zh_tw']} if sub_menu + p site.save(:validate => false) + p 'End Site' + + end + +end diff --git a/log/sunspot-solr-development.log.1 b/log/sunspot-solr-development.log.1 new file mode 100644 index 000000000..049dd80c3 --- /dev/null +++ b/log/sunspot-solr-development.log.1 @@ -0,0 +1,222 @@ +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: JNDI not configured for solr (NoInitialContextEx) +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: using system property solr.solr.home: /Users/kaito/Documents/MyWorkspeace/NCCU/solr +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader <init> +INFO: Solr home set to '/Users/kaito/Documents/MyWorkspeace/NCCU/solr/' +Jun 18, 2012 4:30:20 PM org.apache.solr.servlet.SolrDispatchFilter init +INFO: SolrDispatchFilter.init() +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: JNDI not configured for solr (NoInitialContextEx) +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: using system property solr.solr.home: /Users/kaito/Documents/MyWorkspeace/NCCU/solr +Jun 18, 2012 4:30:20 PM org.apache.solr.core.CoreContainer$Initializer initialize +INFO: looking for solr.xml: /Users/kaito/Documents/MyWorkspeace/NCCU/solr/solr.xml +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrResourceLoader <init> +INFO: Solr home set to '/Users/kaito/Documents/MyWorkspeace/NCCU/solr/' +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrConfig initLibs +INFO: Adding specified lib dirs to ClassLoader +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrConfig <init> +INFO: Loaded SolrConfig: solrconfig.xml +Jun 18, 2012 4:30:20 PM org.apache.solr.core.SolrCore <init> +INFO: Opening new SolrCore at /Users/kaito/Documents/MyWorkspeace/NCCU/solr/, dataDir=/Users/kaito/Documents/MyWorkspeace/NCCU/solr/data/development/ +Jun 18, 2012 4:30:20 PM org.apache.solr.schema.IndexSchema readSchema +INFO: Reading Solr Schema +Jun 18, 2012 4:30:21 PM org.apache.solr.schema.IndexSchema readSchema +INFO: Schema name=sunspot +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created string: org.apache.solr.schema.StrField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created tdouble: org.apache.solr.schema.TrieDoubleField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created rand: org.apache.solr.schema.RandomSortField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created null: org.apache.solr.analysis.StandardTokenizerFactory +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created null: org.apache.solr.analysis.StandardFilterFactory +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created null: org.apache.solr.analysis.LowerCaseFilterFactory +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created text: org.apache.solr.schema.TextField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created boolean: org.apache.solr.schema.BoolField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created date: org.apache.solr.schema.DateField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created sdouble: org.apache.solr.schema.SortableDoubleField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created sfloat: org.apache.solr.schema.SortableFloatField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created sint: org.apache.solr.schema.SortableIntField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created slong: org.apache.solr.schema.SortableLongField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created tint: org.apache.solr.schema.TrieIntField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created tfloat: org.apache.solr.schema.TrieFloatField +Jun 18, 2012 4:30:21 PM org.apache.solr.util.plugin.AbstractPluginLoader load +INFO: created tdate: org.apache.solr.schema.TrieDateField +Jun 18, 2012 4:30:21 PM org.apache.solr.schema.IndexSchema readSchema +INFO: default search field is text +Jun 18, 2012 4:30:21 PM org.apache.solr.schema.IndexSchema readSchema +INFO: query parser default operator is AND +Jun 18, 2012 4:30:21 PM org.apache.solr.schema.IndexSchema readSchema +INFO: unique key field: id +Jun 18, 2012 4:30:21 PM org.apache.solr.core.JmxMonitoredMap <init> +INFO: No JMX servers found, not exposing Solr information with JMX. +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrCore initListeners +INFO: Added SolrEventListener: org.apache.solr.core.QuerySenderListener{queries=[]} +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrCore initListeners +INFO: Added SolrEventListener: org.apache.solr.core.QuerySenderListener{queries=[{q=solr rocks,start=0,rows=10}, {q=static firstSearcher warming query from solrconfig.xml}]} +Jun 18, 2012 4:30:21 PM org.apache.solr.request.XSLTResponseWriter init +INFO: xsltCacheLifetimeSeconds=5 +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created standard: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created dismax: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created partitioned: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /spell: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created tvrh: org.apache.solr.handler.component.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: adding lazy requestHandler: org.apache.solr.handler.extraction.ExtractingRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /update/extract: org.apache.solr.handler.extraction.ExtractingRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /terms: org.apache.solr.handler.component.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: adding lazy requestHandler: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /elevate: solr.SearchHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /update: solr.XmlUpdateRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /update/javabin: solr.BinaryUpdateRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /analysis/document: solr.DocumentAnalysisRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /analysis/field: solr.FieldAnalysisRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: adding lazy requestHandler: solr.CSVRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /update/csv: solr.CSVRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /admin/: org.apache.solr.handler.admin.AdminHandlers +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /admin/ping: PingRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /debug/dump: solr.DumpRequestHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.core.RequestHandlers initHandlersFromConfig +INFO: created /mlt: solr.MoreLikeThisHandler +Jun 18, 2012 4:30:21 PM org.apache.solr.search.SolrIndexSearcher <init> +INFO: Opening Searcher@3b5b123b main +Jun 18, 2012 4:30:21 PM org.apache.solr.update.DirectUpdateHandler2$CommitTracker <init> +INFO: AutoCommit: disabled +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SpellCheckComponent inform +INFO: Initializing spell checkers +Jun 18, 2012 4:30:21 PM org.apache.solr.spelling.AbstractLuceneSpellChecker init +INFO: Using WhitespaceAnalzyer for dictionary: default +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SpellCheckComponent inform +WARNING: No queryConverter defined, using default converter +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.QueryElevationComponent inform +INFO: Loading QueryElevation from: /Users/kaito/Documents/MyWorkspeace/NCCU/solr/conf/elevate.xml +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.QueryComponent@7dc21ece +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.FacetComponent@5374a6e2 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.MoreLikeThisComponent@f786a3c +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.HighlightComponent@2a869113 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.StatsComponent@689e8c34 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding debug component:org.apache.solr.handler.component.DebugComponent@106df95 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.QueryComponent@7dc21ece +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.FacetComponent@5374a6e2 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.MoreLikeThisComponent@f786a3c +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.HighlightComponent@2a869113 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.StatsComponent@689e8c34 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding debug component:org.apache.solr.handler.component.DebugComponent@106df95 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.QueryComponent@7dc21ece +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.FacetComponent@5374a6e2 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.MoreLikeThisComponent@f786a3c +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.HighlightComponent@2a869113 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.StatsComponent@689e8c34 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding debug component:org.apache.solr.handler.component.DebugComponent@106df95 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.QueryComponent@7dc21ece +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.FacetComponent@5374a6e2 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.MoreLikeThisComponent@f786a3c +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.HighlightComponent@2a869113 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.StatsComponent@689e8c34 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.SpellCheckComponent@6a40afb9 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding debug component:org.apache.solr.handler.component.DebugComponent@106df95 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.QueryComponent@7dc21ece +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.FacetComponent@5374a6e2 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.MoreLikeThisComponent@f786a3c +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.HighlightComponent@2a869113 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.StatsComponent@689e8c34 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.TermVectorComponent@3cd0d12e +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding debug component:org.apache.solr.handler.component.DebugComponent@106df95 +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SearchHandler inform +INFO: Adding component:org.apache.solr.handler.component.TermsComponent@31554233 +Jun 18, 2012 4:30:21 PM org.apache.solr.core.QuerySenderListener newSearcher +INFO: QuerySenderListener sending requests to Searcher@3b5b123b main +Jun 18, 2012 4:30:21 PM org.apache.solr.core.CoreContainer register +INFO: registering core: +Jun 18, 2012 4:30:21 PM org.apache.solr.servlet.SolrDispatchFilter init +INFO: user.dir=/Users/kaito/.rvm/gems/ruby-1.9.2-p290@orbit/gems/sunspot_solr-1.3.3/solr +Jun 18, 2012 4:30:21 PM org.apache.solr.servlet.SolrDispatchFilter init +INFO: SolrDispatchFilter.init() done +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrCore execute +INFO: [] webapp=null path=null params={start=0&event=firstSearcher&q=solr+rocks&rows=10} hits=0 status=0 QTime=43 +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrCore execute +INFO: [] webapp=null path=null params={event=firstSearcher&q=static+firstSearcher+warming+query+from+solrconfig.xml} hits=0 status=0 QTime=1 +Jun 18, 2012 4:30:21 PM org.apache.solr.core.QuerySenderListener newSearcher +INFO: QuerySenderListener done. +Jun 18, 2012 4:30:21 PM org.apache.solr.handler.component.SpellCheckComponent$SpellCheckerListener newSearcher +INFO: Loading spell index for spellchecker: default +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrCore registerSearcher +INFO: [] Registered new searcher Searcher@3b5b123b main +Jun 18, 2012 4:30:21 PM org.apache.solr.servlet.SolrServlet init +INFO: SolrServlet.init() +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: JNDI not configured for solr (NoInitialContextEx) +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: using system property solr.solr.home: /Users/kaito/Documents/MyWorkspeace/NCCU/solr +Jun 18, 2012 4:30:21 PM org.apache.solr.servlet.SolrServlet init +INFO: SolrServlet.init() done +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: JNDI not configured for solr (NoInitialContextEx) +Jun 18, 2012 4:30:21 PM org.apache.solr.core.SolrResourceLoader locateSolrHome +INFO: using system property solr.solr.home: /Users/kaito/Documents/MyWorkspeace/NCCU/solr +Jun 18, 2012 4:30:21 PM org.apache.solr.servlet.SolrUpdateServlet init +INFO: SolrUpdateServlet.init() done diff --git a/public/static/kernel.js b/public/static/kernel.js index c5b9a8a6a..38cffeefe 100644 --- a/public/static/kernel.js +++ b/public/static/kernel.js @@ -12,9 +12,9 @@ $(document).ready(function() { }); function ajax_load_proc(wapper,url){ - wapper.load(url,function(respText,textSta,XML){ + wapper.load(encodeURI(url),function(respText,textSta,XML){ if(textSta == 'error') - wapper.html("Loading Failed"); + wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>"); }); } @@ -26,14 +26,17 @@ function getTimeout() { $(document).ready(function() { $('.slideshow').children('img').click(function() { - if($(this).attr('link_open')=='new_window') + if($(this).attr('link_url')!='') { - window.open($(this).attr('link_url')); + if($(this).attr('link_open')=='new_window') + { + window.open($(this).attr('link_url')); } - else - { - document.location.href=$(this).attr('link_url') + else + { + document.location.href=$(this).attr('link_url') } + } }) }); // Ad Banner FX code [end] diff --git a/public/static/nccu_calendar.xml b/public/static/nccu_calendar.xml index 0a78dc7f5..e903ac458 100644 --- a/public/static/nccu_calendar.xml +++ b/public/static/nccu_calendar.xml @@ -2,63 +2,135 @@ <feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"> <title>國立政治大學校園活動行事曆 - 本日最新活動 + 本月最新活動 zh-tw - 2012年世界狂歡節-「框」住瞬間「框」住世界 - + 政大講座論壇:東亞模式的民法典?(蘇永欽講座教授) + - 101/05/01-101/05/08 00:00-23:59 + 101/06/04 10:10-11:50 - 2012年世界狂歡節-環友世界 - + 文化講座【父親與民國】-白先勇 + - 101/05/01-101/05/10 00:00-23:59 + 101/06/06 14:00-16:00 - 2012年世界狂歡節-從政大看台灣 - + 鄭丁旺講座教授榮退專題演講-我國會計發展的回顧與前瞻 + - 101/05/01-101/05/10 08:00-22:00 + 101/06/07 10:00-12:30 - 2012年世界狂歡節-美食嘉年華 - + 弦樂社 + - 101/05/08-101/05/10 12:00-14:00 + 政大弦樂社期末成果發表音樂會 - 2012年世界狂歡節-「原,夜」晚會 - + 期末舞展 + - 101/05/08 19:00-21:00 + 政大國標社期末舞展 歡迎大家來共襄盛舉 - 2012年世界狂歡節-開幕式 - + 國際學院運動會 + - 101/05/08 12:10-13:30 + 101/06/09 08:00-17:00 - 職場講座「數位文本實務課程」 - + IELTS雅思校園考 + - 101/04/24-101/05/15 12:20-13:50 + 101/06/09 09:00-17:00 + + + 政橄隊慶 + + + + + 101/06/09 11:00-18:00 + + + 傳院頂大計畫「與未來對話:新的使用者體驗」交流會 + + + + + 101/06/09 13:00-17:30 + + + 2012年福祿貝爾恩物親子戲遊成長團體(下午) + + + + + 101/04/07-101/06/09 14:00-16:00 + + + 商院盃排球賽 + + + + + 101/06/10 08:00-17:00 + + + 教職員羽球賽 + + + + + 101/06/16 08:00-12:00 + + + 「樂活飲食•健康之鑰」系列活動--餐飲實務操作與食品安全 + + + + + 101/06/22 14:00-16:00 + + + 學生議會預備會議 + + + + + 第13屆學生議會第1會期預備會議,將選舉新任學生議會議長、副議長,歡迎政大同學列席旁聽!! + + + 山水講堂:政大教學日 + + + + + 101/06/26 08:20-16:40 + + + 「樂活飲食•健康之鑰」系列活動--廚房消毒與病媒防治 + + + + + 101/06/29 14:00-16:00 diff --git a/solr/conf/admin-extra.html b/solr/conf/admin-extra.html new file mode 100644 index 000000000..aa739da86 --- /dev/null +++ b/solr/conf/admin-extra.html @@ -0,0 +1,31 @@ + + + diff --git a/solr/conf/elevate.xml b/solr/conf/elevate.xml new file mode 100644 index 000000000..7630ebe20 --- /dev/null +++ b/solr/conf/elevate.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + diff --git a/solr/conf/mapping-ISOLatin1Accent.txt b/solr/conf/mapping-ISOLatin1Accent.txt new file mode 100644 index 000000000..ede774258 --- /dev/null +++ b/solr/conf/mapping-ISOLatin1Accent.txt @@ -0,0 +1,246 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Syntax: +# "source" => "target" +# "source".length() > 0 (source cannot be empty.) +# "target".length() >= 0 (target can be empty.) + +# example: +# "À" => "A" +# "\u00C0" => "A" +# "\u00C0" => "\u0041" +# "ß" => "ss" +# "\t" => " " +# "\n" => "" + +# À => A +"\u00C0" => "A" + +# Á => A +"\u00C1" => "A" + +#  => A +"\u00C2" => "A" + +# à => A +"\u00C3" => "A" + +# Ä => A +"\u00C4" => "A" + +# Å => A +"\u00C5" => "A" + +# Æ => AE +"\u00C6" => "AE" + +# Ç => C +"\u00C7" => "C" + +# È => E +"\u00C8" => "E" + +# É => E +"\u00C9" => "E" + +# Ê => E +"\u00CA" => "E" + +# Ë => E +"\u00CB" => "E" + +# Ì => I +"\u00CC" => "I" + +# Í => I +"\u00CD" => "I" + +# Î => I +"\u00CE" => "I" + +# Ï => I +"\u00CF" => "I" + +# IJ => IJ +"\u0132" => "IJ" + +# Ð => D +"\u00D0" => "D" + +# Ñ => N +"\u00D1" => "N" + +# Ò => O +"\u00D2" => "O" + +# Ó => O +"\u00D3" => "O" + +# Ô => O +"\u00D4" => "O" + +# Õ => O +"\u00D5" => "O" + +# Ö => O +"\u00D6" => "O" + +# Ø => O +"\u00D8" => "O" + +# Œ => OE +"\u0152" => "OE" + +# Þ +"\u00DE" => "TH" + +# Ù => U +"\u00D9" => "U" + +# Ú => U +"\u00DA" => "U" + +# Û => U +"\u00DB" => "U" + +# Ü => U +"\u00DC" => "U" + +# Ý => Y +"\u00DD" => "Y" + +# Ÿ => Y +"\u0178" => "Y" + +# à => a +"\u00E0" => "a" + +# á => a +"\u00E1" => "a" + +# â => a +"\u00E2" => "a" + +# ã => a +"\u00E3" => "a" + +# ä => a +"\u00E4" => "a" + +# å => a +"\u00E5" => "a" + +# æ => ae +"\u00E6" => "ae" + +# ç => c +"\u00E7" => "c" + +# è => e +"\u00E8" => "e" + +# é => e +"\u00E9" => "e" + +# ê => e +"\u00EA" => "e" + +# ë => e +"\u00EB" => "e" + +# ì => i +"\u00EC" => "i" + +# í => i +"\u00ED" => "i" + +# î => i +"\u00EE" => "i" + +# ï => i +"\u00EF" => "i" + +# ij => ij +"\u0133" => "ij" + +# ð => d +"\u00F0" => "d" + +# ñ => n +"\u00F1" => "n" + +# ò => o +"\u00F2" => "o" + +# ó => o +"\u00F3" => "o" + +# ô => o +"\u00F4" => "o" + +# õ => o +"\u00F5" => "o" + +# ö => o +"\u00F6" => "o" + +# ø => o +"\u00F8" => "o" + +# œ => oe +"\u0153" => "oe" + +# ß => ss +"\u00DF" => "ss" + +# þ => th +"\u00FE" => "th" + +# ù => u +"\u00F9" => "u" + +# ú => u +"\u00FA" => "u" + +# û => u +"\u00FB" => "u" + +# ü => u +"\u00FC" => "u" + +# ý => y +"\u00FD" => "y" + +# ÿ => y +"\u00FF" => "y" + +# ff => ff +"\uFB00" => "ff" + +# fi => fi +"\uFB01" => "fi" + +# fl => fl +"\uFB02" => "fl" + +# ffi => ffi +"\uFB03" => "ffi" + +# ffl => ffl +"\uFB04" => "ffl" + +# ſt => ft +"\uFB05" => "ft" + +# st => st +"\uFB06" => "st" diff --git a/solr/conf/protwords.txt b/solr/conf/protwords.txt new file mode 100644 index 000000000..1dfc0abec --- /dev/null +++ b/solr/conf/protwords.txt @@ -0,0 +1,21 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# Use a protected word file to protect against the stemmer reducing two +# unrelated words to the same base word. + +# Some non-words that normally won't be encountered, +# just to test that they won't be stemmed. +dontstems +zwhacky + diff --git a/solr/conf/schema.xml b/solr/conf/schema.xml new file mode 100644 index 000000000..17a751ad0 --- /dev/null +++ b/solr/conf/schema.xml @@ -0,0 +1,238 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + text + + + + diff --git a/solr/conf/scripts.conf b/solr/conf/scripts.conf new file mode 100644 index 000000000..f58b262ae --- /dev/null +++ b/solr/conf/scripts.conf @@ -0,0 +1,24 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +user= +solr_hostname=localhost +solr_port=8983 +rsyncd_port=18983 +data_dir= +webapp_name=solr +master_host= +master_data_dir= +master_status_dir= diff --git a/solr/conf/solrconfig.xml b/solr/conf/solrconfig.xml new file mode 100644 index 000000000..65c196073 --- /dev/null +++ b/solr/conf/solrconfig.xml @@ -0,0 +1,934 @@ + + + + + + ${solr.abortOnConfigurationError:true} + + + + + + + + + + + + + ${solr.data.dir:./solr/data} + + + + false + 10 + + + + 32 + + 10000 + 1000 + 10000 + + + + + + + + native + + + + + + false + 32 + 10 + + + + + + false + + true + + + + + + 1 + + 0 + + + + false + + + + + + + + + + + + + + + + + 1024 + + + + + + + + + + true + + + + + 20 + + 200 + + + + + + + + + + + + solr rocks + 0 + 10 + + + static firstSearcher warming query from solrconfig.xml + + + + + false + + 2 + + + + + + + + + + + + + + + + + + explicit + + + + + + + + + + + dismax + explicit + 0.01 + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + + text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9 + + + popularity^0.5 recip(price,1,1000,1000)^0.3 + + + id,name,price,score + + + 2<-1 5<-2 6<90% + + 100 + *:* + + text features name + + 0 + + name + regex + + + + + + + dismax + explicit + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 + 2<-1 5<-2 6<90% + + incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2 + + + + inStock:true + + + + cat + manu_exact + price:[* TO 500] + price:[500 TO *] + + + + + + textSpell + + default + name + ./spellchecker + + + + + + + + + false + + false + + 1 + + + spellcheck + + + + + + + true + + + tvComponent + + + + + + + + default + + org.carrot2.clustering.lingo.LingoClusteringAlgorithm + + 20 + + + stc + org.carrot2.clustering.stc.STCClusteringAlgorithm + + + + + true + default + true + + name + id + + features + + true + + + + false + + + clusteringComponent + + + + + + + text + true + ignored_ + + true + links + ignored_ + + + + + + + true + + + termsComponent + + + + + + string + elevate.xml + + + + + explicit + + + elevator + + + + + + + + + + + + + + + + + + standard + solrpingquery + all + + + + + + explicit + + true + + + + + + + + 100 + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + ]]> + ]]> + + + + + + + + + 5 + + + + + + solr + + + + + 1 + 2 + + + diff --git a/solr/conf/spellings.txt b/solr/conf/spellings.txt new file mode 100644 index 000000000..d7ede6f56 --- /dev/null +++ b/solr/conf/spellings.txt @@ -0,0 +1,2 @@ +pizza +history \ No newline at end of file diff --git a/solr/conf/stopwords.txt b/solr/conf/stopwords.txt new file mode 100644 index 000000000..b5824da32 --- /dev/null +++ b/solr/conf/stopwords.txt @@ -0,0 +1,58 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +# a couple of test stopwords to test that the words are really being +# configured from this file: +stopworda +stopwordb + +#Standard english stop words taken from Lucene's StopAnalyzer +a +an +and +are +as +at +be +but +by +for +if +in +into +is +it +no +not +of +on +or +s +such +t +that +the +their +then +there +these +they +this +to +was +will +with + diff --git a/solr/conf/synonyms.txt b/solr/conf/synonyms.txt new file mode 100644 index 000000000..b0e31cb7e --- /dev/null +++ b/solr/conf/synonyms.txt @@ -0,0 +1,31 @@ +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#----------------------------------------------------------------------- +#some test synonym mappings unlikely to appear in real input text +aaa => aaaa +bbb => bbbb1 bbbb2 +ccc => cccc1,cccc2 +a\=>a => b\=>b +a\,a => b\,b +fooaaa,baraaa,bazaaa + +# Some synonym groups specific to this example +GB,gib,gigabyte,gigabytes +MB,mib,megabyte,megabytes +Television, Televisions, TV, TVs +#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming +#after us won't split it into two words. + +# Synonym mappings can be used for spelling correction too +pixima => pixma + diff --git a/vendor/built_in_modules/announcement/announcement.json b/vendor/built_in_modules/announcement/announcement.json index 7d68bc1e1..191fbd7d8 100644 --- a/vendor/built_in_modules/announcement/announcement.json +++ b/vendor/built_in_modules/announcement/announcement.json @@ -11,6 +11,7 @@ "index":["1","2","3","4","5"], "bulletins_and_web_links":[] }, + "category": ["BulletinCategory"], "widget_fields":["title","category","postdate"], "enable_frontend": true } diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb index a41c27acf..5dfbb7501 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/approvals_controller.rb @@ -7,14 +7,23 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle @bulletin = Bulletin.find params[:bulletin_id] end - # def approve - # - # end + def approve + notice = "" + @bulletin = Bulletin.find params[:bulletin_id] + @bulletin.proc_check(params[:bulletin][:is_checked],params[:bulletin][:not_checked_reason]) + @bulletin.de_pending + if @bulletin.save + notice = t('bulletin.approve_bulletin_success') + else + notice = t('bulletin.approve_bulletin_fail') + end + redirect_to(panel_announcement_back_end_bulletins_url,:notice => notice) + end def setting @sys_users = User.all(conditions: {admin: false}).includes(:avatar) @bulletin_categorys = BulletinCategory.all - @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.i18n_variable[I18n.locale],bc.id] } + @options_from_collection_for_select_bulletin_categorys = @bulletin_categorys.collect{|bc| [bc.title,bc.id] } if params.has_key? :category @bulletin_category = BulletinCategory.find params[:category][:id] else @@ -51,12 +60,12 @@ class Panel::Announcement::BackEnd::ApprovalsController < OrbitBackendControlle object_auth end - def get_categorys(id = nil) - @bulletin_categorys = [] - if(is_manager? || is_admin?) - @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) - elsif is_sub_manager? - @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') - end - end + # def get_categorys(id = nil) + # @bulletin_categorys = [] + # if(is_manager? || is_admin?) + # @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.all) + # elsif is_sub_manager? + # @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit_new') + # end + # end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb index 65359763c..56de21040 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletin_categorys_controller.rb @@ -1,11 +1,11 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendController + include OrbitControllerLib::DivisionForDisable before_filter :for_app_manager,:except => [:index] - - + def index - @bulletin_categorys = BulletinCategory.all + @bulletin_categorys = get_categories_for_index("BulletinCategory") + #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 @bulletin_category = BulletinCategory.new(:display => 'List') - @url = panel_announcement_back_end_bulletin_categorys_path respond_to do |format| @@ -108,12 +108,19 @@ class Panel::Announcement::BackEnd::BulletinCategorysController < OrbitBackendCo # DELETE /bulletins/1.xml def destroy @bulletin_category = BulletinCategory.find(params[:id]) - @bulletin_category.destroy + @bulletin_category.disable = @bulletin_category.disable ? false : true - respond_to do |format| - format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) } - # format.xml { head :ok } - format.js + if @bulletin_category.save! + respond_to do |format| + flash[:notice] = t("bulletin_category.update_success") + # flash[:error] += @bulletin_category.disable ? t("bulletin_category.disable_change_to_true") : t("bulletin_category.disable_change_to_false") + format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) } + # format.xml { head :ok } + format.js + end + else + flash[:error] = t("bulletin_category.update_failed") + format.html { render :action => "index" } end end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb index d11ea301f..c013d7f49 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/back_end/bulletins_controller.rb @@ -1,14 +1,21 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController + include AdminHelper + include OrbitControllerLib::DivisionForDisable + + layout 'new_admin' before_filter :authenticate_user! + before_filter :only => [ :new,:create,:edit,:update,:create] do |controller| + controller.get_categorys('BulletinCategory') + end # before_filter :for_admin_only,:only => [:] # before_filter :for_app_manager,:only => [:index,:show,] before_filter :for_app_sub_manager,:except => [:index,:show,:get_sorted_and_filtered_bulletins] def index # @bulletins = Bulletin.all # @bulletins = Bulletin.desc("postdate desc") - get_categorys(params[:bulletin_category_id]) - get_tags + get_categorys('BulletinCategory',params[:bulletin_category_id]) + get_tags @filter = params[:filter] new_filter = params[:new_filter] @@ -27,15 +34,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @filter = {new_filter[:type] => [new_filter[:id].to_s]} end - # @bulletins = Bulletin.where("bulletin_category_id" => params[:bulletin_category_id]).desc("postdate") if params[:bulletin_category_id] - - # @bulletins = Bulletin.search(params[:search], params[:category_id]) - # @bulletins = Bulletin.all.order_by([params[:sort], params[:direction]]) + @bulletin_categories = get_categories_for_index("BulletinCategory") + @bulletin_category_ids = @bulletin_categories.collect{|t| t.id.to_s} + [nil] - - # @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered_bulletins : Bulletin.all.page(params[:page]).per(10) - @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin") : get_viewable("bulletin") - @bulletin_categories = BulletinCategory.all + @bulletins = (params[:sort] || @filter) ? get_sorted_and_filtered("bulletin",:bulletin_category_id.in => @bulletin_category_ids) : get_viewable("bulletin",:bulletin_category_id.in => @bulletin_category_ids) @bulletin_link = BulletinLink.new @link_url = panel_announcement_back_end_bulletins_path @@ -54,16 +56,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/1.xml def show @bulletin = Bulletin.find(params[:id]) - get_tags - # get_categorys - - # @bulletin_categorys = BulletinCategory.where("_id" => params[:id]) - - # if params[:id] - # @bulletins = Bulletin.where("bulletin_category_id" => params[:id]) - # else - # @bulletins = Bulletin.desc("postdate desc") - # end + get_tags respond_to do |format| format.html # show.html.erb @@ -74,22 +67,13 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # GET /bulletins/new # GET /bulletins/new.xml def new - @bulletin = Bulletin.new + @bulletin = Bulletin.new(:postdate => DateTime.now) - @link_url = panel_announcement_back_end_bulletins_path - - # @bulletin.bulletin_files.build - # @bulletin.bulletin_files.new - - if get_categorys.empty? - flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") - redirect_to :action => :index - else - get_tags - respond_to do |format| + @link_url = panel_announcement_back_end_bulletins_path + get_tags + respond_to do |format| format.html # new.html.erb format.xml { render :xml => @bulletin } - end end end @@ -103,7 +87,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @link_url = panel_announcement_back_end_bulletin_path(@bulletin) - get_categorys get_tags end end @@ -111,7 +94,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # POST /bulletins # POST /bulletins.xml def create - + get_tags if params[:bulletin_link] @bulletin_link = BulletinLink.new(params[:bulletin_link]) @@ -128,22 +111,25 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController respond_to do |format| if @bulletin_file.save - format.js { render 'create_bulletin_file' } + format.js { render 'create_bulletin_file' } end end else @bulletin = Bulletin.new(params[:bulletin]) - @bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil) + @bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil) @bulletin.create_user_id = current_user.id @bulletin.update_user_id = current_user.id + if(is_manager? || is_admin?) + @bulletin.de_pending + end respond_to do |format| if @bulletin.save - # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('announcement.create_bulletin_success')) } - format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('announcement.create_bulletin_success')) } + + format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.create_bulletin_success')) } format.xml { render :xml => @bulletin, :status => :created, :location => @bulletin } format.js else @@ -156,13 +142,10 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end - def link_quick_add - # debugger - + def link_quick_add @bulletin_link = BulletinLink.new - @link_url = panel_announcement_back_end_bulletins_path - - @bulletin_link.bulletin_id = params[:bulletin_id] + @link_url = panel_announcement_back_end_bulletins_path + @bulletin_link.bulletin_id = params[:bulletin_id] respond_to do |format| format.js @@ -171,29 +154,17 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end def link_quick_edit - # debugger @bulletin_link = BulletinLink.find(params[:bulletin_id]) - - @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) - - # @bulletin = Bulletin.find(params[:bulletin_id]) - - # @link_url = panel_announcement_back_end_bulletin_path(@bulletin) - + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) respond_to do |format| format.js end - end - def file_quick_add - # debugger - + def file_quick_add @bulletin_file = BulletinFile.new @file_url = panel_announcement_back_end_bulletins_path - @bulletin_file.bulletin_id = params[:bulletin_id] - respond_to do |format| format.js end @@ -201,11 +172,8 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController end def file_quick_edit - # debugger @bulletin_file = BulletinFile.find(params[:bulletin_id]) - @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) - respond_to do |format| format.js end @@ -213,15 +181,16 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # PUT /bulletins/1 # PUT /bulletins/1.xml + def update - - if params[:bulletin_link] + if params[:bulletin_link] @bulletin_link = BulletinLink.find(params[:id]) - + @link_url = panel_announcement_back_end_bulletin_path(@bulletin_link) respond_to do |format| + if @bulletin_link.update_attributes(params[:bulletin_link]) # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } format.js { render 'update_bulletin_link' } @@ -235,6 +204,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @file_url = panel_announcement_back_end_bulletin_path(@bulletin_file) respond_to do |format| + if @bulletin_file.update_attributes(params[:bulletin_file]) # format.html { redirect_to(panel_announcement_back_end_bulletins_url) } format.js { render 'update_bulletin_file' } @@ -244,9 +214,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController else @bulletin = Bulletin.find(params[:id]) - @bulletin.deadline = nil if (@bulletin.deadline < @bulletin.postdate rescue nil) - - @bulletin.update_user_id = current_user.id # @bulletin.image.clear if params[:bulletin][:image_del] == '1' # if params[:bulletin][:image_del] == '1' @@ -255,22 +222,37 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController # params[:bulletin][:image_del] = nil # end + + delete_out_invalid_date_from_params respond_to do |format| + if @bulletin.update_attributes(params[:bulletin]) + if(is_manager? || is_admin?) + @bulletin.is_checked = true + @bulletin.is_rejected = false + @bulletin.de_pending! + end + # if (params[:bulletin][:is_checked] == "false") + # @bulletin.is_rejected = true + # @bulletin.save! + # end + # if (@bulletin.deadline < @bulletin.postdate rescue nil) + # @bulletin.deadline = nil + # @bulletin.update_user_id = current_user.id + # @bulletin.save! + # end # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin), :notice => t('bulletin.update_bulletin_success')) } format.html { redirect_to(panel_announcement_back_end_bulletins_url, :notice => t('bulletin.update_bulletin_success')) } format.js { render 'toggle_enable' } format.xml { head :ok } else - get_tags - get_categorys + get_tags format.html { render :action => "edit" } format.xml { render :xml => @bulletin.errors, :status => :unprocessable_entity } end end end - end # DELETE /bulletins/1 @@ -281,6 +263,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin.destroy respond_to do |format| + format.html { redirect_to(panel_announcement_back_end_bulletins_url) } # format.xml { head :ok } format.js @@ -302,12 +285,14 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController @bulletin = Bulletin.find(params[:id]) @type = params[:type] @bulletin_categories = BulletinCategory.all + #TODO 需要做 manager ,admin 才可以 all. 其他 available就好 + get_tags end def delete - if params[:to_delete] - bulletins = Bulletin.any_in(:_id => params[:to_delete]).delete_all + if params[:ids] + bulletins = Bulletin.any_in(:_id => params[:ids]).delete_all end redirect_to panel_announcement_back_end_bulletins_url(:filter => params[:filter], :direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]) end @@ -315,15 +300,39 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController protected - def get_categorys(id = nil) - @bulletin_categorys = [] - #@unit_list_for_anc = UnitListForAnc.all - if(is_manager? || is_admin?) - @bulletin_categorys = (id ? BulletinCategory.find(id).to_a : BulletinCategory.excludes('disabled' => true)) - elsif is_sub_manager? - @bulletin_categorys = BulletinCategory.authed_for_user(current_user,'submit') - end + def delete_out_invalid_date_from_params + if((params[:bulletin]["deadline(1i)"] && params[:bulletin]["deadline(1i)"].blank?) or (params[:bulletin]["deadline(2i)"] && params[:bulletin]["deadline(2i)"].blank?) or (params[:bulletin]["deadline(3i)"] && params[:bulletin]["deadline(3i)"].blank?)) + params[:bulletin].delete("deadline(1i)") + params[:bulletin].delete("deadline(2i)") + params[:bulletin].delete("deadline(3i)") + params[:bulletin].delete("deadline(4i)") + params[:bulletin].delete("deadline(5i)") + @bulletin.deadline = nil + end rescue nil end + + # def get_categories_for_index(id = nil) + # @bulletin_categories = [] + # if(is_manager? || is_admin?) + # @bulletin_categories = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all) + # elsif is_sub_manager? + # @bulletin_categories = BulletinCategory.all + # end + # @bulletin_categories + # end + + # def get_categorys(id = nil) + # @bulletin_categorys = [] + # if(is_manager? || is_admin?) + # @bulletin_categorys = (id ? BulletinCategory.admin_manager_all.find(id).to_a : BulletinCategory.admin_manager_all) + # elsif is_sub_manager? + # @bulletin_categorys = BulletinCategory.all.authed_for_user(current_user,'submit') + # end + # if @bulletin_categorys.empty? && params[:action] != "index" + # flash[:alert] = t("announcement.error.no_avilb_cate_for_posting") + # redirect_to :action => :index + # end + # end def get_tags module_app = ModuleApp.first(:conditions => {:key => 'announcement'}) diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb index da67c0bb0..4f54936b7 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/front_end/bulletins_controller.rb @@ -7,40 +7,72 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController # GET /bulletins # GET /bulletins.xml - + def index_bulletins_by_unit + @page = Page.find(params[:page_id]) rescue nil + @bulletins=Bulletin.all.available_for_lang(I18n.locale).can_display.where("cache_dept.#{I18n.locale.to_s.downcase}"=>params[:name]).page( params[:page_main]).per(15) + render :index + end + def index - - @item = Page.find(params[:page_id]) + @item = Page.find(params[:page_id]) if @item.frontend_data_count - @page_num = @item.frontend_data_count - else - @page_num = 10 - end - + @page_num = @item.frontend_data_count + else + @page_num = 15 + end @frontend_style = @item.frontend_style - - date_now = Time.now - if !params[:category_id].blank? - @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) - @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil - elsif !params[:tag_id].blank? - @tag = AnnouncementTag.find(params[:tag_id]) rescue nil - @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag - @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + + @page = Page.find(params[:page_id]) rescue nil + if !params[:search_query].blank? + # search_cond = {:is_checked=>true,:is_hidden=>false,:is_pending => false} + # search_cond.merge!({:bulletin_category_id => "#{params[:category_id]}" }) if !params[:category_id].blank? + @search = Bulletin.solr_search do + fulltext params[:search_query] + with(:frontend_search,true) + #order_by(:average_rating) + end + search_result = @search.results.collect{|result| result.id} + + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_in(_id:search_result).page( params[:page_main]).per(@page_num) else - @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + date_now = Time.now + if !params[:category_id].blank? && !params[:tag_id].blank? + @tag = AnnouncementTag.find(params[:tag_id]) rescue nil + @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag + @bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil + elsif !params[:category_id].blank? + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil + elsif !params[:tag_id].blank? + @tag = AnnouncementTag.find(params[:tag_id]) rescue nil + @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag + @bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + else + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page_main]).per(@page_num) + end + impressionist(@tag) if @tag end end def show + @page = Page.find(params[:page_id]) rescue nil if params[:preview] == "true" preview_content else - @bulletin = Bulletin.can_display.where(_id: params[:id]).first - impressionist(@bulletin) - get_categorys + @bulletin = Bulletin.all.can_display.where(_id: params[:id]).first + if !@bulletin.disable? and !@bulletin.is_rejected + if @bulletin.enabled_for_lang(I18n.locale.to_s) + impressionist(@bulletin) + get_categorys + else + render :text => "
    #{t('sys.can_not_display_due_to_no_context')}
    ".html_safe + end + else + render :nothing => true, :status => 403 + end end end @@ -53,7 +85,7 @@ class Panel::Announcement::FrontEnd::BulletinsController < OrbitWidgetController protected def get_categorys - @bulletin_categorys = BulletinCategory.excludes('disabled' => true) + @bulletin_categorys = BulletinCategory.all end end diff --git a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb index 8d38802ab..0c5c3d912 100644 --- a/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb +++ b/vendor/built_in_modules/announcement/app/controllers/panel/announcement/widget/bulletins_controller.rb @@ -1,5 +1,4 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController - def initialize super @app_title = 'announcement' @@ -48,23 +47,23 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController def bulletins_list_and_pic - if params[:widget_data_count] - @page_num = params[:widget_data_count]; - else - @page_num = 4; - end + if params[:widget_data_count] + @page_num = params[:widget_data_count]; + else + @page_num = 4; + end @title = params[:part_title] date_now = Time.now if !params[:category_id].blank? - @bulletins = Bulletin.can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num ) @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil elsif !params[:tag_id].blank? @tag = AnnouncementTag.find(params[:tag_id]) rescue nil @tag = AnnouncementTag.where(key: params[:tag_id])[0] unless @tag - @bulletins = @tag.bulletins.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + @bulletins = @tag.bulletins.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num ) else - @bulletins = Bulletin.can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num) + @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num ) end get_categorys @@ -72,32 +71,35 @@ class Panel::Announcement::Widget::BulletinsController < OrbitWidgetController end def bulletins_and_web_links - @tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']) + @tags = AnnouncementTag.any_in(key: ['students', 'alumni', 'employee', 'guest']).asc(:order) @selected_tag = AnnouncementTag.find(params[:id]) rescue @tags[0] - @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil - @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil + @bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil + @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil end def reload_bulletins @selected_tag = AnnouncementTag.find(params[:tag_id]) - @bulletins = @selected_tag.get_visible_bulletins.can_display.page(params[:page]).per(5) rescue nil + @bulletins = @selected_tag.get_visible_bulletins(:postdate).available_for_lang(I18n.locale).can_display.page(params[:page]).per(5) rescue nil end def reload_web_links @selected_tag = AnnouncementTag.find(params[:tag_id]) - @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links.page(params[:page]).per(5) rescue nil + @web_links = WebResourceTag.first(:conditions => {:en => @selected_tag[:en]}).get_visible_links(:created_at).available_for_lang(I18n.locale).page(params[:page]).per(5) rescue nil end def bulletins_side_bar - @tags = AnnouncementTag.all + @tags_and_class = AnnouncementTag.sorted_for_cloud get_categorys end + def bulletins_search_block + + end protected def get_categorys - @bulletin_categorys = BulletinCategory.excludes('disabled' => true) + @bulletin_categorys = BulletinCategory.all end end diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb index c384bc8f7..7e36a22dd 100644 --- a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletins_helper.rb @@ -1,9 +1,52 @@ module Panel::Announcement::BackEnd::BulletinsHelper - + def show_reject_reason(bulletin) + by_bulletin = bulletin.is_rejected + by_user = (((bulletin.create_user_id == current_user.id) rescue nil) or is_manager? or is_admin?) + by_bulletin && by_user + end + + def show_form_status_field(bulletin) + #by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?) + by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) + by_user + end + def show_approval_link(bulletin) - by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?) + by_bulletin = (!bulletin.is_expired? and bulletin.is_pending?) by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?) by_bulletin and by_user end + def show_delete_link(bulletin) + by_bulletin = (bulletin.create_user_id == current_user.id) + by_user = (is_manager? or is_admin?) + by_bulletin or by_user + end + + def show_bulletin_title_at_index (bulletin) + if bulletin.is_checked? + link_to bulletin.title, panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue '' + else + bulletin.title + end + end + + def file_picture_preview_setting(file_path) + res= "" + ext = File.extname(file_path) + unless file_path.nil? + case ext + when ".jpg",".jpeg",".png",".gif" + #res = '' + #res.html_safe + {"data-content" => "#{image_tag file_path}" } + else + {"data-content" => t("sys.not_previewable") } + end + end + end + + end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/announcement_tag.rb b/vendor/built_in_modules/announcement/app/models/announcement_tag.rb index 9cb29038b..a23e74bf5 100644 --- a/vendor/built_in_modules/announcement/app/models/announcement_tag.rb +++ b/vendor/built_in_modules/announcement/app/models/announcement_tag.rb @@ -1,11 +1,15 @@ class AnnouncementTag < Tag has_and_belongs_to_many :bulletins + field :order,:default => 0 - - def get_visible_bulletins(sort = :name) + def get_visible_bulletins(sort = :title) date_now = Time.now - self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) + self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) end + def bulletins + Bulletin.all.any_in(:_id => bulletin_ids) + end + end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/bulletin.rb b/vendor/built_in_modules/announcement/app/models/bulletin.rb index 589da3208..adc50101f 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin.rb @@ -1,21 +1,32 @@ # encoding: utf-8 - +# require "impressionist" class Bulletin include Mongoid::Document include Mongoid::Timestamps include Mongoid::MultiParameterAttributes + include Sunspot::Mongo include Impressionist::Impressionable + BelongsToCategory = :bulletin_category + include OrbitCoreLib::BelongsToCategoryMayDisable + + # include NccuSearch + + #scope :searchable,where(:is_checked=>true,:is_hidden=>false,:is_pending=>false) + is_impressionable :counter_cache => { :column_name => :view_count } - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :subtitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :text, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true + field :subtitle, localize: true + field :text, localize: true + has_and_belongs_to_many :tags, :class_name => "AnnouncementTag" field :postdate , :type => DateTime field :deadline , :type => DateTime # field :url + field :cache_dept,type: Hash + field :create_user_id field :update_user_id, :class_name => "User" @@ -32,12 +43,13 @@ class Bulletin field :public, :type => Boolean, :default => true - scope :can_display,where(is_checked: true) - + scope :can_display, where(is_checked: true, is_rejected: false, is_pending: false) + scope :available_for_lang, ->(locale){ where("available_for_#{locale}".to_sym => true) } + mount_uploader :image, ImageUploader - belongs_to :bulletin_category -# belongs_to :unit_list_for_anc + + # belongs_to :unit_list_for_anc # embeds_many :bulletin_links, :cascade_callbacks => true # embeds_many :bulletin_files, :cascade_callbacks => true @@ -48,13 +60,59 @@ class Bulletin accepts_nested_attributes_for :bulletin_files, :allow_destroy => true accepts_nested_attributes_for :bulletin_links, :allow_destroy => true - validates_presence_of :title - - before_save :set_key, :update_status - + validates :title, :at_least_one => true + + before_save :check_deadline, :update_avliable_language, :clean_tags + + before_save :fetch_dept after_save :save_bulletin_links after_save :save_bulletin_files - + + searchable do + text :titles do + title_translations.to_a.collect{|t| t[1]} + end + text :texts do + text_translations.to_a.collect{|t| Nokogiri::HTML(t[1]).text} + end + # text :text do + # a = (title_translations["zh_tw"] + title_translations["en"]) + # a + # end + boolean :frontend_search do + ( !is_hidden && !is_pending && is_checked && !is_rejected ) + end + + integer :view_count + string :bulletin_category_id + end + + def proc_check(check,not_pass_info = "") + self.is_checked = true + if check =="true" + self.is_rejected = false + elsif check == "false" + self.is_rejected = true + self.not_checked_reason = not_pass_info + end + end + + def de_pending + self.is_pending = false + end + + def de_pending! + de_pending + self.save! + end + + def enabled_for_lang(lang) + eval("self.available_for_#{lang}") + end + + def publish_month + published_at.strftime("%B %Y") + end def self.search( search = nil, category_id = nil ) if category_id.to_s.size > 0 and search.to_s.size > 0 @@ -103,9 +161,9 @@ class Bulletin def is_hidden? self.is_hidden end - + def is_checked? - self.is_checked + !self.is_pending && self.is_checked && (self.is_rejected == false) end def is_pending? @@ -113,7 +171,7 @@ class Bulletin end def is_rejected? - self.is_rejected + !self.is_pending && self.is_rejected && (self.is_rejected == true) end @@ -132,19 +190,6 @@ class Bulletin end end end - - - def title - @title ||= I18nVariable.first(:conditions => {:key => 'title', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def subtitle - @subtitle ||= I18nVariable.first(:conditions => {:key => 'subtitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def text - @text ||= I18nVariable.first(:conditions => {:key => 'text', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end def self.filter(bulletins) bulletins.each do |bulletin| @@ -159,29 +204,28 @@ class Bulletin protected - def set_key - if title && title.new_record? - title.key = 'title' + def check_deadline + if(!self.deadline.nil? and (self.deadline < self.postdate )) + self.deadline = nil end - if subtitle && subtitle.new_record? - subtitle.key = 'subtitle' - end - if text && text.new_record? - text.key = 'text' + end + + def update_avliable_language + VALID_LOCALES.each do |locale| + if (title_translations[locale].blank? rescue true) + self["available_for_#{locale}".to_sym] = false + else + self["available_for_#{locale}".to_sym] = true + end end end + + def fetch_dept + self.cache_dept = (User.find(self.create_user_id).cache_dept rescue nil) if self.new_record? + end - def update_status - if !self.is_pending && !self.is_checked - self.is_pending = false - self.is_rejected = true - self.is_checked = false - elsif self.is_checked - self.is_pending = false - self.is_rejected = false - self.is_checked = true - end + def clean_tags + self.tag_ids.delete('') end - - -end \ No newline at end of file + +end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb index ff0e0a9cb..9eb3cfbef 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_category.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_category.rb @@ -4,26 +4,28 @@ class BulletinCategory include Mongoid::Document include Mongoid::Timestamps include OrbitCoreLib::ObjectAuthable - + include OrbitCoreLib::ObjectDisable + ObjectAuthTitlesOptions = %W{submit_new fact_check} AfterObjectAuthUrl = '/panel/announcement/back_end/bulletin_categorys' # include Mongoid::MultiParameterAttributes PAYMENT_TYPES = [ "List", "Picture" ] APP_NAME = 'Announcement' - field :key + + field :disable, type: Boolean, :default => false field :display - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :key + field :title, localize: true has_many :bulletins def pp_object - i18n_variable[I18n.locale] + title end def self.from_id(id) BulletinCategory.find(id) rescue nil end -end \ No newline at end of file +end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb index a30ec1311..2912fc976 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_file.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_file.rb @@ -4,37 +4,11 @@ class BulletinFile include Mongoid::Timestamps mount_uploader :file, AssetUploader - - # field :filetitle - # field :description - has_one :filetitle, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - has_one :description, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy - - # field :to_save, :type => Boolean - field :should_destroy, :type => Boolean + + field :description, localize: true + field :should_destroy, :type => Boolean + field :title, localize: true belongs_to :bulletin - # embedded_in :bulletin - - before_save :set_key - - def filetitle - @filetitle ||= I18nVariable.first(:conditions => {:key => 'filetitle', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - def description - @description ||= I18nVariable.first(:conditions => {:key => 'description', :language_value_id => self.id, :language_value_type => self.class}) rescue nil - end - - protected - - def set_key - if filetitle && filetitle.new_record? - filetitle.key = 'filetitle' - end - if description && description.new_record? - description.key = 'description' - end - end end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb index 303631820..374ce5de2 100644 --- a/vendor/built_in_modules/announcement/app/models/bulletin_link.rb +++ b/vendor/built_in_modules/announcement/app/models/bulletin_link.rb @@ -4,12 +4,22 @@ class BulletinLink include Mongoid::Timestamps field :url - # field :name - - has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy + field :title, localize: true field :should_destroy, :type => Boolean # embedded_in :bulletin belongs_to :bulletin + + before_validation :add_http + validates :url, :presence => true, :format => /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix + + protected + + def add_http + unless self.url[/^http:\/\//] || self.url[/^https:\/\//] + self.url = 'http://' + self.url + end + end + end diff --git a/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb b/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb deleted file mode 100644 index 9cb29038b..000000000 --- a/vendor/built_in_modules/announcement/app/models/bulletin_tag.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AnnouncementTag < Tag - - has_and_belongs_to_many :bulletins - - - def get_visible_bulletins(sort = :name) - date_now = Time.now - self.bulletins.where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort) - end - -end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb index 5261f6a2a..179e95886 100644 --- a/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb +++ b/vendor/built_in_modules/announcement/app/models/unit_list_for_anc.rb @@ -5,8 +5,7 @@ class UnitListForAnc field :order field :ut_code field :up_ut_code - - has_one :title, :class_name => "I18nVariable", :as => :language_value, :autosave => true + field :title, localize: true end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/_announcement_secondary.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/_announcement_secondary.html.erb new file mode 100644 index 000000000..40f5e871c --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/_announcement_secondary.html.erb @@ -0,0 +1,14 @@ +
    +
    +
    +
    +
    +
      +
    • <%= link_to t('bulletin.announcement_list'), panel_announcement_back_end_bulletins_path if is_manager?%>
    • +
    • <%= link_to t('bulletin.new_announcement_class'), panel_announcement_back_end_bulletin_categorys_path if is_manager?%>
    • +
    • <%= link_to t('bulletin.fact_check_for_manager'), panel_announcement_back_end_fact_checks_path if is_manager?%>
    • + +
    • <%= link_to t('bulletin.my_announcement'), panel_announcement_back_end_list_mine_path if is_sub_manager? %>
    • +
    • <%= link_to t('bulletin.new_announcement'), new_panel_announcement_back_end_bulletin_path if is_sub_manager? %>
    • + +
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/_list_table.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/_list_table.html.erb new file mode 100644 index 000000000..a8c5a83b2 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/_list_table.html.erb @@ -0,0 +1,15 @@ +

    <%= bulletin_category.key %>

    + + + + + + + + + + +<% bulletin_category.bulletins.each do |post| %> + <%= render :partial => 'panel/announcement/back_end/bulletins/bulletins', :locals => {:post => post,:fact_check_allow=>false} %> +<% end %> +
    <%= t('bulletin.status') %><%= t('bulletin.category') %><%= t('bulletin.title') %><%= t('bulletin.postdate') %><%= t('bulletin.deadline') %><%= t('bulletin.action') %>
    \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/list_mine.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/list_mine.html.erb new file mode 100644 index 000000000..2bd988279 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/announcements/list_mine.html.erb @@ -0,0 +1,12 @@ +<% content_for :secondary do %> +<%= render :partial => '/panel/announcement/back_end/announcement_secondary' %> +<% end -%> + +<%= flash_messages %> + +
    +
    +
    +
    +
    +<%= render :partial => "list_table", :collection => @bulletin_categorys ,:as => :bulletin_category%> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb index 35049b981..2a400a1fa 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_approve.html.erb @@ -18,7 +18,7 @@
    - <%= f.fields_for :i18n_variable, (@bulletin_category.new_record? ? @bulletin_category.build_i18n_variable : @bulletin_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (@bulletin_category.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb index cb32d861a..9e774709f 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/_quick_edit_qe.html.erb @@ -7,12 +7,12 @@ <%= f.text_field :key %>
    - <%= f.fields_for :i18n_variable, bulletin_category.i18n_variable do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (bulletin_category.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb index 882b13d22..e7f791906 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletin_categorys/destroy.js.erb @@ -1 +1 @@ -$("#<%= dom_id @bulletin_category %>").remove(); \ No newline at end of file +$("#<%= dom_id @bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@bulletin_category) %> "); \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb index 8f879e795..f6d9d240b 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin.html.erb @@ -28,10 +28,9 @@
    - <%= bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %> + <%= bulletin.bulletin_category.title rescue nil %> - <%= link_to bulletin.title[I18n.locale], panel_announcement_front_end_bulletin_path(bulletin, :category_id => bulletin.bulletin_category.id) rescue ''%> - + <%= show_bulletin_title_at_index bulletin%>
    diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb index 23229b5da..547736ffe 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_file_qe.html.erb @@ -13,23 +13,23 @@ - <%= f.fields_for :filetitle, (@bulletin_file.new_record? ? @bulletin_file.build_filetitle : @bulletin_file.filetitle ) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    - <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.title_translations[locale] rescue nil) %>
    <% end %> <% end %> - <%= f.fields_for :description, (@bulletin_file.new_record? ? @bulletin_file.build_description : @bulletin_file.description ) do |f| %> + <%= f.fields_for :description_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    - <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@bulletin_file.description_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb index fd013f56c..0efbdc15d 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_bulletin_link_qe.html.erb @@ -14,13 +14,13 @@ - <%= f.fields_for :i18n_variable, (@bulletin_link.new_record? ? @bulletin_link.build_i18n_variable : @bulletin_link.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    <%#= f.text_field locale, :class => 'input-xxlarge' %> - <%= f.text_field locale %> + <%= f.text_field locale, :class => 'control-label', :value => (@bulletin_link.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb index 537178484..c18852877 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_file.html.erb @@ -11,7 +11,7 @@ <%= f.file_field :file %> <%= f.label :file_title %> - <%= f.text_field :filetitle %> + <%= f.text_field :title %> <%= f.label :file_description %> <%= f.text_field :description %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb index 4d140880d..b81c0e31a 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter.html.erb @@ -34,4 +34,4 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "sort_header" %> -<% end %> \ No newline at end of file +<% end %> diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb index 7856f74b4..b07275014 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_filter_categories.html.erb @@ -1,6 +1,6 @@
    <% @bulletin_categories.each do |category| -%> - <%= link_to category.i18n_variable[I18n.locale], panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> + <%= link_to category.title, panel_announcement_back_end_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> <% end -%>
    <%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %> \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb index 180cf67a9..b00408512 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/bulletins/_form.html.erb @@ -4,42 +4,6 @@ <%= f.error_messages %>
    -
    -
    - -
    -

    Picture

    -
    -
    - -
    - - <% if @bulletin.image %> - <%= image_tag @bulletin.image rescue ''%> - <% else %> - - <% end %> - -
    -
    - - -
    - -
    - <% if @bulletin.image.file %> - <%= f.check_box :remove_image %> - <%= t('announcement.刪除已上傳檔案') %> - <% end %> -
    -
    -
    -
    - -
    @@ -61,7 +25,8 @@
    - + + <% if show_form_status_field(@bulletin)%>
    @@ -84,7 +49,18 @@
    - + <% end %> + <% if @bulletin.is_rejected %> +
    +
    + +
    +

    Approval Status

    +
    + <%= @bulletin.not_checked_reason rescue t("rejected_reason_empty") %> +
    +
    + <% end %>
    @@ -94,8 +70,9 @@

    <% @tags.each do |tag| %> <%= content_tag :label,:class => "checkbox inline" do -%> - <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id)%> + <%= check_box_tag 'bulletin[tag_ids][]', tag.id, @bulletin.tag_ids.include?(tag.id) %> <%= tag[I18n.locale] %> + <%= hidden_field_tag 'bulletin[tag_ids][]', '' %> <% end %> <% end %>

    @@ -121,10 +98,10 @@
    <%#= f.label :unit_list_for_anc%> - <%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%#= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %> - <%= f.label :category %> - <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%= f.label :category,t('announcement.bulletin.category')%> + <%= f.select :bulletin_category_id, @bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
    - <%= f.fields_for :i18n_variable, (@news_bulletin_category.new_record? ? @news_bulletin_category.build_i18n_variable : @news_bulletin_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (@news_bulletin_category.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb index 94a4e851f..15a09fd68 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_news_bulletin_category.html.erb @@ -4,18 +4,17 @@ <%= news_bulletin_category.key %>
    <% @site_valid_locales.each do |locale| %> - <%= news_bulletin_category.i18n_variable[locale] rescue nil %> + <%= news_bulletin_category.title_translations[locale] rescue nil %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_quick_edit_qe.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_quick_edit_qe.html.erb index d59e55b7c..005ae64e6 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_quick_edit_qe.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/_quick_edit_qe.html.erb @@ -7,12 +7,12 @@ <%= f.text_field :key %>
    - <%= f.fields_for :i18n_variable, news_bulletin_category.i18n_variable do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin_category.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/destroy.js.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/destroy.js.erb index 0ffa06b1d..e2acc583a 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/destroy.js.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletin_categorys/destroy.js.erb @@ -1 +1 @@ -$("#<%= dom_id @news_bulletin_category %>").remove(); \ No newline at end of file +$("#<%= dom_id @news_bulletin_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@news_bulletin_category) %> "); \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb index 9e0943ed0..8346402b9 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_file.html.erb @@ -11,7 +11,7 @@ <%= f.file_field :file %> <%= f.label :file_title %> - <%= f.text_field :filetitle %> + <%= f.text_field :title %> <%= f.label :file_description %> <%= f.text_field :description %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter_categories.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter_categories.html.erb index eb301ec06..d8d49a9ee 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter_categories.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_filter_categories.html.erb @@ -1,6 +1,6 @@
    <% @news_bulletin_categories.each do |category| -%> - <%= link_to category.i18n_variable[I18n.locale], panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> + <%= link_to category.title, panel_news_back_end_news_bulletins_path(:filter => @filter, :new_filter => {:type => 'categories', :id => category.id}, :sort => params[:sort], :direction => params[:direction], :sort_options => params[:sort_options]), :class => "btn js_history#{is_filter_active?('categories', category.id)}" %> <% end -%>
    <%= render :partial => 'clear_filters', :locals => {:type => 'categories'} %> \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb index eb2a2d95f..3460f8d81 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form.html.erb @@ -62,6 +62,7 @@
    + <% if news_show_form_status_field( @news_bulletin)%>
    @@ -84,7 +85,7 @@
    - + <% end %>
    @@ -95,10 +96,22 @@ <%= content_tag :label,:class => "checkbox inline" do -%> <%= check_box_tag 'news_bulletin[tag_ids][]', tag.id, @news_bulletin.tag_ids.include?(tag.id)%> <%= tag[I18n.locale] %> + <%= hidden_field_tag 'news_bulletin[tag_ids][]', '' %> <% end %> <% end %>
    + <% if @news_bulletin.is_rejected %> +
    +
    + +
    +

    Approval Status

    +
    + <%= @news_bulletin.not_checked_reason rescue t("rejected_reason_empty") %> +
    +
    + <% end %> <% if params[:action] != 'new' %>
    @@ -118,11 +131,11 @@
    - <%= f.label :unit_list_for_anc%> - <%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%= f.label :unit_list_for_anc,t('news.news_bulletin.unit_name')%> + <%= f.select :unit_list_for_anc_id,@unit_list_for_anc.collect{|t| [ t.title, t.id ]}, {:prompt => t("news.news_bulletin.ut_prompt")}, :class => "input-medium" %> - <%= f.label :category %> - <%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => "input-medium" %> + <%= f.label :category,t('news.news_bulletin.category') %> + <%= f.select :news_bulletin_category_id, @news_bulletin_categorys.collect{|t| [ t.title, t.id ]}, {}, :class => "input-medium" %>
    @@ -275,17 +290,20 @@ <% content_for :page_specific_javascript do %> <%= javascript_include_tag "inc/jquery.imagesloaded.js" %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb index 27867f49b..0eb9c3a0c 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_file.html.erb @@ -4,7 +4,7 @@
    <%= f.file_field :file %> - <%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'btn', :target => '_blank', :title => t(:view)} ) : '' %> + <%= form_news_bulletin_file.file.file ? ( link_to t(:view), form_news_bulletin_file.file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view)}.merge(file_picture_preview_setting(form_news_bulletin_file.file.url)) ) : '' %>
    @@ -16,11 +16,11 @@
    "> - <%= f.fields_for :filetitle, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_filetitle : form_news_bulletin_file.filetitle ) do |f| %> + <%= f.fields_for :title_translations do |f| %>
    - <%= f.text_field locale, :id => "link-#{locale}" %> + <%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.title_translations[locale] rescue nil) %>
    <% end %> @@ -40,11 +40,11 @@
    "> - <%= f.fields_for :description, (form_news_bulletin_file.new_record? ? form_news_bulletin_file.build_description : form_news_bulletin_file.description ) do |f| %> + <%= f.fields_for :description_translations do |f| %>
    - <%= f.text_field locale, :id => "link-#{locale}" %> + <%= f.text_field locale, :id => "link-#{locale}", :value => (form_news_bulletin_file.description_translations[locale] rescue nil) %>
    <% end %> @@ -62,6 +62,7 @@ <% else %> <%= f.hidden_field :id %> + <%= hidden_field_tag :tr, (dom_id form_news_bulletin_file) %> <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_link.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_link.html.erb index f7d58919b..9a280bdd3 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_link.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_form_news_bulletin_link.html.erb @@ -17,11 +17,11 @@
    "> - <%= f.fields_for :i18n_variable, (form_news_bulletin_link.new_record? ? form_news_bulletin_link.build_i18n_variable : form_news_bulletin_link.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %>
    - <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "link-#{locale}", :class => "input-xlarge", :value => (form_news_bulletin_link.title_translations[locale] rescue nil) %>
    <% end %> @@ -39,6 +39,7 @@ <% else %> <%= f.hidden_field :id %> + <%= hidden_field_tag :tr, (dom_id form_news_bulletin_link) %> <%= f.hidden_field :should_destroy, :value => nil, :class => 'should_destroy' %> <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_file.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_file.html.erb index a57a5aedb..04f11c44c 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_file.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_file.html.erb @@ -1,7 +1,7 @@ - <%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.zh_tw, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.zh_tw} ) : list_news_bulletin_file.filetitle.zh_tw %> - <%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.filetitle.en, list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description.en} ) : list_news_bulletin_file.filetitle.en %> + <%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['zh_tw'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['zh_tw']} ) : list_news_bulletin_file.title_translations['zh_tw'] %> + <%= list_news_bulletin_file.file.file ? ( link_to list_news_bulletin_file.title_translations['en'], list_news_bulletin_file.file.url, {:target => '_blank', :title => list_news_bulletin_file.description_translations['en']} ) : list_news_bulletin_file.title_translations['en'] %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_link.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_link.html.erb index 806fac757..b5e94323d 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_link.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_list_news_bulletin_link.html.erb @@ -1,6 +1,6 @@ - <%= link_to list_news_bulletin_link.i18n_variable.zh_tw, list_news_bulletin_link.url, :target => '_blank' %> - <%= link_to list_news_bulletin_link.i18n_variable.en, list_news_bulletin_link.url, :target => '_blank' %> + <%= link_to list_news_bulletin_link.title_translations['zh_tw'], list_news_bulletin_link.url, :target => '_blank' %> + <%= link_to list_news_bulletin_link.title_translations['en'], list_news_bulletin_link.url, :target => '_blank' %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb index 95a3d4fe6..01decfbd3 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin.html.erb @@ -28,10 +28,8 @@
    - <%= news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %> - - <%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category.id) rescue ''%> - + + <%= show_news_bulletin_title_at_index news_bulletin%>
  • - <%#= debugger %> - <%#= a=1 %> - <% end %> + <% end %> + <% if news_show_delete_link(news_bulletin) %> <% end %> <% if news_show_approval_link(news_bulletin) %>
  • <%= link_to t('news.news_bulletin.approval'), panel_news_back_end_news_bulletin_approval_preview_path(news_bulletin),:class => 'preview_trigger' %>
  • <%#= #TODO add ancher so user can quick access into that part %> <% end %> - + <% if news_show_reject_reason(news_bulletin)%> +
  • <%= link_to t('rejected_reason')+truncate(news_bulletin.not_checked_reason, :length => 10),'#',:rel=>"tooltip" ,'data-original-title'=> (wrap_string_with(news_bulletin.not_checked_reason, :line_width => 24)),:class=>'reject_info' %>
  • + <% end %> @@ -72,6 +71,7 @@ - <%= User.from_id(news_bulletin.update_user_id).name rescue ''%> + <%= news_bulletin.view_count rescue nil %> + <%= news_bulletin.unit_list_for_anc.title rescue nil %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_file_qe.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_file_qe.html.erb index 211daaa6d..842ebe09e 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_file_qe.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_file_qe.html.erb @@ -13,23 +13,23 @@ - <%= f.fields_for :filetitle, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_filetitle : @news_bulletin_file.filetitle ) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    - <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.title_translations[locale] rescue nil) %>
    <% end %> <% end %> - <%= f.fields_for :description, (@news_bulletin_file.new_record? ? @news_bulletin_file.build_description : @news_bulletin_file.description ) do |f| %> + <%= f.fields_for :description_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    - <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge" %> + <%= f.text_field locale, :id => "file-#{locale}", :class => "input-xlarge", :value => (@news_bulletin_file.description_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_link_qe.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_link_qe.html.erb index d4613e385..e033b46fd 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_link_qe.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletin_link_qe.html.erb @@ -14,13 +14,13 @@ - <%= f.fields_for :i18n_variable, (@news_bulletin_link.new_record? ? @news_bulletin_link.build_i18n_variable : @news_bulletin_link.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "link-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    <%#= f.text_field locale, :class => 'input-xxlarge' %> - <%= f.text_field locale %> + <%= f.text_field locale, :value => (@news_bulletin_link.title_translations[locale] rescue nil) %>
    <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletins.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletins.html.erb index eb1c9781e..5ed04c764 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletins.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_news_bulletins.html.erb @@ -2,11 +2,11 @@ - + diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb index 84d4eb277..084421ccb 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_basic.html.erb @@ -3,18 +3,18 @@
    - <%= f.select :news_bulletin_category_id, @news_bulletin_categories.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]}, {}, :class => 'input-large' %> + <%= f.select :news_bulletin_category_id, @news_bulletin_categories.collect {|t| [ t.title, t.id ]}, {}, :class => 'input-large' %>
    - <%= f.fields_for :title, news_bulletin.title do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
    <%= label_tag "title-#{locale}", "Title-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
    - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (news_bulletin.title_translations[locale] rescue nil) %>
    <% end %> @@ -25,27 +25,30 @@
    - <%= f.date_select :postdate, {}, :class => 'input-small' %> + <%= f.date_select :postdate, { :use_month_numbers => true, :order => [:day, :month, :year] }, :class => 'input-small' %>
    - <%= f.date_select :deadline, {}, :class => 'input-small' %> + <%= f.date_select :deadline, { :use_month_numbers => true, :prompt => { :month => 'Month', :day => 'Day', :year => 'Year'}, :order => [:day, :month, :year] }, :class => 'input-small' %>
    -
    -
    - -
    - - - + <% if news_show_form_status_field(@news_bulletin)%> +
    +
    + +
    + + + +
    -
    -
    + <% end -%> + +
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb index b29dd2764..663ef6470 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_quick_edit_picture.html.erb @@ -4,7 +4,7 @@
    - + <%= image_tag(@news_bulletin.image.url , :class => "pull-left") if @news_bulletin.image? %>
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_sort_headers.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_sort_headers.html.erb index d91134b6c..34586da45 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_sort_headers.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/_sort_headers.html.erb @@ -1,7 +1,8 @@ -<%= render_sort_bar(true, ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'], - ['category', 'news_bulletin_category', 'span1-2', 'news_bulletin.category'], +<%= render_sort_bar(true, delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), + ['status', ['is_top', 'is_hot', 'is_hidden', 'is_pending', 'is_checked', 'is_rejected'], 'span1-2', 'news_bulletin.status'], ['title', 'title','span7', 'news_bulletin.title'], ['start_date', 'postdate', 'span1-2', 'news_bulletin.start_date'], ['end_date', 'deadline', 'span1-2', 'news_bulletin.end_date'], ['tags', 'tags', 'span1-2', 'news_bulletin.tags'], - ['last_modified', 'update_user_id','span1-3', 'news_bulletin.last_modified']).html_safe %> \ No newline at end of file + ['view_count', 'view_count','span1-2', 'view_count'], + ['unit_list_for_anc', 'unit_list_for_anc','span1-3', 'news.news_bulletin.unit_name']).html_safe %> \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb index 8149a86e2..6603d41d9 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/edit.html.erb @@ -8,3 +8,6 @@ <%= render :partial => 'form', :locals => {:f => f} %> <% end %>
    +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "news_bulletin_form" %> +<% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb index 742293fe7..970263fc5 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/index.html.erb @@ -1,12 +1,10 @@ -<%= form_for :news_bulletins, :url => delete_panel_news_back_end_news_bulletins_path(:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> - <%= render 'filter' %> - - <%= render 'news_bulletins' %> -
    -<% end %> +<%= render 'filter' %> + + <%= render 'news_bulletins' %> +
    - <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary' %> + <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('admin.add'), new_panel_news_back_end_news_bulletin_path, :class => 'btn btn-primary pull-right' %>
    <%= paginate @news_bulletins, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil, :sort_options => params[:sort_options]} %>
    @@ -14,13 +12,13 @@
    diff --git a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb index ce64e41fa..686a1ee1b 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/back_end/news_bulletins/show.html.erb @@ -1,7 +1,7 @@
    • <%= t('news.category') %> - <%= @news_bulletin.news_bulletin_category.i18n_variable[I18n.locale] rescue nil %> + <%= @news_bulletin.news_bulletin_category.title rescue nil %>
    • <%= t('news.postdate') %> @@ -9,7 +9,7 @@
    • <%= t('news.title') %> - <%= @news_bulletin.title[I18n.locale] %> + <%= @news_bulletin.title %>
    • <%#= image_tag(@news_bulletin.image.url, :size => "320x240") if @news_bulletin.image.file %> @@ -17,23 +17,23 @@
    • <%= t('news.subtitle') %> - <%= @news_bulletin.subtitle[I18n.locale].html_safe %> + <%= @news_bulletin.subtitle.html_safe rescue '' %>
    • <%= t('news.text') %> - <%= @news_bulletin.text[I18n.locale].html_safe %> + <%= @news_bulletin.text.html_safe rescue '' %>
    • <%= t('news.link') %> <% @news_bulletin.news_bulletin_links.each do | blink | %> - <%= link_to blink.i18n_variable[I18n.locale], blink.url, :target => '_blank' %> + <%= link_to blink.title, blink.url, :target => '_blank' %> <% end %>
    • <%= t('news.file') %> <% @news_bulletin.news_bulletin_files.each do | bfile | %> - <%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description[I18n.locale]} if bfile.file.file %> + <%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> <% end %>
    • diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb index 6968a482f..2a7c1668e 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.html.erb @@ -2,12 +2,17 @@ <%= flash_messages %> -<% if @current_category %> -

      <%= @current_category.i18n_variable[I18n.locale] %>

      -<% else %> -

      <%= t('news.news') %>

      +

      <%= @page.title rescue nil %>

      + +<% if !params[:name].blank?%> + <%= t("search.unit_get",:unit_name => UnitListForAnc.find(params[:name]).title,:item_num=>@news_bulletins.count) %> <% end %> +<% if @news_bulletins.blank? and !params[:search_query].blank? %> + <%=render :partial => 'shared/search_not_found' %> +<% elsif !params[:search_query].blank? %> + <%= t("search.result_get",:search_word => params[:search_query],:item_num=>@news_bulletins.count) %> +<% end %> @@ -17,12 +22,12 @@ <% @news_bulletins.each do |post| %> - + - + <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder new file mode 100644 index 000000000..058e296ce --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/index.rss.builder @@ -0,0 +1,21 @@ +xml.instruct! :xml, :version => "1.0" +xml.rss :version => "2.0" do + xml.channel do + if @current_category + xml.title @current_category.title_translations[I18n.locale.to_s] + else + xml.title t('news.campus_news') + end + xml.link panel_news_front_end_news_bulletins_path(:rss) + + for news_bulletin in @news_bulletins + xml.item do + xml.title news_bulletin.title_translations[I18n.locale.to_s] + xml.description news_bulletin.subtitle_translations[I18n.locale.to_s] + xml.pubDate news_bulletin.postdate.to_s(:rfc822) + xml.link panel_news_front_end_news_bulletin_path(news_bulletin, :rss) + xml.guid panel_news_front_end_news_bulletin_path(news_bulletin, :rss) + end + end + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb index df391c548..eac3fec8e 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.html.erb @@ -1,12 +1,12 @@ <% # encoding: utf-8 %> -

      <%= @news_bulletin.title[I18n.locale] %>

      +

      <%= @news_bulletin.title %>

      <%= dislpay_view_count(@news_bulletin) %> <%= display_date(@news_bulletin.postdate) %> - <% unit = @news_bulletin.unit_list_for_anc.title[I18n.locale] rescue nil %> + <% unit = @news_bulletin.unit_list_for_anc.title rescue nil %> <%= " | " if unit %> - <%= unit %> + <%= link_to unit, panel_news_front_end_index_news_bulletins_by_unit_path(:name=>@news_bulletin.unit_list_for_anc_id) unless unit.blank?%>
      @@ -14,7 +14,7 @@ <%= link_to image_tag(@news_bulletin.image.url, :size => "320x240"), @news_bulletin.image.url, {:target => '_blank', :title => @news_bulletin.image_identifier} if @news_bulletin.image.file %>
      - <%= @news_bulletin.text[I18n.locale].html_safe %> + <%= @news_bulletin.text.html_safe rescue '' %>
      <% if @news_bulletin.news_bulletin_links.size > 0 %> @@ -22,7 +22,7 @@
      @@ -32,13 +32,11 @@
      <% @news_bulletin.news_bulletin_files.each do | bfile | %> - <%= link_to bfile.filetitle[I18n.locale], bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> + <%= link_to bfile.title, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> <% end %>
      <% end %> -
      - -
      +<%= share_links(@news_bulletin, 'news') %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder new file mode 100644 index 000000000..3def9abe7 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/front_end/news_bulletins/show.rss.builder @@ -0,0 +1,21 @@ +xml.instruct! :xml, :version => "1.0" +xml.rss :version => "2.0" do + xml.channel do + if @current_category + xml.title @current_category.title_translations[I18n.locale.to_s] + else + xml.title t('news.campus_news') + end + xml.link panel_news_front_end_news_bulletins_path(:rss) + +# for news_bulletin in @news_bulletins + xml.item do + xml.title @news_bulletin.title + xml.description @news_bulletin.text + xml.pubDate @news_bulletin.postdate.to_s(:rfc822) + xml.link panel_news_front_end_news_bulletin_path(@news_bulletin, :rss) + xml.guid panel_news_front_end_news_bulletin_path(@news_bulletin, :rss) + end +# end + end +end \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb index 4eab719a0..39af5c14b 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_index.html.erb @@ -15,8 +15,8 @@ diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb index be0c140fc..d677c6202 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_news_bulletins.html.erb @@ -1,6 +1,6 @@ <% @news_bulletins.each do |news_bulletin| %>
    • - <%= link_to news_bulletin.title[I18n.locale], panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category_id) %> + <%= link_to news_bulletin.title, panel_news_front_end_news_bulletin_path(news_bulletin, :category_id => news_bulletin.news_bulletin_category_id) %>
    • <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_web_links.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_web_links.html.erb index a88334066..2a888b6e5 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_web_links.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/_web_links.html.erb @@ -1,6 +1,6 @@ <% @web_links.each do |web_link| %>
    • - <%= link_to web_link.name[I18n.locale], web_link.url %> + <%= link_to web_link.title, web_link.url %>
    • <% end %> diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb index fb6c0452e..62e2e9581 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/home_banner.html.erb @@ -1,5 +1,5 @@ <% if @news_bulletins and !@news_bulletins.nil? %> -

      <%= t('news.campus_news')%>

      +

      <%= link_to t('news.campus_news'), panel_news_front_end_news_bulletins_path %>

      <%#= link_to t('news.more'),panel_news_front_end_news_bulletins_path(), :class => "topic_note" %>
      @@ -9,7 +9,7 @@ @@ -19,9 +19,9 @@
        <% @news_bulletins.each do |post| %>
      • -
        <%= image_tag(post.image.url, :size => "290x130") if post.image.file %>
        -

        <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>

        -

        <%= post.subtitle[I18n.locale].html_safe %>

        +
        <%= link_to image_tag(post.image.url, :size => "290x130"), panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>
        +

        <%= link_to post.title, panel_news_front_end_news_bulletin_path(post, :category_id => post.news_bulletin_category_id) %>

        +

        <%= post.subtitle.html_safe rescue '' %>

      • <% end %>
      diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_list.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_list.html.erb index 9523fd9a5..588c34f08 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_list.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_list.html.erb @@ -17,7 +17,7 @@
      next
        <% tag.news_bulletins.each do |post| %> -
      • <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post) %>
      • +
      • <%= link_to post.title, panel_news_front_end_news_bulletin_path(post) %>
      • <% end %>
      diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_search_block.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_search_block.html.erb new file mode 100644 index 000000000..b4e568fc9 --- /dev/null +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_search_block.html.erb @@ -0,0 +1,9 @@ +<%= form_tag panel_news_front_end_news_bulletins_path, method: :get do %> + <%= hidden_field_tag :category_id, params[:category_id] %> + <%= hidden_field_tag :tag_id, params[:tag_id] %> +

      + <%= text_field_tag :search_query, params[:search_query],{:value => (params[:search_query].blank?? '' : params[:search_query]),:placeholder=>t("news.search") }%> + <%= hidden_field_tag :category_id, params[:category_id] %> + <%= submit_tag "Search", name: nil %> +

      +<% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb index 5ea1a930c..d60cf04b2 100644 --- a/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb +++ b/vendor/built_in_modules/news/app/views/panel/news/widget/news_bulletins/news_bulletins_side_bar.html.erb @@ -4,7 +4,7 @@
        <% @news_bulletin_categorys.each do |category| %>
      • - <%= link_to category.i18n_variable[I18n.locale], panel_news_front_end_news_bulletins_path(:category_id => category.id) %> + <%= link_to category.title, panel_news_front_end_news_bulletins_path(:category_id => category.id) %>
      • <% end %>
      @@ -12,8 +12,8 @@

      <%= t('announcement.tag_cloud') %>

      - <% @tags.each do |tag| %> - <%= link_to tag[I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag.id), :class => "hot#{rand(4) + 1} #{(tag.id.to_s.eql?(params[:tag_id]) || tag.key.eql?(params[:tag_id])) ? 'active' : nil}" %> + <% @tags_and_class.each do |tag| %> + <%= link_to tag[0][I18n.locale], panel_news_front_end_news_bulletins_path(:tag_id => tag[0].id, :category_id => params[:category_id]),:class => "#{tag[1]} #{(tag[0].id.to_s.eql?(params[:tag_id]) || tag[0].key.eql?(params[:tag_id])) ? 'active' : nil} " %> <% end %>
      diff --git a/vendor/built_in_modules/news/config/locales/en.yml b/vendor/built_in_modules/news/config/locales/en.yml index 37f06ea43..98667b9a0 100644 --- a/vendor/built_in_modules/news/config/locales/en.yml +++ b/vendor/built_in_modules/news/config/locales/en.yml @@ -35,6 +35,9 @@ en: passed: Passed pending: Pending rejected: Rejected + rejected_reason: 'Reason:' + rejected_reason_empty: "Approval rejected,no referencable information" + clear: Clear hot: Hot @@ -59,12 +62,14 @@ en: all_articles: List add_new: Add sure?: Sure? + search: Search in news campus_news: Campus News more: more+ news_bulletins: NewsBulletins related_links: Related Links news: News news_bulletin: + ut_prompt: Please select UT category: Category list_lower: " list" title: Title @@ -77,7 +82,8 @@ en: approval_pending: 'Pending' approval_pass: 'Pass' approval_setting_window_title: 'Unit' - + update_success: Successfully Updated + unit_name: Unit name # admin: # action: Action # add_language: Add language diff --git a/vendor/built_in_modules/news/config/locales/zh_tw.yml b/vendor/built_in_modules/news/config/locales/zh_tw.yml index 290df5e60..4ed7d00be 100644 --- a/vendor/built_in_modules/news/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/news/config/locales/zh_tw.yml @@ -30,6 +30,8 @@ zh_tw: passed: 審核通過 pending: 待審查 rejected: 不通過 + rejected_reason: '原因:' + rejected_reason_empty: 審核沒有通過,沒有相關訊息 clear: 清除 quick_edit: 快速編輯 @@ -39,6 +41,7 @@ zh_tw: all_articles: 列表 tags: 標籤 categories: 分類 + search: 搜尋新聞 status: 狀態 sure?: 確定嗎? campus_news: 校園新聞 @@ -47,11 +50,15 @@ zh_tw: related_links: 相關連結 news: 新聞 news_bulletin: + ut_prompt: 請選擇單位 category: 分類 list_lower: 列表 title: 標題 + subtitle: 副標題 + text: 內文 + unit_name: 發佈單位 postdate: 張貼日期 - approval: 公告審核 + approval: 新聞審核 approval_setting: 審核設定 approval_stat: 審核狀況 approval_pending: 待審核 @@ -59,7 +66,7 @@ zh_tw: approval_pass: '通過' approval_not_pass_reason: '不通過原因' approval_setting_window_title: '單位' - + update_success: 新聞已成功更新 news_bulletin: last_modified: 最後修改於 tags: 標籤 @@ -68,9 +75,16 @@ zh_tw: category: 分類 status: 狀態 title: 標題 - fact_check: 公告審核 + fact_check: 新聞審核 delete: 刪除 edit: 編輯 + update_success: 分類更新成功 + update_failed: 分類更新失敗 + create_news_bulletin_success: 新增新聞成功 + update_success: 更新新聞成功 + approve_bulletin_success: 成功審核新聞 + approve_bulletin_fail: 審核新聞失敗 + # action: 行動 # add_language: 新增語言 # admin: 管理 diff --git a/vendor/built_in_modules/news/config/routes.rb b/vendor/built_in_modules/news/config/routes.rb index 244b1d034..5220248c6 100644 --- a/vendor/built_in_modules/news/config/routes.rb +++ b/vendor/built_in_modules/news/config/routes.rb @@ -15,7 +15,7 @@ Rails.application.routes.draw do get 'load_quick_edit' end collection do - post 'delete' + get 'delete' end match "file_quick_add/:news_bulletin_id" => "news_bulletins#file_quick_add" ,:as => :file_quick_add match "file_quick_edit/:news_bulletin_id" => "news_bulletins#file_quick_edit" ,:as => :file_quick_edit @@ -34,6 +34,7 @@ Rails.application.routes.draw do resources :tags end namespace :front_end do + match "index_by_unit" => "news_bulletins#index_news_bulletins_by_unit",:as => :index_news_bulletins_by_unit resources :news_bulletins # do # match "preview" => "news_bulletins#preview_content",:as => :get_preview_content # end @@ -45,6 +46,7 @@ Rails.application.routes.draw do match "reload_news_bulletins" => "news_bulletins#reload_news_bulletins" match "reload_web_links" => "news_bulletins#reload_web_links" match "news_bulletins_side_bar" => "news_bulletins#news_bulletins_side_bar" + match "news_bulletins_search_block" => "news_bulletins#news_bulletins_search_block" end end end diff --git a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb index 809bfbb33..0f334e77b 100644 --- a/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb +++ b/vendor/built_in_modules/page_content/app/controllers/panel/page_content/back_end/page_contexts_controller.rb @@ -5,8 +5,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll #before_filter :is_admin? def index - - @page_contexts = params[:sort] ? get_sorted_and_filtered("page_contexts", {:archived => false}) : PageContext.where(:archived => false).page(params[:page]).per(10) + @page_contexts = (params.has_key?:sort)? get_sorted_and_filtered("page_contexts", {:archived => false}) : PageContext.where(:archived => false).page(params[:page]).per(10) respond_to do |format| format.html # index.html.erb diff --git a/vendor/built_in_modules/page_content/app/models/page_context.rb b/vendor/built_in_modules/page_content/app/models/page_context.rb index be60db27b..7c9bde354 100644 --- a/vendor/built_in_modules/page_content/app/models/page_context.rb +++ b/vendor/built_in_modules/page_content/app/models/page_context.rb @@ -9,7 +9,7 @@ class PageContext is_impressionable :counter_cache => { :column_name => :view_count } - has_one :context, :class_name => "I18nVariable", :as => :language_value, :autosave => true, :dependent => :destroy + field :context, localize: true field :create_user_id field :update_user_id @@ -26,7 +26,7 @@ class PageContext ObjectAuthTitlesOptions = %W{Edit} def pp_object - page.i18n_variable[I18n.locale] + page.title end def is_top? diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb index 835b05114..d41fb6d9c 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_form.html.erb @@ -6,7 +6,7 @@
      <%= f.label :name %> - <%= @page_context.page.i18n_variable[I18n.locale] %> + <%= @page_context.page.title %>
      - + + \ No newline at end of file diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb index 7a37d4a76..0c15e3e18 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_sort_headers.html.erb @@ -1,4 +1,4 @@ -<%= render_sort_bar(false, ['name', 'page','span7', 'page_context.name'], +<%= render_sort_bar(false, nil, ['name', 'page','span7', 'page_context.name'], ['version', 'version', 'span2', 'page_context.version'], ['update_time', 'updated_at', 'span2', 'page_context.update_time'], ['last_modified', 'update_user_id', 'span2', 'page_context.last_modified']).html_safe %> diff --git a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb index 38d83b294..56ec11e3c 100644 --- a/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb +++ b/vendor/built_in_modules/page_content/app/views/panel/page_content/back_end/page_contexts/_view_page_context.html.erb @@ -2,7 +2,7 @@ <% @site_valid_locales.each do |locale| %> - + <% end %> \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/destroy.js.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/destroy.js.erb index bea996335..fc1ed1421 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/destroy.js.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/destroy.js.erb @@ -1 +1 @@ -$("#<%= dom_id @web_link_category %>").remove(); \ No newline at end of file +$("#<%= dom_id @web_link_category %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@web_link_category) %> "); \ No newline at end of file diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb index 03d11db1c..97f21a8c9 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/_form.html.erb @@ -39,6 +39,7 @@ <%= content_tag :label,:class => "checkbox inline" do -%> <%= check_box_tag 'web_link[tag_ids][]', tag.id, @web_link.tag_ids.include?(tag.id)%> <%= tag[I18n.locale] %> + <%= hidden_field_tag 'web_link[tag_ids][]', '' %> <% end %> <% end %> @@ -53,8 +54,8 @@
      - <%= f.label :category %> - <%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.i18n_variable[I18n.locale], t.id ]} %> + <%= f.label :category ,t("web_resource.category")%> + <%= f.select :web_link_category_id, @web_link_categorys.collect {|t| [ t.title, t.id ]} %>
      -
      + - + diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb index 7e7f2c95e..e69de29bb 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/show.html.erb @@ -1,57 +0,0 @@ -<% # encoding: utf-8 %> - -
      -
      -
      - -

      <%= flash_messages %>

      - -
        -
      • - <%= t('announcement.category') %> - <%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %> -
      • -
      • - <%= t('announcement.postdate') %> - <%= display_date(@bulletin.postdate) %> -
      • -
      • - <%= t('announcement.title') %> - <%= @bulletin.title %> -
      • -
      • - <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> - <%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %> -
      • -
      • - <%= t('announcement.subtitle') %> - <%= @bulletin.subtitle %> -
      • -
      • - <%= t('announcement.text') %> - <%= @bulletin.text %> -
      • -
      • -
      • - <%= t('announcement.link') %> - <% @bulletin.bulletin_links.each do | blink | %> - <%= link_to blink.name, blink.url, :target => '_blank' %> - <% end %> -
      • -
      • - <%= t('announcement.file') %> - <% @bulletin.bulletin_files.each do | bfile | %> - <%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> - <% end %> -
      • -
      • - <%= t('announcement.張貼者') %> - <%= User.find(@bulletin.create_user_id).name %> -
      • -
      • - <%= t('announcement.最後修改時間') %> - <%= display_date_time(@bulletin.updated_at) %> -
      • - - -<%#= link_back %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/_web_links.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/_web_links.html.erb index 93e65230c..cc612c5ec 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/_web_links.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/_web_links.html.erb @@ -1,6 +1,6 @@
          <% @web_links.each do |widget| -%> -
        • <%= link_to widget.name[I18n.locale], widget.url, {:target => '_blank', :title => widget.name[I18n.locale]} %>
        • +
        • <%= link_to widget.title, widget.url, {:target => '_blank', :title => widget.title} %>
        • <% end -%>
        diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb index 40d70aaa7..1c7734290 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/widget/web_links/index.html.erb @@ -1,5 +1,5 @@ <% if @current_category %> -

        <%= @current_category.i18n_variable[I18n.locale] + " " + t('web_resource.list_lower') %>

        +

        <%= @current_category.title + " " + t('web_resource.list_lower') %>

        <% elsif @tag %>

        <%= @tag[I18n.locale] + " " + t('web_resource.list_lower') %>

        <% else %> @@ -14,9 +14,9 @@ <% @web_links.each do |post| %>
      - + <% end %> diff --git a/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml b/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml index ace65d53a..a0104cbd1 100644 --- a/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/web_resource/config/locales/zh_tw.yml @@ -21,7 +21,13 @@ zh_tw: web_resource: list_lower: 列表 list_link: 鏈接列表 - + category: 分類 + name: 名稱 + describe: 描述 + url: 路徑 + edit: 編輯 + delete: 刪除 + cate_auth: 分類授權 # Chinese (Taiwan) translations for Ruby on Rails diff --git a/vendor/built_in_modules/web_resource/config/routes.rb b/vendor/built_in_modules/web_resource/config/routes.rb index 02c81a827..d585c6b33 100644 --- a/vendor/built_in_modules/web_resource/config/routes.rb +++ b/vendor/built_in_modules/web_resource/config/routes.rb @@ -6,7 +6,7 @@ Rails.application.routes.draw do root :to => "web_links#index" resources :web_links do collection do - post 'delete' + get 'delete' end end resources :web_link_categorys diff --git a/vendor/built_in_modules/web_resource/web_resource.json b/vendor/built_in_modules/web_resource/web_resource.json index a854d31bb..ea014b3cc 100644 --- a/vendor/built_in_modules/web_resource/web_resource.json +++ b/vendor/built_in_modules/web_resource/web_resource.json @@ -6,6 +6,7 @@ "intro": "A simple blog……", "update_info": "Some info", "create_date": "11-11-2011", - "widgets": ["home_list"], + "widgets": ["home_list"]. + "category": ["WebLinkCategory"], "enable_frontend": true } diff --git a/vendor/impressionist/.gitignore b/vendor/impressionist/.gitignore deleted file mode 100644 index 685130c77..000000000 --- a/vendor/impressionist/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -*~ -/coverage -/pkg -/rdoc -/test_app/db/schema.rb -/test_app/db/migrate/*_create_impressions_table.rb -/test_app/doc -/test_app/test -/test_app/vendor -Gemfile.lock diff --git a/vendor/impressionist/.rspec b/vendor/impressionist/.rspec deleted file mode 100644 index 4e1e0d2f7..000000000 --- a/vendor/impressionist/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/vendor/impressionist/.travis.yml b/vendor/impressionist/.travis.yml deleted file mode 100644 index b7ae9000f..000000000 --- a/vendor/impressionist/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -before_install: gem install bundler -before_script: "cd test_app && bundle install && ./script/rails generate impressionist && bundle exec rake db:migrate && cd .." -language: ruby -rvm: - - rbx-18mode - - rbx-19mode - - jruby-18mode - - 1.8.7 - - 1.9.2 - - 1.9.3 - - ruby-head diff --git a/vendor/impressionist/CHANGELOG.rdoc b/vendor/impressionist/CHANGELOG.rdoc deleted file mode 100644 index c3378b22e..000000000 --- a/vendor/impressionist/CHANGELOG.rdoc +++ /dev/null @@ -1,19 +0,0 @@ -== 0.4.0 (2011-06-03) -* Fix postgres bug -* New impression count method that accepts options for filter, start_date and end_date -* Add referrer to Impression model. YOU MUST RUN THE UPGRADE MIGRATION IF YOU ARE UPGRADING FROM 0.3.0 -* UPGRADE MIGRATION = impressionist/upgrade_migrations/version_0_4_0.rb -* NOTE IF YOU ARE UPGRADING FROM 0.2.5 OR BELOW, YOU MUST RUN BOTH UPGRADE MIGRATIONS - -== 0.3.0 (2011-03-06) -* added session_hash to impression model -* migration template updated to add session_hash -* new count instance method for impressionable model - unique_impression_count_session -* NOTE: if you are upgrading from 0.2.5, then run the migration in the 'upgrade_migrations' dir - -== 0.2.5 (2011-02-17) -* New model method - @widget.unique_impression_count_ip - This gives you unique impression account filtered by IP (and in turn request_hash since they have same IPs) -* @widget.unique_impression_count now uses request_hash. This was incorrectly stated in the README, since it was using ip_address. The README is correct as a result of the method change. - -== 0.2.4 (2011-02-17) -* Fix issue #1 - action_name and controller_name were not being logged for impressionist method inside action diff --git a/vendor/impressionist/Gemfile b/vendor/impressionist/Gemfile deleted file mode 100644 index e6cc394d9..000000000 --- a/vendor/impressionist/Gemfile +++ /dev/null @@ -1,13 +0,0 @@ -source 'https://rubygems.org' - -platforms :jruby do - gem 'activerecord-jdbcsqlite3-adapter' - gem 'jdbc-sqlite3' - gem 'jruby-openssl' -end - -platforms :ruby, :mswin, :mingw do - # gem 'sqlite3' -end - -gemspec diff --git a/vendor/impressionist/LICENSE.txt b/vendor/impressionist/LICENSE.txt deleted file mode 100644 index 67e3f5c64..000000000 --- a/vendor/impressionist/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2011 cowboycoded - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/impressionist/README.md b/vendor/impressionist/README.md deleted file mode 100644 index 40774e740..000000000 --- a/vendor/impressionist/README.md +++ /dev/null @@ -1,198 +0,0 @@ -![Impressionist Logo](https://github.com/charlotte-ruby/impressionist/raw/master/logo.png) - -[![Build Status](https://secure.travis-ci.org/charlotte-ruby/impressionist.png?branch=master)](http://travis-ci.org/charlotte-ruby/impressionist) - -impressionist -============= - -A lightweight plugin that logs impressions per action or manually per model - --------------------------------------------------------------------------------- - -What does this thing do? ------------------------- -Logs an impression... and I use that term loosely. It can log page impressions -(technically action impressions), but it is not limited to that. You can log -impressions multiple times per request. And you can also attach it to a model. -The goal of this project is to provide customizable stats that are immediately -accessible in your application as opposed to using Google Analytics and pulling -data using their API. You can attach custom messages to impressions. No -reporting yet.. this thingy just creates the data. - -What about bots? ----------------- -They are ignored. 1200 known bots have been added to the ignore list as of -February 1, 2011. Impressionist uses this list: -http://www.user-agents.org/allagents.xml - -Installation ------------- -Add it to your Gemfile - - gem 'impressionist' - -Install with Bundler - - bundle install - -Generate the impressions table migration - - rails g impressionist - -Run the migration - - rake db:migrate - -The following fields are provided in the migration: - - t.string "impressionable_type" # model type: Widget - t.integer "impressionable_id" # model instance ID: @widget.id - t.integer "user_id" # automatically logs @current_user.id - t.string "controller_name" # logs the controller name - t.string "action_name" # logs the action_name - t.string "view_name" # TODO: log individual views (as well as partials and nested partials) - t.string "request_hash" # unique ID per request, in case you want to log multiple impressions and group them - t.string "session_hash" # logs the rails session - t.string "ip_address" # request.remote_ip - t.string "referrer" # request.referer - t.string "message" # custom message you can add - t.datetime "created_at" # I am not sure what this is.... Any clue? - t.datetime "updated_at" # never seen this one before either.... Your guess is as good as mine?? - -Usage ------ - -1. Log all actions in a controller - - WidgetsController < ApplicationController - impressionist - end - -2. Specify actions you want logged in a controller - - WidgetsController < ApplicationController - impressionist :actions=>[:show,:index] - end - -3. Make your models impressionable. This allows you to attach impressions to - an AR model instance. Impressionist will automatically log the Model name - (based on action_name) and the id (based on params[:id]), but in order to - get the count of impressions (example: @widget.impression_count), you will - need to make your model impressionalble - - class Widget < ActiveRecord::Base - is_impressionable - end - -4. Log an impression per model instance in your controller. Note that it is - not necessary to specify "impressionist" (usage #1) in the top of you - controller if you are using this method. If you add "impressionist" to the - top of your controller and also use this method in your action, it will - result in 2 impressions being logged (but associated with one request_hash) - - def show - @widget = Widget.find - impressionist(@widget,message:"wtf is a widget?") #message is optional - end - -5. Get unique impression count from a model. This groups impressions by - request_hash, so if you logged multiple impressions per request, it will - only count them one time. This unique impression count will not filter out - unique users, only unique requests - - @widget.impressionist_count - @widget.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-05") - @widget.impressionist_count(:start_date=>"2011-01-01") #specify start date only, end date = now - -6. Get the unique impression count from a model filtered by IP address. This - in turn will give you impressions with unique request_hash, since rows with - the same request_hash will have the same IP address. - - @widget.impressionist_count(:filter=>:ip_address) - -7. Get the unique impression count from a model filtered by session hash. Same - as #6 regarding request hash. This may be more desirable than filtering by - IP address depending on your situation, since filtering by IP may ignore - visitors that use the same IP. The downside to this filtering is that a - user could clear session data in their browser and skew the results. - - @widget.impressionist_count(:filter=>:session_hash) - -8. Get total impression count. This may return more than 1 impression per http - request, depending on how you are logging impressions - - @widget.impressionist_count(:filter=>:all) - -Logging impressions for authenticated users happens automatically. If you have -a current_user helper or use @current_user in your before_filter to set your -authenticated user, current_user.id will be written to the user_id field in the -impressions table. - -Adding a counter cache ----------------------- -Impressionist makes it easy to add a `counter_cache` column to your model. The -most basic configuration looks like: - - is_impressionable :counter_cache => true - -This will automatically increment the `impressions_count` column in the -included model. Note: You'll need to add that column to your model. If you'd -like specific a different column name, you can: - - is_impressionable :counter_cache => { :column_name => :my_column } - -If you'd like to include only unique impressions in your count: - - is_impressionable :counter_cache => { :column_name => :my_column, :unique => true } - -What if I only want to record unique impressions? -------------------------------------------------- -Maybe you only care about unique impressions and would like to avoid -unnecessary database records. You can specify conditions for recording -impressions in your controller: - - # only record impression if the request has a unique combination of type, id, and session - impressionist :unique => [:impressionable_type, :impressionable_id, :session_hash] - - # only record impression if the request has a unique combination of controller, action, and session - impressionist :unique => [:controller_name, :action_name, :session_hash] - - # only record impression if session is unique - impressionist :unique => [:session_hash] - -Or you can use the `impressionist` method directly: - - impressionist(impressionable, "some message", :unique => [:session_hash]) - -Development Roadmap -------------------- -* Automatic impression logging in views. For example, log initial view, and - any partials called from initial view -* Customizable black list for user-agents or IP addresses. Impressions will be - ignored. Web admin as part of the Engine. -* Reporting engine -* AB testing integration - -Contributing to impressionist ------------------------------ -* Check out the latest master to make sure the feature hasn't been implemented - or the bug hasn't been fixed yet -* Check out the issue tracker to make sure someone already hasn't requested it - and/or contributed it -* Fork the project -* Start a feature/bugfix branch -* Commit and push until you are happy with your contribution -* Make sure to add rpsec tests for it. Patches or features without tests will - be ignored. Also, try to write better tests than I do ;-) -* If adding engine controller or view functionality, use HAML and Inherited - Resources. -* All testing is done inside a small Rails app (test_app). You will find specs - within this app. - -Contributors ------------- -* [johnmcaliley](https://github.com/johnmcaliley) -* [coryschires](https://github.com/coryschires) -* [georgmittendorfer](https://github.com/georgmittendorfer) - -Copyright (c) 2011 John McAliley. See LICENSE.txt for further details. diff --git a/vendor/impressionist/Rakefile b/vendor/impressionist/Rakefile deleted file mode 100644 index d808f163b..000000000 --- a/vendor/impressionist/Rakefile +++ /dev/null @@ -1,21 +0,0 @@ -require 'bundler/setup' -require 'rspec/core/rake_task' - -Bundler::GemHelper.install_tasks - -RSpec::Core::RakeTask.new do |task| - task.rspec_opts = "-I ./test_app/spec" - task.pattern = "./test_app/spec/**/*_spec.rb" -end - -task :test => :spec -task :default => :spec - -namespace :impressionist do - require File.dirname(__FILE__) + "/lib/impressionist/bots" - - desc "output the list of bots from http://www.user-agents.org/" - task :bots do - p Impressionist::Bots.consume - end -end diff --git a/vendor/impressionist/app/controllers/impressionist_controller.rb b/vendor/impressionist/app/controllers/impressionist_controller.rb deleted file mode 100644 index 05a397683..000000000 --- a/vendor/impressionist/app/controllers/impressionist_controller.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'digest/sha2' - -module ImpressionistController - module ClassMethods - def impressionist(opts={}) - before_filter { |c| c.impressionist_subapp_filter(opts[:actions], opts[:unique])} - end - end - - module InstanceMethods - def self.included(base) - base.before_filter :impressionist_app_filter - end - - def impressionist(obj,message=nil,opts={}) - unless bypass - if obj.respond_to?("impressionable?") - if unique_instance?(obj, opts[:unique]) - obj.impressions.create(associative_create_statement({:message => message})) - end - else - # we could create an impression anyway. for classes, too. why not? - raise "#{obj.class.to_s} is not impressionable!" - end - end - end - - def impressionist_app_filter - @impressionist_hash = Digest::SHA2.hexdigest(Time.now.to_f.to_s+rand(10000).to_s) - end - - def impressionist_subapp_filter(actions=nil,unique_opts=nil) - unless bypass - actions.collect!{|a|a.to_s} unless actions.blank? - if (actions.blank? || actions.include?(action_name)) && unique?(unique_opts) - Impression.create(direct_create_statement) - end - end - end - - private - - def bypass - Impressionist::Bots.bot?(request.user_agent) - end - - def unique_instance?(impressionable, unique_opts) - return unique_opts.blank? || !impressionable.impressions.where(unique_query(unique_opts)).exists? - end - - def unique?(unique_opts) - return unique_opts.blank? || !Impression.where(unique_query(unique_opts)).exists? - end - - # creates the query to check for uniqueness - def unique_query(unique_opts) - full_statement = direct_create_statement - # reduce the full statement to the params we need for the specified unique options - unique_opts.reduce({}) do |query, param| - query[param] = full_statement[param] - query - end - end - - # creates a statment hash that contains default values for creating an impression via an AR relation. - def associative_create_statement(query_params={}) - query_params.reverse_merge!( - :controller_name => controller_name, - :action_name => action_name, - :user_id => user_id, - :request_hash => @impressionist_hash, - :session_hash => session_hash, - :ip_address => request.remote_ip, - :referrer => request.referer - ) - end - - # creates a statment hash that contains default values for creating an impression. - def direct_create_statement(query_params={}) - query_params.reverse_merge!( - :impressionable_type => controller_name.singularize.camelize, - :impressionable_id=> params[:id] - ) - associative_create_statement(query_params) - end - - def session_hash - # # careful: request.session_options[:id] encoding in rspec test was ASCII-8BIT - # # that broke the database query for uniqueness. not sure if this is a testing only issue. - # str = request.session_options[:id] - # logger.debug "Encoding: #{str.encoding.inspect}" - # # request.session_options[:id].encode("ISO-8859-1") - request.session_options[:id] - end - - #use both @current_user and current_user helper - def user_id - user_id = @current_user ? @current_user.id : nil rescue nil - user_id = current_user ? current_user.id : nil rescue nil if user_id.blank? - user_id - end - end -end diff --git a/vendor/impressionist/app/models/impression.rb b/vendor/impressionist/app/models/impression.rb deleted file mode 100644 index b4d81ecb5..000000000 --- a/vendor/impressionist/app/models/impression.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Impression - belongs_to :impressionable, :polymorphic=>true -end diff --git a/vendor/impressionist/app/models/impressionist/bots.rb b/vendor/impressionist/app/models/impressionist/bots.rb deleted file mode 100644 index aee7cf9cb..000000000 --- a/vendor/impressionist/app/models/impressionist/bots.rb +++ /dev/null @@ -1,1468 +0,0 @@ -module Impressionist - module Bots - - def self.bot?(user_agent = nil) - return false if user_agent.nil? - WILD_CARDS.any? { |wc| user_agent.downcase.include?(wc) } || LIST.include?(user_agent) - end - - WILD_CARDS = ["bot","yahoo","slurp","google","msn","crawler"] - - LIST = [" UnChaos From Chaos To Order Hybrid Web Search Engine.(vadim_gonchar@unchaos.com)", - " UnChaos Bot Hybrid Web Search Engine. (vadim_gonchar@unchaos.com)", - " UnChaosBot From Chaos To Order UnChaos Hybrid Web Search Engine at www.unchaos.com (info@unchaos.com)", - " http://www.sygol.com", - "*/Nutch-0.9-dev", - "+SitiDi.net/SitiDiBot/1.0 (+Have Good Day)", - "-DIE-KRAEHE- META-SEARCH-ENGINE/1.1 http://www.die-kraehe.de", - "192.comAgent", - "4anything.com LinkChecker v2.0", - "8484 Boston Project v 1.0", - ":robot/1.0 (linux) ( admin e-mail: undefined http://www.neofonie.de/loesungen/search/robot.html )", - "A-Online Search", - "A1 Sitemap Generator/1.0 (+http://www.micro-sys.dk/products/sitemap-generator/) miggibot/2006.01.24", - "aardvark-crawler", - "AbachoBOT", - "AbachoBOT (Mozilla compatible)", - "ABCdatos BotLink/5.xx.xxx#BBL", - "Aberja Checkomat", - "abot/0.1 (abot; http://www.abot.com; abot@abot.com)", - "About/0.1libwww-perl/5.47", - "Accelatech RSSCrawler/0.4", - "accoona", - "Accoona-AI-Agent/1.1.1 (crawler at accoona dot com)", - "Accoona-AI-Agent/1.1.2 (aicrawler at accoonabot dot com)", - "Ack (http://www.ackerm.com/)", - "AcoiRobot", - "Acoon Robot v1.50.001", - "Acoon Robot v1.52 (http://www.acoon.de)", - "Acoon-Robot 4.0.x.[xx] (http://www.acoon.de)", - "Acoon-Robot v3.xx (http://www.acoon.de and http://www.acoon.com)", - "Acorn/Nutch-0.9 (Non-Profit Search Engine; acorn.isara.org; acorn at isara dot org)", - "AESOP_com_SpiderMan", - "agadine/1.x.x (+http://www.agada.de)", - "Agent-SharewarePlazaFileCheckBot/2.0+(+http://www.SharewarePlaza.com)", - "AgentName/0.1 libwww-perl/5.48", - "AIBOT/2.1 By +(www.21seek.com A Real artificial intelligence search engine China)", - "aipbot/1.0 (aipbot; http://www.aipbot.com; aipbot@aipbot.com)", - "aipbot/2-beta (aipbot dev; http://aipbot.com; aipbot@aipbot.com)", - "Aladin/3.324", - "Aleksika Spider/1.0 (+http://www.aleksika.com/)", - "AlkalineBOT/1.3", - "AlkalineBOT/1.4 (1.4.0326.0 RTM)", - "Allesklar/0.1 libwww-perl/5.46", - "Allrati/1.1 (+)", - "AltaVista Intranet V2.0 AVS EVAL search@freeit.com", - "AltaVista Intranet V2.0 Compaq Altavista Eval sveand@altavista.net", - "AltaVista Intranet V2.0 evreka.com crawler@evreka.com", - "AltaVista V2.0B crawler@evreka.com", - "AmfibiBOT", - "Amfibibot/0.06 (Amfibi Web Search; http://www.amfibi.com; agent@amfibi.com)", - "Amfibibot/0.07 (Amfibi Robot; http://www.amfibi.com; agent@amfibi.com)", - "amibot", - "AnnoMille spider 0.1 alpha - http://www.annomille.it", - "AnswerBus (http://www.answerbus.com/)", - "antibot-V1.1.5/i586-linux-2.2", - "AnzwersCrawl/2.0 (anzwerscrawl@anzwers.com.au;Engine)", - "Apexoo Spider 1.x", - "Aport", - "appie 1.1 (www.walhello.com)", - "ArabyBot (compatible; Mozilla/5.0; GoogleBot; FAST Crawler 6.4; http://www.araby.com;)", - "ArachBot", - "Arachnoidea (arachnoidea@euroseek.com)", - "ArchitextSpider", - "archive.org_bot", - "Arikus_Spider", - "Arquivo-web-crawler (compatible; heritrix/1.12.1 +http://arquivo-web.fccn.pt)", - "ASAHA Search Engine Turkey V.001 (http://www.asaha.com/)", - "Asahina-Antenna/1.x", - "Asahina-Antenna/1.x (libhina.pl/x.x ; libtime.pl/x.x)", - "ask.24x.info", - "AskAboutOil/0.06-rcp (Nutch; http://www.nutch.org/docs/en/bot.html; nutch-agent@askaboutoil.com)", - "asked/Nutch-0.8 (web crawler; http://asked.jp; epicurus at gmail dot com)", - "ASPSeek/1.2.5", - "ASPseek/1.2.9d", - "ASPSeek/1.2.x", - "ASPSeek/1.2.xa", - "ASPseek/1.2.xx", - "ASPSeek/1.2.xxpre", - "ASSORT/0.10", - "asterias/2.0", - "AtlocalBot/1.1 +(http://www.atlocal.com/local-web-site-owner.html)", - "Atomic_Email_Hunter/4.0", - "Atomz/1.0", - "atSpider/1.0", - "Attentio/Nutch-0.9-dev (Attentio's beta blog crawler; www.attentio.com; info@attentio.com)", - "augurfind", - "augurnfind V-1.x", - "autoemailspider", - "autowebdir 1.1 (www.autowebdir.com)", - "AV Fetch 1.0", - "AVSearch-1.0(peter.turney@nrc.ca)", - "AVSearch-3.0(AltaVista/AVC)", - "axadine/ (Axadine Crawler; http://www.axada.de/; )", - "AxmoRobot - Crawling your site for better indexing on www.axmo.com search engine.", - "BabalooSpider/1.3 (BabalooSpider; http://www.babaloo.si; spider@babaloo.si)", - "BaboomBot/1.x.x (+http://www.baboom.us)", - "BaiduImagespider+(+http://www.baidu.jp/search/s308.html)", - "BaiDuSpider", - "Baiduspider+(+http://help.baidu.jp/system/05.html)", - "Baiduspider+(+http://www.baidu.com/search/spider.htm)", - "Baiduspider+(+http://www.baidu.com/search/spider_jp.html)", - "Balihoo/Nutch-1.0-dev (Crawler for Balihoo.com search engine - obeys robots.txt and robots meta tags ; http://balihoo.com/index.aspx; robot at balihoo dot com)", - "BarraHomeCrawler (albertof@barrahome.org)", - "bdcindexer_2.6.2 (research@bdc)", - "BDFetch", - "BDNcentral Crawler v2.3 [en] (http://www.bdncentral.com/robot.html) (X11; I; Linux 2.0.44 i686)", - "beautybot/1.0 (+http://www.uchoose.de/crawler/beautybot/)", - "BebopBot/2.5.1 ( crawler http://www.apassion4jazz.net/bebopbot.html )", - "BigCliqueBOT/1.03-dev (bigclicbot; http://www.bigclique.com; bot@bigclique.com)", - "BIGLOTRON (Beta 2;GNU/Linux)", - "Bigsearch.ca/Nutch-x.x-dev (Bigsearch.ca Internet Spider; http://www.bigsearch.ca/; info@enhancededge.com)", - "BilgiBetaBot/0.8-dev (bilgi.com (Beta) ; http://lucene.apache.org/nutch/bot.html; nutch-agent@lucene.apache.org)", - "BilgiBot/1.0(beta) (http://www.bilgi.com/; bilgi at bilgi dot com)", - "Bitacle bot/1.1", - "Bitacle Robot (V:1.0;) (http://www.bitacle.com)", - "BlackWidow", - "Blaiz-Bee/1.0 (+http://www.blaiz.net)", - "Blaiz-Bee/2.00.8222 (BE Internet Search Engine http://www.rawgrunt.com)", - "Blaiz-Bee/2.00.xxxx (+http://www.blaiz.net)", - "BlitzBOT@tricus.net", - "BlitzBOT@tricus.net (Mozilla compatible)", - "BlogBot/1.x", - "Bloglines Title Fetch/1.0 (http://www.bloglines.com)", - "Bloglines-Images/0.1 (http://www.bloglines.com)", - "Bloglines/3.1 (http://www.bloglines.com)", - "Blogpulse (info@blogpulse.com)", - "BlogPulseLive (support@blogpulse.com)", - "BlogSearch/1.x +http://www.icerocket.com/", - "blogsearchbot-pumpkin-3", - "BlogsNowBot, V 2.01 (+http://www.blogsnow.com/)", - "BlogVibeBot-v1.1 (spider@blogvibe.nl)", - "blogWatcher_Spider/0.1 (http://www.lr.pi.titech.ac.jp/blogWatcher/)", - "BlogzIce/1.0 (+http://icerocket.com; rhodes@icerocket.com)", - "BlogzIce/1.0 +http://www.icerocket.com/", - "BloobyBot", - "Bloodhound/Nutch-0.9 (Testing Crawler for Research - obeys robots.txt and robots meta tags ; http://balihoo.com/index.aspx; robot at balihoo dot com)", - "boitho.com-dc/0.xx (http://www.boitho.com/dcbot.html)", - "boitho.com-robot/1.x", - "boitho.com-robot/1.x (http://www.boitho.com/bot.html)", - "BPImageWalker/2.0 (www.bdbrandprotect.com)", - "BravoBrian SpiderEngine MarcoPolo", - "BruinBot (+http://webarchive.cs.ucla.edu/bruinbot.html) ", - "BSDSeek/1.0", - "BTbot/0.x (+http://www.btbot.com/btbot.html)", - "BuildCMS crawler (http://www.buildcms.com/crawler)", - "BullsEye", - "bumblebee@relevare.com", - "BurstFindCrawler/1.1 (crawler.burstfind.com; http://crawler.burstfind.com; crawler@burstfind.com)", - "Buscaplus Robi/1.0 (http://www.buscaplus.com/robi/)", - "bwh3_user_agent", - "Cabot/Nutch-0.9 (Amfibi's web-crawling robot; http://www.amfibi.com/cabot/; agent@amfibi.com)", - "Cabot/Nutch-1.0-dev (Amfibi's web-crawling robot; http://www.amfibi.com/cabot/; agent@amfibi.com)", - "carleson/1.0", - "Carnegie_Mellon_University_Research_WebBOT-->PLEASE READ-->http://www.andrew.cmu.edu/~brgordon/webbot/index.html http://www.andrew.cmu.edu/~brgordon/webbot/index.html", - "Carnegie_Mellon_University_WebCrawler http://www.andrew.cmu.edu/~brgordon/webbot/index.html", - "Catall Spider", - "CazoodleBot/CazoodleBot-0.1 (CazoodleBot Crawler; http://www.cazoodle.com/cazoodlebot; cazoodlebot@cazoodle.com)", - "CCBot/1.0 (+http://www.commoncrawl.org/bot.html)", - "ccubee/x.x", - "Ceramic Tile Installation Guide (http://www.floorstransformed.com)", - "cfetch/1.0", - "China Local Browse 2.6", - "ChristCRAWLER 2.0", - "CipinetBot (http://www.cipinet.com/bot.html)", - "ClariaBot/1.0", - "Claymont.com", - "CloakDetect/0.9 (+http://fulltext.seznam.cz/)", - "Clushbot/2.x (+http://www.clush.com/bot.html)", - "Clushbot/3.x-BinaryFury (+http://www.clush.com/bot.html)", - "Clushbot/3.xx-Ajax (+http://www.clush.com/bot.html)", - "Clushbot/3.xx-Hector (+http://www.clush.com/bot.html)", - "Clushbot/3.xx-Peleus (+http://www.clush.com/bot.html)", - "Cogentbot/1.X (+http://www.cogentsoftwaresolutions.com/bot.html)", - "combine/0.0", - "Combine/2.0 http://combine.it.lth.se/", - "Combine/3 http://combine.it.lth.se/", - "Combine/x.0", - "cometrics-bot, http://www.cometrics.de", - "Computer_and_Automation_Research_Institute_Crawler crawler@ilab.sztaki.hu", - "Comrite/0.7.1 (Nutch; http://lucene.apache.org/nutch/bot.html; nutch-agent@lucene.apache.org)", - "ContactBot/0.2", - "ContentSmartz", - "Convera Internet Spider V6.x", - "ConveraCrawler/0.2", - "ConveraCrawler/0.9d (+http://www.authoritativeweb.com/crawl)", - "ConveraMultiMediaCrawler/0.1 (+http://www.authoritativeweb.com/crawl)", - "CoolBot", - "cosmos/0.8_(robot@xyleme.com)", - "cosmos/0.9_(robot@xyleme.com)", - "CougarSearch/0.x (+http://www.cougarsearch.com/faq.shtml)", - "Covac TexAs Arachbot", - "Cowbot-0.1 (NHN Corp. / +82-2-3011-1954 / nhnbot@naver.com)", - "Cowbot-0.1.x (NHN Corp. / +82-2-3011-1954 / nhnbot@naver.com)", - "CrawlConvera0.1 (CrawlConvera@yahoo.com)", - "Crawler (cometsearch@cometsystems.com)", - "Crawler admin@crawler.de", - "Crawler V 0.2.x admin@crawler.de", - "crawler@alexa.com", - "CrawlerBoy Pinpoint.com", - "Crawllybot/0.1 (Crawllybot; +http://www.crawlly.com; crawler@crawlly.com)", - "CreativeCommons/0.06-dev (Nutch; http://www.nutch.org/docs/en/bot.html; nutch-agent@lists.sourceforge.net)", - "CrocCrawler vx.3 [en] (http://www.croccrawler.com) (X11; I; Linux 2.0.44 i686)", - "csci_b659/0.13", - "Cuasarbot/0.9b http://www.cuasar.com/spider_beta/ ", - "CurryGuide SiteScan 1.1", - "Custom Spider www.bisnisseek.com /1.0", - "CyberPatrol SiteCat Webbot (http://www.cyberpatrol.com/cyberpatrolcrawler.asp)", - "CydralSpider/1.x (Cydral Web Image Search; http://www.cydral.com)", - "CydralSpider/3.0 (Cydral Image Search; http://www.cydral.com)", - "DataCha0s/2.0", - "DataCha0s/2.0", - "DataFountains/DMOZ Downloader", - "DataFountains/Dmoz Downloader (http://ivia.ucr.edu/useragents.shtml)", - "DataFountains/DMOZ Feature Vector Corpus Creator (http://ivia.ucr.edu/useragents.shtml)", - "DataparkSearch/4.47 (+http://dataparksearch.org/bot)", - "DataparkSearch/4.xx (http://www.dataparksearch.org/)", - "DataSpear/1.0 (Spider; http://www.dataspear.com/spider.html; spider@dataspear.com)", - "DataSpearSpiderBot/0.2 (DataSpear Spider Bot; http://dssb.dataspear.com/bot.html; dssb@dataspear.com)", - "DatenBot( http://www.sicher-durchs-netz.de/bot.html)", - "DaviesBot/1.7 (www.wholeweb.net)", - "daypopbot/0.x", - "dbDig(http://www.prairielandconsulting.com)", - "DBrowse 1.4b", - "DBrowse 1.4d", - "dCSbot/1.1", - "de.searchengine.comBot 1.2 (http://de.searchengine.com/spider)", - "deepak-USC/ISI", - "DeepIndex", - "DeepIndex ( http://www.zetbot.com )", - "DeepIndex (www.en.deepindex.com)", - "DeepIndexer.ca", - "Demo Bot DOT 16b", - "Demo Bot Z 16b", - "Denmex websearch (http://search.denmex.com)", - "dev-spider2.searchpsider.com/1.3b", - "DiaGem/1.1 (http://www.skyrocket.gr.jp/diagem.html)", - "Diamond/x.0", - "DiamondBot", - "Digger/1.0 JDK/1.3.0rc3", - "DigOut4U", - "DIIbot/1.2", - "disco/Nutch-0.9 (experimental crawler; www.discoveryengine.com; disco-crawl@discoveryengine.com)", - "disco/Nutch-1.0-dev (experimental crawler; www.discoveryengine.com; disco-crawl@discoveryengine.com)", - "DittoSpyder", - "dloader(NaverRobot)/1.0", - "DoCoMo/1.0/Nxxxi/c10", - "DoCoMo/1.0/Nxxxi/c10/TB", - "DoCoMo/2.0 P900iV(c100;TB;W24H11) ", - "DoCoMo/2.0 SH902i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)", - "DoCoMo/2.0/SO502i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)", - "dodgebot/experimental", - "Download-Tipp Linkcheck (http://download-tipp.de/)", - "Drecombot/1.0 (http://career.drecom.jp/bot.html)", - "DSurf15a 01", - "DSurf15a 71", - "DSurf15a 81", - "DSurf15a VA", - "dtSearchSpider", - "DuckDuckBot/1.0; (+http://duckduckgo.com/duckduckbot.html)", - "Dumbot(version 0.1 beta - dumbfind.com)", - "Dumbot(version 0.1 beta - http://www.dumbfind.com/dumbot.html)", - "Dumbot(version 0.1 beta)", - "e-sense 1.0 ea(www.vigiltech.com/esensedisclaim.html)", - "e-SocietyRobot(http://www.yama.info.waseda.ac.jp/~yamana/es/)", - "eApolloBot/2.0 (compatible; heritrix/2.0.0-SNAPSHOT-20071024.170148 +http://www.eapollo-opto.com)", - "EARTHCOM.info/1.x [www.earthcom.info]", - "EARTHCOM.info/1.xbeta [www.earthcom.info]", - "EasyDL/3.xx", - "EasyDL/3.xx http://keywen.com/Encyclopedia/Bot", - "EBrowse 1.4b", - "EchO!/2.0", - "Educate Search VxB", - "egothor/3.0a (+http://www.xdefine.org/robot.html)", - "EgotoBot/4.8 (+http://www.egoto.com/about.htm)", - "ejupiter.com", - "elfbot/1.0 (+http://www.uchoose.de/crawler/elfbot/)", - "ELI/20070402:2.0 (DAUM RSS Robot, Daum Communications Corp.; +http://ws.daum.net/aboutkr.html)", - "EmailSiphon", - "EmailSpider", - "EmailWolf 1.00", - "EMPAS_ROBOT", - "EnaBot/1.x (http://www.enaball.com/crawler.html)", - "Enfish Tracker", - "Enterprise_Search/1.0", - "Enterprise_Search/1.0.xxx", - "Enterprise_Search/1.00.xxx;MSSQL (http://www.innerprise.net/es-spider.asp)", - "envolk/1.7 (+http://www.envolk.com/envolkspiderinfo.php)", - "envolk[ITS]spider/1.6(+http://www.envolk.com/envolkspider.html)", - "EroCrawler", - "ES.NET_Crawler/2.0 (http://search.innerprise.net/)", - "eseek-larbin_2.6.2 (crawler@exactseek.com)", - "ESISmartSpider", - "eStyleSearch 4 (compatible; MSIE 6.0; Windows NT 5.0)", - "ESurf15a 15", - "EuripBot/0.x (+http://www.eurip.com) GetFile", - "EuripBot/0.x (+http://www.eurip.com) GetRobots", - "EuripBot/0.x (+http://www.eurip.com) PreCheck", - "Eurobot/1.0 (http://www.ayell.eu)", - "EvaalSE - bot@evaal.com", - "eventax/1.3 (eventax; http://www.eventax.de/; info@eventax.de)", - "Everest-Vulcan Inc./0.1 (R&D project; host=e-1-24; http://everest.vulcan.com/crawlerhelp)", - "Everest-Vulcan Inc./0.1 (R&D project; http://everest.vulcan.com/crawlerhelp)", - "Exabot-Images/1.0", - "Exabot-Test/1.0", - "Exabot/2.0", - "Exabot/3.0", - "ExactSeek Crawler/0.1", - "exactseek-crawler-2.63 (crawler@exactseek.com)", - "exactseek-pagereaper-2.63 (crawler@exactseek.com)", - "exactseek.com", - "Exalead NG/MimeLive Client (convert/http/0.120)", - "Excalibur Internet Spider V6.5.4", - "Execrawl/1.0 (Execrawl; http://www.execrawl.com/; bot@execrawl.com)", - "exooba crawler/exooba crawler (crawler for exooba.com; http://www.exooba.com/; info at exooba dot com)", - "exooba/exooba crawler (exooba; exooba)", - "ExperimentalHenrytheMiragoRobot", - "ExtractorPro", - "EyeCatcher (Download-tipp.de)/1.0", - "Factbot 1.09 (see http://www.factbites.com/webmasters.php)", - "factbot : http://www.factbites.com/robots", - "Fast Crawler Gold Edition", - "FAST Enterprise Crawler 6 (Experimental)", - "FAST Enterprise Crawler 6 / Scirus scirus-crawler@fast.no; http://www.scirus.com/srsapp/contactus/", - "FAST Enterprise Crawler 6 used by Cobra Development (admin@fastsearch.com)", - "FAST Enterprise Crawler 6 used by Comperio AS (sts@comperio.no)", - "FAST Enterprise Crawler 6 used by FAST (FAST)", - "FAST Enterprise Crawler 6 used by Pages Jaunes (pvincent@pagesjaunes.fr)", - "FAST Enterprise Crawler 6 used by Sensis.com.au Web Crawler (search_comments\\at\\sensis\\dot\\com\\dot\\au)", - "FAST Enterprise Crawler 6 used by Singapore Press Holdings (crawler@sphsearch.sg)", - "FAST Enterprise Crawler/6 (www.fastsearch.com)", - "FAST Enterprise Crawler/6.4 (helpdesk at fast.no)", - "FAST FirstPage retriever (compatible; MSIE 5.5; Mozilla/4.0)", - "FAST MetaWeb Crawler (helpdesk at fastsearch dot com)", - "Fast PartnerSite Crawler", - "FAST-WebCrawler/2.2.10 (Multimedia Search) (crawler@fast.no; http://www.fast.no/faq/faqfastwebsearch/faqfastwebcrawler.html)", - "FAST-WebCrawler/2.2.6 (crawler@fast.no; http://www.fast.no/faq/faqfastwebsearch/faqfastwebcrawler.html)", - "FAST-WebCrawler/2.2.7 (crawler@fast.no; http://www.fast.no/faq/faqfastwebsearch/faqfastwebcrawler.html)http://www.fast.no", - "FAST-WebCrawler/2.2.8 (crawler@fast.no; http://www.fast.no/faq/faqfastwebsearch/faqfastwebcrawler.html)http://www.fast.no", - "FAST-WebCrawler/3.2 test", - "FAST-WebCrawler/3.3 (crawler@fast.no; http://fast.no/support.php?c=faqs/crawler)", - "FAST-WebCrawler/3.4/Nirvana (crawler@fast.no; http://fast.no/support.php?c=faqs/crawler)", - "FAST-WebCrawler/3.4/PartnerSite (crawler@fast.no; http://fast.no/support.php?c=faqs/crawler)", - "FAST-WebCrawler/3.5 (atw-crawler at fast dot no; http://fast.no/support.php?c=faqs/crawler)", - "FAST-WebCrawler/3.6 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)", - "FAST-WebCrawler/3.6/FirstPage (crawler@fast.no; http://fast.no/support.php?c=faqs/crawler)", - "FAST-WebCrawler/3.7 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)", - "FAST-WebCrawler/3.7/FirstPage (atw-crawler at fast dot no;http://fast.no/support/crawler.asp)", - "FAST-WebCrawler/3.8 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)", - "FAST-WebCrawler/3.8/Fresh (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)", - "FAST-WebCrawler/3.x Multimedia", - "FAST-WebCrawler/3.x Multimedia (mm dash crawler at fast dot no)", - "fastbot crawler beta 2.0 (+http://www.fastbot.de)", - "FastBug http://www.ay-up.com", - "FastCrawler 3.0.1 (crawler@1klik.dk)", - "FastSearch Web Crawler for Verizon SuperPages (kevin.watters@fastsearch.com)", - "Favcollector/2.0 (info@favcollector.com http://www.favcollector.com/)", - "favo.eu crawler/0.6 (http://www.favo.eu)", - "Faxobot/1.0", - "Feed Seeker Bot (RSS Feed Seeker http://www.MyNewFavoriteThing.com/fsb.php)", - "Feed24.com", - "FeedChecker/0.01", - "Feedfetcher-Google; (+http://www.google.com/feedfetcher.html)", - "FeedHub FeedDiscovery/1.0 (http://www.feedhub.com)", - "FeedHub MetaDataFetcher/1.0 (http://www.feedhub.com)", - "Feedjit Favicon Crawler 1.0", - "Feedster Crawler/3.0; Feedster, Inc.", - "Felix - Mixcat Crawler (+http://mixcat.com)", - "FFC Trap Door Spider", - "Filtrbox/1.0", - "Findexa Crawler (http://www.findexa.no/gulesider/article26548.ece)", - "findlinks/x.xxx (+http://wortschatz.uni-leipzig.de/findlinks/) ", - "FineBot", - "Firefly/1.0", - "Firefly/1.0 (compatible; Mozilla 4.0; MSIE 5.5)", - "Firefox (kastaneta03@hotmail.com)", - "Firefox_1.0.6 (kasparek@naparek.cz)", - "FirstGov.gov Search - POC:firstgov.webmasters@gsa.gov", - "firstsbot", - "Flapbot/0.7.2 (Flaptor Crawler; http://www.flaptor.com; crawler at flaptor period com)", - "Flexum spider", - "Flexum/2.0", - "FlickBot 2.0 RPT-HTTPClient/0.3-3", - "flunky", - "FnooleBot/2.5.2 (+http://www.fnoole.com/addurl.html)", - "FocusedSampler/1.0", - "Folkd.com Spider/0.1 beta 1 (www.folkd.com)", - "Fooky.com/ScorpionBot/ScoutOut; http://www.fooky.com/scorpionbots", - "Francis/1.0 (francis@neomo.de http://www.neomo.de/)", - "Franklin Locator 1.8", - "FreeFind.com-SiteSearchEngine/1.0 (http://freefind.com; spiderinfo@freefind.com)", - "FreshNotes crawler< report problems to crawler-at-freshnotes-dot-com", - "FSurf15a 01", - "FTB-Bot http://www.findthebest.co.uk/", - "Full Web Bot 0416B", - "Full Web Bot 0516B", - "Full Web Bot 2816B", - "FuseBulb.Com", - "FyberSpider (+http://www.fybersearch.com/fyberspider.php)", - "GAIS Robot/1.0B2", - "Gaisbot/3.0 (indexer@gais.cs.ccu.edu.tw; http://gais.cs.ccu.edu.tw/robot.php)", - "Gaisbot/3.0+(robot06@gais.cs.ccu.edu.tw;+http://gais.cs.ccu.edu.tw/robot.php)", - "GalaxyBot/1.0 (http://www.galaxy.com/galaxybot.html)", - "Gallent Search Spider v1.4 Robot 2 (http://robot.GallentSearch.com)", - "gamekitbot/1.0 (+http://www.uchoose.de/crawler/gamekitbot/)", - "GammaSpider/1.0", - "gazz/x.x (gazz@nttrd.com)", - "generic_crawler/01.0217/", - "genieBot (http://64.5.245.11/faq/faq.html)", - "geniebot wgao@genieknows.com", - "GeonaBot 1.x; http://www.geona.com/", - "gigabaz/3.1x (baz@gigabaz.com; http://gigabaz.com/gigabaz/)", - "Gigabot/2.0 (gigablast.com)", - "Gigabot/2.0/gigablast.com/spider.html", - "Gigabot/2.0; http://www.gigablast.com/spider.html", - "Gigabot/2.0att", - "Gigabot/3.0 (http://www.gigablast.com/spider.html)", - "Gigabot/x.0", - "GigabotSiteSearch/2.0 (sitesearch.gigablast.com)", - "GNODSPIDER (www.gnod.net)", - "Goblin/0.9 (http://www.goguides.org/)", - "Goblin/0.9.x (http://www.goguides.org/goblin-info.html)", - "GoForIt.com", - "GOFORITBOT ( http://www.goforit.com/about/ )", - "gonzo1[P] +http://www.suchen.de/popups/faq.jsp", - "gonzo2[P] +http://www.suchen.de/faq.html", - "Goofer/0.2", - "Googlebot-Image/1.0", - "Googlebot-Image/1.0 ( http://www.googlebot.com/bot.html)", - "Googlebot/2.1 ( http://www.google.com/bot.html)", - "Googlebot/2.1 ( http://www.googlebot.com/bot.html)", - "Googlebot/Test ( http://www.googlebot.com/bot.html)", - "GrapeFX/0.3 libwww/5.4.0", - "great-plains-web-spider/flatlandbot (Flatland Industries Web Spider; http://www.flatlandindustries.com/flatlandbot.php; jason@flatlandindustries.com)", - "GrigorBot 0.8 (http://www.grigor.biz/bot.html)", - "Gromit/1.0", - "grub crawler(http://www.grub.org)", - "grub-client", - "gsa-crawler (Enterprise; GID-01422; jplastiras@google.com)", - "gsa-crawler (Enterprise; GID-01742;gsatesting@rediffmail.com)", - "gsa-crawler (Enterprise; GIX-02057; dm@enhesa.com)", - "gsa-crawler (Enterprise; GIX-03519; cknuetter@stubhub.com)", - "gsa-crawler (Enterprise; GIX-0xxxx; enterprise-training@google.com)", - "Guestbook Auto Submitter", - "Gulliver/1.3", - "Gulper Web Bot 0.2.4 (www.ecsl.cs.sunysb.edu/~maxim/cgi-bin/Link/GulperBot)", - "Gungho/0.08004 (http://code.google.com/p/gungho-crawler/wiki/Index)", - "GurujiBot/1.0 (+http://www.guruji.com/WebmasterFAQ.html)", - "GurujiImageBot/1.0 (+http://www.guruji.com/en/WebmasterFAQ.html)", - "HappyFunBot/1.1", - "Harvest-NG/1.0.2", - "Hatena Antenna/0.4 (http://a.hatena.ne.jp/help#robot)", - "Hatena Pagetitle Agent/1.0", - "Hatena RSS/0.3 (http://r.hatena.ne.jp)", - "hbtronix.spider.2 -- http://hbtronix.de/spider.php", - "HeinrichderMiragoRobot", - "HeinrichderMiragoRobot (http://www.miragorobot.com/scripts/deinfo.asp)", - "Helix/1.x ( http://www.sitesearch.ca/helix/)", - "HenriLeRobotMirago (http://www.miragorobot.com/scripts/frinfo.asp)", - "HenrytheMiragoRobot", - "HenryTheMiragoRobot (http://www.miragorobot.com/scripts/mrinfo.asp)", - "Hi! I'm CsCrawler my homepage: http://www.kde.cs.uni-kassel.de/lehre/ss2005/googlespam/crawler.html RPT-HTTPClient/0.3-3", - "Hippias/0.9 Beta", - "HitList", - "Hitwise Spider v1.0 http://www.hitwise.com", - "holmes/3.11 (http://morfeo.centrum.cz/bot)", - "holmes/3.9 (onet.pl)", - "holmes/3.xx (OnetSzukaj/5.0; +http://szukaj.onet.pl)", - "holmes/x.x", - "HolmesBot (http://holmes.ge)", - "HomePageSearch(hpsearch.uni-trier.de)", - "Homerbot: www.homerweb.com", - "Honda-Search/0.7.2 (Nutch; http://lucene.apache.org/nutch/bot.html; search@honda-search.com)", - "HooWWWer/2.1.3 (debugging run) (+http://cosco.hiit.fi/search/hoowwwer/ | mailto:crawler-infohiit.fi)", - "HooWWWer/2.1.x ( http://cosco.hiit.fi/search/hoowwwer/ | mailto:crawler-infohiit.fi)", - "HPL/Nutch-0.9 -", - "htdig/3.1.6 (http://computerorgs.com)", - "htdig/3.1.6 (unconfigured@htdig.searchengine.maintainer)", - "htdig/3.1.x (root@localhost)", - "http://Ask.24x.Info/ (http://narres.it/)", - "http://hilfe.acont.de/bot.html ACONTBOT", - "http://www.almaden.ibm.com/cs/crawler", - "http://www.almaden.ibm.com/cs/crawler [rc1.wf.ibm.com]", - "http://www.almaden.ibm.com/cs/crawler [wf216]", - "http://www.istarthere.com_spider@istarthere.com", - "http://www.monogol.de", - "http://www.trendtech.dk/spider.asp)", - "i1searchbot/2.0 (i1search web crawler; http://www.i1search.com; crawler@i1search.com)", - "IAArchiver-1.0", - "iaskspider2 (iask@staff.sina.com.cn)", - "ia_archiver", - "ia_archiver-web.archive.org", - "ia_archiver/1.6", - "ICC-Crawler(Mozilla-compatible; http://kc.nict.go.jp/icc/crawl.html; icc-crawl(at)ml(dot)nict(dot)go(dot)jp)", - "ICC-Crawler(Mozilla-compatible;http://kc.nict.go.jp/icc/crawl.html;icc-crawl-contact(at)ml(dot)nict(dot)go(dot)jp)", - "iCCrawler (http://www.iccenter.net)", - "ICCrawler - ICjobs (http://www.icjobs.de/bot.htm)", - "ichiro/x.0 (http://help.goo.ne.jp/door/crawler.html)", - "ichiro/x.0 (ichiro@nttr.co.jp)", - "IconSurf/2.0 favicon finder (see http://iconsurf.com/robot.html)", - "IconSurf/2.0 favicon monitor (see http://iconsurf.com/robot.html)", - "ICRA_label_spider/x.0", - "icsbot-0.1", - "ideare - SignSite/1.x", - "iFeed.jp/2.0 (www.psychedelix.com/agents/agents.rss; 0 subscribers)", - "igdeSpyder (compatible; igde.ru; +http://igde.ru/doc/tech.html)", - "IIITBOT/1.1 (Indian Language Web Search Engine; http://webkhoj.iiit.net; pvvpr at iiit dot ac dot in)", - "ilial/Nutch-0.9 (Ilial, Inc. is a Los Angeles based Internet startup company. For more information please visit http://www.ilial.com/crawler; http://www.ilial.com/crawler; crawl@ilial.com)", - "ilial/Nutch-0.9-dev", - "IlseBot/1.x", - "IlTrovatore-Setaccio ( http://www.iltrovatore.it)", - "Iltrovatore-Setaccio/0.3-dev (Indexing; http://www.iltrovatore.it/bot.html; info@iltrovatore.it)", - "IlTrovatore-Setaccio/1.2 ( http://www.iltrovatore.it/aiuto/faq.html)", - "Iltrovatore-Setaccio/1.2 (It-bot; http://www.iltrovatore.it/bot.html; info@iltrovatore.it)", - "iltrovatore-setaccio/1.2-dev (spidering; http://www.iltrovatore.it/aiuto/.....)", - "IlTrovatore/1.2 (IlTrovatore; http://www.iltrovatore.it/bot.html; bot@iltrovatore.it)", - "ImageWalker/2.0 (www.bdbrandprotect.com)", - "IncyWincy data gatherer(webmaster@loopimprovements.com", - "IncyWincy page crawler(webmaster@loopimprovements.com", - "IncyWincy(http://www.look.com)", - "IncyWincy(http://www.loopimprovements.com/robot.html)", - "IncyWincy/2.1(loopimprovements.com/robot.html)", - "IndexTheWeb.com Crawler7", - "Industry Program 1.0.x", - "Inet library", - "info@pubblisito.com- (http://www.pubblisito.com) il Sud dei Motori di Ricerca", - "InfoFly/1.0 (http://www.versions-project.org/)", - "INFOMINE/8.0 Adders", - "INFOMINE/8.0 RemoteServices", - "INFOMINE/8.0 VLCrawler (http://infomine.ucr.edu/useragents)", - "InfoNaviRobot(F107)", - "InfoSeek Sidewinder/0.9", - "InfoSeek Sidewinder/1.0A", - "InfoSeek Sidewinder/1.1A", - "Infoseek SideWinder/1.45 (Compatible; MSIE 10.0; UNIX)", - "Infoseek SideWinder/2.0B (Linux 2.4 i686)", - "INGRID/3.0 MT (webcrawler@NOSPAMexperimental.net; http://webmaster.ilse.nl/jsp/webmaster.jsp)", - "Inktomi Search", - "InnerpriseBot/1.0 (http://www.innerprise.com/)", - "Insitor.com search and find world wide!", - "Insitornaut", - "Internet Ninja x.0", - "InternetArchive/0.8-dev(Nutch;http://lucene.apache.org/nutch/bot.html;nutch-agent@lucene.apache", - "InternetSeer.com", - "IOI/2.0 (ISC Open Index crawler; http://index.isc.org/; bot@index.isc.org)", - "IPiumBot laurion(dot)com", - "IpselonBot/0.xx-beta (Ipselon; http://www.ipselon.com; ipselonbot@ipselon.com)", - "IRLbot/1.0 ( http://irl.cs.tamu.edu/crawler)", - "IRLbot/3.0 (compatible; MSIE 6.0; http://irl.cs.tamu.edu/crawler/)", - "ISC Systems iRc Search 2.1", - "IUPUI Research Bot v 1.9a", - "IWAgent/ 1.0 - www.brandprotect.com", - "Jabot/6.x (http://odin.ingrid.org/)", - "Jabot/7.x.x (http://odin.ingrid.org/)", - "Jack", - "Jambot/0.1.x (Jambot; http://www.jambot.com/blog; crawler@jambot.com)", - "Jambot/0.2.1 (Jambot; http://www.jambot.com/blog/static.php?page=webmaster-robot; crawler@jambot.com)", - "Jayde Crawler. http://www.jayde.com", - "Jetbot/1.0", - "JobSpider_BA/1.1", - "Jyxobot/x", - "k2spider", - "KAIST AITrc Crawler", - "KakleBot - www.kakle.com/0.1 (KakleBot - www.kakle.com; http:// www.kakle.com/bot.html; support@kakle.com)", - "kalooga/kalooga-4.0-dev-datahouse (Kalooga; http://www.kalooga.com; info@kalooga.com)", - "kalooga/KaloogaBot (Kalooga; http://www.kalooga.com/info.html?page=crawler; crawler@kalooga.com)", - "Kenjin Spider", - "Kevin http://dznet.com/kevin/", - "Kevin http://websitealert.net/kevin/", - "KE_1.0/2.0 libwww/5.2.8", - "KFSW-Bot (Version: 1.01 powered by KFSW www.kfsw.de)", - "kinja-imagebot (http://www.kinja.com/)", - "kinjabot (http://www.kinja.com)", - "KIT-Fireball/2.0", - "KIT-Fireball/2.0 (compatible; Mozilla 4.0; MSIE 5.5)", - "KnowItAll(knowitall@cs.washington.edu)", - "Knowledge.com/0.x", - "Krugle/Krugle,Nutch/0.8+ (Krugle web crawler; http://www.krugle.com/crawler/info.html; webcrawler@krugle.com)", - "KSbot/1.0 (KnowledgeStorm crawler; http://www.knowledgestorm.com/resources/content/crawler/index.html; crawleradmin@knowledgestorm.com)", - "kuloko-bot/0.x", - "kulokobot www.kuloko.com kuloko@backweave.com", - "kulturarw3/0.1", - "LapozzBot/1.4 ( http://robot.lapozz.com)", - "LapozzBot/1.5 (+http://robot.lapozz.hu)", - "larbin (samualt9@bigfoot.com)", - "LARBIN-EXPERIMENTAL (efp@gmx.net)", - "larbin_2.1.1 larbin2.1.1@somewhere.com", - "larbin_2.2.0 (crawl@compete.com)", - "larbin_2.2.1_de_Viennot (Laurent.Viennot@inria.fr)", - "larbin_2.2.2 (sugayama@lab7.kuis.kyoto-u.ac.jp)", - "larbin_2.2.2_guillaume (guillaume@liafa.jussieu.fr)", - "larbin_2.6.0 (larbin2.6.0@unspecified.mail)", - "larbin_2.6.1 (larbin2.6.1@unspecified.mail)", - "larbin_2.6.2 (hamasaki@grad.nii.ac.jp)", - "larbin_2.6.2 (larbin2.6.2@unspecified.mail)", - "larbin_2.6.2 (listonATccDOTgatechDOTedu)", - "larbin_2.6.2 (pimenas@systems.tuc.gr)", - "larbin_2.6.2 (tom@lemurconsulting.com)", - "larbin_2.6.2 (vitalbox1@hotmail.com)", - "larbin_2.6.3 (ltaa_web_crawler@groupes.epfl.ch)", - "larbin_2.6.3 (wgao@genieknows.com)", - "larbin_2.6.3_for_(http://cosco.hiit.fi/search/) tsilande@hiit.fi", - "larbin_2.6_basileocaml (basile.starynkevitch@cea.fr)", - "larbin_devel (http://pauillac.inria.fr/~ailleret/prog/larbin/)", - "lawinfo-crawler/Nutch-0.9-dev (Crawler for lawinfo.com pages; http://www.lawinfo.com; webmaster@lawinfo.com)", - "LECodeChecker/3.0 libgetdoc/1.0", - "LEIA/2.90", - "LEIA/3.01pr (LEIAcrawler; [SNIP])", - "LetsCrawl.com/1.0 +http://letscrawl.com/", - "LexiBot/1.00", - "Libby_1.1/libwww-perl/5.47", - "LibertyW (+http://www.lw01.com)", - "libWeb/clsHTTP -- hiongun@kt.co.kr", - "libwww-perl/5.41", - "libwww-perl/5.45", - "libwww-perl/5.48", - "libwww-perl/5.52 FP/2.1", - "libwww-perl/5.52 FP/4.0", - "libwww-perl/5.65", - "libwww-perl/5.800", - "libwww/5.3.2", - "LijitSpider/Nutch-0.9 (Reports crawler; http://www.lijit.com/; info(a)lijit(d)com)", - "Lincoln State Web Browser", - "linkbot", - "linknzbot", - "Links 2.0 (http://gossamer-threads.com/scripts/links/)", - "Links SQL (http://gossamer-threads.com/scripts/links-sql/)", - "LinkScan/11.0beta2 UnixShareware robot from Elsop.com (used by Indiafocus/Indiainfo)", - "LinkScan/9.0g Unix", - "LinkScan/x.x Unix", - "LiveTrans/Nutch-0.9 (maintainer: cobain at iis dot sinica dot edu dot tw; http://wkd.iis.sinica.edu.tw/LiveTrans/)", - "Llaut/1.0 (http://mnm.uib.es/~gallir/llaut/bot.html)", - "LMQueueBot/0.2", - "lmspider (lmspider@scansoft.com)", - "LNSpiderguy", - "LocalBot/1.0 ( http://www.localbot.co.uk/)", - "LocalcomBot/1.2.x ( http://www.local.com/bot.htm)", - "Lockstep Spider/1.0", - "Look.com", - "Lovel as 1.0 ( +http://www.everatom.com)", - "LTI/LemurProject Nutch Spider/Nutch-1.0-dev (lti crawler for CMU; http://www.lti.cs.cmu.edu; changkuk at cmu dot edu)", - "LTI/LemurProject Nutch Spider/Nutch-1.0-dev (Research spider using Nutch; http://www.lemurproject.org; mhoy@cs.cmu.edu)", - "lwp-trivial/1.32", - "lwp-trivial/1.34", - "lwp-trivial/1.34", - "LWP::Simple/5.22", - "LWP::Simple/5.36", - "LWP::Simple/5.48", - "LWP::Simple/5.50", - "LWP::Simple/5.51", - "LWP::Simple/5.53", - "LWP::Simple/5.63", - "LWP::Simple/5.803", - "Lycos_Spider_(modspider)", - "Lycos_Spider_(T-Rex)", - "Lynx/2.8.4rel.1 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/0.9.6c (human-guided@lerly.net)", - "Mac Finder 1.0.xx", - "Mackster( http://www.ukwizz.com )", - "Mahiti.Com/Mahiti Crawler-1.0 (Mahiti.Com; http://mahiti.com ; mahiti.com)", - "Mail.Ru/1.0", - "mailto:webcraft@bea.com", - "mammoth/1.0 ( http://www.sli-systems.com/)", - "MantraAgent", - "MapoftheInternet.com ( http://MapoftheInternet.com)", - "Mariner/5.1b [de] (Win95; I ;Kolibri gncwebbot)", - "Marketwave Hit List", - "Martini", - "MARTINI", - "Marvin v0.3", - "MaSagool/1.0 (MaSagool; http://sagool.jp/; info@sagool.jp)", - "MasterSeek", - "Mata Hari/2.00 ", - "Matrix S.p.A. - FAST Enterprise Crawler 6 (Unknown admin e-mail address)", - "maxomobot/dev-20051201 (maxomo; http://67.102.134.34:4047/MAXOMO/MAXOMObot.html; maxomobot@maxomo.com)", - "MDbot/1.0 (+http://www.megadownload.net/bot.html)", - "MediaCrawler-1.0 (Experimental)", - "Mediapartners-Google/2.1 ( http://www.googlebot.com/bot.html)", - "MediaSearch/0.1", - "MegaSheep v1.0 (www.searchuk.com internet sheep)", - "Megite2.0 (http://www.megite.com)", - "Mercator-1.x", - "Mercator-2.0", - "Mercator-Scrub-1.1", - "Metaeuro Web Crawler/0.2 (MetaEuro Web Search Clustering Engine; http://www.metaeuro.com; crawler at metaeuro dot com)", - "MetaGer-LinkChecker", - "MetagerBot/0.8-dev (MetagerBot; http://metager.de; )", - "MetaGer_PreChecker0.1", - "Metaspinner/0.01 (Metaspinner; http://www.meta-spinner.de/; support@meta-spinner.de/)", - "metatagsdir/0.7 (+http://metatagsdir.com/directory/)", - "MFC Foundation Class Library 4.0", - "MicroBaz", - "Microsoft Small Business Indexer", - "Microsoft URL Control - 6.00.8xxx", - "MicrosoftPrototypeCrawler (How's my crawling? mailto:newbiecrawler@hotmail.com)", - "Missauga Locate 1.0.0", - "Missigua Locator 1.9", - "Missouri College Browse", - "Misterbot-Nutch/0.7.1 (Misterbot-Nutch; http://www.misterbot.fr; admin@misterbot.fr)", - "Miva (AlgoFeedback@miva.com)", - "Mizzu Labs 2.2", - "MJ12bot/vx.x.x (http://majestic12.co.uk/bot.php?+)", - "MJ12bot/vx.x.x (http://www.majestic12.co.uk/projects/dsearch/mj12bot.php)", - "MJBot (SEO assessment)", - "MLBot (www.metadatalabs.com)", - "MnogoSearch/3.2.xx", - "Mo College 1.9", - "moget/x.x (moget@goo.ne.jp)", - "mogimogi/1.0", - "MojeekBot/0.x (archi; http://www.mojeek.com/bot.html)", - "Morris - Mixcat Crawler ( http://mixcat.com)", - "Mouse-House/7.4 (spider_monkey spider info at www.mobrien.com/sm.shtml)", - "mozDex/0.xx-dev (mozDex; http://www.mozdex.com/en/bot.html; spider@mozdex.com)", - "Mozilla (Mozilla@somewhere.com)", - "Mozilla 4.0(compatible; BotSeer/1.0; +http://botseer.ist.psu.edu)", - "Mozilla/2.0 (compatible; Ask Jeeves)", - "Mozilla/2.0 (compatible; Ask Jeeves/Teoma)", - "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; http://about.ask.com/en/docs/about/webmasters.shtml) ", - "Mozilla/2.0 (compatible; Ask Jeeves/Teoma; http://sp.ask.com/docs/about/tech_crawling.html)", - "Mozilla/2.0 (compatible; EZResult -- Internet Search Engine)", - "Mozilla/2.0 (compatible; NEWT ActiveX; Win32)", - "Mozilla/2.0 (compatible; T-H-U-N-D-E-R-S-T-O-N-E)", - "Mozilla/3.0 (compatible; Fluffy the spider; http://www.searchhippo.com/; info@searchhippo.com)", - "Mozilla/3.0 (compatible; Indy Library)", - "Mozilla/3.0 (compatible; MuscatFerret/1.5.4; claude@euroferret.com)", - "Mozilla/3.0 (compatible; MuscatFerret/1.5; olly@muscat.co.uk)", - "Mozilla/3.0 (compatible; MuscatFerret/1.6.x; claude@euroferret.com)", - "Mozilla/3.0 (compatible; scan4mail (advanced version) http://www.peterspages.net/?scan4mail)", - "Mozilla/3.0 (compatible; ScollSpider; http://www.webwobot.com)", - "Mozilla/3.0 (compatible; Webinator-DEV01.home.iprospect.com/2.56)", - "Mozilla/3.0 (compatible; Webinator-indexer.cyberalert.com/2.56)", - "Mozilla/3.0 (INGRID/3.0 MT; webcrawler@NOSPAMexperimental.net; http://aanmelden.ilse.nl/?aanmeld_mode=webhints)", - "Mozilla/3.0 (Slurp.so/Goo; slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Mozilla/3.0 (Slurp/cat; slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Mozilla/3.0 (Slurp/si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Mozilla/3.0 (Vagabondo/1.1 MT; webcrawler@NOSPAMwise-guys.nl; http://webagent.wise-guys.nl/)", - "Mozilla/3.0 (Vagabondo/1.x MT; webagent@wise-guys.nl; http://webagent.wise-guys.nl/)", - "Mozilla/3.0 (Vagabondo/2.0 MT; webcrawler@NOSPAMexperimental.net; http://aanmelden.ilse.nl/?aanmeld_mode=webhints)", - "Mozilla/3.0 (Vagabondo/2.0 MT; webcrawler@NOSPAMwise-guys.nl; http://webagent.wise-guys.nl/)", - "Mozilla/3.01 (Compatible; Links2Go Similarity Engine)", - "Mozilla/4.0", - "Mozilla/4.0 (agadine3.0) www.agada.de", - "Mozilla/4.0 (compatible: AstraSpider V.2.1 : astrafind.com)", - "Mozilla/4.0 (compatible; Vagabondo/2.2; webcrawler at wise-guys dot nl; http://webagent.wise-guys.nl/)", - "Mozilla/4.0 (compatible; Vagabondo/4.0Beta; webcrawler at wise-guys dot nl; http://webagent.wise-guys.nl/)", - "Mozilla/4.0 (compatible; Advanced Email Extractor v2.xx)", - "Mozilla/4.0 (compatible; B_L_I_T_Z_B_O_T)", - "Mozilla/4.0 (compatible; ChristCrawler.com ChristCrawler@ChristCENTRAL.com)", - "Mozilla/4.0 (compatible; crawlx, crawler@trd.overture.com)", - "Mozilla/4.0 (compatible; DAUMOA-video; +http://ws.daum.net/aboutkr.html)", - "Mozilla/4.0 (compatible; FastCrawler3 support-fastcrawler3@fast.no)", - "Mozilla/4.0 (compatible; FDSE robot)", - "Mozilla/4.0 (compatible; GPU p2p crawler http://gpu.sourceforge.net/search_engine.php)", - "Mozilla/4.0 (compatible; grub-client-0.2.x; Crawl your stuff with http://grub.org)", - "Mozilla/4.0 (compatible; grub-client-0.3.x; Crawl your own stuff with http://grub.org)", - "Mozilla/4.0 (compatible; grub-client-2.x)", - "Mozilla/4.0 (compatible; Iplexx Spider/1.0 http://www.iplexx.at)", - "Mozilla/4.0 (compatible; MSIE 4.01; Vonna.com b o t)", - "Mozilla/4.0 (compatible; MSIE 4.01; Windows CE; PPC; 240x320; SPV M700; OpVer 19.123.2.733) OrangeBot-Mobile 2008.0 (mobilesearch.support@orange-ftgroup.com)", - "Mozilla/4.0 (compatible; MSIE 4.0; Windows NT; Site Server 3.0 Robot) Indonesia Interactive", - "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) (samualt9@bigfoot.com)", - "Mozilla/4.0 (compatible; MSIE 5.0; NetNose-Crawler 2.0; A New Search Experience: http://www.netnose.com)", - "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) TrueRobot; 1.5", - "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) VoilaBot BETA 1.2 (http://www.voila.com/)", - "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) VoilaBot; 1.6", - "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt; DTS Agent", - "Mozilla/4.0 (compatible; MSIE 5.0; www.galaxy.com; www.psychedelix.com)", - "Mozilla/4.0 (compatible; MSIE 5.0; www.galaxy.com; www.psychedelix.com/; http://www.galaxy.com/info/crawler.html)", - "Mozilla/4.0 (compatible; MSIE 5.0; YANDEX)", - "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; obot)", - "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0; QXW03018)", - "Mozilla/4.0 (compatible; MSIE 6.0 compatible; Asterias Crawler v4; +http://www.singingfish.com/help/spider.html; webmaster@singingfish.com); SpiderThread Revision: 3.10", - "Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Skampy/0.9.x [en]", - "Mozilla/4.0 (compatible; MSIE 6.0; TargetSeek/1.0; +http://www.targetgroups.net/TargetSeek.html)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ODP entries t_st; http://tuezilla.de/t_st-odp-entries-agent.html)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ODP links test; http://tuezilla.de/test-odp-links-agent.html)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; ZoomSpider.net bot; .NET CLR 1.1.4322)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; heritrix/1.3.0 http://www.cs.washington.edu/research/networking/websys/)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; QihooBot 1.0 qihoobot@qihoo.net)", - "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT; MS Search 4.0 Robot)", - "Mozilla/4.0 (compatible; MSIE enviable; DAUMOA 2.0; DAUM Web Robot; Daum Communications Corp., Korea; +http://ws.daum.net/aboutkr.html)", - "Mozilla/4.0 (compatible; MSIE is not me; DAUMOA/1.0.1; DAUM Web Robot; Daum Communications Corp., Korea)", - "Mozilla/4.0 (compatible; NaverBot/1.0; http://help.naver.com/delete_main.asp)", - "Mozilla/4.0 (compatible; SpeedySpider; www.entireweb.com)", - "Mozilla/4.0 (compatible; www.galaxy.com)", - "Mozilla/4.0 (compatible; Y!J; for robot study; keyoshid)", - "Mozilla/4.0 (compatible; Yahoo Japan; for robot study; kasugiya)", - "Mozilla/4.0 (JemmaTheTourist;http://www.activtourist.com)", - "Mozilla/4.0 (MobilePhone SCP-5500/US/1.0) NetFront/3.0 MMP/2.0 (compatible; Googlebot/2.1; http://www.google.com/bot.html)", - "Mozilla/4.0 (MobilePhone SCP-5500/US/1.0) NetFront/3.0 MMP/2.0 FAKE (compatible; Googlebot/2.1; http://www.google.com/bot.html)", - "Mozilla/4.0 (Mozilla; http://www.mozilla.org/docs/en/bot.html; master@mozilla.com)", - "Mozilla/4.0 (Sleek Spider/1.2)", - "Mozilla/4.0 compatible FurlBot/Furl Search 2.0 (FurlBot; http://www.furl.net; wn.furlbot@looksmart.net)", - "Mozilla/4.0 compatible ZyBorg/1.0 (wn.zyborg@looksmart.net; http://www.WISEnutbot.com)", - "Mozilla/4.0 compatible ZyBorg/1.0 (ZyBorg@WISEnutbot.com; http://www.WISEnutbot.com)", - "Mozilla/4.0 compatible ZyBorg/1.0 Dead Link Checker (wn.zyborg@looksmart.net; http://www.WISEnutbot.com)", - "Mozilla/4.0 compatible ZyBorg/1.0 for Homepage (ZyBorg@WISEnutbot.com; http://www.WISEnutbot.com)", - "Mozilla/4.0 efp@gmx.net", - "Mozilla/4.0 [en] (Ask Jeeves Corporate Spider)", - "Mozilla/4.0(compatible; Zealbot 1.0)", - "Mozilla/4.04 (compatible; Dulance bot; +http://www.dulance.com/bot.jsp)", - "Mozilla/4.0_(compatible;_MSIE_5.0;_Windows_95)_TrueRobot/1.4 libwww/5.2.8", - "Mozilla/4.0_(compatible;_MSIE_5.0;_Windows_95)_VoilaBot/1.6 libwww/5.3.2", - "Mozilla/4.6 [en] (http://www.cnet.com/)", - "Mozilla/4.7", - "Mozilla/4.7 (compatible; http://eidetica.com/spider)", - "Mozilla/4.7 (compatible; Intelliseek; http://www.intelliseek.com)", - "Mozilla/4.7 (compatible; Whizbang)", - "Mozilla/4.7 (compatible; WhizBang; http://www.whizbang.com/crawler)", - "Mozilla/4.7 [en](BecomeBot@exava.com)", - "Mozilla/4.7 [en](Exabot@exava.com)", - "Mozilla/4.72 [en] (BACS http://www.ba.be)", - "Mozilla/5.0", - "Mozilla/5.0 (+http://www.eurekster.com/mammoth) Mammoth/0.1", - "Mozilla/5.0 (+http://www.sli-systems.com/) Mammoth/0.1", - "Mozilla/5.0 (Clustered-Search-Bot/1.0; support@clush.com; http://www.clush.com/)", - "Mozilla/5.0 (compatible; +http://www.evri.com/evrinid)", - "Mozilla/5.0 (compatible; 008/0.83; http://www.80legs.com/spider.html;) Gecko/2008032620", - "Mozilla/5.0 (compatible; Abonti/0.8 - http://www.abonti.com)", - "Mozilla/5.0 (compatible; aiHitBot/1.0; +http://www.aihit.com/)", - "Mozilla/5.0 (compatible; AnsearchBot/1.x; +http://www.ansearch.com.au/)", - "Mozilla/5.0 (compatible; archive.org_bot/1.10.0 +http://www.loc.gov/minerva/crawl.html)", - "Mozilla/5.0 (compatible; archive.org_bot/1.13.1x http://crawler.archive.org)", - "Mozilla/5.0 (compatible; archive.org_bot/1.5.0-200506132127 http://crawler.archive.org) Hurricane Katrina", - "Mozilla/5.0 (compatible; Ask Jeeves/Teoma; http://about.ask.com/en/docs/about/webmasters.shtml)", - "Mozilla/5.0 (compatible; BecomeBot/1.23; http://www.become.com/webmasters.html)", - "Mozilla/5.0 (compatible; BecomeBot/1.xx; MSIE 6.0 compatible; http://www.become.com/webmasters.html)", - "Mozilla/5.0 (compatible; BecomeBot/2.0beta; http://www.become.com/webmasters.html)", - "Mozilla/5.0 (compatible; BecomeBot/2.x; MSIE 6.0 compatible; http://www.become.com/site_owners.html)", - "Mozilla/5.0 (compatible; BecomeJPBot/2.3; MSIE 6.0 compatible; +http://www.become.co.jp/site_owners.html)", - "Mozilla/5.0 (compatible; BlogRefsBot/0.1; http://www.blogrefs.com/about/bloggers)", - "Mozilla/5.0 (compatible; Bot; +http://pressemitteilung.ws/spamfilter", - "Mozilla/5.0 (compatible; BuzzRankingBot/1.0; +http://www.buzzrankingbot.com/)", - "Mozilla/5.0 (compatible; Charlotte/1.0b; charlotte@betaspider.com)", - "Mozilla/5.0 (compatible; Charlotte/1.0b; http://www.searchme.com/support/)", - "Mozilla/5.0 (compatible; Crawling jpeg; http://www.yama.info.waseda.ac.jp)", - "Mozilla/5.0 (compatible; de/1.13.2 +http://www.de.com)", - "Mozilla/5.0 (compatible; Diffbot/0.1; +http://www.diffbot.com)", - "Mozilla/5.0 (compatible; DNS-Digger-Explorer/1.0; +http://www.dnsdigger.com)", - "Mozilla/5.0 (compatible; DNS-Digger/1.0; +http://www.dnsdigger.com)", - "Mozilla/5.0 (compatible; EARTHCOM.info/2.01; http://www.earthcom.info)", - "Mozilla/5.0 (compatible; EARTHCOM/2.2; +http://enter4u.eu)", - "Mozilla/5.0 (compatible; Exabot Test/3.0; +http://www.exabot.com/go/robot)", - "Mozilla/5.0 (compatible; FatBot 2.0; http://www.thefind.com/main/CrawlerFAQs.fhtml)", - "Mozilla/5.0 (compatible; Galbot/1.0; +http://www.galbot.com/bot.html)", - "mozilla/5.0 (compatible; genevabot http://www.healthdash.com)", - "Mozilla/5.0 (compatible; Googlebot/2.1; http://www.google.com/bot.html)", - "mozilla/5.0 (compatible; heritrix/1.0.4 http://innovationblog.com)", - "Mozilla/5.0 (compatible; heritrix/1.10.2 +http://i.stanford.edu/)", - "Mozilla/5.0 (compatible; heritrix/1.12.1 +http://newstin.com/)", - "Mozilla/5.0 (compatible; heritrix/1.12.1 +http://www.page-store.com)", - "Mozilla/5.0 (compatible; heritrix/1.12.1 +http://www.page-store.com) [email:paul@page-store.com]", - "mozilla/5.0 (compatible; heritrix/1.3.0 http://archive.crawler.org)", - "Mozilla/5.0 (compatible; heritrix/1.4.0 +http://www.chepi.net)", - "Mozilla/5.0 (compatible; heritrix/1.4t http://www.truveo.com/)", - "Mozilla/5.0 (compatible; heritrix/1.5.0 http://www.l3s.de/~kohlschuetter/projects/crawling/)", - "Mozilla/5.0 (compatible; heritrix/1.5.0-200506231921 http://pandora.nla.gov.au/crawl.html)", - "Mozilla/5.0 (compatible; heritrix/1.6.0 http://www.worio.com/)", - "Mozilla/5.0 (compatible; heritrix/1.7.0 +http://www.greaterera.com/)", - "Mozilla/5.0 (compatible; heritrix/1.x.x +http://www.accelobot.com)", - "Mozilla/5.0 (compatible; heritrix/2.0.0-RC1 +http://www.aol.com)", - "Mozilla/5.0 (compatible; Hermit Search. Com; +http://www.hermitsearch.com)", - "Mozilla/5.0 (compatible; HyperixScoop/1.3; +http://www.hyperix.com)", - "Mozilla/5.0 (compatible; IDBot/1.0; +http://www.id-search.org/bot.html)", - "Mozilla/5.0 (compatible; InterseekWeb/3.x)", - "Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Exabot-Thumbnails)", - "Mozilla/5.0 (compatible; LemSpider 0.1)", - "Mozilla/5.0 (compatible; MojeekBot/2.0; http://www.mojeek.com/bot.html)", - "Mozilla/5.0 (compatible; MSIE 6.0; Podtech Network; crawler_admin@podtech.net)", - "Mozilla/5.0 (compatible; OnetSzukaj/5.0; http://szukaj.onet.pl)", - "Mozilla/5.0 (compatible; PalmeraBot; http://www.links24h.com/help/palmera) Version 0.001", - "Mozilla/5.0 (compatible; pogodak.ba/3.x)", - "Mozilla/5.0 (compatible; Pogodak.hr/3.1)", - "Mozilla/5.0 (compatible; PWeBot/3.1; http://www.programacionweb.net/robot.php)", - "Mozilla/5.0 (compatible; Quantcastbot/1.0; www.quantcast.com)", - "Mozilla/5.0 (compatible; ScoutJet; +http://www.scoutjet.com/)", - "Mozilla/5.0 (compatible; Scrubby/2.2; http://www.scrubtheweb.com/)", - "Mozilla/5.0 (compatible; ShunixBot/1.x.x +http://www.shunix.com/robot.htm)", - "Mozilla/5.0 (compatible; ShunixBot/1.x; http://www.shunix.com/bot.htm)", - "Mozilla/5.0 (compatible; SkreemRBot +http://skreemr.com)", - "Mozilla/5.0 (compatible; SummizeBot +http://www.summize.com)", - "Mozilla/5.0 (compatible; Synoobot/0.9; http://www.synoo.com/search/bot.html)", - "Mozilla/5.0 (compatible; Theophrastus/x.x; http://users.cs.cf.ac.uk/N.A.Smith/theophrastus.php)", - "Mozilla/5.0 (compatible; TridentSpider/3.1)", - "Mozilla/5.0 (compatible; Vagabondo/2.1; webcrawler at wise-guys dot nl; http://webagent.wise-guys.nl/)", - "Mozilla/5.0 (compatible; Webduniabot/1.0; +http://search.webdunia.com/bot.aspx)", - "Mozilla/5.0 (compatible; worio bot heritrix/1.10.0 +http://worio.com)", - "Mozilla/5.0 (compatible; WoW Lemmings Kathune/2.0;http://www.wowlemmings.com/kathune.html)", - "Mozilla/5.0 (compatible; Yahoo! DE Slurp; http://help.yahoo.com/help/us/ysearch/slurp)", - "Mozilla/5.0 (compatible; Yahoo! Slurp China; http://misc.yahoo.com.cn/help.html)", - "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)", - "Mozilla/5.0 (compatible; Yoono; http://www.yoono.com/)", - "Mozilla/5.0 (compatible; YoudaoBot/1.0; http://www.youdao.com/help/webmaster/spider/; )", - "Mozilla/5.0 (compatible; Zenbot/1.3; +http://zen.co.za/webmasters/)", - "Mozilla/5.0 (compatible; zermelo +http://www.powerset.com) [email:paul@page-store.com,crawl@powerset.com]", - "Mozilla/5.0 (compatible;archive.org_bot/1.7.1; collectionId=316; Archive-It; +http://www.archive-it.org)", - "Mozilla/5.0 (compatible;archive.org_bot/heritrix-1.9.0-200608171144 +http://pandora.nla.gov.au/crawl.html)", - "Mozilla/5.0 (compatible;MAINSEEK_BOT)", - "Mozilla/5.0 (Slurp/cat; slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Mozilla/5.0 (Slurp/si; slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Mozilla/5.0 (Twiceler-0.9 http://www.cuill.com/twiceler/robot.html)", - "Mozilla/5.0 (Version: xxxx Type:xx)", - "Mozilla/5.0 (wgao@genieknows.com)", - "Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) NimbleCrawler 1.11 obeys UserAgent NimbleCrawler For problems contact: crawler_at_dataalchemy.com", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) VoilaBot BETA 1.2 (support.voilabot@orange-ftgroup.com)", - "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) VoilaBot BETA 1.2 (support.voilabot@orange-ftgroup.com)", - "Mozilla/5.0 (Windows;) NimbleCrawler 1.12 obeys UserAgent NimbleCrawler For problems contact: crawler@health", - "Mozilla/5.0 (Windows;) NimbleCrawler 1.12 obeys UserAgent NimbleCrawler For problems contact: crawler@healthline.com", - "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1; aggregator:Spinn3r (Spinn3r 3.1); http://spinn3r.com/robot) Gecko/20021130", - "Mozilla/5.0 URL-Spider", - "Mozilla/5.0 usww.com-Spider-for-w8.net", - "Mozilla/5.0 wgao@genieknows.com", - "Mozilla/5.0 [en] (compatible; Gulper Web Bot 0.2.4 www.ecsl.cs.sunysb.edu/~maxim/cgi-bin/Link/GulperBot)", - "MQbot metaquerier.cs.uiuc.edu/crawler", - "MQBOT/Nutch-0.9-dev (MQBOT Nutch Crawler; http://falcon.cs.uiuc.edu; mqbot@cs.uiuc.edu)", - "msnbot-media/1.0 (+http://search.msn.com/msnbot.htm)", - "msnbot-Products/1.0 (+http://search.msn.com/msnbot.htm)", - "MSNBOT/0.xx (http://search.msn.com/msnbot.htm)", - "msnbot/x.xx ( http://search.msn.com/msnbot.htm)", - "MSNBOT_Mobile MSMOBOT Mozilla/2.0 (compatible; MSIE 4.02; Windows CE; Default)", - "MSNPTC/1.0", - "MSRBOT (http://research.microsoft.com/research/sv/msrbot)", - "multicrawler ( http://sw.deri.org/2006/04/multicrawler/robots.html)", - "MultiText/0.1", - "MusicWalker2.0 ( http://www.somusical.com)", - "MVAClient", - "Mylinea.com Crawler 2.0", - "Naamah 1.0.1/Blogbot (http://blogbot.de/)", - "Naamah 1.0a/Blogbot (http://blogbot.de/)", - "NABOT/5.0", - "nabot_1.0", - "NameOfAgent (CMS Spider)", - "NASA Search 1.0", - "NationalDirectory-WebSpider/1.3", - "NationalDirectoryAddURL/1.0", - "NaverBot-1.0 (NHN Corp. / +82-2-3011-1954 / nhnbot@naver.com)", - "NaverBot_dloader/1.5", - "NavissoBot", - "NavissoBot/1.7 (+http://navisso.com/)", - "NCSA Beta 1 (http://vias.ncsa.uiuc.edu/viasarchivinginformation.html)", - "Nebullabot/2.2 (http://bot.nebulla.info)", - "NEC Research Agent -- compuman at research.nj.nec.com", - "Net-Seekr Bot/Net-Seekr Bot V1 (http://www.net-seekr.com)", - "NetinfoBot/1.0 (http://netinfo.bg/netinfobot.html)", - "NetLookout/2.24", - "Netluchs/0.8-dev ( ; http://www.netluchs.de/; ___don't___spam_me_@netluchs.de)", - "NetNoseCrawler/v1.0", - "Netprospector JavaCrawler", - "NetResearchServer(http://www.look.com)", - "NetResearchServer/x.x(loopimprovements.com/robot.html)", - "NetSeer/Nutch-0.9 (NetSeer Crawler; http://www.netseer.com; crawler@netseer.com)", - "NetSprint -- 2.0", - "NetWhatCrawler/0.06-dev (NetWhatCrawler from NetWhat.com; http://www.netwhat.com; support@netwhat.com)", - "NetZippy", - "NextGenSearchBot 1 (for information visit http://www.eliyon.com/NextGenSearchBot)", - "NextopiaBOT (+http://www.nextopia.com) distributed crawler client beta v0.x", - "NG-Search/0.90 (NG-SearchBot; http://www.ng-search.com; )", - "NG/1.0", - "NG/4.0.1229", - "NITLE Blog Spider/0.01", - "Noago Spider", - "Nokia-WAPToolkit/1.2 googlebot(at)googlebot.com", - "Nokia6610/1.0 (3.09) Profile/MIDP-1.0 Configuration/CLDC-1.0 (compatible;YahooSeeker/M1A1-R2D2; http://help.yahoo.com/help/us/ysearch/crawling/crawling-01.html)", - "NokodoBot/1.x (+http://nokodo.com/bot.htm)", - "Norbert the Spider(Burf.com)", - "noxtrumbot/1.0 (crawler@noxtrum.com)", - "noyona_0_1", - "NP/0.1 (NP; http://www.nameprotect.com; npbot@nameprotect.com)", - "NPBot (http://www.nameprotect.com/botinfo.html)", - "NPBot-1/2.0", - "Nsauditor/1.x", - "nsyght.com/Nutch-1.0-dev (nsyght.com; Nsyght.com)", - "nsyght.com/Nutch-x.x (nsyght.com; search.nsyght.com)", - "nttdirectory_robot/0.9 (super-robot@super.navi.ocn.ne.jp)", - "nuSearch Spider www.nusearch.com (compatible; MSIE 4.01)", - "NuSearch Spider (compatible; MSIE 6.0)", - "NuSearch Spider www.nusearch.com", - "Nutch", - "Nutch crawler/Nutch-0.9 (picapage.com; admin@picapage.com)", - "Nutch/Nutch-0.9 (Eurobot; http://www.ayell.eu )", - "NutchCVS/0.0x-dev (Nutch; http://www.nutch.org/docs/bot.html; nutch-agent@lists.sourceforge.net)", - "NutchCVS/0.7.1 (Nutch running at UW; http://www.nutch.org/docs/en/bot.html; sycrawl@cs.washington.edu)", - "NutchEC2Test/Nutch-0.9-dev (Testing Nutch on Amazon EC2.; http://lucene.apache.org/nutch/bot.html; ec2test at lucene.com)", - "NutchOrg/0.0x-dev (Nutch; http://www.nutch.org/docs/bot.html; nutch-agent@lists.sourceforge.net)", - "nutchsearch/Nutch-0.9 (Nutch Search 1.0; herceg_novi at yahoo dot com)", - "NutchVinegarCrawl/Nutch-0.8.1 (Vinegar; http://www.cs.washington.edu; eytanadar at gmail dot com)", - "obidos-bot (just looking for books.)", - "ObjectsSearch/0.01-dev (ObjectsSearch;http://www.ObjectsSearch.com/bot.html; support@thesoftwareobjects.com)", - "ObjectsSearch/0.0x (ObjectsSearch; http://www.ObjectsSearch.com/bot.html; support@thesoftwareobjects.com)", - "oBot ((compatible;Win32))", - "Ocelli/1.x (http://www.globalspec.com/Ocelli)", - "Octora Beta - www.octora.com", - "Octora Beta Bot - www.octora.com", - "OmniExplorer_Bot/1.0x (+http://www.omni-explorer.com) Internet CategorizerOmniExplorer http://www.omni-explorer.com/ car & shopping search (64.62.175.xxx)", - "OmniExplorer_Bot/1.0x (+http://www.omni-explorer.com) Job Crawler", - "OmniExplorer_Bot/1.1x (+http://www.omni-explorer.com) Torrent Crawler", - "OmniExplorer_Bot/x.xx (+http://www.omni-explorer.com) WorldIndexer", - "Onet.pl SA- http://szukaj.onet.pl", - "OntoSpider/1.0 libwww-perl/5.65", - "OOZBOT/0.20 ( http://www.setooz.com/oozbot.html ; agentname at setooz dot_com )", - "OpenAcoon v4.0.x (www.openacoon.de)", - "Openbot/3.0+(robot-response@openfind.com.tw;+http://www.openfind.com.tw/robot.html)", - "Openfind data gatherer- Openbot/3.0+(robot-response@openfind.com.tw;+http://www.openfind.com.tw/robot.html)", - "Openfind Robot/1.1A2", - "OpenISearch/1.x (www.openisearch.com)", - "OpenTaggerBot (http://www.opentagger.com/opentaggerbot.htm)", - "OpenTextSiteCrawler/2.9.2", - "OpenWebSpider/0.x.x (http://www.openwebspider.org)", - "OpenWebSpider/x", - "OpidooBOT (larbin2.6.3@unspecified.mail)", - "Oracle Ultra Search", - "OrangeSpider", - "Orbiter/T-2.0 (+http://www.dailyorbit.com/bot.htm)", - "Overture-WebCrawler/3.8/Fresh (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)", - "ozelot/2.7.3 (Search engine indexer; www.flying-cat.de/ozelot; ozelot@flying-cat.de)", - "PADLibrary Spider", - "PageBitesHyperBot/600 (http://www.pagebites.com/)", - "Pagebull http://www.pagebull.com/", - "page_verifier (http://www.securecomputing.com/goto/pv)", - "parallelContextFocusCrawler1.1parallelContextFocusCrawler1.1", - "ParaSite/1.0b (http://www.ianett.com/parasite/)", - "Patwebbot (http://www.herz-power.de/technik.html)", - "PBrowse 1.4b", - "pd02_1.0.0 pd02_1.0.0@dzimi@post.sk", - "PEERbot www.peerbot.com", - "PEval 1.4b", - "PicoSearch/1.0", - "Piffany_Web_Scraper_v0.x", - "Piffany_Web_Spider_v0.x", - "pipeLiner/0.3a (PipeLine Spider;http://www.pipeline-search.com/webmaster.html; webmaster'at'pipeline-search.com)", - "pipeLiner/0.xx (PipeLine Spider; http://www.pipeline-search.com/webmaster.html)", - "Pita", - "PJspider/3.0 (pjspider@portaljuice.com; http://www.portaljuice.com)", - "PlagiarBot/1.0", - "PluckFeedCrawler/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://www.pluck.com; 1 subscribers)", - "Pluggd/Nutch-0.9 (automated crawler http://www.pluggd.com;support at pluggd dot com)", - "Poirot", - "polybot 1.0 (http://cis.poly.edu/polybot/)", - "Pompos/1.x http://dir.com/pompos.html", - "Pompos/1.x pompos@iliad.fr", - "Popdexter/1.0", - "Port Huron Labs", - "PortalBSpider/2.0 (spider@portalb.com)", - "potbot 1.0", - "PRCrawler/Nutch-0.9 (data mining development project; crawler@projectrialto.com)", - "PrivacyFinder Cache Bot v1.0", - "PrivacyFinder/1.1", - "Production Bot 0116B", - "Production Bot 2016B", - "Production Bot DOT 3016B", - "Program Shareware 1.0.2", - "Project XP5 [2.03.07-111203]", - "PROve AnswerBot 4.0", - "ProWebGuide Link Checker (http://www.prowebguide.com)", - "psbot/0.1 (+http://www.picsearch.com/bot.html)", - "PSurf15a 11", - "PSurf15a 51", - "PSurf15a VA", - "psycheclone", - "PubCrawl (pubcrawl.stanford.edu)", - "pulseBot (pulse Web Miner)", - "PWeBot/1.2 Inspector (http://www.programacionweb.net/robot.php)", - "PycURL", - "Python-urllib/1.1x", - "Python-urllib/2.0a1", - "Qango.com Web Directory (http://www.qango.com/)", - "QEAVis Agent/Nutch-0.9 (Quantitative Evaluation of Academic Websites Visibility; http://nlp.uned.es/qeavis", - "QPCreep Test Rig ( We are not indexing- just testing )", - "QuepasaCreep ( crawler@quepasacorp.com )", - "QuepasaCreep v0.9.1x", - "QueryN Metasearch", - "QweeryBot/3.01 ( http://qweerybot.qweery.nl)", - "Qweery_robot.txt_CheckBot/3.01 (http://qweerybot.qweery.com)", - "R6_CommentReader_(www.radian6.com/crawler)", - "R6_FeedFetcher_(www.radian6.com/crawler)", - "rabaz (rabaz at gigabaz dot com)", - "RaBot/1.0 Agent-admin/phortse@hanmail.net", - "ramBot xtreme x.x", - "RAMPyBot - www.giveRAMP.com/0.1 (RAMPyBot - www.giveRAMP.com; http://www.giveramp.com/bot.html; support@giveRAMP.com)", - "RAMPyBot/0.8-dev (Nutch; http://lucene.apache.org/nutch/bot.html; nutch-agent@lucene.apache.org)", - "Rankivabot/3.2 (www.rankiva.com; 3.2; vzmxikn)", - "Rational SiteCheck (Windows NT)", - "Reaper [2.03.10-031204] (http://www.sitesearch.ca/reaper/)", - "Reaper/2.0x (+http://www.sitesearch.ca/reaper)", - "RedCarpet/1.2 (http://www.redcarpet-inc.com/robots.html)", - "RedCell/0.1 (InfoSec Search Bot (Coming Soon); http://www.telegenetic.net/bot.html; lhall@telegenetic.net)", - "RedCell/0.1 (RedCell; telegenetic.net/bot.html; lhall_at_telegenetic.net)", - "RedKernel WWW-Spider 2/0 (+http://www-spider.redkernel-softwares.com/)", - "rico/0.1", - "RixBot (http://babelserver.org/rix)", - "RoboCrawl (http://www.canadiancontent.net)", - "RoboCrawl (www.canadiancontent.net)", - "RoboPal (http://www.findpal.com/)", - "Robot/www.pj-search.com", - "Robot: NutchCrawler- Owner: wdavies@acm.org", - "Robot@SuperSnooper.Com", - "Robozilla/1.0", - "Rotondo/3.1 libwww/5.3.1", - "RRC (crawler_admin@bigfoot.com)", - "RSSMicro.com RSS/Atom Feed Robot", - "RSurf15a 41", - "RSurf15a 51", - "RSurf15a 81", - "RufusBot (Rufus Web Miner; http://64.124.122.252/feedback.html)", - "RufusBot (Rufus Web Miner; http://www.webaroo.com/rooSiteOwners.html)", - "sait/Nutch-0.9 (SAIT Research; http://www.samsung.com)", - "SandCrawler - Compatibility Testing", - "SapphireWebCrawler/1.0 (Sapphire Web Crawler using Nutch; http://boston.lti.cs.cmu.edu/crawler/; mhoy@cs.cmu.edu)", - "SapphireWebCrawler/Nutch-1.0-dev (Sapphire Web Crawler using Nutch; http://boston.lti.cs.cmu.edu/crawler/; mhoy@cs.cmu.edu)", - "savvybot/0.2", - "SBIder/0.7 (SBIder; http://www.sitesell.com/sbider.html; http://support.sitesell.com/contact-support.html)", - "SBIder/0.8-dev (SBIder; http://www.sitesell.com/sbider.html; http://support.sitesell.com/contact-support.html)", - "ScanWeb", - "ScholarUniverse/0.8 (Nutch;+http://scholaruniverse.com/bot.jsp; fetch-agent@scholaruniverse.com)", - "schwarzmann.biz-Spider_for_paddel.org+(http://www.innerprise.net/usp-spider.asp)", - "ScollSpider/2.0 (+http://www.webwobot.com/ScollSpider.php)", - "Scooter-3.0.EU", - "Scooter-3.0.FS", - "Scooter-3.0.HD", - "Scooter-3.0.VNS", - "Scooter-3.0QI", - "Scooter-3.2", - "Scooter-3.2.BT", - "Scooter-3.2.DIL", - "Scooter-3.2.EX", - "Scooter-3.2.JT", - "Scooter-3.2.NIV", - "Scooter-3.2.SF0", - "Scooter-3.2.snippet", - "Scooter-3.3dev", - "Scooter-ARS-1.1", - "Scooter-ARS-1.1-ih", - "scooter-venus-3.0.vns", - "Scooter-W3-1.0", - "Scooter-W3.1.2", - "Scooter/1.0", - "Scooter/1.0 scooter@pa.dec.com", - "Scooter/1.1 (custom)", - "Scooter/2.0 G.R.A.B. V1.1.0", - "Scooter/2.0 G.R.A.B. X2.0", - "Scooter/3.3", - "Scooter/3.3.QA.pczukor", - "Scooter/3.3.vscooter", - "Scooter/3.3_SF", - "Scooter2_Mercator_x-x.0", - "Scooter_bh0-3.0.3", - "Scooter_trk3-3.0.3", - "ScoutAbout", - "ScoutAnt/0.1; +http://www.ant.com/what_is_ant.com/", - "scoutmaster", - "Scrubby/2.x (http://www.scrubtheweb.com/)", - "Scrubby/3.0 (+http://www.scrubtheweb.com/help/technology.html)", - "Search+", - "Search-Engine-Studio", - "search.ch V1.4", - "search.ch V1.4.2 (spiderman@search.ch; http://www.search.ch)", - "Search/1.0 (http://www.innerprise.net/es-spider.asp)", - "searchbot admin@google.com", - "SearchByUsa/2 (SearchByUsa; http://www.SearchByUsa.com/bot.html; info@SearchByUsa.com)", - "SearchdayBot", - "SearchExpress Spider0.99", - "SearchGuild/DMOZ/Experiment (searchguild@gmail.com)", - "SearchGuild_DMOZ_Experiment (chris@searchguild.com)", - "Searchit-Now Robot/2.2 (+http://www.searchit-now.co.uk)", - "Searchmee! Spider v0.98a", - "SearchSight/2.0 (http://SearchSight.com/)", - "SearchSpider.com/1.1", - "Searchspider/1.2 (SearchSpider; http://www.searchspider.com; webmaster@searchspider.com)", - "SearchTone2.0 - IDEARE", - "Seekbot/1.0 (http://www.seekbot.net/bot.html) HTTPFetcher/0.3", - "Seekbot/1.0 (http://www.seekbot.net/bot.html) RobotsTxtFetcher/1.0 (XDF)", - "Seekbot/1.0 (http://www.seekbot.net/bot.html) RobotsTxtFetcher/1.2", - "Seeker.lookseek.com", - "Semager/1.1 (http://www.semager.de/blog/semager-bots/)", - "Semager/1.x (http://www.semager.de)", - "Sensis Web Crawler (search_comments\\at\\sensis\\dot\\com\\dot\\au)", - "Sensis.com.au Web Crawler (search_comments\\at\\sensis\\dot\\com\\dot\\au)", - "SeznamBot/1.0", - "SeznamBot/1.0 (+http://fulltext.seznam.cz/)", - "SeznamBot/2.0-test (+http://fulltext.sblog.cz/)", - "ShablastBot 1.0", - "Shim Crawler", - "Shim-Crawler(Mozilla-compatible; http://www.logos.ic.i.u-tokyo.ac.jp/crawler/; crawl@logos.ic.i.u-tokyo.ac.jp)", - "ShopWiki/1.0 ( +http://www.shopwiki.com/)", - "ShopWiki/1.0 ( +http://www.shopwiki.com/wiki/Help:Bot)", - "Shoula.com Crawler 2.0", - "SietsCrawler/1.1 (+http://www.siets.biz)", - "Sigram/Nutch-1.0-dev (Test agent for Nutch development; http://www.sigram.com/bot.html; bot at sigram dot com)", - "Siigle Orumcex v.001 Turkey (http://www.siigle.com)", - "silk/1.0", - "silk/1.0 (+http://www.slider.com/silk.htm)/3.7", - "Sirketcebot/v.01 (http://www.sirketce.com/bot.html)", - "SiteSpider +(http://www.SiteSpider.com/)", - "SiteTruth.com site rating system", - "SiteXpert", - "Skampy/0.9.x (http://www.skaffe.com/skampy-info.html)", - "Skimpy/0.x (http://www.skaffe.com/skampy-info.html)", - "Skywalker/0.1 (Skywalker; anonymous; anonymous)", - "Slarp/0.1", - "Slider_Search_v1-de", - "Slurp/2.0 (slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Slurp/2.0-KiteWeekly (slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Slurp/si (slurp@inktomi.com; http://www.inktomi.com/slurp.html)", - "Slurpy Verifier/1.0", - "SlySearch (slysearch@slysearch.com)", - "SlySearch/1.0 http://www.plagiarism.org/crawler/robotinfo.html", - "SlySearch/1.x http://www.slysearch.com", - "smartwit.com", - "SmiffyDCMetaSpider/1.0", - "snap.com beta crawler v0", - "Snapbot/1.0", - "Snapbot/1.0 (Snap Shots, +http://www.snap.com)", - "SnykeBot/0.6 (http://www.snyke.com)", - "SocSciBot ()", - "SoftHypermarketFileCheckBot/1.0+(+http://www.softhypermaket.com)", - "sogou develop spider", - "Sogou Orion spider/3.0(+http://www.sogou.com/docs/help/webmasters.htm#07)", - "sogou spider", - "Sogou web spider/3.0(+http://www.sogou.com/docs/help/webmasters.htm#07)", - "sohu agent", - "sohu-search", - "Sosospider+(+http://help.soso.com/webspider.htm)", - "speedfind ramBot xtreme 8.1", - "Speedy Spider (Beta/x.x; speedy@entireweb.com)", - "Speedy Spider (Entireweb; Beta/1.0; http://www.entireweb.com/about/search_tech/speedyspider/)", - "Speedy_Spider (http://www.entireweb.com)", - "Sphere Scout&v4.0 - scout at sphere dot com", - "Sphider", - "Spida/0.1", - "Spider-Sleek/2.0 (+http://search-info.com/linktous.html)", - "spider.batsch.com", - "spider.yellopet.com - www.yellopet.com", - "Spider/maxbot.com admin@maxbot.com", - "SpiderKU/0.x", - "SpiderMan", - "SpiderMonkey/7.0x (SpiderMonkey.ca info at http://spidermonkey.ca/sm.shtml)", - "Spinne/2.0", - "Spinne/2.0 med", - "Spinne/2.0 med_AH", - "Spock Crawler (http://www.spock.com/crawler)", - "sportsuchmaschine.de-Robot (Version: 1.02- powered by www.sportsuchmaschine.de)", - "sproose/0.1-alpha (sproose crawler; http://www.sproose.com/bot.html; crawler@sproose.com)", - "Sqworm/2.9.81-BETA (beta_release; 20011102-760; i686-pc-linux-gnu)", - "Sqworm/2.9.85-BETA (beta_release; 20011115-775; i686-pc-linux-gnu)", - "SSurf15a 11 ", - "StackRambler/x.x ", - "stat statcrawler@gmail.com", - "Steeler/1.x (http://www.tkl.iis.u-tokyo.ac.jp/~crawler/)", - "Steeler/3.3 (http://www.tkl.iis.u-tokyo.ac.jp/~crawler/)", - "Strategic Board Bot (+http://www.strategicboard.com)", - "Strategic Board Bot (+http://www.strategicboard.com)", - "Submission Spider at surfsafely.com", - "suchbaer.de", - "suchbaer.de (CrawlerAgent v0.103)", - "suchbot", - "Suchknecht.at-Robot", - "suchpadbot/1.0 (+http://www.suchpad.de)", - "SurferF3 1/0", - "suzuran", - "Swooglebot/2.0. (+http://swoogle.umbc.edu/swooglebot.htm)", - "SWSBot-Images/1.2 http://www.smartwaresoft.com/swsbot12.html", - "SygolBot http://www.sygol.net", - "SynoBot", - "Syntryx ANT Scout Chassis Pheromone; Mozilla/4.0 compatible crawler", - "Szukacz/1.x", - "Szukacz/1.x (robot; www.szukacz.pl/jakdzialarobot.html; szukacz@proszynski.pl)", - "tags2dir.com/0.8 (+http://tags2dir.com/directory/)", - "Tagword (http://tagword.com/dmoz_survey.php)", - "Talkro Web-Shot/1.0 (E-mail: webshot@daumsoft.com- Home: http://222.122.15.190/webshot)", - "TCDBOT/Nutch-0.8 (PhD student research;http://www.tcd.ie; mcgettrs at t c d dot IE)", - "TECOMAC-Crawler/0.x", - "Tecomi Bot (http://www.tecomi.com/bot.htm)", - "Teemer (NetSeer, Inc. is a Los Angeles based Internet startup company.; http://www.netseer.com/crawler.html; crawler@netseer.com)", - "Teoma MP", - "teomaagent crawler-admin@teoma.com", - "teomaagent1 [crawler-admin@teoma.com]", - "teoma_agent1", - "Teradex Mapper; mapper@teradex.com; http://www.teradex.com", - "terraminds-bot/1.0 (support@terraminds.de)", - "TerrawizBot/1.0 (+http://www.terrawiz.com/bot.html)", - "Test spider", - "TestCrawler/Nutch-0.9 (Testing Crawler for Research ; http://balihoo.com/index.aspx; tgautier at balihoo dot com)", - "TheRarestParser/0.2a (http://therarestwords.com/)", - "TheSuBot/0.1 (www.thesubot.de)", - "thumbshots-de-Bot (Version: 1.02- powered by www.thumbshots.de)", - "timboBot/0.9 http://www.breakingblogs.com/timbo_bot.html", - "TinEye/1.1 (http://tineye.com/crawler.html)", - "tivraSpider/1.0 (crawler@tivra.com)", - "TJG/Spider", - "Tkensaku/x.x(http://www.tkensaku.com/q.html)", - "Topodia/1.2-dev (Topodia - Crawler for HTTP content indexing; http://www.topodia.com/; support@topodia.com)", - "Toutatis x-xx.x (hoppa.com)", - "Toutatis x.x (hoppa.com)", - "Toutatis x.x-x", - "traazibot/testengine (+http://www.traazi.de)", - "Trampelpfad-Spider", - "Trampelpfad-Spider-v0.1", - "TSurf15a 11", - "Tumblr/1.0 RSS syndication (+http://www.tumblr.com/) (support@tumblr.com)", - "TurnitinBot/x.x (http://www.turnitin.com/robot/crawlerinfo.html)", - "Turnpike Emporium LinkChecker/0.1", - "TutorGig/1.5 (+http://www.tutorgig.com/crawler)", - "Tutorial Crawler 1.4 (http://www.tutorgig.com/crawler)", - "Twiceler www.cuill.com/robots.html", - "Twiceler-0.9 http://www.cuill.com/twiceler/robot.html", - "Tycoon Agent/Nutch-1.0-dev", - "TygoBot", - "TygoProwler", - "UIowaCrawler/1.0", - "UKWizz/Nutch-0.8.1 (UKWizz Nutch crawler; http://www.ukwizz.com/)", - "Ultraseek", - "Under the Rainbow 2.2", - "UofTDB_experiment (leehyun@cs.toronto.edu)", - "updated/0.1-alpha (updated crawler; http://www.updated.com; crawler@updated.com)", - "updated/0.1beta (updated.com; http://www.updated.com; crawler@updated.om)", - "Uptimebot", - "UptimeBot(www.uptimebot.com)", - "URL Spider Pro/x.xx (innerprise.net)", - "urlfan-bot/1.0; +http://www.urlfan.com/site/bot/350.html", - "URL_Spider_Pro/x.x", - "URL_Spider_Pro/x.x+(http://www.innerprise.net/usp-spider.asp)", - "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", - "User-Agent: Mozilla/4.0 (SKIZZLE! Distributed Internet Spider v1.0 - www.SKIZZLE.com)", - "USyd-NLP-Spider (http://www.it.usyd.edu.au/~vinci/bot.html)", - "VadixBot", - "Vagabondo-WAP/2.0 (webcrawler at wise-guys dot nl; http://webagent.wise-guys.nl/)/1.0 Profile", - "Vagabondo/1.x MT (webagent@wise-guys.nl)", - "Vagabondo/2.0 MT", - "Vagabondo/2.0 MT (webagent at wise-guys dot nl)", - "Vagabondo/2.0 MT (webagent@NOSPAMwise-guys.nl)", - "Vagabondo/3.0 (webagent at wise-guys dot nl)", - "Vakes/0.01 (Vakes; http://www.vakes.com/; search@vakes.com)", - "versus 0.2 (+http://versus.integis.ch)", - "versus crawler eda.baykan@epfl.ch", - "VeryGoodSearch.com.DaddyLongLegs", - "verzamelgids.nl - Networking4all Bot/x.x", - "Verzamelgids/2.2 (http://www.verzamelgids.nl)", - "Vespa Crawler", - "VisBot/2.0 (Visvo.com Crawler; http://www.visvo.com/bot.html; bot@visvo.com)", - "Vision Research Lab image spider at vision.ece.ucsb.edu", - "VMBot/0.x.x (VMBot; http://www.VerticalMatch.com/; vmbot@tradedot.com)", - "Vortex/2.2 (+http://marty.anstey.ca/robots/vortex/)", - "voyager-hc/1.0", - "voyager/1.0", - "voyager/2.0 (http://www.kosmix.com/html/crawler.html)", - "VSE/1.0 (testcrawler@hotmail.com)", - "VSE/1.0 (testcrawler@vivisimo.com)", - "vspider", - "vspider/3.x", - "VWBOT/Nutch-0.9-dev (VWBOT Nutch Crawler; http://vwbot.cs.uiuc.edu;+vwbot@cs.uiuc.edu", - "W3SiteSearch Crawler_v1.1 http://www.w3sitesearch.de", - "wadaino.jp-crawler 0.2 (http://wadaino.jp/)", - "Wavefire/0.8-dev (Wavefire; http://www.wavefire.com; info@wavefire.com)", - "Waypath development crawler - info at waypath dot com", - "Waypath Scout v2.x - info at waypath dot com", - "Web Snooper", - "web2express.org/Nutch-0.9-dev (leveled playing field; http://web2express.org/; info at web2express.org)", - "WebAlta Crawler/1.2.1 (http://www.webalta.ru/bot.html)", - "WebarooBot (Webaroo Bot; http://64.124.122.252/feedback.html)", - "WebarooBot (Webaroo Bot; http://www.webaroo.com/rooSiteOwners.html)", - "webbandit/4.xx.0", - "Webclipping.com", - "WebCompass 2.0", - "WebCorp/1.0", - "webcrawl.net", - "WebFindBot(http://www.web-find.com)", - "Webglimpse 2.xx.x (http://webglimpse.net)", - "Weblog Attitude Diffusion 1.0", - "webmeasurement-bot, http://rvs.informatik.uni-leipzig.de", - "WebRankSpider/1.37 (+http://ulm191.server4you.de/crawler/)", - "WebSearch.COM.AU/3.0.1 (The Australian Search Engine; http://WebSearch.COM.AU; Search@WebSearch.COM.AU)", - "WebSearchBench WebCrawler v0.1(Experimental)", - "WebsiteWorth v1.0", - "Webspinne/1.0 webmaster@webspinne.de", - "Websquash.com (Add url robot)", - "WebStat/1.0 (Unix; beta; 20040314)", - "Webster v0.3 ( http://webster.healeys.net/ )", - "WebVac (webmaster@pita.stanford.edu)", - "Webverzeichnis.de - Telefon: 01908 / 26005", - "WebVulnCrawl.unknown/1.0 libwww-perl/5.803", - "Wells Search II", - "WEP Search 00", - "WFARC", - "whatUseek_winona/3.0", - "WhizBang! Lab", - "Willow Internet Crawler by Twotrees V2.1", - "WinHTTP Example/1.0", - "WinkBot/0.06 (Wink.com search engine web crawler; http://www.wink.com/Wink:WinkBot; winkbot@wink.com)", - "WIRE/0.11 (Linux; i686; Bot,Robot,Spider,Crawler,aromano@cli.di.unipi.it)", - "WIRE/0.x (Linux; i686; Bot,Robot,Spider,Crawler)", - "WISEbot/1.0 (WISEbot@koreawisenut.com; http://wisebot.koreawisenut.com)", - "worio heritrix bot (+http://worio.com/)", - "woriobot ( http://www.worio.com/)", - "WorldLight", - "Wotbox/alpha0.6 (bot@wotbox.com; http://www.wotbox.com)", - "Wotbox/alpha0.x.x (bot@wotbox.com; http://www.wotbox.com) Java/1.4.1_02", - "WSB WebCrawler V1.0 (Beta)- cl@cs.uni-dortmund.de", - "WSB, http://websearchbench.cs.uni-dortmund.de", - "wume_crawler/1.1 (http://wume.cse.lehigh.edu/~xiq204/crawler/)", - "Wwlib/Linux", - "www.arianna.it", - "WWWeasel Robot v1.00 (http://wwweasel.de)", - "wwwster/1.x (Beta- mailto:gue@cis.uni-muenchen.de)", - "X-Crawler ", - "xirq/0.1-beta (xirq; http://www.xirq.com; xirq@xirq.com)", - "xyro_(xcrawler@cosmos.inria.fr)", - "Y!J-BSC/1.0 (http://help.yahoo.co.jp/help/jp/search/indexing/indexing-15.html)", - "Y!J-SRD/1.0", - "Y!J/1.0 (http://help.yahoo.co.jp/help/jp/search/indexing/indexing-15.html)", - "yacy (www.yacy.net; v20040602; i386 Linux 2.4.26-gentoo-r13; java 1.4.2_06; MET/en)", - "yacybot (x86 Windows XP 5.1; java 1.5.0_06; Europe/de) yacy.net", - "Yahoo Pipes 1.0", - "Yahoo! Mindset", - "Yahoo-Blogs/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; http://help.yahoo.com/help/us/ysearch/crawling/crawling-02.html )", - "Yahoo-MMAudVid/1.0 (mms dash mmaudvidcrawler dash support at yahoo dash inc dot com)", - "Yahoo-MMAudVid/2.0(mms dash mm aud vid crawler dash support at yahoo dash inc.com ;Mozilla 4.0 compatible; MSIE 7.0;Windows NT 5.0; .NET CLR 2.0)", - "Yahoo-MMCrawler/3.x (mm dash crawler at trd dot overture dot com)", - "Yahoo-Test/4.0", - "Yahoo-VerticalCrawler-FormerWebCrawler/3.9 crawler at trd dot overture dot com; http://www.alltheweb.com/help/webmaster/crawler", - "YahooFeedSeeker/2.0 (compatible; Mozilla 4.0; MSIE 5.5; http://publisher.yahoo.com/rssguide)", - "YahooSeeker-Testing/v3.9 (compatible; Mozilla 4.0; MSIE 5.5; http://search.yahoo.com/)", - "YahooSeeker/1.0 (compatible; Mozilla 4.0; MSIE 5.5; http://help.yahoo.com/help/us/shop/merchant/)", - "YahooSeeker/1.0 (compatible; Mozilla 4.0; MSIE 5.5; http://search.yahoo.com/yahooseeker.html)", - "YahooSeeker/1.1 (compatible; Mozilla 4.0; MSIE 5.5; http://help.yahoo.com/help/us/shop/merchant/)", - "YahooSeeker/bsv3.9 (compatible; Mozilla 4.0; MSIE 5.5; http://help.yahoo.com/help/us/ysearch/crawling/crawling-02.html )", - "YahooSeeker/CafeKelsa-dev (compatible; Konqueror/3.2; FreeBSD ;cafekelsa-dev-webmaster@yahoo-inc.com )", - "Yandex/1.01.001 (compatible; Win16; I)", - "Yanga WorldSearch Bot v1.1/beta (http://www.yanga.co.uk/)", - "yarienavoir.net/0.2", - "Yeti", - "Yeti/0.01 (nhn/1noon, yetibot@naver.com, check robots.txt daily and follows it)", - "Yeti/1.0 (NHN Corp.; http://help.naver.com/robots/)", - "yggdrasil/Nutch-0.9 (yggdrasil biorelated search engine; www dot biotec dot tu minus dresden do de slash schroeder; heiko dot dietze at biotec dot tu minus dresden dot de)", - "YodaoBot/1.0 (http://www.yodao.com/help/webmaster/spider/; )", - "yoofind/yoofind-0.1-dev (yoono webcrawler; http://www.yoono.com ; MyEmail)", - "yoogliFetchAgent/0.1", - "yoono/1.0 web-crawler/1.0", - "YottaCars_Bot/4.12 (+http://www.yottacars.com) Car Search Engine ", - "YottaShopping_Bot/4.12 (+http://www.yottashopping.com) Shopping Search Engine", - "Zao-Crawler", - "Zao-Crawler 0.2b", - "Zao/0.1 (http://www.kototoi.org/zao/)", - "ZBot/1.00 (icaulfield@zeus.com)", - "Zearchit", - "ZeBot_lseek.net (bot@ze.bz)", - "ZeBot_www.ze.bz (ze.bz@hotmail.com)", - "zedzo.digest/0.1 (http://www.zedzo.com/)", - "zermelo Mozilla/5.0 compatible; heritrix/1.12.1 (+http://www.powerset.com) [email:crawl@powerset.com,email:paul@page-store.com]", - "zerxbot/Version 0.6 libwww-perl/5.79", - "Zeus ThemeSite Viewer Webster Pro V2.9 Win32", - "Zeus xxxxx Webster Pro V2.9 Win32", - "Zeusbot/0.07 (Ulysseek's web-crawling robot; http://www.zeusbot.com; agent@zeusbot.com)", - "ZipppBot/0.xx (ZipppBot; http://www.zippp.net; webmaster@zippp.net)", - "ZIPPPCVS/0.xx (ZipppBot/.xx;http://www.zippp.net; webmaster@zippp.net)", - "Zippy v2.0 - Zippyfinder.com", - "ZoomSpider - wrensoft.com", - "zspider/0.9-dev http://feedback.redkolibri.com/", - "ZyBorg/1.0 (ZyBorg@WISEnut.com; http://www.WISEnut.com)"] - end -end diff --git a/vendor/impressionist/app/models/impressionist/impressionable.rb b/vendor/impressionist/app/models/impressionist/impressionable.rb deleted file mode 100644 index 1df2f1c34..000000000 --- a/vendor/impressionist/app/models/impressionist/impressionable.rb +++ /dev/null @@ -1,67 +0,0 @@ -module Impressionist - module Impressionable - extend ActiveSupport::Concern - - module ClassMethods - attr_accessor :impressionist_cache_options - @impressionist_cache_options = nil - - def impressionist_counter_cache_options - if @impressionist_cache_options - options = { :column_name => :impressions_count, :unique => false } - options.merge!(@impressionist_cache_options) if @impressionist_cache_options.is_a?(Hash) - options - end - end - - def impressionist_counter_caching? - impressionist_counter_cache_options.present? - end - - def counter_caching? - ::ActiveSupport::Deprecation.warn("#counter_caching? is deprecated; please use #impressionist_counter_caching? instead") - impressionist_counter_caching? - end - end - - def impressionable? - true - end - - def impressionist_count(options={}) - # options.reverse_merge!(:filter=>:request_hash, :start_date=>nil, :end_date=>Time.now) - # imps = options[:start_date].blank? ? impressions : impressions.where("created_at>=? and created_at<=?",options[:start_date],options[:end_date]) - # options[:filter] == :all ? imps.count : imps.count(options[:filter], :distinct => true) - options.reverse_merge!(:filter => :request_hash, :start_date => nil, :end_date => Time.now) - imps = options[:start_date].blank? ? impressions : impressions.where(:created_at.gte => options[:start_date], :created_at.lte => options[:end_date]) - options[:filter] == :all ? imps.count : imps.distinct(options[:filter]).count - end - - def update_impressionist_counter_cache - # cache_options = self.class.impressionist_counter_cache_options - # column_name = cache_options[:column_name].to_sym - # count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count - # update_attribute(column_name, count) - cache_options = self.class.impressionist_counter_cache_options - column_name = cache_options[:column_name].to_sym - update_attribute(column_name, self.send(cache_options[:column_name]) + 1) - end - - # OLD METHODS - DEPRECATE IN V0.5 - def impression_count(start_date=nil,end_date=Time.now) - impressionist_count({:start_date=>start_date, :end_date=>end_date, :filter=>:all}) - end - - def unique_impression_count(start_date=nil,end_date=Time.now) - impressionist_count({:start_date=>start_date, :end_date=>end_date, :filter=> :request_hash}) - end - - def unique_impression_count_ip(start_date=nil,end_date=Time.now) - impressionist_count({:start_date=>start_date, :end_date=>end_date, :filter=> :ip_address}) - end - - def unique_impression_count_session(start_date=nil,end_date=Time.now) - impressionist_count({:start_date=>start_date, :end_date=>end_date, :filter=> :session_hash}) - end - end -end diff --git a/vendor/impressionist/impressionist.gemspec b/vendor/impressionist/impressionist.gemspec deleted file mode 100644 index e462fe735..000000000 --- a/vendor/impressionist/impressionist.gemspec +++ /dev/null @@ -1,27 +0,0 @@ -# encoding: utf-8 -require File.expand_path('../lib/impressionist/version', __FILE__) - -Gem::Specification.new do |s| - s.add_dependency 'httpclient', '~> 2.2' - s.add_dependency 'nokogiri', '~> 1.5' - s.add_development_dependency 'capybara' - s.add_development_dependency 'rake', '>= 0.9' - s.add_development_dependency 'rails', '~>3.1' - s.add_development_dependency 'rdoc', '>= 2.4.2' - s.add_development_dependency 'rspec-rails' - s.add_development_dependency 'simplecov' - s.add_development_dependency 'sqlite3' - s.add_development_dependency 'systemu' - s.authors = ["johnmcaliley"] - s.description = "Log impressions from controller actions or from a model" - s.email = "john.mcaliley@gmail.com" - s.files = `git ls-files`.split("\n") - s.homepage = "https://github.com/charlotte-ruby/impressionist" - s.licenses = ["MIT"] - s.name = "impressionist" - s.require_paths = ["lib"] - s.required_rubygems_version = Gem::Requirement.new('>= 1.3.6') if s.respond_to? :required_rubygems_version= - s.summary = "Easy way to log impressions" - s.test_files = `git ls-files -- test_app/*`.split("\n") - s.version = Impressionist::VERSION -end diff --git a/vendor/impressionist/lib/generators/active_record/impressionist_generator.rb b/vendor/impressionist/lib/generators/active_record/impressionist_generator.rb deleted file mode 100644 index 31f4c1a4d..000000000 --- a/vendor/impressionist/lib/generators/active_record/impressionist_generator.rb +++ /dev/null @@ -1,21 +0,0 @@ -module ActiveRecord - module Generators - class ImpressionistGenerator < Rails::Generators::Base - include Rails::Generators::Migration - source_root File.join(File.dirname(__FILE__), 'templates') - - def self.next_migration_number(dirname) - sleep 1 - if ActiveRecord::Base.timestamped_migrations - Time.now.utc.strftime("%Y%m%d%H%M%S") - else - "%.3d" % (current_migration_number(dirname) + 1) - end - end - - def create_migration_file - migration_template 'create_impressions_table.rb', 'db/migrate/create_impressions_table.rb' - end - end - end -end diff --git a/vendor/impressionist/lib/generators/active_record/templates/create_impressions_table.rb b/vendor/impressionist/lib/generators/active_record/templates/create_impressions_table.rb deleted file mode 100644 index 5282380cd..000000000 --- a/vendor/impressionist/lib/generators/active_record/templates/create_impressions_table.rb +++ /dev/null @@ -1,30 +0,0 @@ -class CreateImpressionsTable < ActiveRecord::Migration - def self.up - create_table :impressions, :force => true do |t| - t.string :impressionable_type - t.integer :impressionable_id - t.integer :user_id - t.string :controller_name - t.string :action_name - t.string :view_name - t.string :request_hash - t.string :ip_address - t.string :session_hash - t.text :message - t.text :referrer - t.timestamps - end - add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false - add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false - add_index :impressions, [:impressionable_type, :impressionable_id, :ip_address], :name => "poly_ip_index", :unique => false - add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false - add_index :impressions, :user_id - end - - def self.down - drop_table :impressions - end -end diff --git a/vendor/impressionist/lib/generators/impressionist_generator.rb b/vendor/impressionist/lib/generators/impressionist_generator.rb deleted file mode 100644 index 30290af23..000000000 --- a/vendor/impressionist/lib/generators/impressionist_generator.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Impressionist - module Generators - class ImpressionistGenerator < Rails::Generators::Base - hook_for :orm - source_root File.expand_path('../templates', __FILE__) - - def copy_config_file - template 'impression.rb', 'config/initializers/impression.rb' - end - end - end -end diff --git a/vendor/impressionist/lib/generators/mongo_mapper/impressionist_generator.rb b/vendor/impressionist/lib/generators/mongo_mapper/impressionist_generator.rb deleted file mode 100644 index eaa1b65cc..000000000 --- a/vendor/impressionist/lib/generators/mongo_mapper/impressionist_generator.rb +++ /dev/null @@ -1,8 +0,0 @@ -module MongoMapper - module Generators - class ImpressionistGenerator < Rails::Generators::Base - # Empty for now, need it for generating the config file without - # triggering other ORM's generators. - end - end -end diff --git a/vendor/impressionist/lib/generators/mongoid/impressionist_generator.rb b/vendor/impressionist/lib/generators/mongoid/impressionist_generator.rb deleted file mode 100644 index e56bf904f..000000000 --- a/vendor/impressionist/lib/generators/mongoid/impressionist_generator.rb +++ /dev/null @@ -1,8 +0,0 @@ -module Mongoid - module Generators - class ImpressionistGenerator < Rails::Generators::Base - # Empty for now, need it for generating the config file without - # triggering other ORM's generators. - end - end -end diff --git a/vendor/impressionist/lib/generators/templates/impression.rb b/vendor/impressionist/lib/generators/templates/impression.rb deleted file mode 100644 index fbdee915b..000000000 --- a/vendor/impressionist/lib/generators/templates/impression.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Use this hook to configure impressionist parameters -Impressionist.setup do |config| - # Define ORM. Could be :active_record (default) and :mongo_mapper - # config.orm = :active_record -end diff --git a/vendor/impressionist/lib/impressionist.rb b/vendor/impressionist/lib/impressionist.rb deleted file mode 100644 index 7ead8fe9d..000000000 --- a/vendor/impressionist/lib/impressionist.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "impressionist/engine.rb" - -module Impressionist - # Define ORM - mattr_accessor :orm - @@orm = :active_record - - # Load configuration from initializer - def self.setup - yield self - end -end diff --git a/vendor/impressionist/lib/impressionist/bots.rb b/vendor/impressionist/lib/impressionist/bots.rb deleted file mode 100644 index 10d3fd64c..000000000 --- a/vendor/impressionist/lib/impressionist/bots.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'httpclient' -require 'nokogiri' - -module Impressionist - module Bots - LIST_URL = "http://www.user-agents.org/allagents.xml" - def self.consume - response = HTTPClient.new.get_content(LIST_URL) - doc = Nokogiri::XML(response) - list = [] - doc.xpath('//user-agent').each do |agent| - type = agent.xpath("Type").text - list << agent.xpath("String").text.gsub("<","<") if ["R","S"].include?(type) #gsub hack for badly formatted data - end - list - end - end -end diff --git a/vendor/impressionist/lib/impressionist/engine.rb b/vendor/impressionist/lib/impressionist/engine.rb deleted file mode 100644 index 8f953d75e..000000000 --- a/vendor/impressionist/lib/impressionist/engine.rb +++ /dev/null @@ -1,30 +0,0 @@ -require "impressionist" -require "rails" - -module Impressionist - class Engine < Rails::Engine - initializer 'impressionist.model' do |app| - require "#{root}/app/models/impressionist/impressionable.rb" - if Impressionist.orm == :active_record - require "impressionist/models/active_record/impression.rb" - require "impressionist/models/active_record/impressionist/impressionable.rb" - ActiveRecord::Base.send(:include, Impressionist::Impressionable) - elsif Impressionist.orm == :mongo_mapper - require "impressionist/models/mongo_mapper/impression.rb" - require "impressionist/models/mongo_mapper/impressionist/impressionable.rb" - MongoMapper::Document.plugin Impressionist::Impressionable - elsif Impressionist.orm == :mongoid - require "impressionist/models/mongoid/impression.rb" - require "impressionist/models/mongoid/impressionist/impressionable.rb" - # Mongoid::Document Impressionist::Impressionable - end - end - - initializer 'impressionist.controller' do - ActiveSupport.on_load(:action_controller) do - include ImpressionistController::InstanceMethods - extend ImpressionistController::ClassMethods - end - end - end -end diff --git a/vendor/impressionist/lib/impressionist/models/active_record/impression.rb b/vendor/impressionist/lib/impressionist/models/active_record/impression.rb deleted file mode 100644 index 94c2710c7..000000000 --- a/vendor/impressionist/lib/impressionist/models/active_record/impression.rb +++ /dev/null @@ -1,18 +0,0 @@ -class Impression < ActiveRecord::Base - attr_accessible :impressionable_type, :impressionable_id, :user_id, - :controller_name, :action_name, :view_name, :request_hash, :ip_address, - :session_hash, :message, :referrer - - after_save :update_impressions_counter_cache - - private - - def update_impressions_counter_cache - impressionable_class = self.impressionable_type.constantize - - if impressionable_class.impressionist_counter_cache_options - resouce = impressionable_class.find(self.impressionable_id) - resouce.try(:update_impressionist_counter_cache) - end - end -end diff --git a/vendor/impressionist/lib/impressionist/models/active_record/impressionist/impressionable.rb b/vendor/impressionist/lib/impressionist/models/active_record/impressionist/impressionable.rb deleted file mode 100644 index 6100b8868..000000000 --- a/vendor/impressionist/lib/impressionist/models/active_record/impressionist/impressionable.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Impressionist - module Impressionable - extend ActiveSupport::Concern - - module ClassMethods - def is_impressionable(options={}) - has_many :impressions, :as => :impressionable, :dependent => :destroy - @impressionist_cache_options = options[:counter_cache] - end - end - end -end diff --git a/vendor/impressionist/lib/impressionist/models/mongo_mapper/impression.rb b/vendor/impressionist/lib/impressionist/models/mongo_mapper/impression.rb deleted file mode 100644 index a7d5f64cb..000000000 --- a/vendor/impressionist/lib/impressionist/models/mongo_mapper/impression.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Impression - include MongoMapper::Document - - key :impressionable_type, String - key :impressionable_id, String - key :user_id, String - key :controller_name, String - key :action_name, String - key :view_name, String - key :request_hash, String - key :ip_address, String - key :session_hash, String - key :message, String - key :referrer, String - timestamps! -end diff --git a/vendor/impressionist/lib/impressionist/models/mongo_mapper/impressionist/impressionable.rb b/vendor/impressionist/lib/impressionist/models/mongo_mapper/impressionist/impressionable.rb deleted file mode 100644 index 9e0dd524b..000000000 --- a/vendor/impressionist/lib/impressionist/models/mongo_mapper/impressionist/impressionable.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Impressionist - module Impressionable - extend ActiveSupport::Concern - - module ClassMethods - def is_impressionable(options={}) - many :impressions, :as => :impressionable, :dependent => :destroy - @cache_options = options[:counter_cache] - end - end - end -end diff --git a/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb b/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb deleted file mode 100644 index 9a2d958c4..000000000 --- a/vendor/impressionist/lib/impressionist/models/mongoid/impression.rb +++ /dev/null @@ -1,39 +0,0 @@ -class Impression - include Mongoid::Document - include Mongoid::Timestamps - - field :impressionable_type - field :impressionable_id - field :user_id - field :controller_name - field :action_name - field :view_name - field :request_hash - field :ip_address - field :session_hash - field :message - field :referrer - - belongs_to :impressionable, :polymorphic => true - - after_save :update_impressions_counter_cache - - def self.impressionist_count(options={}) - options.reverse_merge!(:filter => :request_hash, :start_date => nil, :end_date => Time.now) - imps = options[:start_date].blank? ? impressions : impressions.where(:created_at.gte => options[:start_date], :created_at.lte => options[:end_date]) - options[:filter] == :all ? imps.count : imps.distinct(options[:filter]).count - end - - private - - def update_impressions_counter_cache - if self.referrer - impressionable_class = self.impressionable_type.constantize - - if impressionable_class.impressionist_counter_cache_options - resouce = impressionable_class.find(self.impressionable_id) - resouce.try(:update_impressionist_counter_cache) - end - end - end -end diff --git a/vendor/impressionist/lib/impressionist/models/mongoid/impressionist/impressionable.rb b/vendor/impressionist/lib/impressionist/models/mongoid/impressionist/impressionable.rb deleted file mode 100644 index 6100b8868..000000000 --- a/vendor/impressionist/lib/impressionist/models/mongoid/impressionist/impressionable.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Impressionist - module Impressionable - extend ActiveSupport::Concern - - module ClassMethods - def is_impressionable(options={}) - has_many :impressions, :as => :impressionable, :dependent => :destroy - @impressionist_cache_options = options[:counter_cache] - end - end - end -end diff --git a/vendor/impressionist/lib/impressionist/version.rb b/vendor/impressionist/lib/impressionist/version.rb deleted file mode 100644 index cc644dcd3..000000000 --- a/vendor/impressionist/lib/impressionist/version.rb +++ /dev/null @@ -1,3 +0,0 @@ -module Impressionist - VERSION = "1.1.1" -end diff --git a/vendor/impressionist/logo.png b/vendor/impressionist/logo.png deleted file mode 100644 index 9106036b0..000000000 Binary files a/vendor/impressionist/logo.png and /dev/null differ diff --git a/vendor/impressionist/test_app/.gitignore b/vendor/impressionist/test_app/.gitignore deleted file mode 100644 index 351f63828..000000000 --- a/vendor/impressionist/test_app/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. -# -# If you find yourself ignoring temporary files generated by your text editor -# or operating system, you probably want to add a global ignore instead: -# git config --global core.excludesfile ~/.gitignore_global - -# Ignore bundler config -/.bundle -/Gemfile.lock - -# Ignore the default SQLite database. -/db/*.sqlite3 - -# Ignore all logfiles and tempfiles. -/coverage -/log/*.log -/tmp diff --git a/vendor/impressionist/test_app/.rspec b/vendor/impressionist/test_app/.rspec deleted file mode 100644 index 4e1e0d2f7..000000000 --- a/vendor/impressionist/test_app/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/vendor/impressionist/test_app/Gemfile b/vendor/impressionist/test_app/Gemfile deleted file mode 100644 index 67f8bb246..000000000 --- a/vendor/impressionist/test_app/Gemfile +++ /dev/null @@ -1,59 +0,0 @@ -source 'https://rubygems.org' - -gem 'rails', '3.2.2' - -gem 'impressionist', :path => '../' - -platforms :jruby do - gem 'activerecord-jdbcsqlite3-adapter' - gem 'jdbc-sqlite3' - gem 'jruby-openssl' -end - -platforms :ruby, :mswin, :mingw do - gem 'pg' - gem 'sqlite3' -end - -gem 'json' - -# Gems used only for assets and not required -# in production environments by default. -group :assets do - gem 'sass-rails', '~> 3.2.3' - gem 'coffee-rails', '~> 3.2.1' - - # See https://github.com/sstephenson/execjs#readme for more supported runtimes - # gem 'therubyracer' - - gem 'uglifier', '>= 1.0.3' -end - -group :development, :test do - gem 'autotest-notification' - gem 'rspec-rails' - gem 'spork' -end - -group :test do - gem 'capybara' - gem 'simplecov' - gem 'systemu' -end - -gem 'jquery-rails' - -# To use ActiveModel has_secure_password -# gem 'bcrypt-ruby', '~> 3.0.0' - -# To use Jbuilder templates for JSON -# gem 'jbuilder' - -# Use unicorn as the app server -# gem 'unicorn' - -# Deploy with Capistrano -# gem 'capistrano' - -# To use debugger -# gem 'ruby-debug' diff --git a/vendor/impressionist/test_app/README b/vendor/impressionist/test_app/README deleted file mode 100644 index fe7013d52..000000000 --- a/vendor/impressionist/test_app/README +++ /dev/null @@ -1,256 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.find(:all) - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.com/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - | |-- images - | |-- javascripts - | `-- stylesheets - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Contains subdirectories for - images, stylesheets, and javascripts. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/vendor/impressionist/test_app/README.rdoc b/vendor/impressionist/test_app/README.rdoc deleted file mode 100644 index 7c36f2356..000000000 --- a/vendor/impressionist/test_app/README.rdoc +++ /dev/null @@ -1,261 +0,0 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.all - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.org/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - |-- assets - `-- stylesheets - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/assets - Contains subdirectories for images, stylesheets, and JavaScript files. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. diff --git a/vendor/impressionist/test_app/Rakefile b/vendor/impressionist/test_app/Rakefile deleted file mode 100644 index 9946cea61..000000000 --- a/vendor/impressionist/test_app/Rakefile +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env rake -# Add your own tasks in files placed in lib/tasks ending in .rake, -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. - -require File.expand_path('../config/application', __FILE__) - -TestApp::Application.load_tasks diff --git a/vendor/impressionist/test_app/app/assets/images/rails.png b/vendor/impressionist/test_app/app/assets/images/rails.png deleted file mode 100644 index d5edc04e6..000000000 Binary files a/vendor/impressionist/test_app/app/assets/images/rails.png and /dev/null differ diff --git a/vendor/impressionist/test_app/app/assets/javascripts/application.js b/vendor/impressionist/test_app/app/assets/javascripts/application.js deleted file mode 100644 index 9097d830e..000000000 --- a/vendor/impressionist/test_app/app/assets/javascripts/application.js +++ /dev/null @@ -1,15 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// the compiled file. -// -// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD -// GO AFTER THE REQUIRES BELOW. -// -//= require jquery -//= require jquery_ujs -//= require_tree . diff --git a/vendor/impressionist/test_app/app/assets/stylesheets/application.css b/vendor/impressionist/test_app/app/assets/stylesheets/application.css deleted file mode 100644 index 3b5cc6648..000000000 --- a/vendor/impressionist/test_app/app/assets/stylesheets/application.css +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . -*/ diff --git a/vendor/impressionist/test_app/app/controllers/application_controller.rb b/vendor/impressionist/test_app/app/controllers/application_controller.rb deleted file mode 100644 index 1ce61fa1b..000000000 --- a/vendor/impressionist/test_app/app/controllers/application_controller.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ApplicationController < ActionController::Base - protect_from_forgery - before_filter :secondary_before_filter - - def secondary_before_filter - @test_secondary_before_filter = "this is a test" - end -end diff --git a/vendor/impressionist/test_app/app/controllers/articles_controller.rb b/vendor/impressionist/test_app/app/controllers/articles_controller.rb deleted file mode 100644 index 367b460f8..000000000 --- a/vendor/impressionist/test_app/app/controllers/articles_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class ArticlesController < ApplicationController - before_filter :test_current_user_var - - def test_current_user_var - if session[:user_id] - @current_user = User.new - @current_user.id = session[:user_id] - end - end - - def index - impressionist(Article.first,"this is a test article impression") - end - - def show - impressionist(Article.first) - end -end diff --git a/vendor/impressionist/test_app/app/controllers/dummy_controller.rb b/vendor/impressionist/test_app/app/controllers/dummy_controller.rb deleted file mode 100644 index 86664a670..000000000 --- a/vendor/impressionist/test_app/app/controllers/dummy_controller.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This controller imports the impressionist module to make the modules methods available for testing -class DummyController < ActionController::Base - - impressionist - -end diff --git a/vendor/impressionist/test_app/app/controllers/posts_controller.rb b/vendor/impressionist/test_app/app/controllers/posts_controller.rb deleted file mode 100644 index 352627095..000000000 --- a/vendor/impressionist/test_app/app/controllers/posts_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class PostsController < ApplicationController - helper_method :current_user - impressionist - def index - - end - - def show - - end - - def edit - - end - - def current_user - if session[:user_id] - user = User.new - user.id = session[:user_id] - @current_user ||= user - end - end -end diff --git a/vendor/impressionist/test_app/app/controllers/widgets_controller.rb b/vendor/impressionist/test_app/app/controllers/widgets_controller.rb deleted file mode 100644 index b6b99a72a..000000000 --- a/vendor/impressionist/test_app/app/controllers/widgets_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -class WidgetsController < ApplicationController - impressionist :actions=>[:show,:index], :unique => [:controller_name,:action_name,:impressionable_id] - - def show - end - - def index - end - - def new - end -end diff --git a/vendor/impressionist/test_app/app/helpers/application_helper.rb b/vendor/impressionist/test_app/app/helpers/application_helper.rb deleted file mode 100644 index de6be7945..000000000 --- a/vendor/impressionist/test_app/app/helpers/application_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module ApplicationHelper -end diff --git a/vendor/impressionist/test_app/app/mailers/.gitkeep b/vendor/impressionist/test_app/app/mailers/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/models/.gitkeep b/vendor/impressionist/test_app/app/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/models/article.rb b/vendor/impressionist/test_app/app/models/article.rb deleted file mode 100644 index 0a18546d7..000000000 --- a/vendor/impressionist/test_app/app/models/article.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Article < ActiveRecord::Base - is_impressionable -end diff --git a/vendor/impressionist/test_app/app/models/dummy.rb b/vendor/impressionist/test_app/app/models/dummy.rb deleted file mode 100644 index 745c60aa5..000000000 --- a/vendor/impressionist/test_app/app/models/dummy.rb +++ /dev/null @@ -1,7 +0,0 @@ -# We don't really care about this model. It's just being used to test the uniqueness controller -# specs. Nevertheless, we need a model because the counter caching functionality expects it. -# -class Dummy < ActiveRecord::Base - self.abstract_class = true # doesn't need to be backed by an actual table - is_impressionable -end diff --git a/vendor/impressionist/test_app/app/models/post.rb b/vendor/impressionist/test_app/app/models/post.rb deleted file mode 100644 index ccc43dac6..000000000 --- a/vendor/impressionist/test_app/app/models/post.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Post < ActiveRecord::Base - is_impressionable -end diff --git a/vendor/impressionist/test_app/app/models/user.rb b/vendor/impressionist/test_app/app/models/user.rb deleted file mode 100644 index 6da0f6507..000000000 --- a/vendor/impressionist/test_app/app/models/user.rb +++ /dev/null @@ -1,3 +0,0 @@ -class User - attr_accessor :id -end diff --git a/vendor/impressionist/test_app/app/models/widget.rb b/vendor/impressionist/test_app/app/models/widget.rb deleted file mode 100644 index 51bab18d1..000000000 --- a/vendor/impressionist/test_app/app/models/widget.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Widget < ActiveRecord::Base - is_impressionable :counter_cache => true -end diff --git a/vendor/impressionist/test_app/app/views/articles/index.html.erb b/vendor/impressionist/test_app/app/views/articles/index.html.erb deleted file mode 100644 index 97e10f824..000000000 --- a/vendor/impressionist/test_app/app/views/articles/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%=@impressionist_hash==nil%> diff --git a/vendor/impressionist/test_app/app/views/articles/show.html.erb b/vendor/impressionist/test_app/app/views/articles/show.html.erb deleted file mode 100644 index 7dc920f38..000000000 --- a/vendor/impressionist/test_app/app/views/articles/show.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%=link_to "Same Page", article_url(Article.first)%> diff --git a/vendor/impressionist/test_app/app/views/layouts/application.html.erb b/vendor/impressionist/test_app/app/views/layouts/application.html.erb deleted file mode 100644 index d4557d879..000000000 --- a/vendor/impressionist/test_app/app/views/layouts/application.html.erb +++ /dev/null @@ -1,14 +0,0 @@ - - - - TestApp - <%= stylesheet_link_tag "application", :media => "all" %> - <%= javascript_include_tag "application" %> - <%= csrf_meta_tags %> - - - -<%= yield %> - - - diff --git a/vendor/impressionist/test_app/app/views/posts/edit.html.erb b/vendor/impressionist/test_app/app/views/posts/edit.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/views/posts/index.html.erb b/vendor/impressionist/test_app/app/views/posts/index.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/views/posts/show.html.erb b/vendor/impressionist/test_app/app/views/posts/show.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/views/widgets/index.html.erb b/vendor/impressionist/test_app/app/views/widgets/index.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/views/widgets/new.html.erb b/vendor/impressionist/test_app/app/views/widgets/new.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/app/views/widgets/show.html.erb b/vendor/impressionist/test_app/app/views/widgets/show.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/config.ru b/vendor/impressionist/test_app/config.ru deleted file mode 100644 index 86a587d07..000000000 --- a/vendor/impressionist/test_app/config.ru +++ /dev/null @@ -1,4 +0,0 @@ -# This file is used by Rack-based servers to start the application. - -require ::File.expand_path('../config/environment', __FILE__) -run TestApp::Application diff --git a/vendor/impressionist/test_app/config/application.rb b/vendor/impressionist/test_app/config/application.rb deleted file mode 100644 index d0d0095d1..000000000 --- a/vendor/impressionist/test_app/config/application.rb +++ /dev/null @@ -1,59 +0,0 @@ -require File.expand_path('../boot', __FILE__) - -require 'rails/all' - -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end - -module TestApp - class Application < Rails::Application - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Custom directories with classes and modules you want to be autoloadable. - # config.autoload_paths += %W(#{config.root}/extras) - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named. - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Activate observers that should always be running. - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # Configure the default encoding used in templates for Ruby 1.9. - config.encoding = "utf-8" - - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - - # Use SQL instead of Active Record's schema dumper when creating the database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Enforce whitelist mode for mass assignment. - # This will create an empty whitelist of attributes available for mass-assignment for all models - # in your app. As such, your models will need to explicitly whitelist or blacklist accessible - # parameters by using an attr_accessible or attr_protected declaration. - # config.active_record.whitelist_attributes = true - - # Enable the asset pipeline - config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' - end -end diff --git a/vendor/impressionist/test_app/config/boot.rb b/vendor/impressionist/test_app/config/boot.rb deleted file mode 100644 index 4489e5868..000000000 --- a/vendor/impressionist/test_app/config/boot.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'rubygems' - -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) - -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/vendor/impressionist/test_app/config/cucumber.yml b/vendor/impressionist/test_app/config/cucumber.yml deleted file mode 100644 index 6f304dfaf..000000000 --- a/vendor/impressionist/test_app/config/cucumber.yml +++ /dev/null @@ -1,8 +0,0 @@ -<% -rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" -rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" -std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip" -%> -default: --drb <%= std_opts %> features -wip: --drb --tags @wip:3 --wip features -rerun: --drb <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip diff --git a/vendor/impressionist/test_app/config/database.yml b/vendor/impressionist/test_app/config/database.yml deleted file mode 100644 index 45fed06ff..000000000 --- a/vendor/impressionist/test_app/config/database.yml +++ /dev/null @@ -1,30 +0,0 @@ -# SQLite version 3.x -# gem install sqlite3-ruby (not necessary on OS X Leopard) -development: - adapter: sqlite3 - database: db/development.sqlite3 - pool: 5 - timeout: 5000 - -test: &test - adapter: sqlite3 - database: db/test.sqlite3 - pool: 5 - timeout: 5000 - -#pg_test: -# adapter: postgresql -# database: impressionist_test -# username: johnmcaliley -# password: -# host: localhost -# encoding: UTF8 - -production: - adapter: sqlite3 - database: db/production.sqlite3 - pool: 5 - timeout: 5000 - -cucumber: - <<: *test diff --git a/vendor/impressionist/test_app/config/environment.rb b/vendor/impressionist/test_app/config/environment.rb deleted file mode 100644 index f4cc1e44a..000000000 --- a/vendor/impressionist/test_app/config/environment.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Load the rails application -require File.expand_path('../application', __FILE__) - -# Initialize the rails application -TestApp::Application.initialize! diff --git a/vendor/impressionist/test_app/config/environments/development.rb b/vendor/impressionist/test_app/config/environments/development.rb deleted file mode 100644 index b5306b32e..000000000 --- a/vendor/impressionist/test_app/config/environments/development.rb +++ /dev/null @@ -1,37 +0,0 @@ -TestApp::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development - # since you don't have to restart the web server when you make code changes. - config.cache_classes = false - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false - - # Print deprecation notices to the Rails logger - config.active_support.deprecation = :log - - # Only use best-standards-support built into browsers - config.action_dispatch.best_standards_support = :builtin - - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - - # Log the query plan for queries taking more than this (works - # with SQLite, MySQL, and PostgreSQL) - config.active_record.auto_explain_threshold_in_seconds = 0.5 - - # Do not compress assets - config.assets.compress = false - - # Expands the lines which load the assets - config.assets.debug = true -end diff --git a/vendor/impressionist/test_app/config/environments/pg_test.rb b/vendor/impressionist/test_app/config/environments/pg_test.rb deleted file mode 100644 index d17c1aebf..000000000 --- a/vendor/impressionist/test_app/config/environments/pg_test.rb +++ /dev/null @@ -1,35 +0,0 @@ -TestApp::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Log error messages when you accidentally call methods on nil. - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Use SQL instead of Active Record's schema dumper when creating the test database. - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types - # config.active_record.schema_format = :sql - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/vendor/impressionist/test_app/config/environments/test.rb b/vendor/impressionist/test_app/config/environments/test.rb deleted file mode 100644 index 21ec8e47f..000000000 --- a/vendor/impressionist/test_app/config/environments/test.rb +++ /dev/null @@ -1,37 +0,0 @@ -TestApp::Application.configure do - # Settings specified here will take precedence over those in config/application.rb - - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = true - - # Configure static asset server for tests with Cache-Control for performance - config.serve_static_assets = true - config.static_cache_control = "public, max-age=3600" - - # Log error messages when you accidentally call methods on nil - config.whiny_nils = true - - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false - - # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = false - - # Disable request forgery protection in test environment - config.action_controller.allow_forgery_protection = false - - # Tell Action Mailer not to deliver emails to the real world. - # The :test delivery method accumulates sent emails in the - # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test - - # Raise exception on mass assignment protection for Active Record models - config.active_record.mass_assignment_sanitizer = :strict - - # Print deprecation notices to the stderr - config.active_support.deprecation = :stderr -end diff --git a/vendor/impressionist/test_app/config/initializers/backtrace_silencers.rb b/vendor/impressionist/test_app/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf3..000000000 --- a/vendor/impressionist/test_app/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/vendor/impressionist/test_app/config/initializers/impression.rb b/vendor/impressionist/test_app/config/initializers/impression.rb deleted file mode 100644 index fbdee915b..000000000 --- a/vendor/impressionist/test_app/config/initializers/impression.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Use this hook to configure impressionist parameters -Impressionist.setup do |config| - # Define ORM. Could be :active_record (default) and :mongo_mapper - # config.orm = :active_record -end diff --git a/vendor/impressionist/test_app/config/initializers/inflections.rb b/vendor/impressionist/test_app/config/initializers/inflections.rb deleted file mode 100644 index 5d8d9be23..000000000 --- a/vendor/impressionist/test_app/config/initializers/inflections.rb +++ /dev/null @@ -1,15 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' -# inflect.uncountable %w( fish sheep ) -# end -# -# These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections do |inflect| -# inflect.acronym 'RESTful' -# end diff --git a/vendor/impressionist/test_app/config/initializers/mime_types.rb b/vendor/impressionist/test_app/config/initializers/mime_types.rb deleted file mode 100644 index 72aca7e44..000000000 --- a/vendor/impressionist/test_app/config/initializers/mime_types.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Add new mime types for use in respond_to blocks: -# Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone diff --git a/vendor/impressionist/test_app/config/initializers/secret_token.rb b/vendor/impressionist/test_app/config/initializers/secret_token.rb deleted file mode 100644 index 30f90d458..000000000 --- a/vendor/impressionist/test_app/config/initializers/secret_token.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Your secret key for verifying the integrity of signed cookies. -# If you change this key, all old signed cookies will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -TestApp::Application.config.secret_token = '4a6fd2eb397985331d209be32073259ed7c25aef4fafcabb00e483ee548e592322277eb15459bdb257b65f31146eda92684b3e7a98ea1b2dfad9b0d08ab62e10' diff --git a/vendor/impressionist/test_app/config/initializers/session_store.rb b/vendor/impressionist/test_app/config/initializers/session_store.rb deleted file mode 100644 index 8188ba2d6..000000000 --- a/vendor/impressionist/test_app/config/initializers/session_store.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -TestApp::Application.config.session_store :cookie_store, :key => '_test_app_session' - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# TestApp::Application.config.session_store :active_record_store diff --git a/vendor/impressionist/test_app/config/initializers/wrap_parameters.rb b/vendor/impressionist/test_app/config/initializers/wrap_parameters.rb deleted file mode 100644 index da4fb076f..000000000 --- a/vendor/impressionist/test_app/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters :format => [:json] -end - -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end diff --git a/vendor/impressionist/test_app/config/locales/en.yml b/vendor/impressionist/test_app/config/locales/en.yml deleted file mode 100644 index 179c14ca5..000000000 --- a/vendor/impressionist/test_app/config/locales/en.yml +++ /dev/null @@ -1,5 +0,0 @@ -# Sample localization file for English. Add more files in this directory for other locales. -# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. - -en: - hello: "Hello world" diff --git a/vendor/impressionist/test_app/config/routes.rb b/vendor/impressionist/test_app/config/routes.rb deleted file mode 100644 index 7bcb78eae..000000000 --- a/vendor/impressionist/test_app/config/routes.rb +++ /dev/null @@ -1,3 +0,0 @@ -TestApp::Application.routes.draw do - resources :articles, :posts, :widgets -end diff --git a/vendor/impressionist/test_app/db/migrate/20110201153144_create_articles.rb b/vendor/impressionist/test_app/db/migrate/20110201153144_create_articles.rb deleted file mode 100644 index 66f46ef4b..000000000 --- a/vendor/impressionist/test_app/db/migrate/20110201153144_create_articles.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateArticles < ActiveRecord::Migration - def self.up - create_table :articles do |t| - t.string :name - - t.timestamps - end - end - - def self.down - drop_table :articles - end -end diff --git a/vendor/impressionist/test_app/db/migrate/20110210205028_create_posts.rb b/vendor/impressionist/test_app/db/migrate/20110210205028_create_posts.rb deleted file mode 100644 index f018e1ce2..000000000 --- a/vendor/impressionist/test_app/db/migrate/20110210205028_create_posts.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreatePosts < ActiveRecord::Migration - def self.up - create_table :posts do |t| - t.string :name - - t.timestamps - end - end - - def self.down - drop_table :posts - end -end diff --git a/vendor/impressionist/test_app/db/migrate/20111127184039_create_widgets.rb b/vendor/impressionist/test_app/db/migrate/20111127184039_create_widgets.rb deleted file mode 100644 index 5cb1fe2c1..000000000 --- a/vendor/impressionist/test_app/db/migrate/20111127184039_create_widgets.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateWidgets < ActiveRecord::Migration - def self.up - create_table :widgets do |t| - t.string :name - t.integer :impressions_count - - t.timestamps - end - end - - def self.down - drop_table :widgets - end -end - diff --git a/vendor/impressionist/test_app/db/seeds.rb b/vendor/impressionist/test_app/db/seeds.rb deleted file mode 100644 index d34dfa024..000000000 --- a/vendor/impressionist/test_app/db/seeds.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) -# Mayor.create(:name => 'Emanuel', :city => cities.first) diff --git a/vendor/impressionist/test_app/lib/assets/.gitkeep b/vendor/impressionist/test_app/lib/assets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/lib/tasks/.gitkeep b/vendor/impressionist/test_app/lib/tasks/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/lib/tasks/cucumber.rake b/vendor/impressionist/test_app/lib/tasks/cucumber.rake deleted file mode 100644 index 982054e2e..000000000 --- a/vendor/impressionist/test_app/lib/tasks/cucumber.rake +++ /dev/null @@ -1,53 +0,0 @@ -# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. -# It is recommended to regenerate this file in the future when you upgrade to a -# newer version of cucumber-rails. Consider adding your own code to a new file -# instead of editing this one. Cucumber will automatically load all features/**/*.rb -# files. - - -unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks - -vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? - -begin - require 'cucumber/rake/task' - - namespace :cucumber do - Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| - t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. - t.fork = true # You may get faster startup if you set this to false - t.profile = 'default' - end - - Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'wip' - end - - Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| - t.binary = vendored_cucumber_bin - t.fork = true # You may get faster startup if you set this to false - t.profile = 'rerun' - end - - desc 'Run all features' - task :all => [:ok, :wip] - end - desc 'Alias for cucumber:ok' - task :cucumber => 'cucumber:ok' - - task :default => :cucumber - - task :features => :cucumber do - STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" - end -rescue LoadError - desc 'cucumber rake task not available (cucumber not installed)' - task :cucumber do - abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' - end -end - -end diff --git a/vendor/impressionist/test_app/log/.gitkeep b/vendor/impressionist/test_app/log/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/public/404.html b/vendor/impressionist/test_app/public/404.html deleted file mode 100644 index 9a48320a5..000000000 --- a/vendor/impressionist/test_app/public/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The page you were looking for doesn't exist (404) - - - - - -
      -

      The page you were looking for doesn't exist.

      -

      You may have mistyped the address or the page may have moved.

      -
      - - diff --git a/vendor/impressionist/test_app/public/422.html b/vendor/impressionist/test_app/public/422.html deleted file mode 100644 index 83660ab18..000000000 --- a/vendor/impressionist/test_app/public/422.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - The change you wanted was rejected (422) - - - - - -
      -

      The change you wanted was rejected.

      -

      Maybe you tried to change something you didn't have access to.

      -
      - - diff --git a/vendor/impressionist/test_app/public/500.html b/vendor/impressionist/test_app/public/500.html deleted file mode 100644 index f3648a0db..000000000 --- a/vendor/impressionist/test_app/public/500.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - We're sorry, but something went wrong (500) - - - - - -
      -

      We're sorry, but something went wrong.

      -
      - - diff --git a/vendor/impressionist/test_app/public/favicon.ico b/vendor/impressionist/test_app/public/favicon.ico deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/public/images/rails.png b/vendor/impressionist/test_app/public/images/rails.png deleted file mode 100644 index d5edc04e6..000000000 Binary files a/vendor/impressionist/test_app/public/images/rails.png and /dev/null differ diff --git a/vendor/impressionist/test_app/public/index.html b/vendor/impressionist/test_app/public/index.html deleted file mode 100644 index a1d50995c..000000000 --- a/vendor/impressionist/test_app/public/index.html +++ /dev/null @@ -1,241 +0,0 @@ - - - - Ruby on Rails: Welcome aboard - - - - -
      - - -
      - - - - -
      -

      Getting started

      -

      Here’s how to get rolling:

      - -
        -
      1. -

        Use rails generate to create your models and controllers

        -

        To see all available options, run it without parameters.

        -
      2. - -
      3. -

        Set up a default route and remove public/index.html

        -

        Routes are set up in config/routes.rb.

        -
      4. - -
      5. -

        Create your database

        -

        Run rake db:create to create your database. If you're not using SQLite (the default), edit config/database.yml with your username and password.

        -
      6. -
      -
      -
      - - -
      - - diff --git a/vendor/impressionist/test_app/public/javascripts/application.js b/vendor/impressionist/test_app/public/javascripts/application.js deleted file mode 100644 index fe4577696..000000000 --- a/vendor/impressionist/test_app/public/javascripts/application.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place your application-specific JavaScript functions and classes here -// This file is automatically included by javascript_include_tag :defaults diff --git a/vendor/impressionist/test_app/public/javascripts/controls.js b/vendor/impressionist/test_app/public/javascripts/controls.js deleted file mode 100644 index 75d1bed7c..000000000 --- a/vendor/impressionist/test_app/public/javascripts/controls.js +++ /dev/null @@ -1,965 +0,0 @@ -// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan) -// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com) -// Contributors: -// Richard Livsey -// Rahul Bhargava -// Rob Wills -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// Autocompleter.Base handles all the autocompletion functionality -// that's independent of the data source for autocompletion. This -// includes drawing the autocompletion menu, observing keyboard -// and mouse events, and similar. -// -// Specific autocompleters need to provide, at the very least, -// a getUpdatedChoices function that will be invoked every time -// the text inside the monitored textbox changes. This method -// should get the text for which to provide autocompletion by -// invoking this.getToken(), NOT by directly accessing -// this.element.value. This is to allow incremental tokenized -// autocompletion. Specific auto-completion logic (AJAX, etc) -// belongs in getUpdatedChoices. -// -// Tokenized incremental autocompletion is enabled automatically -// when an autocompleter is instantiated with the 'tokens' option -// in the options parameter, e.g.: -// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' }); -// will incrementally autocomplete with a comma as the token. -// Additionally, ',' in the above example can be replaced with -// a token array, e.g. { tokens: [',', '\n'] } which -// enables autocompletion on multiple tokens. This is most -// useful when one of the tokens is \n (a newline), as it -// allows smart autocompletion after linebreaks. - -if(typeof Effect == 'undefined') - throw("controls.js requires including script.aculo.us' effects.js library"); - -var Autocompleter = { }; -Autocompleter.Base = Class.create({ - baseInitialize: function(element, update, options) { - element = $(element); - this.element = element; - this.update = $(update); - this.hasFocus = false; - this.changed = false; - this.active = false; - this.index = 0; - this.entryCount = 0; - this.oldElementValue = this.element.value; - - if(this.setOptions) - this.setOptions(options); - else - this.options = options || { }; - - this.options.paramName = this.options.paramName || this.element.name; - this.options.tokens = this.options.tokens || []; - this.options.frequency = this.options.frequency || 0.4; - this.options.minChars = this.options.minChars || 1; - this.options.onShow = this.options.onShow || - function(element, update){ - if(!update.style.position || update.style.position=='absolute') { - update.style.position = 'absolute'; - Position.clone(element, update, { - setHeight: false, - offsetTop: element.offsetHeight - }); - } - Effect.Appear(update,{duration:0.15}); - }; - this.options.onHide = this.options.onHide || - function(element, update){ new Effect.Fade(update,{duration:0.15}) }; - - if(typeof(this.options.tokens) == 'string') - this.options.tokens = new Array(this.options.tokens); - // Force carriage returns as token delimiters anyway - if (!this.options.tokens.include('\n')) - this.options.tokens.push('\n'); - - this.observer = null; - - this.element.setAttribute('autocomplete','off'); - - Element.hide(this.update); - - Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); - Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this)); - }, - - show: function() { - if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); - if(!this.iefix && - (Prototype.Browser.IE) && - (Element.getStyle(this.update, 'position')=='absolute')) { - new Insertion.After(this.update, - ''); - this.iefix = $(this.update.id+'_iefix'); - } - if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50); - }, - - fixIEOverlapping: function() { - Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)}); - this.iefix.style.zIndex = 1; - this.update.style.zIndex = 2; - Element.show(this.iefix); - }, - - hide: function() { - this.stopIndicator(); - if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update); - if(this.iefix) Element.hide(this.iefix); - }, - - startIndicator: function() { - if(this.options.indicator) Element.show(this.options.indicator); - }, - - stopIndicator: function() { - if(this.options.indicator) Element.hide(this.options.indicator); - }, - - onKeyPress: function(event) { - if(this.active) - switch(event.keyCode) { - case Event.KEY_TAB: - case Event.KEY_RETURN: - this.selectEntry(); - Event.stop(event); - case Event.KEY_ESC: - this.hide(); - this.active = false; - Event.stop(event); - return; - case Event.KEY_LEFT: - case Event.KEY_RIGHT: - return; - case Event.KEY_UP: - this.markPrevious(); - this.render(); - Event.stop(event); - return; - case Event.KEY_DOWN: - this.markNext(); - this.render(); - Event.stop(event); - return; - } - else - if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || - (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; - - this.changed = true; - this.hasFocus = true; - - if(this.observer) clearTimeout(this.observer); - this.observer = - setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000); - }, - - activate: function() { - this.changed = false; - this.hasFocus = true; - this.getUpdatedChoices(); - }, - - onHover: function(event) { - var element = Event.findElement(event, 'LI'); - if(this.index != element.autocompleteIndex) - { - this.index = element.autocompleteIndex; - this.render(); - } - Event.stop(event); - }, - - onClick: function(event) { - var element = Event.findElement(event, 'LI'); - this.index = element.autocompleteIndex; - this.selectEntry(); - this.hide(); - }, - - onBlur: function(event) { - // needed to make click events working - setTimeout(this.hide.bind(this), 250); - this.hasFocus = false; - this.active = false; - }, - - render: function() { - if(this.entryCount > 0) { - for (var i = 0; i < this.entryCount; i++) - this.index==i ? - Element.addClassName(this.getEntry(i),"selected") : - Element.removeClassName(this.getEntry(i),"selected"); - if(this.hasFocus) { - this.show(); - this.active = true; - } - } else { - this.active = false; - this.hide(); - } - }, - - markPrevious: function() { - if(this.index > 0) this.index--; - else this.index = this.entryCount-1; - this.getEntry(this.index).scrollIntoView(true); - }, - - markNext: function() { - if(this.index < this.entryCount-1) this.index++; - else this.index = 0; - this.getEntry(this.index).scrollIntoView(false); - }, - - getEntry: function(index) { - return this.update.firstChild.childNodes[index]; - }, - - getCurrentEntry: function() { - return this.getEntry(this.index); - }, - - selectEntry: function() { - this.active = false; - this.updateElement(this.getCurrentEntry()); - }, - - updateElement: function(selectedElement) { - if (this.options.updateElement) { - this.options.updateElement(selectedElement); - return; - } - var value = ''; - if (this.options.select) { - var nodes = $(selectedElement).select('.' + this.options.select) || []; - if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select); - } else - value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal'); - - var bounds = this.getTokenBounds(); - if (bounds[0] != -1) { - var newValue = this.element.value.substr(0, bounds[0]); - var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/); - if (whitespace) - newValue += whitespace[0]; - this.element.value = newValue + value + this.element.value.substr(bounds[1]); - } else { - this.element.value = value; - } - this.oldElementValue = this.element.value; - this.element.focus(); - - if (this.options.afterUpdateElement) - this.options.afterUpdateElement(this.element, selectedElement); - }, - - updateChoices: function(choices) { - if(!this.changed && this.hasFocus) { - this.update.innerHTML = choices; - Element.cleanWhitespace(this.update); - Element.cleanWhitespace(this.update.down()); - - if(this.update.firstChild && this.update.down().childNodes) { - this.entryCount = - this.update.down().childNodes.length; - for (var i = 0; i < this.entryCount; i++) { - var entry = this.getEntry(i); - entry.autocompleteIndex = i; - this.addObservers(entry); - } - } else { - this.entryCount = 0; - } - - this.stopIndicator(); - this.index = 0; - - if(this.entryCount==1 && this.options.autoSelect) { - this.selectEntry(); - this.hide(); - } else { - this.render(); - } - } - }, - - addObservers: function(element) { - Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this)); - Event.observe(element, "click", this.onClick.bindAsEventListener(this)); - }, - - onObserverEvent: function() { - this.changed = false; - this.tokenBounds = null; - if(this.getToken().length>=this.options.minChars) { - this.getUpdatedChoices(); - } else { - this.active = false; - this.hide(); - } - this.oldElementValue = this.element.value; - }, - - getToken: function() { - var bounds = this.getTokenBounds(); - return this.element.value.substring(bounds[0], bounds[1]).strip(); - }, - - getTokenBounds: function() { - if (null != this.tokenBounds) return this.tokenBounds; - var value = this.element.value; - if (value.strip().empty()) return [-1, 0]; - var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue); - var offset = (diff == this.oldElementValue.length ? 1 : 0); - var prevTokenPos = -1, nextTokenPos = value.length; - var tp; - for (var index = 0, l = this.options.tokens.length; index < l; ++index) { - tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1); - if (tp > prevTokenPos) prevTokenPos = tp; - tp = value.indexOf(this.options.tokens[index], diff + offset); - if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp; - } - return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]); - } -}); - -Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) { - var boundary = Math.min(newS.length, oldS.length); - for (var index = 0; index < boundary; ++index) - if (newS[index] != oldS[index]) - return index; - return boundary; -}; - -Ajax.Autocompleter = Class.create(Autocompleter.Base, { - initialize: function(element, update, url, options) { - this.baseInitialize(element, update, options); - this.options.asynchronous = true; - this.options.onComplete = this.onComplete.bind(this); - this.options.defaultParams = this.options.parameters || null; - this.url = url; - }, - - getUpdatedChoices: function() { - this.startIndicator(); - - var entry = encodeURIComponent(this.options.paramName) + '=' + - encodeURIComponent(this.getToken()); - - this.options.parameters = this.options.callback ? - this.options.callback(this.element, entry) : entry; - - if(this.options.defaultParams) - this.options.parameters += '&' + this.options.defaultParams; - - new Ajax.Request(this.url, this.options); - }, - - onComplete: function(request) { - this.updateChoices(request.responseText); - } -}); - -// The local array autocompleter. Used when you'd prefer to -// inject an array of autocompletion options into the page, rather -// than sending out Ajax queries, which can be quite slow sometimes. -// -// The constructor takes four parameters. The first two are, as usual, -// the id of the monitored textbox, and id of the autocompletion menu. -// The third is the array you want to autocomplete from, and the fourth -// is the options block. -// -// Extra local autocompletion options: -// - choices - How many autocompletion choices to offer -// -// - partialSearch - If false, the autocompleter will match entered -// text only at the beginning of strings in the -// autocomplete array. Defaults to true, which will -// match text at the beginning of any *word* in the -// strings in the autocomplete array. If you want to -// search anywhere in the string, additionally set -// the option fullSearch to true (default: off). -// -// - fullSsearch - Search anywhere in autocomplete array strings. -// -// - partialChars - How many characters to enter before triggering -// a partial match (unlike minChars, which defines -// how many characters are required to do any match -// at all). Defaults to 2. -// -// - ignoreCase - Whether to ignore case when autocompleting. -// Defaults to true. -// -// It's possible to pass in a custom function as the 'selector' -// option, if you prefer to write your own autocompletion logic. -// In that case, the other options above will not apply unless -// you support them. - -Autocompleter.Local = Class.create(Autocompleter.Base, { - initialize: function(element, update, array, options) { - this.baseInitialize(element, update, options); - this.options.array = array; - }, - - getUpdatedChoices: function() { - this.updateChoices(this.options.selector(this)); - }, - - setOptions: function(options) { - this.options = Object.extend({ - choices: 10, - partialSearch: true, - partialChars: 2, - ignoreCase: true, - fullSearch: false, - selector: function(instance) { - var ret = []; // Beginning matches - var partial = []; // Inside matches - var entry = instance.getToken(); - var count = 0; - - for (var i = 0; i < instance.options.array.length && - ret.length < instance.options.choices ; i++) { - - var elem = instance.options.array[i]; - var foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase()) : - elem.indexOf(entry); - - while (foundPos != -1) { - if (foundPos == 0 && elem.length != entry.length) { - ret.push("
    • " + elem.substr(0, entry.length) + "" + - elem.substr(entry.length) + "
    • "); - break; - } else if (entry.length >= instance.options.partialChars && - instance.options.partialSearch && foundPos != -1) { - if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) { - partial.push("
    • " + elem.substr(0, foundPos) + "" + - elem.substr(foundPos, entry.length) + "" + elem.substr( - foundPos + entry.length) + "
    • "); - break; - } - } - - foundPos = instance.options.ignoreCase ? - elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : - elem.indexOf(entry, foundPos + 1); - - } - } - if (partial.length) - ret = ret.concat(partial.slice(0, instance.options.choices - ret.length)); - return "
        " + ret.join('') + "
      "; - } - }, options || { }); - } -}); - -// AJAX in-place editor and collection editor -// Full rewrite by Christophe Porteneuve (April 2007). - -// Use this if you notice weird scrolling problems on some browsers, -// the DOM might be a bit confused when this gets called so do this -// waits 1 ms (with setTimeout) until it does the activation -Field.scrollFreeActivate = function(field) { - setTimeout(function() { - Field.activate(field); - }, 1); -}; - -Ajax.InPlaceEditor = Class.create({ - initialize: function(element, url, options) { - this.url = url; - this.element = element = $(element); - this.prepareOptions(); - this._controls = { }; - arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!! - Object.extend(this.options, options || { }); - if (!this.options.formId && this.element.id) { - this.options.formId = this.element.id + '-inplaceeditor'; - if ($(this.options.formId)) - this.options.formId = ''; - } - if (this.options.externalControl) - this.options.externalControl = $(this.options.externalControl); - if (!this.options.externalControl) - this.options.externalControlOnly = false; - this._originalBackground = this.element.getStyle('background-color') || 'transparent'; - this.element.title = this.options.clickToEditText; - this._boundCancelHandler = this.handleFormCancellation.bind(this); - this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this); - this._boundFailureHandler = this.handleAJAXFailure.bind(this); - this._boundSubmitHandler = this.handleFormSubmission.bind(this); - this._boundWrapperHandler = this.wrapUp.bind(this); - this.registerListeners(); - }, - checkForEscapeOrReturn: function(e) { - if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return; - if (Event.KEY_ESC == e.keyCode) - this.handleFormCancellation(e); - else if (Event.KEY_RETURN == e.keyCode) - this.handleFormSubmission(e); - }, - createControl: function(mode, handler, extraClasses) { - var control = this.options[mode + 'Control']; - var text = this.options[mode + 'Text']; - if ('button' == control) { - var btn = document.createElement('input'); - btn.type = 'submit'; - btn.value = text; - btn.className = 'editor_' + mode + '_button'; - if ('cancel' == mode) - btn.onclick = this._boundCancelHandler; - this._form.appendChild(btn); - this._controls[mode] = btn; - } else if ('link' == control) { - var link = document.createElement('a'); - link.href = '#'; - link.appendChild(document.createTextNode(text)); - link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler; - link.className = 'editor_' + mode + '_link'; - if (extraClasses) - link.className += ' ' + extraClasses; - this._form.appendChild(link); - this._controls[mode] = link; - } - }, - createEditField: function() { - var text = (this.options.loadTextURL ? this.options.loadingText : this.getText()); - var fld; - if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) { - fld = document.createElement('input'); - fld.type = 'text'; - var size = this.options.size || this.options.cols || 0; - if (0 < size) fld.size = size; - } else { - fld = document.createElement('textarea'); - fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows); - fld.cols = this.options.cols || 40; - } - fld.name = this.options.paramName; - fld.value = text; // No HTML breaks conversion anymore - fld.className = 'editor_field'; - if (this.options.submitOnBlur) - fld.onblur = this._boundSubmitHandler; - this._controls.editor = fld; - if (this.options.loadTextURL) - this.loadExternalText(); - this._form.appendChild(this._controls.editor); - }, - createForm: function() { - var ipe = this; - function addText(mode, condition) { - var text = ipe.options['text' + mode + 'Controls']; - if (!text || condition === false) return; - ipe._form.appendChild(document.createTextNode(text)); - }; - this._form = $(document.createElement('form')); - this._form.id = this.options.formId; - this._form.addClassName(this.options.formClassName); - this._form.onsubmit = this._boundSubmitHandler; - this.createEditField(); - if ('textarea' == this._controls.editor.tagName.toLowerCase()) - this._form.appendChild(document.createElement('br')); - if (this.options.onFormCustomization) - this.options.onFormCustomization(this, this._form); - addText('Before', this.options.okControl || this.options.cancelControl); - this.createControl('ok', this._boundSubmitHandler); - addText('Between', this.options.okControl && this.options.cancelControl); - this.createControl('cancel', this._boundCancelHandler, 'editor_cancel'); - addText('After', this.options.okControl || this.options.cancelControl); - }, - destroy: function() { - if (this._oldInnerHTML) - this.element.innerHTML = this._oldInnerHTML; - this.leaveEditMode(); - this.unregisterListeners(); - }, - enterEditMode: function(e) { - if (this._saving || this._editing) return; - this._editing = true; - this.triggerCallback('onEnterEditMode'); - if (this.options.externalControl) - this.options.externalControl.hide(); - this.element.hide(); - this.createForm(); - this.element.parentNode.insertBefore(this._form, this.element); - if (!this.options.loadTextURL) - this.postProcessEditField(); - if (e) Event.stop(e); - }, - enterHover: function(e) { - if (this.options.hoverClassName) - this.element.addClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onEnterHover'); - }, - getText: function() { - return this.element.innerHTML.unescapeHTML(); - }, - handleAJAXFailure: function(transport) { - this.triggerCallback('onFailure', transport); - if (this._oldInnerHTML) { - this.element.innerHTML = this._oldInnerHTML; - this._oldInnerHTML = null; - } - }, - handleFormCancellation: function(e) { - this.wrapUp(); - if (e) Event.stop(e); - }, - handleFormSubmission: function(e) { - var form = this._form; - var value = $F(this._controls.editor); - this.prepareSubmission(); - var params = this.options.callback(form, value) || ''; - if (Object.isString(params)) - params = params.toQueryParams(); - params.editorId = this.element.id; - if (this.options.htmlResponse) { - var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Updater({ success: this.element }, this.url, options); - } else { - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: params, - onComplete: this._boundWrapperHandler, - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.url, options); - } - if (e) Event.stop(e); - }, - leaveEditMode: function() { - this.element.removeClassName(this.options.savingClassName); - this.removeForm(); - this.leaveHover(); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - if (this.options.externalControl) - this.options.externalControl.show(); - this._saving = false; - this._editing = false; - this._oldInnerHTML = null; - this.triggerCallback('onLeaveEditMode'); - }, - leaveHover: function(e) { - if (this.options.hoverClassName) - this.element.removeClassName(this.options.hoverClassName); - if (this._saving) return; - this.triggerCallback('onLeaveHover'); - }, - loadExternalText: function() { - this._form.addClassName(this.options.loadingClassName); - this._controls.editor.disabled = true; - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._form.removeClassName(this.options.loadingClassName); - var text = transport.responseText; - if (this.options.stripLoadedTextTags) - text = text.stripTags(); - this._controls.editor.value = text; - this._controls.editor.disabled = false; - this.postProcessEditField(); - }.bind(this), - onFailure: this._boundFailureHandler - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - postProcessEditField: function() { - var fpc = this.options.fieldPostCreation; - if (fpc) - $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate'](); - }, - prepareOptions: function() { - this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions); - Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks); - [this._extraDefaultOptions].flatten().compact().each(function(defs) { - Object.extend(this.options, defs); - }.bind(this)); - }, - prepareSubmission: function() { - this._saving = true; - this.removeForm(); - this.leaveHover(); - this.showSaving(); - }, - registerListeners: function() { - this._listeners = { }; - var listener; - $H(Ajax.InPlaceEditor.Listeners).each(function(pair) { - listener = this[pair.value].bind(this); - this._listeners[pair.key] = listener; - if (!this.options.externalControlOnly) - this.element.observe(pair.key, listener); - if (this.options.externalControl) - this.options.externalControl.observe(pair.key, listener); - }.bind(this)); - }, - removeForm: function() { - if (!this._form) return; - this._form.remove(); - this._form = null; - this._controls = { }; - }, - showSaving: function() { - this._oldInnerHTML = this.element.innerHTML; - this.element.innerHTML = this.options.savingText; - this.element.addClassName(this.options.savingClassName); - this.element.style.backgroundColor = this._originalBackground; - this.element.show(); - }, - triggerCallback: function(cbName, arg) { - if ('function' == typeof this.options[cbName]) { - this.options[cbName](this, arg); - } - }, - unregisterListeners: function() { - $H(this._listeners).each(function(pair) { - if (!this.options.externalControlOnly) - this.element.stopObserving(pair.key, pair.value); - if (this.options.externalControl) - this.options.externalControl.stopObserving(pair.key, pair.value); - }.bind(this)); - }, - wrapUp: function(transport) { - this.leaveEditMode(); - // Can't use triggerCallback due to backward compatibility: requires - // binding + direct element - this._boundComplete(transport, this.element); - } -}); - -Object.extend(Ajax.InPlaceEditor.prototype, { - dispose: Ajax.InPlaceEditor.prototype.destroy -}); - -Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, { - initialize: function($super, element, url, options) { - this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions; - $super(element, url, options); - }, - - createEditField: function() { - var list = document.createElement('select'); - list.name = this.options.paramName; - list.size = 1; - this._controls.editor = list; - this._collection = this.options.collection || []; - if (this.options.loadCollectionURL) - this.loadCollection(); - else - this.checkForExternalText(); - this._form.appendChild(this._controls.editor); - }, - - loadCollection: function() { - this._form.addClassName(this.options.loadingClassName); - this.showLoadingText(this.options.loadingCollectionText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - var js = transport.responseText.strip(); - if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check - throw('Server returned an invalid collection representation.'); - this._collection = eval(js); - this.checkForExternalText(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadCollectionURL, options); - }, - - showLoadingText: function(text) { - this._controls.editor.disabled = true; - var tempOption = this._controls.editor.firstChild; - if (!tempOption) { - tempOption = document.createElement('option'); - tempOption.value = ''; - this._controls.editor.appendChild(tempOption); - tempOption.selected = true; - } - tempOption.update((text || '').stripScripts().stripTags()); - }, - - checkForExternalText: function() { - this._text = this.getText(); - if (this.options.loadTextURL) - this.loadExternalText(); - else - this.buildOptionList(); - }, - - loadExternalText: function() { - this.showLoadingText(this.options.loadingText); - var options = Object.extend({ method: 'get' }, this.options.ajaxOptions); - Object.extend(options, { - parameters: 'editorId=' + encodeURIComponent(this.element.id), - onComplete: Prototype.emptyFunction, - onSuccess: function(transport) { - this._text = transport.responseText.strip(); - this.buildOptionList(); - }.bind(this), - onFailure: this.onFailure - }); - new Ajax.Request(this.options.loadTextURL, options); - }, - - buildOptionList: function() { - this._form.removeClassName(this.options.loadingClassName); - this._collection = this._collection.map(function(entry) { - return 2 === entry.length ? entry : [entry, entry].flatten(); - }); - var marker = ('value' in this.options) ? this.options.value : this._text; - var textFound = this._collection.any(function(entry) { - return entry[0] == marker; - }.bind(this)); - this._controls.editor.update(''); - var option; - this._collection.each(function(entry, index) { - option = document.createElement('option'); - option.value = entry[0]; - option.selected = textFound ? entry[0] == marker : 0 == index; - option.appendChild(document.createTextNode(entry[1])); - this._controls.editor.appendChild(option); - }.bind(this)); - this._controls.editor.disabled = false; - Field.scrollFreeActivate(this._controls.editor); - } -}); - -//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! **** -//**** This only exists for a while, in order to let **** -//**** users adapt to the new API. Read up on the new **** -//**** API and convert your code to it ASAP! **** - -Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) { - if (!options) return; - function fallback(name, expr) { - if (name in options || expr === undefined) return; - options[name] = expr; - }; - fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' : - options.cancelLink == options.cancelButton == false ? false : undefined))); - fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' : - options.okLink == options.okButton == false ? false : undefined))); - fallback('highlightColor', options.highlightcolor); - fallback('highlightEndColor', options.highlightendcolor); -}; - -Object.extend(Ajax.InPlaceEditor, { - DefaultOptions: { - ajaxOptions: { }, - autoRows: 3, // Use when multi-line w/ rows == 1 - cancelControl: 'link', // 'link'|'button'|false - cancelText: 'cancel', - clickToEditText: 'Click to edit', - externalControl: null, // id|elt - externalControlOnly: false, - fieldPostCreation: 'activate', // 'activate'|'focus'|false - formClassName: 'inplaceeditor-form', - formId: null, // id|elt - highlightColor: '#ffff99', - highlightEndColor: '#ffffff', - hoverClassName: '', - htmlResponse: true, - loadingClassName: 'inplaceeditor-loading', - loadingText: 'Loading...', - okControl: 'button', // 'link'|'button'|false - okText: 'ok', - paramName: 'value', - rows: 1, // If 1 and multi-line, uses autoRows - savingClassName: 'inplaceeditor-saving', - savingText: 'Saving...', - size: 0, - stripLoadedTextTags: false, - submitOnBlur: false, - textAfterControls: '', - textBeforeControls: '', - textBetweenControls: '' - }, - DefaultCallbacks: { - callback: function(form) { - return Form.serialize(form); - }, - onComplete: function(transport, element) { - // For backward compatibility, this one is bound to the IPE, and passes - // the element directly. It was too often customized, so we don't break it. - new Effect.Highlight(element, { - startcolor: this.options.highlightColor, keepBackgroundImage: true }); - }, - onEnterEditMode: null, - onEnterHover: function(ipe) { - ipe.element.style.backgroundColor = ipe.options.highlightColor; - if (ipe._effect) - ipe._effect.cancel(); - }, - onFailure: function(transport, ipe) { - alert('Error communication with the server: ' + transport.responseText.stripTags()); - }, - onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls. - onLeaveEditMode: null, - onLeaveHover: function(ipe) { - ipe._effect = new Effect.Highlight(ipe.element, { - startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor, - restorecolor: ipe._originalBackground, keepBackgroundImage: true - }); - } - }, - Listeners: { - click: 'enterEditMode', - keydown: 'checkForEscapeOrReturn', - mouseover: 'enterHover', - mouseout: 'leaveHover' - } -}); - -Ajax.InPlaceCollectionEditor.DefaultOptions = { - loadingCollectionText: 'Loading options...' -}; - -// Delayed observer, like Form.Element.Observer, -// but waits for delay after last key input -// Ideal for live-search fields - -Form.Element.DelayedObserver = Class.create({ - initialize: function(element, delay, callback) { - this.delay = delay || 0.5; - this.element = $(element); - this.callback = callback; - this.timer = null; - this.lastValue = $F(this.element); - Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this)); - }, - delayedListener: function(event) { - if(this.lastValue == $F(this.element)) return; - if(this.timer) clearTimeout(this.timer); - this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000); - this.lastValue = $F(this.element); - }, - onTimerEvent: function() { - this.timer = null; - this.callback(this.element, $F(this.element)); - } -}); diff --git a/vendor/impressionist/test_app/public/javascripts/dragdrop.js b/vendor/impressionist/test_app/public/javascripts/dragdrop.js deleted file mode 100644 index 579715ecc..000000000 --- a/vendor/impressionist/test_app/public/javascripts/dragdrop.js +++ /dev/null @@ -1,974 +0,0 @@ -// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -if(Object.isUndefined(Effect)) - throw("dragdrop.js requires including script.aculo.us' effects.js library"); - -var Droppables = { - drops: [], - - remove: function(element) { - this.drops = this.drops.reject(function(d) { return d.element==$(element) }); - }, - - add: function(element) { - element = $(element); - var options = Object.extend({ - greedy: true, - hoverclass: null, - tree: false - }, arguments[1] || { }); - - // cache containers - if(options.containment) { - options._containers = []; - var containment = options.containment; - if(Object.isArray(containment)) { - containment.each( function(c) { options._containers.push($(c)) }); - } else { - options._containers.push($(containment)); - } - } - - if(options.accept) options.accept = [options.accept].flatten(); - - Element.makePositioned(element); // fix IE - options.element = element; - - this.drops.push(options); - }, - - findDeepestChild: function(drops) { - deepest = drops[0]; - - for (i = 1; i < drops.length; ++i) - if (Element.isParent(drops[i].element, deepest.element)) - deepest = drops[i]; - - return deepest; - }, - - isContained: function(element, drop) { - var containmentNode; - if(drop.tree) { - containmentNode = element.treeNode; - } else { - containmentNode = element.parentNode; - } - return drop._containers.detect(function(c) { return containmentNode == c }); - }, - - isAffected: function(point, element, drop) { - return ( - (drop.element!=element) && - ((!drop._containers) || - this.isContained(element, drop)) && - ((!drop.accept) || - (Element.classNames(element).detect( - function(v) { return drop.accept.include(v) } ) )) && - Position.within(drop.element, point[0], point[1]) ); - }, - - deactivate: function(drop) { - if(drop.hoverclass) - Element.removeClassName(drop.element, drop.hoverclass); - this.last_active = null; - }, - - activate: function(drop) { - if(drop.hoverclass) - Element.addClassName(drop.element, drop.hoverclass); - this.last_active = drop; - }, - - show: function(point, element) { - if(!this.drops.length) return; - var drop, affected = []; - - this.drops.each( function(drop) { - if(Droppables.isAffected(point, element, drop)) - affected.push(drop); - }); - - if(affected.length>0) - drop = Droppables.findDeepestChild(affected); - - if(this.last_active && this.last_active != drop) this.deactivate(this.last_active); - if (drop) { - Position.within(drop.element, point[0], point[1]); - if(drop.onHover) - drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element)); - - if (drop != this.last_active) Droppables.activate(drop); - } - }, - - fire: function(event, element) { - if(!this.last_active) return; - Position.prepare(); - - if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active)) - if (this.last_active.onDrop) { - this.last_active.onDrop(element, this.last_active.element, event); - return true; - } - }, - - reset: function() { - if(this.last_active) - this.deactivate(this.last_active); - } -}; - -var Draggables = { - drags: [], - observers: [], - - register: function(draggable) { - if(this.drags.length == 0) { - this.eventMouseUp = this.endDrag.bindAsEventListener(this); - this.eventMouseMove = this.updateDrag.bindAsEventListener(this); - this.eventKeypress = this.keyPress.bindAsEventListener(this); - - Event.observe(document, "mouseup", this.eventMouseUp); - Event.observe(document, "mousemove", this.eventMouseMove); - Event.observe(document, "keypress", this.eventKeypress); - } - this.drags.push(draggable); - }, - - unregister: function(draggable) { - this.drags = this.drags.reject(function(d) { return d==draggable }); - if(this.drags.length == 0) { - Event.stopObserving(document, "mouseup", this.eventMouseUp); - Event.stopObserving(document, "mousemove", this.eventMouseMove); - Event.stopObserving(document, "keypress", this.eventKeypress); - } - }, - - activate: function(draggable) { - if(draggable.options.delay) { - this._timeout = setTimeout(function() { - Draggables._timeout = null; - window.focus(); - Draggables.activeDraggable = draggable; - }.bind(this), draggable.options.delay); - } else { - window.focus(); // allows keypress events if window isn't currently focused, fails for Safari - this.activeDraggable = draggable; - } - }, - - deactivate: function() { - this.activeDraggable = null; - }, - - updateDrag: function(event) { - if(!this.activeDraggable) return; - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - // Mozilla-based browsers fire successive mousemove events with - // the same coordinates, prevent needless redrawing (moz bug?) - if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return; - this._lastPointer = pointer; - - this.activeDraggable.updateDrag(event, pointer); - }, - - endDrag: function(event) { - if(this._timeout) { - clearTimeout(this._timeout); - this._timeout = null; - } - if(!this.activeDraggable) return; - this._lastPointer = null; - this.activeDraggable.endDrag(event); - this.activeDraggable = null; - }, - - keyPress: function(event) { - if(this.activeDraggable) - this.activeDraggable.keyPress(event); - }, - - addObserver: function(observer) { - this.observers.push(observer); - this._cacheObserverCallbacks(); - }, - - removeObserver: function(element) { // element instead of observer fixes mem leaks - this.observers = this.observers.reject( function(o) { return o.element==element }); - this._cacheObserverCallbacks(); - }, - - notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag' - if(this[eventName+'Count'] > 0) - this.observers.each( function(o) { - if(o[eventName]) o[eventName](eventName, draggable, event); - }); - if(draggable.options[eventName]) draggable.options[eventName](draggable, event); - }, - - _cacheObserverCallbacks: function() { - ['onStart','onEnd','onDrag'].each( function(eventName) { - Draggables[eventName+'Count'] = Draggables.observers.select( - function(o) { return o[eventName]; } - ).length; - }); - } -}; - -/*--------------------------------------------------------------------------*/ - -var Draggable = Class.create({ - initialize: function(element) { - var defaults = { - handle: false, - reverteffect: function(element, top_offset, left_offset) { - var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02; - new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur, - queue: {scope:'_draggable', position:'end'} - }); - }, - endeffect: function(element) { - var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0; - new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, - queue: {scope:'_draggable', position:'end'}, - afterFinish: function(){ - Draggable._dragging[element] = false - } - }); - }, - zindex: 1000, - revert: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] } - delay: 0 - }; - - if(!arguments[1] || Object.isUndefined(arguments[1].endeffect)) - Object.extend(defaults, { - starteffect: function(element) { - element._opacity = Element.getOpacity(element); - Draggable._dragging[element] = true; - new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); - } - }); - - var options = Object.extend(defaults, arguments[1] || { }); - - this.element = $(element); - - if(options.handle && Object.isString(options.handle)) - this.handle = this.element.down('.'+options.handle, 0); - - if(!this.handle) this.handle = $(options.handle); - if(!this.handle) this.handle = this.element; - - if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) { - options.scroll = $(options.scroll); - this._isScrollChild = Element.childOf(this.element, options.scroll); - } - - Element.makePositioned(this.element); // fix IE - - this.options = options; - this.dragging = false; - - this.eventMouseDown = this.initDrag.bindAsEventListener(this); - Event.observe(this.handle, "mousedown", this.eventMouseDown); - - Draggables.register(this); - }, - - destroy: function() { - Event.stopObserving(this.handle, "mousedown", this.eventMouseDown); - Draggables.unregister(this); - }, - - currentDelta: function() { - return([ - parseInt(Element.getStyle(this.element,'left') || '0'), - parseInt(Element.getStyle(this.element,'top') || '0')]); - }, - - initDrag: function(event) { - if(!Object.isUndefined(Draggable._dragging[this.element]) && - Draggable._dragging[this.element]) return; - if(Event.isLeftClick(event)) { - // abort on form elements, fixes a Firefox issue - var src = Event.element(event); - if((tag_name = src.tagName.toUpperCase()) && ( - tag_name=='INPUT' || - tag_name=='SELECT' || - tag_name=='OPTION' || - tag_name=='BUTTON' || - tag_name=='TEXTAREA')) return; - - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - var pos = this.element.cumulativeOffset(); - this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) }); - - Draggables.activate(this); - Event.stop(event); - } - }, - - startDrag: function(event) { - this.dragging = true; - if(!this.delta) - this.delta = this.currentDelta(); - - if(this.options.zindex) { - this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0); - this.element.style.zIndex = this.options.zindex; - } - - if(this.options.ghosting) { - this._clone = this.element.cloneNode(true); - this._originallyAbsolute = (this.element.getStyle('position') == 'absolute'); - if (!this._originallyAbsolute) - Position.absolutize(this.element); - this.element.parentNode.insertBefore(this._clone, this.element); - } - - if(this.options.scroll) { - if (this.options.scroll == window) { - var where = this._getWindowScroll(this.options.scroll); - this.originalScrollLeft = where.left; - this.originalScrollTop = where.top; - } else { - this.originalScrollLeft = this.options.scroll.scrollLeft; - this.originalScrollTop = this.options.scroll.scrollTop; - } - } - - Draggables.notify('onStart', this, event); - - if(this.options.starteffect) this.options.starteffect(this.element); - }, - - updateDrag: function(event, pointer) { - if(!this.dragging) this.startDrag(event); - - if(!this.options.quiet){ - Position.prepare(); - Droppables.show(pointer, this.element); - } - - Draggables.notify('onDrag', this, event); - - this.draw(pointer); - if(this.options.change) this.options.change(this); - - if(this.options.scroll) { - this.stopScrolling(); - - var p; - if (this.options.scroll == window) { - with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; } - } else { - p = Position.page(this.options.scroll); - p[0] += this.options.scroll.scrollLeft + Position.deltaX; - p[1] += this.options.scroll.scrollTop + Position.deltaY; - p.push(p[0]+this.options.scroll.offsetWidth); - p.push(p[1]+this.options.scroll.offsetHeight); - } - var speed = [0,0]; - if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity); - if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity); - if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity); - if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity); - this.startScrolling(speed); - } - - // fix AppleWebKit rendering - if(Prototype.Browser.WebKit) window.scrollBy(0,0); - - Event.stop(event); - }, - - finishDrag: function(event, success) { - this.dragging = false; - - if(this.options.quiet){ - Position.prepare(); - var pointer = [Event.pointerX(event), Event.pointerY(event)]; - Droppables.show(pointer, this.element); - } - - if(this.options.ghosting) { - if (!this._originallyAbsolute) - Position.relativize(this.element); - delete this._originallyAbsolute; - Element.remove(this._clone); - this._clone = null; - } - - var dropped = false; - if(success) { - dropped = Droppables.fire(event, this.element); - if (!dropped) dropped = false; - } - if(dropped && this.options.onDropped) this.options.onDropped(this.element); - Draggables.notify('onEnd', this, event); - - var revert = this.options.revert; - if(revert && Object.isFunction(revert)) revert = revert(this.element); - - var d = this.currentDelta(); - if(revert && this.options.reverteffect) { - if (dropped == 0 || revert != 'failure') - this.options.reverteffect(this.element, - d[1]-this.delta[1], d[0]-this.delta[0]); - } else { - this.delta = d; - } - - if(this.options.zindex) - this.element.style.zIndex = this.originalZ; - - if(this.options.endeffect) - this.options.endeffect(this.element); - - Draggables.deactivate(this); - Droppables.reset(); - }, - - keyPress: function(event) { - if(event.keyCode!=Event.KEY_ESC) return; - this.finishDrag(event, false); - Event.stop(event); - }, - - endDrag: function(event) { - if(!this.dragging) return; - this.stopScrolling(); - this.finishDrag(event, true); - Event.stop(event); - }, - - draw: function(point) { - var pos = this.element.cumulativeOffset(); - if(this.options.ghosting) { - var r = Position.realOffset(this.element); - pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY; - } - - var d = this.currentDelta(); - pos[0] -= d[0]; pos[1] -= d[1]; - - if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) { - pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft; - pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop; - } - - var p = [0,1].map(function(i){ - return (point[i]-pos[i]-this.offset[i]) - }.bind(this)); - - if(this.options.snap) { - if(Object.isFunction(this.options.snap)) { - p = this.options.snap(p[0],p[1],this); - } else { - if(Object.isArray(this.options.snap)) { - p = p.map( function(v, i) { - return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this)); - } else { - p = p.map( function(v) { - return (v/this.options.snap).round()*this.options.snap }.bind(this)); - } - }} - - var style = this.element.style; - if((!this.options.constraint) || (this.options.constraint=='horizontal')) - style.left = p[0] + "px"; - if((!this.options.constraint) || (this.options.constraint=='vertical')) - style.top = p[1] + "px"; - - if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering - }, - - stopScrolling: function() { - if(this.scrollInterval) { - clearInterval(this.scrollInterval); - this.scrollInterval = null; - Draggables._lastScrollPointer = null; - } - }, - - startScrolling: function(speed) { - if(!(speed[0] || speed[1])) return; - this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed]; - this.lastScrolled = new Date(); - this.scrollInterval = setInterval(this.scroll.bind(this), 10); - }, - - scroll: function() { - var current = new Date(); - var delta = current - this.lastScrolled; - this.lastScrolled = current; - if(this.options.scroll == window) { - with (this._getWindowScroll(this.options.scroll)) { - if (this.scrollSpeed[0] || this.scrollSpeed[1]) { - var d = delta / 1000; - this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] ); - } - } - } else { - this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000; - this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000; - } - - Position.prepare(); - Droppables.show(Draggables._lastPointer, this.element); - Draggables.notify('onDrag', this); - if (this._isScrollChild) { - Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer); - Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000; - Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000; - if (Draggables._lastScrollPointer[0] < 0) - Draggables._lastScrollPointer[0] = 0; - if (Draggables._lastScrollPointer[1] < 0) - Draggables._lastScrollPointer[1] = 0; - this.draw(Draggables._lastScrollPointer); - } - - if(this.options.change) this.options.change(this); - }, - - _getWindowScroll: function(w) { - var T, L, W, H; - with (w.document) { - if (w.document.documentElement && documentElement.scrollTop) { - T = documentElement.scrollTop; - L = documentElement.scrollLeft; - } else if (w.document.body) { - T = body.scrollTop; - L = body.scrollLeft; - } - if (w.innerWidth) { - W = w.innerWidth; - H = w.innerHeight; - } else if (w.document.documentElement && documentElement.clientWidth) { - W = documentElement.clientWidth; - H = documentElement.clientHeight; - } else { - W = body.offsetWidth; - H = body.offsetHeight; - } - } - return { top: T, left: L, width: W, height: H }; - } -}); - -Draggable._dragging = { }; - -/*--------------------------------------------------------------------------*/ - -var SortableObserver = Class.create({ - initialize: function(element, observer) { - this.element = $(element); - this.observer = observer; - this.lastValue = Sortable.serialize(this.element); - }, - - onStart: function() { - this.lastValue = Sortable.serialize(this.element); - }, - - onEnd: function() { - Sortable.unmark(); - if(this.lastValue != Sortable.serialize(this.element)) - this.observer(this.element) - } -}); - -var Sortable = { - SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/, - - sortables: { }, - - _findRootElement: function(element) { - while (element.tagName.toUpperCase() != "BODY") { - if(element.id && Sortable.sortables[element.id]) return element; - element = element.parentNode; - } - }, - - options: function(element) { - element = Sortable._findRootElement($(element)); - if(!element) return; - return Sortable.sortables[element.id]; - }, - - destroy: function(element){ - element = $(element); - var s = Sortable.sortables[element.id]; - - if(s) { - Draggables.removeObserver(s.element); - s.droppables.each(function(d){ Droppables.remove(d) }); - s.draggables.invoke('destroy'); - - delete Sortable.sortables[s.element.id]; - } - }, - - create: function(element) { - element = $(element); - var options = Object.extend({ - element: element, - tag: 'li', // assumes li children, override with tag: 'tagname' - dropOnEmpty: false, - tree: false, - treeTag: 'ul', - overlap: 'vertical', // one of 'vertical', 'horizontal' - constraint: 'vertical', // one of 'vertical', 'horizontal', false - containment: element, // also takes array of elements (or id's); or false - handle: false, // or a CSS class - only: false, - delay: 0, - hoverclass: null, - ghosting: false, - quiet: false, - scroll: false, - scrollSensitivity: 20, - scrollSpeed: 15, - format: this.SERIALIZE_RULE, - - // these take arrays of elements or ids and can be - // used for better initialization performance - elements: false, - handles: false, - - onChange: Prototype.emptyFunction, - onUpdate: Prototype.emptyFunction - }, arguments[1] || { }); - - // clear any old sortable with same element - this.destroy(element); - - // build options for the draggables - var options_for_draggable = { - revert: true, - quiet: options.quiet, - scroll: options.scroll, - scrollSpeed: options.scrollSpeed, - scrollSensitivity: options.scrollSensitivity, - delay: options.delay, - ghosting: options.ghosting, - constraint: options.constraint, - handle: options.handle }; - - if(options.starteffect) - options_for_draggable.starteffect = options.starteffect; - - if(options.reverteffect) - options_for_draggable.reverteffect = options.reverteffect; - else - if(options.ghosting) options_for_draggable.reverteffect = function(element) { - element.style.top = 0; - element.style.left = 0; - }; - - if(options.endeffect) - options_for_draggable.endeffect = options.endeffect; - - if(options.zindex) - options_for_draggable.zindex = options.zindex; - - // build options for the droppables - var options_for_droppable = { - overlap: options.overlap, - containment: options.containment, - tree: options.tree, - hoverclass: options.hoverclass, - onHover: Sortable.onHover - }; - - var options_for_tree = { - onHover: Sortable.onEmptyHover, - overlap: options.overlap, - containment: options.containment, - hoverclass: options.hoverclass - }; - - // fix for gecko engine - Element.cleanWhitespace(element); - - options.draggables = []; - options.droppables = []; - - // drop on empty handling - if(options.dropOnEmpty || options.tree) { - Droppables.add(element, options_for_tree); - options.droppables.push(element); - } - - (options.elements || this.findElements(element, options) || []).each( function(e,i) { - var handle = options.handles ? $(options.handles[i]) : - (options.handle ? $(e).select('.' + options.handle)[0] : e); - options.draggables.push( - new Draggable(e, Object.extend(options_for_draggable, { handle: handle }))); - Droppables.add(e, options_for_droppable); - if(options.tree) e.treeNode = element; - options.droppables.push(e); - }); - - if(options.tree) { - (Sortable.findTreeElements(element, options) || []).each( function(e) { - Droppables.add(e, options_for_tree); - e.treeNode = element; - options.droppables.push(e); - }); - } - - // keep reference - this.sortables[element.identify()] = options; - - // for onupdate - Draggables.addObserver(new SortableObserver(element, options.onUpdate)); - - }, - - // return all suitable-for-sortable elements in a guaranteed order - findElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.tag); - }, - - findTreeElements: function(element, options) { - return Element.findChildren( - element, options.only, options.tree ? true : false, options.treeTag); - }, - - onHover: function(element, dropon, overlap) { - if(Element.isParent(dropon, element)) return; - - if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) { - return; - } else if(overlap>0.5) { - Sortable.mark(dropon, 'before'); - if(dropon.previousSibling != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, dropon); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } else { - Sortable.mark(dropon, 'after'); - var nextElement = dropon.nextSibling || null; - if(nextElement != element) { - var oldParentNode = element.parentNode; - element.style.visibility = "hidden"; // fix gecko rendering - dropon.parentNode.insertBefore(element, nextElement); - if(dropon.parentNode!=oldParentNode) - Sortable.options(oldParentNode).onChange(element); - Sortable.options(dropon.parentNode).onChange(element); - } - } - }, - - onEmptyHover: function(element, dropon, overlap) { - var oldParentNode = element.parentNode; - var droponOptions = Sortable.options(dropon); - - if(!Element.isParent(dropon, element)) { - var index; - - var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only}); - var child = null; - - if(children) { - var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap); - - for (index = 0; index < children.length; index += 1) { - if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) { - offset -= Element.offsetSize (children[index], droponOptions.overlap); - } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) { - child = index + 1 < children.length ? children[index + 1] : null; - break; - } else { - child = children[index]; - break; - } - } - } - - dropon.insertBefore(element, child); - - Sortable.options(oldParentNode).onChange(element); - droponOptions.onChange(element); - } - }, - - unmark: function() { - if(Sortable._marker) Sortable._marker.hide(); - }, - - mark: function(dropon, position) { - // mark on ghosting only - var sortable = Sortable.options(dropon.parentNode); - if(sortable && !sortable.ghosting) return; - - if(!Sortable._marker) { - Sortable._marker = - ($('dropmarker') || Element.extend(document.createElement('DIV'))). - hide().addClassName('dropmarker').setStyle({position:'absolute'}); - document.getElementsByTagName("body").item(0).appendChild(Sortable._marker); - } - var offsets = dropon.cumulativeOffset(); - Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'}); - - if(position=='after') - if(sortable.overlap == 'horizontal') - Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'}); - else - Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'}); - - Sortable._marker.show(); - }, - - _tree: function(element, options, parent) { - var children = Sortable.findElements(element, options) || []; - - for (var i = 0; i < children.length; ++i) { - var match = children[i].id.match(options.format); - - if (!match) continue; - - var child = { - id: encodeURIComponent(match ? match[1] : null), - element: element, - parent: parent, - children: [], - position: parent.children.length, - container: $(children[i]).down(options.treeTag) - }; - - /* Get the element containing the children and recurse over it */ - if (child.container) - this._tree(child.container, options, child); - - parent.children.push (child); - } - - return parent; - }, - - tree: function(element) { - element = $(element); - var sortableOptions = this.options(element); - var options = Object.extend({ - tag: sortableOptions.tag, - treeTag: sortableOptions.treeTag, - only: sortableOptions.only, - name: element.id, - format: sortableOptions.format - }, arguments[1] || { }); - - var root = { - id: null, - parent: null, - children: [], - container: element, - position: 0 - }; - - return Sortable._tree(element, options, root); - }, - - /* Construct a [i] index for a particular node */ - _constructIndex: function(node) { - var index = ''; - do { - if (node.id) index = '[' + node.position + ']' + index; - } while ((node = node.parent) != null); - return index; - }, - - sequence: function(element) { - element = $(element); - var options = Object.extend(this.options(element), arguments[1] || { }); - - return $(this.findElements(element, options) || []).map( function(item) { - return item.id.match(options.format) ? item.id.match(options.format)[1] : ''; - }); - }, - - setSequence: function(element, new_sequence) { - element = $(element); - var options = Object.extend(this.options(element), arguments[2] || { }); - - var nodeMap = { }; - this.findElements(element, options).each( function(n) { - if (n.id.match(options.format)) - nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode]; - n.parentNode.removeChild(n); - }); - - new_sequence.each(function(ident) { - var n = nodeMap[ident]; - if (n) { - n[1].appendChild(n[0]); - delete nodeMap[ident]; - } - }); - }, - - serialize: function(element) { - element = $(element); - var options = Object.extend(Sortable.options(element), arguments[1] || { }); - var name = encodeURIComponent( - (arguments[1] && arguments[1].name) ? arguments[1].name : element.id); - - if (options.tree) { - return Sortable.tree(element, arguments[1]).children.map( function (item) { - return [name + Sortable._constructIndex(item) + "[id]=" + - encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); - }).flatten().join('&'); - } else { - return Sortable.sequence(element, arguments[1]).map( function(item) { - return name + "[]=" + encodeURIComponent(item); - }).join('&'); - } - } -}; - -// Returns true if child is contained within element -Element.isParent = function(child, element) { - if (!child.parentNode || child == element) return false; - if (child.parentNode == element) return true; - return Element.isParent(child.parentNode, element); -}; - -Element.findChildren = function(element, only, recursive, tagName) { - if(!element.hasChildNodes()) return null; - tagName = tagName.toUpperCase(); - if(only) only = [only].flatten(); - var elements = []; - $A(element.childNodes).each( function(e) { - if(e.tagName && e.tagName.toUpperCase()==tagName && - (!only || (Element.classNames(e).detect(function(v) { return only.include(v) })))) - elements.push(e); - if(recursive) { - var grandchildren = Element.findChildren(e, only, recursive, tagName); - if(grandchildren) elements.push(grandchildren); - } - }); - - return (elements.length>0 ? elements.flatten() : []); -}; - -Element.offsetSize = function (element, type) { - return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')]; -}; diff --git a/vendor/impressionist/test_app/public/javascripts/effects.js b/vendor/impressionist/test_app/public/javascripts/effects.js deleted file mode 100644 index c977462fd..000000000 --- a/vendor/impressionist/test_app/public/javascripts/effects.js +++ /dev/null @@ -1,1123 +0,0 @@ -// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009 - -// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) -// Contributors: -// Justin Palmer (http://encytemedia.com/) -// Mark Pilgrim (http://diveintomark.org/) -// Martin Bialasinki -// -// script.aculo.us is freely distributable under the terms of an MIT-style license. -// For details, see the script.aculo.us web site: http://script.aculo.us/ - -// converts rgb() and #xxx to #xxxxxx format, -// returns self (or first argument) if not convertable -String.prototype.parseColor = function() { - var color = '#'; - if (this.slice(0,4) == 'rgb(') { - var cols = this.slice(4,this.length-1).split(','); - var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3); - } else { - if (this.slice(0,1) == '#') { - if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase(); - if (this.length==7) color = this.toLowerCase(); - } - } - return (color.length==7 ? color : (arguments[0] || this)); -}; - -/*--------------------------------------------------------------------------*/ - -Element.collectTextNodes = function(element) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - (node.hasChildNodes() ? Element.collectTextNodes(node) : '')); - }).flatten().join(''); -}; - -Element.collectTextNodesIgnoreClass = function(element, className) { - return $A($(element).childNodes).collect( function(node) { - return (node.nodeType==3 ? node.nodeValue : - ((node.hasChildNodes() && !Element.hasClassName(node,className)) ? - Element.collectTextNodesIgnoreClass(node, className) : '')); - }).flatten().join(''); -}; - -Element.setContentZoom = function(element, percent) { - element = $(element); - element.setStyle({fontSize: (percent/100) + 'em'}); - if (Prototype.Browser.WebKit) window.scrollBy(0,0); - return element; -}; - -Element.getInlineOpacity = function(element){ - return $(element).style.opacity || ''; -}; - -Element.forceRerendering = function(element) { - try { - element = $(element); - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch(e) { } -}; - -/*--------------------------------------------------------------------------*/ - -var Effect = { - _elementDoesNotExistError: { - name: 'ElementDoesNotExistError', - message: 'The specified DOM element does not exist, but is required for this effect to operate' - }, - Transitions: { - linear: Prototype.K, - sinoidal: function(pos) { - return (-Math.cos(pos*Math.PI)/2) + .5; - }, - reverse: function(pos) { - return 1-pos; - }, - flicker: function(pos) { - var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4; - return pos > 1 ? 1 : pos; - }, - wobble: function(pos) { - return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5; - }, - pulse: function(pos, pulses) { - return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5; - }, - spring: function(pos) { - return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); - }, - none: function(pos) { - return 0; - }, - full: function(pos) { - return 1; - } - }, - DefaultOptions: { - duration: 1.0, // seconds - fps: 100, // 100= assume 66fps max. - sync: false, // true for combining - from: 0.0, - to: 1.0, - delay: 0.0, - queue: 'parallel' - }, - tagifyText: function(element) { - var tagifyStyle = 'position:relative'; - if (Prototype.Browser.IE) tagifyStyle += ';zoom:1'; - - element = $(element); - $A(element.childNodes).each( function(child) { - if (child.nodeType==3) { - child.nodeValue.toArray().each( function(character) { - element.insertBefore( - new Element('span', {style: tagifyStyle}).update( - character == ' ' ? String.fromCharCode(160) : character), - child); - }); - Element.remove(child); - } - }); - }, - multiple: function(element, effect) { - var elements; - if (((typeof element == 'object') || - Object.isFunction(element)) && - (element.length)) - elements = element; - else - elements = $(element).childNodes; - - var options = Object.extend({ - speed: 0.1, - delay: 0.0 - }, arguments[2] || { }); - var masterDelay = options.delay; - - $A(elements).each( function(element, index) { - new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay })); - }); - }, - PAIRS: { - 'slide': ['SlideDown','SlideUp'], - 'blind': ['BlindDown','BlindUp'], - 'appear': ['Appear','Fade'] - }, - toggle: function(element, effect, options) { - element = $(element); - effect = (effect || 'appear').toLowerCase(); - - return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({ - queue: { position:'end', scope:(element.id || 'global'), limit: 1 } - }, options || {})); - } -}; - -Effect.DefaultOptions.transition = Effect.Transitions.sinoidal; - -/* ------------- core effects ------------- */ - -Effect.ScopedQueue = Class.create(Enumerable, { - initialize: function() { - this.effects = []; - this.interval = null; - }, - _each: function(iterator) { - this.effects._each(iterator); - }, - add: function(effect) { - var timestamp = new Date().getTime(); - - var position = Object.isString(effect.options.queue) ? - effect.options.queue : effect.options.queue.position; - - switch(position) { - case 'front': - // move unstarted effects after this effect - this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) { - e.startOn += effect.finishOn; - e.finishOn += effect.finishOn; - }); - break; - case 'with-last': - timestamp = this.effects.pluck('startOn').max() || timestamp; - break; - case 'end': - // start effect after last queued effect has finished - timestamp = this.effects.pluck('finishOn').max() || timestamp; - break; - } - - effect.startOn += timestamp; - effect.finishOn += timestamp; - - if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit)) - this.effects.push(effect); - - if (!this.interval) - this.interval = setInterval(this.loop.bind(this), 15); - }, - remove: function(effect) { - this.effects = this.effects.reject(function(e) { return e==effect }); - if (this.effects.length == 0) { - clearInterval(this.interval); - this.interval = null; - } - }, - loop: function() { - var timePos = new Date().getTime(); - for(var i=0, len=this.effects.length;i= this.startOn) { - if (timePos >= this.finishOn) { - this.render(1.0); - this.cancel(); - this.event('beforeFinish'); - if (this.finish) this.finish(); - this.event('afterFinish'); - return; - } - var pos = (timePos - this.startOn) / this.totalTime, - frame = (pos * this.totalFrames).round(); - if (frame > this.currentFrame) { - this.render(pos); - this.currentFrame = frame; - } - } - }, - cancel: function() { - if (!this.options.sync) - Effect.Queues.get(Object.isString(this.options.queue) ? - 'global' : this.options.queue.scope).remove(this); - this.state = 'finished'; - }, - event: function(eventName) { - if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this); - if (this.options[eventName]) this.options[eventName](this); - }, - inspect: function() { - var data = $H(); - for(property in this) - if (!Object.isFunction(this[property])) data.set(property, this[property]); - return '#'; - } -}); - -Effect.Parallel = Class.create(Effect.Base, { - initialize: function(effects) { - this.effects = effects || []; - this.start(arguments[1]); - }, - update: function(position) { - this.effects.invoke('render', position); - }, - finish: function(position) { - this.effects.each( function(effect) { - effect.render(1.0); - effect.cancel(); - effect.event('beforeFinish'); - if (effect.finish) effect.finish(position); - effect.event('afterFinish'); - }); - } -}); - -Effect.Tween = Class.create(Effect.Base, { - initialize: function(object, from, to) { - object = Object.isString(object) ? $(object) : object; - var args = $A(arguments), method = args.last(), - options = args.length == 5 ? args[3] : null; - this.method = Object.isFunction(method) ? method.bind(object) : - Object.isFunction(object[method]) ? object[method].bind(object) : - function(value) { object[method] = value }; - this.start(Object.extend({ from: from, to: to }, options || { })); - }, - update: function(position) { - this.method(position); - } -}); - -Effect.Event = Class.create(Effect.Base, { - initialize: function() { - this.start(Object.extend({ duration: 0 }, arguments[0] || { })); - }, - update: Prototype.emptyFunction -}); - -Effect.Opacity = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - // make this work on IE on elements without 'layout' - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - var options = Object.extend({ - from: this.element.getOpacity() || 0.0, - to: 1.0 - }, arguments[1] || { }); - this.start(options); - }, - update: function(position) { - this.element.setOpacity(position); - } -}); - -Effect.Move = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - x: 0, - y: 0, - mode: 'relative' - }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - this.element.makePositioned(); - this.originalLeft = parseFloat(this.element.getStyle('left') || '0'); - this.originalTop = parseFloat(this.element.getStyle('top') || '0'); - if (this.options.mode == 'absolute') { - this.options.x = this.options.x - this.originalLeft; - this.options.y = this.options.y - this.originalTop; - } - }, - update: function(position) { - this.element.setStyle({ - left: (this.options.x * position + this.originalLeft).round() + 'px', - top: (this.options.y * position + this.originalTop).round() + 'px' - }); - } -}); - -// for backwards compatibility -Effect.MoveBy = function(element, toTop, toLeft) { - return new Effect.Move(element, - Object.extend({ x: toLeft, y: toTop }, arguments[3] || { })); -}; - -Effect.Scale = Class.create(Effect.Base, { - initialize: function(element, percent) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - scaleX: true, - scaleY: true, - scaleContent: true, - scaleFromCenter: false, - scaleMode: 'box', // 'box' or 'contents' or { } with provided values - scaleFrom: 100.0, - scaleTo: percent - }, arguments[2] || { }); - this.start(options); - }, - setup: function() { - this.restoreAfterFinish = this.options.restoreAfterFinish || false; - this.elementPositioning = this.element.getStyle('position'); - - this.originalStyle = { }; - ['top','left','width','height','fontSize'].each( function(k) { - this.originalStyle[k] = this.element.style[k]; - }.bind(this)); - - this.originalTop = this.element.offsetTop; - this.originalLeft = this.element.offsetLeft; - - var fontSize = this.element.getStyle('font-size') || '100%'; - ['em','px','%','pt'].each( function(fontSizeType) { - if (fontSize.indexOf(fontSizeType)>0) { - this.fontSize = parseFloat(fontSize); - this.fontSizeType = fontSizeType; - } - }.bind(this)); - - this.factor = (this.options.scaleTo - this.options.scaleFrom)/100; - - this.dims = null; - if (this.options.scaleMode=='box') - this.dims = [this.element.offsetHeight, this.element.offsetWidth]; - if (/^content/.test(this.options.scaleMode)) - this.dims = [this.element.scrollHeight, this.element.scrollWidth]; - if (!this.dims) - this.dims = [this.options.scaleMode.originalHeight, - this.options.scaleMode.originalWidth]; - }, - update: function(position) { - var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position); - if (this.options.scaleContent && this.fontSize) - this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType }); - this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale); - }, - finish: function(position) { - if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle); - }, - setDimensions: function(height, width) { - var d = { }; - if (this.options.scaleX) d.width = width.round() + 'px'; - if (this.options.scaleY) d.height = height.round() + 'px'; - if (this.options.scaleFromCenter) { - var topd = (height - this.dims[0])/2; - var leftd = (width - this.dims[1])/2; - if (this.elementPositioning == 'absolute') { - if (this.options.scaleY) d.top = this.originalTop-topd + 'px'; - if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px'; - } else { - if (this.options.scaleY) d.top = -topd + 'px'; - if (this.options.scaleX) d.left = -leftd + 'px'; - } - } - this.element.setStyle(d); - } -}); - -Effect.Highlight = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { }); - this.start(options); - }, - setup: function() { - // Prevent executing on elements not in the layout flow - if (this.element.getStyle('display')=='none') { this.cancel(); return; } - // Disable background image during the effect - this.oldStyle = { }; - if (!this.options.keepBackgroundImage) { - this.oldStyle.backgroundImage = this.element.getStyle('background-image'); - this.element.setStyle({backgroundImage: 'none'}); - } - if (!this.options.endcolor) - this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff'); - if (!this.options.restorecolor) - this.options.restorecolor = this.element.getStyle('background-color'); - // init color calculations - this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this)); - this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this)); - }, - update: function(position) { - this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){ - return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) }); - }, - finish: function() { - this.element.setStyle(Object.extend(this.oldStyle, { - backgroundColor: this.options.restorecolor - })); - } -}); - -Effect.ScrollTo = function(element) { - var options = arguments[1] || { }, - scrollOffsets = document.viewport.getScrollOffsets(), - elementOffsets = $(element).cumulativeOffset(); - - if (options.offset) elementOffsets[1] += options.offset; - - return new Effect.Tween(null, - scrollOffsets.top, - elementOffsets[1], - options, - function(p){ scrollTo(scrollOffsets.left, p.round()); } - ); -}; - -/* ------------- combination effects ------------- */ - -Effect.Fade = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - var options = Object.extend({ - from: element.getOpacity() || 1.0, - to: 0.0, - afterFinishInternal: function(effect) { - if (effect.options.to!=0) return; - effect.element.hide().setStyle({opacity: oldOpacity}); - } - }, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Appear = function(element) { - element = $(element); - var options = Object.extend({ - from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0), - to: 1.0, - // force Safari to render floated elements properly - afterFinishInternal: function(effect) { - effect.element.forceRerendering(); - }, - beforeSetup: function(effect) { - effect.element.setOpacity(effect.options.from).show(); - }}, arguments[1] || { }); - return new Effect.Opacity(element,options); -}; - -Effect.Puff = function(element) { - element = $(element); - var oldStyle = { - opacity: element.getInlineOpacity(), - position: element.getStyle('position'), - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height - }; - return new Effect.Parallel( - [ new Effect.Scale(element, 200, - { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], - Object.extend({ duration: 1.0, - beforeSetupInternal: function(effect) { - Position.absolutize(effect.effects[0].element); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().setStyle(oldStyle); } - }, arguments[1] || { }) - ); -}; - -Effect.BlindUp = function(element) { - element = $(element); - element.makeClipping(); - return new Effect.Scale(element, 0, - Object.extend({ scaleContent: false, - scaleX: false, - restoreAfterFinish: true, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }, arguments[1] || { }) - ); -}; - -Effect.BlindDown = function(element) { - element = $(element); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: 0, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping(); - } - }, arguments[1] || { })); -}; - -Effect.SwitchOff = function(element) { - element = $(element); - var oldOpacity = element.getInlineOpacity(); - return new Effect.Appear(element, Object.extend({ - duration: 0.4, - from: 0, - transition: Effect.Transitions.flicker, - afterFinishInternal: function(effect) { - new Effect.Scale(effect.element, 1, { - duration: 0.3, scaleFromCenter: true, - scaleX: false, scaleContent: false, restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity}); - } - }); - } - }, arguments[1] || { })); -}; - -Effect.DropOut = function(element) { - element = $(element); - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left'), - opacity: element.getInlineOpacity() }; - return new Effect.Parallel( - [ new Effect.Move(element, {x: 0, y: 100, sync: true }), - new Effect.Opacity(element, { sync: true, to: 0.0 }) ], - Object.extend( - { duration: 0.5, - beforeSetup: function(effect) { - effect.effects[0].element.makePositioned(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle); - } - }, arguments[1] || { })); -}; - -Effect.Shake = function(element) { - element = $(element); - var options = Object.extend({ - distance: 20, - duration: 0.5 - }, arguments[1] || {}); - var distance = parseFloat(options.distance); - var split = parseFloat(options.duration) / 10.0; - var oldStyle = { - top: element.getStyle('top'), - left: element.getStyle('left') }; - return new Effect.Move(element, - { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) { - new Effect.Move(effect.element, - { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) { - effect.element.undoPositioned().setStyle(oldStyle); - }}); }}); }}); }}); }}); }}); -}; - -Effect.SlideDown = function(element) { - element = $(element).cleanWhitespace(); - // SlideDown need to have the content of the element wrapped in a container element with fixed height! - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, 100, Object.extend({ - scaleContent: false, - scaleX: false, - scaleFrom: window.opera ? 0 : 1, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().setStyle({height: '0px'}).show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); } - }, arguments[1] || { }) - ); -}; - -Effect.SlideUp = function(element) { - element = $(element).cleanWhitespace(); - var oldInnerBottom = element.down().getStyle('bottom'); - var elementDimensions = element.getDimensions(); - return new Effect.Scale(element, window.opera ? 0 : 1, - Object.extend({ scaleContent: false, - scaleX: false, - scaleMode: 'box', - scaleFrom: 100, - scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width}, - restoreAfterFinish: true, - afterSetup: function(effect) { - effect.element.makePositioned(); - effect.element.down().makePositioned(); - if (window.opera) effect.element.setStyle({top: ''}); - effect.element.makeClipping().show(); - }, - afterUpdateInternal: function(effect) { - effect.element.down().setStyle({bottom: - (effect.dims[0] - effect.element.clientHeight) + 'px' }); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().undoPositioned(); - effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); - } - }, arguments[1] || { }) - ); -}; - -// Bug in opera makes the TD containing this element expand for a instance after finish -Effect.Squish = function(element) { - return new Effect.Scale(element, window.opera ? 1 : 0, { - restoreAfterFinish: true, - beforeSetup: function(effect) { - effect.element.makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping(); - } - }); -}; - -Effect.Grow = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.full - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var initialMoveX, initialMoveY; - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - initialMoveX = initialMoveY = moveX = moveY = 0; - break; - case 'top-right': - initialMoveX = dims.width; - initialMoveY = moveY = 0; - moveX = -dims.width; - break; - case 'bottom-left': - initialMoveX = moveX = 0; - initialMoveY = dims.height; - moveY = -dims.height; - break; - case 'bottom-right': - initialMoveX = dims.width; - initialMoveY = dims.height; - moveX = -dims.width; - moveY = -dims.height; - break; - case 'center': - initialMoveX = dims.width / 2; - initialMoveY = dims.height / 2; - moveX = -dims.width / 2; - moveY = -dims.height / 2; - break; - } - - return new Effect.Move(element, { - x: initialMoveX, - y: initialMoveY, - duration: 0.01, - beforeSetup: function(effect) { - effect.element.hide().makeClipping().makePositioned(); - }, - afterFinishInternal: function(effect) { - new Effect.Parallel( - [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }), - new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }), - new Effect.Scale(effect.element, 100, { - scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, - sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true}) - ], Object.extend({ - beforeSetup: function(effect) { - effect.effects[0].element.setStyle({height: '0px'}).show(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); - } - }, options) - ); - } - }); -}; - -Effect.Shrink = function(element) { - element = $(element); - var options = Object.extend({ - direction: 'center', - moveTransition: Effect.Transitions.sinoidal, - scaleTransition: Effect.Transitions.sinoidal, - opacityTransition: Effect.Transitions.none - }, arguments[1] || { }); - var oldStyle = { - top: element.style.top, - left: element.style.left, - height: element.style.height, - width: element.style.width, - opacity: element.getInlineOpacity() }; - - var dims = element.getDimensions(); - var moveX, moveY; - - switch (options.direction) { - case 'top-left': - moveX = moveY = 0; - break; - case 'top-right': - moveX = dims.width; - moveY = 0; - break; - case 'bottom-left': - moveX = 0; - moveY = dims.height; - break; - case 'bottom-right': - moveX = dims.width; - moveY = dims.height; - break; - case 'center': - moveX = dims.width / 2; - moveY = dims.height / 2; - break; - } - - return new Effect.Parallel( - [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }), - new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}), - new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }) - ], Object.extend({ - beforeStartInternal: function(effect) { - effect.effects[0].element.makePositioned().makeClipping(); - }, - afterFinishInternal: function(effect) { - effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); } - }, options) - ); -}; - -Effect.Pulsate = function(element) { - element = $(element); - var options = arguments[1] || { }, - oldOpacity = element.getInlineOpacity(), - transition = options.transition || Effect.Transitions.linear, - reverser = function(pos){ - return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5); - }; - - return new Effect.Opacity(element, - Object.extend(Object.extend({ duration: 2.0, from: 0, - afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); } - }, options), {transition: reverser})); -}; - -Effect.Fold = function(element) { - element = $(element); - var oldStyle = { - top: element.style.top, - left: element.style.left, - width: element.style.width, - height: element.style.height }; - element.makeClipping(); - return new Effect.Scale(element, 5, Object.extend({ - scaleContent: false, - scaleX: false, - afterFinishInternal: function(effect) { - new Effect.Scale(element, 1, { - scaleContent: false, - scaleY: false, - afterFinishInternal: function(effect) { - effect.element.hide().undoClipping().setStyle(oldStyle); - } }); - }}, arguments[1] || { })); -}; - -Effect.Morph = Class.create(Effect.Base, { - initialize: function(element) { - this.element = $(element); - if (!this.element) throw(Effect._elementDoesNotExistError); - var options = Object.extend({ - style: { } - }, arguments[1] || { }); - - if (!Object.isString(options.style)) this.style = $H(options.style); - else { - if (options.style.include(':')) - this.style = options.style.parseStyle(); - else { - this.element.addClassName(options.style); - this.style = $H(this.element.getStyles()); - this.element.removeClassName(options.style); - var css = this.element.getStyles(); - this.style = this.style.reject(function(style) { - return style.value == css[style.key]; - }); - options.afterFinishInternal = function(effect) { - effect.element.addClassName(effect.options.style); - effect.transforms.each(function(transform) { - effect.element.style[transform.style] = ''; - }); - }; - } - } - this.start(options); - }, - - setup: function(){ - function parseColor(color){ - if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff'; - color = color.parseColor(); - return $R(0,2).map(function(i){ - return parseInt( color.slice(i*2+1,i*2+3), 16 ); - }); - } - this.transforms = this.style.map(function(pair){ - var property = pair[0], value = pair[1], unit = null; - - if (value.parseColor('#zzzzzz') != '#zzzzzz') { - value = value.parseColor(); - unit = 'color'; - } else if (property == 'opacity') { - value = parseFloat(value); - if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout)) - this.element.setStyle({zoom: 1}); - } else if (Element.CSS_LENGTH.test(value)) { - var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/); - value = parseFloat(components[1]); - unit = (components.length == 3) ? components[2] : null; - } - - var originalValue = this.element.getStyle(property); - return { - style: property.camelize(), - originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), - targetValue: unit=='color' ? parseColor(value) : value, - unit: unit - }; - }.bind(this)).reject(function(transform){ - return ( - (transform.originalValue == transform.targetValue) || - ( - transform.unit != 'color' && - (isNaN(transform.originalValue) || isNaN(transform.targetValue)) - ) - ); - }); - }, - update: function(position) { - var style = { }, transform, i = this.transforms.length; - while(i--) - style[(transform = this.transforms[i]).style] = - transform.unit=='color' ? '#'+ - (Math.round(transform.originalValue[0]+ - (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() + - (Math.round(transform.originalValue[1]+ - (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() + - (Math.round(transform.originalValue[2]+ - (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() : - (transform.originalValue + - (transform.targetValue - transform.originalValue) * position).toFixed(3) + - (transform.unit === null ? '' : transform.unit); - this.element.setStyle(style, true); - } -}); - -Effect.Transform = Class.create({ - initialize: function(tracks){ - this.tracks = []; - this.options = arguments[1] || { }; - this.addTracks(tracks); - }, - addTracks: function(tracks){ - tracks.each(function(track){ - track = $H(track); - var data = track.values().first(); - this.tracks.push($H({ - ids: track.keys().first(), - effect: Effect.Morph, - options: { style: data } - })); - }.bind(this)); - return this; - }, - play: function(){ - return new Effect.Parallel( - this.tracks.map(function(track){ - var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options'); - var elements = [$(ids) || $$(ids)].flatten(); - return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) }); - }).flatten(), - this.options - ); - } -}); - -Element.CSS_PROPERTIES = $w( - 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + - 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' + - 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' + - 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' + - 'fontSize fontWeight height left letterSpacing lineHeight ' + - 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+ - 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' + - 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' + - 'right textIndent top width wordSpacing zIndex'); - -Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; - -String.__parseStyleElement = document.createElement('div'); -String.prototype.parseStyle = function(){ - var style, styleRules = $H(); - if (Prototype.Browser.WebKit) - style = new Element('div',{style:this}).style; - else { - String.__parseStyleElement.innerHTML = '
      '; - style = String.__parseStyleElement.childNodes[0].style; - } - - Element.CSS_PROPERTIES.each(function(property){ - if (style[property]) styleRules.set(property, style[property]); - }); - - if (Prototype.Browser.IE && this.include('opacity')) - styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]); - - return styleRules; -}; - -if (document.defaultView && document.defaultView.getComputedStyle) { - Element.getStyles = function(element) { - var css = document.defaultView.getComputedStyle($(element), null); - return Element.CSS_PROPERTIES.inject({ }, function(styles, property) { - styles[property] = css[property]; - return styles; - }); - }; -} else { - Element.getStyles = function(element) { - element = $(element); - var css = element.currentStyle, styles; - styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) { - results[property] = css[property]; - return results; - }); - if (!styles.opacity) styles.opacity = element.getOpacity(); - return styles; - }; -} - -Effect.Methods = { - morph: function(element, style) { - element = $(element); - new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { })); - return element; - }, - visualEffect: function(element, effect, options) { - element = $(element); - var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1); - new Effect[klass](element, options); - return element; - }, - highlight: function(element, options) { - element = $(element); - new Effect.Highlight(element, options); - return element; - } -}; - -$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+ - 'pulsate shake puff squish switchOff dropOut').each( - function(effect) { - Effect.Methods[effect] = function(element, options){ - element = $(element); - Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options); - return element; - }; - } -); - -$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( - function(f) { Effect.Methods[f] = Element[f]; } -); - -Element.addMethods(Effect.Methods); diff --git a/vendor/impressionist/test_app/public/javascripts/prototype.js b/vendor/impressionist/test_app/public/javascripts/prototype.js deleted file mode 100644 index 06249a6ae..000000000 --- a/vendor/impressionist/test_app/public/javascripts/prototype.js +++ /dev/null @@ -1,6001 +0,0 @@ -/* Prototype JavaScript framework, version 1.7_rc2 - * (c) 2005-2010 Sam Stephenson - * - * Prototype is freely distributable under the terms of an MIT-style license. - * For details, see the Prototype web site: http://www.prototypejs.org/ - * - *--------------------------------------------------------------------------*/ - -var Prototype = { - - Version: '1.7_rc2', - - Browser: (function(){ - var ua = navigator.userAgent; - var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]'; - return { - IE: !!window.attachEvent && !isOpera, - Opera: isOpera, - WebKit: ua.indexOf('AppleWebKit/') > -1, - Gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') === -1, - MobileSafari: /Apple.*Mobile/.test(ua) - } - })(), - - BrowserFeatures: { - XPath: !!document.evaluate, - - SelectorsAPI: !!document.querySelector, - - ElementExtensions: (function() { - var constructor = window.Element || window.HTMLElement; - return !!(constructor && constructor.prototype); - })(), - SpecificElementExtensions: (function() { - if (typeof window.HTMLDivElement !== 'undefined') - return true; - - var div = document.createElement('div'), - form = document.createElement('form'), - isSupported = false; - - if (div['__proto__'] && (div['__proto__'] !== form['__proto__'])) { - isSupported = true; - } - - div = form = null; - - return isSupported; - })() - }, - - ScriptFragment: ']*>([\\S\\s]*?)<\/script>', - JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, - - emptyFunction: function() { }, - - K: function(x) { return x } -}; - -if (Prototype.Browser.MobileSafari) - Prototype.BrowserFeatures.SpecificElementExtensions = false; - - -var Abstract = { }; - - -var Try = { - these: function() { - var returnValue; - - for (var i = 0, length = arguments.length; i < length; i++) { - var lambda = arguments[i]; - try { - returnValue = lambda(); - break; - } catch (e) { } - } - - return returnValue; - } -}; - -/* Based on Alex Arnell's inheritance implementation. */ - -var Class = (function() { - - var IS_DONTENUM_BUGGY = (function(){ - for (var p in { toString: 1 }) { - if (p === 'toString') return false; - } - return true; - })(); - - function subclass() {}; - function create() { - var parent = null, properties = $A(arguments); - if (Object.isFunction(properties[0])) - parent = properties.shift(); - - function klass() { - this.initialize.apply(this, arguments); - } - - Object.extend(klass, Class.Methods); - klass.superclass = parent; - klass.subclasses = []; - - if (parent) { - subclass.prototype = parent.prototype; - klass.prototype = new subclass; - parent.subclasses.push(klass); - } - - for (var i = 0, length = properties.length; i < length; i++) - klass.addMethods(properties[i]); - - if (!klass.prototype.initialize) - klass.prototype.initialize = Prototype.emptyFunction; - - klass.prototype.constructor = klass; - return klass; - } - - function addMethods(source) { - var ancestor = this.superclass && this.superclass.prototype, - properties = Object.keys(source); - - if (IS_DONTENUM_BUGGY) { - if (source.toString != Object.prototype.toString) - properties.push("toString"); - if (source.valueOf != Object.prototype.valueOf) - properties.push("valueOf"); - } - - for (var i = 0, length = properties.length; i < length; i++) { - var property = properties[i], value = source[property]; - if (ancestor && Object.isFunction(value) && - value.argumentNames()[0] == "$super") { - var method = value; - value = (function(m) { - return function() { return ancestor[m].apply(this, arguments); }; - })(property).wrap(method); - - value.valueOf = method.valueOf.bind(method); - value.toString = method.toString.bind(method); - } - this.prototype[property] = value; - } - - return this; - } - - return { - create: create, - Methods: { - addMethods: addMethods - } - }; -})(); -(function() { - - var _toString = Object.prototype.toString, - NULL_TYPE = 'Null', - UNDEFINED_TYPE = 'Undefined', - BOOLEAN_TYPE = 'Boolean', - NUMBER_TYPE = 'Number', - STRING_TYPE = 'String', - OBJECT_TYPE = 'Object', - BOOLEAN_CLASS = '[object Boolean]', - NUMBER_CLASS = '[object Number]', - STRING_CLASS = '[object String]', - ARRAY_CLASS = '[object Array]', - NATIVE_JSON_STRINGIFY_SUPPORT = window.JSON && - typeof JSON.stringify === 'function' && - JSON.stringify(0) === '0' && - typeof JSON.stringify(Prototype.K) === 'undefined'; - - function Type(o) { - switch(o) { - case null: return NULL_TYPE; - case (void 0): return UNDEFINED_TYPE; - } - var type = typeof o; - switch(type) { - case 'boolean': return BOOLEAN_TYPE; - case 'number': return NUMBER_TYPE; - case 'string': return STRING_TYPE; - } - return OBJECT_TYPE; - } - - function extend(destination, source) { - for (var property in source) - destination[property] = source[property]; - return destination; - } - - function inspect(object) { - try { - if (isUndefined(object)) return 'undefined'; - if (object === null) return 'null'; - return object.inspect ? object.inspect() : String(object); - } catch (e) { - if (e instanceof RangeError) return '...'; - throw e; - } - } - - function toJSON(value) { - return Str('', { '': value }, []); - } - - function Str(key, holder, stack) { - var value = holder[key], - type = typeof value; - - if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - - var _class = _toString.call(value); - - switch (_class) { - case NUMBER_CLASS: - case BOOLEAN_CLASS: - case STRING_CLASS: - value = value.valueOf(); - } - - switch (value) { - case null: return 'null'; - case true: return 'true'; - case false: return 'false'; - } - - type = typeof value; - switch (type) { - case 'string': - return value.inspect(true); - case 'number': - return isFinite(value) ? String(value) : 'null'; - case 'object': - - for (var i = 0, length = stack.length; i < length; i++) { - if (stack[i] === value) { throw new TypeError(); } - } - stack.push(value); - - var partial = []; - if (_class === ARRAY_CLASS) { - for (var i = 0, length = value.length; i < length; i++) { - var str = Str(i, value, stack); - partial.push(typeof str === 'undefined' ? 'null' : str); - } - partial = '[' + partial.join(',') + ']'; - } else { - var keys = Object.keys(value); - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i], str = Str(key, value, stack); - if (typeof str !== "undefined") { - partial.push(key.inspect(true)+ ':' + str); - } - } - partial = '{' + partial.join(',') + '}'; - } - stack.pop(); - return partial; - } - } - - function stringify(object) { - return JSON.stringify(object); - } - - function toQueryString(object) { - return $H(object).toQueryString(); - } - - function toHTML(object) { - return object && object.toHTML ? object.toHTML() : String.interpret(object); - } - - function keys(object) { - if (Type(object) !== OBJECT_TYPE) { throw new TypeError(); } - var results = []; - for (var property in object) { - if (object.hasOwnProperty(property)) { - results.push(property); - } - } - return results; - } - - function values(object) { - var results = []; - for (var property in object) - results.push(object[property]); - return results; - } - - function clone(object) { - return extend({ }, object); - } - - function isElement(object) { - return !!(object && object.nodeType == 1); - } - - function isArray(object) { - return _toString.call(object) === ARRAY_CLASS; - } - - var hasNativeIsArray = (typeof Array.isArray == 'function') - && Array.isArray([]) && !Array.isArray({}); - - if (hasNativeIsArray) { - isArray = Array.isArray; - } - - function isHash(object) { - return object instanceof Hash; - } - - function isFunction(object) { - return typeof object === "function"; - } - - function isString(object) { - return _toString.call(object) === STRING_CLASS; - } - - function isNumber(object) { - return _toString.call(object) === NUMBER_CLASS; - } - - function isUndefined(object) { - return typeof object === "undefined"; - } - - extend(Object, { - extend: extend, - inspect: inspect, - toJSON: NATIVE_JSON_STRINGIFY_SUPPORT ? stringify : toJSON, - toQueryString: toQueryString, - toHTML: toHTML, - keys: Object.keys || keys, - values: values, - clone: clone, - isElement: isElement, - isArray: isArray, - isHash: isHash, - isFunction: isFunction, - isString: isString, - isNumber: isNumber, - isUndefined: isUndefined - }); -})(); -Object.extend(Function.prototype, (function() { - var slice = Array.prototype.slice; - - function update(array, args) { - var arrayLength = array.length, length = args.length; - while (length--) array[arrayLength + length] = args[length]; - return array; - } - - function merge(array, args) { - array = slice.call(array, 0); - return update(array, args); - } - - function argumentNames() { - var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1] - .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '') - .replace(/\s+/g, '').split(','); - return names.length == 1 && !names[0] ? [] : names; - } - - function bind(context) { - if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this; - var __method = this, args = slice.call(arguments, 1); - return function() { - var a = merge(args, arguments); - return __method.apply(context, a); - } - } - - function bindAsEventListener(context) { - var __method = this, args = slice.call(arguments, 1); - return function(event) { - var a = update([event || window.event], args); - return __method.apply(context, a); - } - } - - function curry() { - if (!arguments.length) return this; - var __method = this, args = slice.call(arguments, 0); - return function() { - var a = merge(args, arguments); - return __method.apply(this, a); - } - } - - function delay(timeout) { - var __method = this, args = slice.call(arguments, 1); - timeout = timeout * 1000; - return window.setTimeout(function() { - return __method.apply(__method, args); - }, timeout); - } - - function defer() { - var args = update([0.01], arguments); - return this.delay.apply(this, args); - } - - function wrap(wrapper) { - var __method = this; - return function() { - var a = update([__method.bind(this)], arguments); - return wrapper.apply(this, a); - } - } - - function methodize() { - if (this._methodized) return this._methodized; - var __method = this; - return this._methodized = function() { - var a = update([this], arguments); - return __method.apply(null, a); - }; - } - - return { - argumentNames: argumentNames, - bind: bind, - bindAsEventListener: bindAsEventListener, - curry: curry, - delay: delay, - defer: defer, - wrap: wrap, - methodize: methodize - } -})()); - - - -(function(proto) { - - - function toISOString() { - return this.getUTCFullYear() + '-' + - (this.getUTCMonth() + 1).toPaddedString(2) + '-' + - this.getUTCDate().toPaddedString(2) + 'T' + - this.getUTCHours().toPaddedString(2) + ':' + - this.getUTCMinutes().toPaddedString(2) + ':' + - this.getUTCSeconds().toPaddedString(2) + 'Z'; - } - - - function toJSON() { - return this.toISOString(); - } - - if (!proto.toISOString) proto.toISOString = toISOString; - if (!proto.toJSON) proto.toJSON = toJSON; - -})(Date.prototype); - - -RegExp.prototype.match = RegExp.prototype.test; - -RegExp.escape = function(str) { - return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); -}; -var PeriodicalExecuter = Class.create({ - initialize: function(callback, frequency) { - this.callback = callback; - this.frequency = frequency; - this.currentlyExecuting = false; - - this.registerCallback(); - }, - - registerCallback: function() { - this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); - }, - - execute: function() { - this.callback(this); - }, - - stop: function() { - if (!this.timer) return; - clearInterval(this.timer); - this.timer = null; - }, - - onTimerEvent: function() { - if (!this.currentlyExecuting) { - try { - this.currentlyExecuting = true; - this.execute(); - this.currentlyExecuting = false; - } catch(e) { - this.currentlyExecuting = false; - throw e; - } - } - } -}); -Object.extend(String, { - interpret: function(value) { - return value == null ? '' : String(value); - }, - specialChar: { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '\\': '\\\\' - } -}); - -Object.extend(String.prototype, (function() { - var NATIVE_JSON_PARSE_SUPPORT = window.JSON && - typeof JSON.parse === 'function' && - JSON.parse('{"test": true}').test; - - function prepareReplacement(replacement) { - if (Object.isFunction(replacement)) return replacement; - var template = new Template(replacement); - return function(match) { return template.evaluate(match) }; - } - - function gsub(pattern, replacement) { - var result = '', source = this, match; - replacement = prepareReplacement(replacement); - - if (Object.isString(pattern)) - pattern = RegExp.escape(pattern); - - if (!(pattern.length || pattern.source)) { - replacement = replacement(''); - return replacement + source.split('').join(replacement) + replacement; - } - - while (source.length > 0) { - if (match = source.match(pattern)) { - result += source.slice(0, match.index); - result += String.interpret(replacement(match)); - source = source.slice(match.index + match[0].length); - } else { - result += source, source = ''; - } - } - return result; - } - - function sub(pattern, replacement, count) { - replacement = prepareReplacement(replacement); - count = Object.isUndefined(count) ? 1 : count; - - return this.gsub(pattern, function(match) { - if (--count < 0) return match[0]; - return replacement(match); - }); - } - - function scan(pattern, iterator) { - this.gsub(pattern, iterator); - return String(this); - } - - function truncate(length, truncation) { - length = length || 30; - truncation = Object.isUndefined(truncation) ? '...' : truncation; - return this.length > length ? - this.slice(0, length - truncation.length) + truncation : String(this); - } - - function strip() { - return this.replace(/^\s+/, '').replace(/\s+$/, ''); - } - - function stripTags() { - return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, ''); - } - - function stripScripts() { - return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); - } - - function extractScripts() { - var matchAll = new RegExp(Prototype.ScriptFragment, 'img'), - matchOne = new RegExp(Prototype.ScriptFragment, 'im'); - return (this.match(matchAll) || []).map(function(scriptTag) { - return (scriptTag.match(matchOne) || ['', ''])[1]; - }); - } - - function evalScripts() { - return this.extractScripts().map(function(script) { return eval(script) }); - } - - function escapeHTML() { - return this.replace(/&/g,'&').replace(//g,'>'); - } - - function unescapeHTML() { - return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&'); - } - - - function toQueryParams(separator) { - var match = this.strip().match(/([^?#]*)(#.*)?$/); - if (!match) return { }; - - return match[1].split(separator || '&').inject({ }, function(hash, pair) { - if ((pair = pair.split('='))[0]) { - var key = decodeURIComponent(pair.shift()), - value = pair.length > 1 ? pair.join('=') : pair[0]; - - if (value != undefined) value = decodeURIComponent(value); - - if (key in hash) { - if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; - hash[key].push(value); - } - else hash[key] = value; - } - return hash; - }); - } - - function toArray() { - return this.split(''); - } - - function succ() { - return this.slice(0, this.length - 1) + - String.fromCharCode(this.charCodeAt(this.length - 1) + 1); - } - - function times(count) { - return count < 1 ? '' : new Array(count + 1).join(this); - } - - function camelize() { - return this.replace(/-+(.)?/g, function(match, chr) { - return chr ? chr.toUpperCase() : ''; - }); - } - - function capitalize() { - return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); - } - - function underscore() { - return this.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/-/g, '_') - .toLowerCase(); - } - - function dasherize() { - return this.replace(/_/g, '-'); - } - - function inspect(useDoubleQuotes) { - var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) { - if (character in String.specialChar) { - return String.specialChar[character]; - } - return '\\u00' + character.charCodeAt().toPaddedString(2, 16); - }); - if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; - return "'" + escapedString.replace(/'/g, '\\\'') + "'"; - } - - function unfilterJSON(filter) { - return this.replace(filter || Prototype.JSONFilter, '$1'); - } - - function isJSON() { - var str = this; - if (str.blank()) return false; - str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); - str = str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); - str = str.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); - return (/^[\],:{}\s]*$/).test(str); - } - - function evalJSON(sanitize) { - var json = this.unfilterJSON(), - cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; - if (cx.test(json)) { - json = json.replace(cx, function (a) { - return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - try { - if (!sanitize || json.isJSON()) return eval('(' + json + ')'); - } catch (e) { } - throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); - } - - function parseJSON() { - var json = this.unfilterJSON(); - return JSON.parse(json); - } - - function include(pattern) { - return this.indexOf(pattern) > -1; - } - - function startsWith(pattern) { - return this.lastIndexOf(pattern, 0) === 0; - } - - function endsWith(pattern) { - var d = this.length - pattern.length; - return d >= 0 && this.indexOf(pattern, d) === d; - } - - function empty() { - return this == ''; - } - - function blank() { - return /^\s*$/.test(this); - } - - function interpolate(object, pattern) { - return new Template(this, pattern).evaluate(object); - } - - return { - gsub: gsub, - sub: sub, - scan: scan, - truncate: truncate, - strip: String.prototype.trim || strip, - stripTags: stripTags, - stripScripts: stripScripts, - extractScripts: extractScripts, - evalScripts: evalScripts, - escapeHTML: escapeHTML, - unescapeHTML: unescapeHTML, - toQueryParams: toQueryParams, - parseQuery: toQueryParams, - toArray: toArray, - succ: succ, - times: times, - camelize: camelize, - capitalize: capitalize, - underscore: underscore, - dasherize: dasherize, - inspect: inspect, - unfilterJSON: unfilterJSON, - isJSON: isJSON, - evalJSON: NATIVE_JSON_PARSE_SUPPORT ? parseJSON : evalJSON, - include: include, - startsWith: startsWith, - endsWith: endsWith, - empty: empty, - blank: blank, - interpolate: interpolate - }; -})()); - -var Template = Class.create({ - initialize: function(template, pattern) { - this.template = template.toString(); - this.pattern = pattern || Template.Pattern; - }, - - evaluate: function(object) { - if (object && Object.isFunction(object.toTemplateReplacements)) - object = object.toTemplateReplacements(); - - return this.template.gsub(this.pattern, function(match) { - if (object == null) return (match[1] + ''); - - var before = match[1] || ''; - if (before == '\\') return match[2]; - - var ctx = object, expr = match[3], - pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/; - - match = pattern.exec(expr); - if (match == null) return before; - - while (match != null) { - var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1]; - ctx = ctx[comp]; - if (null == ctx || '' == match[3]) break; - expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); - match = pattern.exec(expr); - } - - return before + String.interpret(ctx); - }); - } -}); -Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; - -var $break = { }; - -var Enumerable = (function() { - function each(iterator, context) { - var index = 0; - try { - this._each(function(value) { - iterator.call(context, value, index++); - }); - } catch (e) { - if (e != $break) throw e; - } - return this; - } - - function eachSlice(number, iterator, context) { - var index = -number, slices = [], array = this.toArray(); - if (number < 1) return array; - while ((index += number) < array.length) - slices.push(array.slice(index, index+number)); - return slices.collect(iterator, context); - } - - function all(iterator, context) { - iterator = iterator || Prototype.K; - var result = true; - this.each(function(value, index) { - result = result && !!iterator.call(context, value, index); - if (!result) throw $break; - }); - return result; - } - - function any(iterator, context) { - iterator = iterator || Prototype.K; - var result = false; - this.each(function(value, index) { - if (result = !!iterator.call(context, value, index)) - throw $break; - }); - return result; - } - - function collect(iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - this.each(function(value, index) { - results.push(iterator.call(context, value, index)); - }); - return results; - } - - function detect(iterator, context) { - var result; - this.each(function(value, index) { - if (iterator.call(context, value, index)) { - result = value; - throw $break; - } - }); - return result; - } - - function findAll(iterator, context) { - var results = []; - this.each(function(value, index) { - if (iterator.call(context, value, index)) - results.push(value); - }); - return results; - } - - function grep(filter, iterator, context) { - iterator = iterator || Prototype.K; - var results = []; - - if (Object.isString(filter)) - filter = new RegExp(RegExp.escape(filter)); - - this.each(function(value, index) { - if (filter.match(value)) - results.push(iterator.call(context, value, index)); - }); - return results; - } - - function include(object) { - if (Object.isFunction(this.indexOf)) - if (this.indexOf(object) != -1) return true; - - var found = false; - this.each(function(value) { - if (value == object) { - found = true; - throw $break; - } - }); - return found; - } - - function inGroupsOf(number, fillWith) { - fillWith = Object.isUndefined(fillWith) ? null : fillWith; - return this.eachSlice(number, function(slice) { - while(slice.length < number) slice.push(fillWith); - return slice; - }); - } - - function inject(memo, iterator, context) { - this.each(function(value, index) { - memo = iterator.call(context, memo, value, index); - }); - return memo; - } - - function invoke(method) { - var args = $A(arguments).slice(1); - return this.map(function(value) { - return value[method].apply(value, args); - }); - } - - function max(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value >= result) - result = value; - }); - return result; - } - - function min(iterator, context) { - iterator = iterator || Prototype.K; - var result; - this.each(function(value, index) { - value = iterator.call(context, value, index); - if (result == null || value < result) - result = value; - }); - return result; - } - - function partition(iterator, context) { - iterator = iterator || Prototype.K; - var trues = [], falses = []; - this.each(function(value, index) { - (iterator.call(context, value, index) ? - trues : falses).push(value); - }); - return [trues, falses]; - } - - function pluck(property) { - var results = []; - this.each(function(value) { - results.push(value[property]); - }); - return results; - } - - function reject(iterator, context) { - var results = []; - this.each(function(value, index) { - if (!iterator.call(context, value, index)) - results.push(value); - }); - return results; - } - - function sortBy(iterator, context) { - return this.map(function(value, index) { - return { - value: value, - criteria: iterator.call(context, value, index) - }; - }).sort(function(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }).pluck('value'); - } - - function toArray() { - return this.map(); - } - - function zip() { - var iterator = Prototype.K, args = $A(arguments); - if (Object.isFunction(args.last())) - iterator = args.pop(); - - var collections = [this].concat(args).map($A); - return this.map(function(value, index) { - return iterator(collections.pluck(index)); - }); - } - - function size() { - return this.toArray().length; - } - - function inspect() { - return '#'; - } - - - - - - - - - - return { - each: each, - eachSlice: eachSlice, - all: all, - every: all, - any: any, - some: any, - collect: collect, - map: collect, - detect: detect, - findAll: findAll, - select: findAll, - filter: findAll, - grep: grep, - include: include, - member: include, - inGroupsOf: inGroupsOf, - inject: inject, - invoke: invoke, - max: max, - min: min, - partition: partition, - pluck: pluck, - reject: reject, - sortBy: sortBy, - toArray: toArray, - entries: toArray, - zip: zip, - size: size, - inspect: inspect, - find: detect - }; -})(); - -function $A(iterable) { - if (!iterable) return []; - if ('toArray' in Object(iterable)) return iterable.toArray(); - var length = iterable.length || 0, results = new Array(length); - while (length--) results[length] = iterable[length]; - return results; -} - - -function $w(string) { - if (!Object.isString(string)) return []; - string = string.strip(); - return string ? string.split(/\s+/) : []; -} - -Array.from = $A; - - -(function() { - var arrayProto = Array.prototype, - slice = arrayProto.slice, - _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available - - function each(iterator) { - for (var i = 0, length = this.length; i < length; i++) - iterator(this[i]); - } - if (!_each) _each = each; - - function clear() { - this.length = 0; - return this; - } - - function first() { - return this[0]; - } - - function last() { - return this[this.length - 1]; - } - - function compact() { - return this.select(function(value) { - return value != null; - }); - } - - function flatten() { - return this.inject([], function(array, value) { - if (Object.isArray(value)) - return array.concat(value.flatten()); - array.push(value); - return array; - }); - } - - function without() { - var values = slice.call(arguments, 0); - return this.select(function(value) { - return !values.include(value); - }); - } - - function reverse(inline) { - return (inline === false ? this.toArray() : this)._reverse(); - } - - function uniq(sorted) { - return this.inject([], function(array, value, index) { - if (0 == index || (sorted ? array.last() != value : !array.include(value))) - array.push(value); - return array; - }); - } - - function intersect(array) { - return this.uniq().findAll(function(item) { - return array.detect(function(value) { return item === value }); - }); - } - - - function clone() { - return slice.call(this, 0); - } - - function size() { - return this.length; - } - - function inspect() { - return '[' + this.map(Object.inspect).join(', ') + ']'; - } - - function indexOf(item, i) { - i || (i = 0); - var length = this.length; - if (i < 0) i = length + i; - for (; i < length; i++) - if (this[i] === item) return i; - return -1; - } - - function lastIndexOf(item, i) { - i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; - var n = this.slice(0, i).reverse().indexOf(item); - return (n < 0) ? n : i - n - 1; - } - - function concat() { - var array = slice.call(this, 0), item; - for (var i = 0, length = arguments.length; i < length; i++) { - item = arguments[i]; - if (Object.isArray(item) && !('callee' in item)) { - for (var j = 0, arrayLength = item.length; j < arrayLength; j++) - array.push(item[j]); - } else { - array.push(item); - } - } - return array; - } - - Object.extend(arrayProto, Enumerable); - - if (!arrayProto._reverse) - arrayProto._reverse = arrayProto.reverse; - - Object.extend(arrayProto, { - _each: _each, - clear: clear, - first: first, - last: last, - compact: compact, - flatten: flatten, - without: without, - reverse: reverse, - uniq: uniq, - intersect: intersect, - clone: clone, - toArray: clone, - size: size, - inspect: inspect - }); - - var CONCAT_ARGUMENTS_BUGGY = (function() { - return [].concat(arguments)[0][0] !== 1; - })(1,2) - - if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat; - - if (!arrayProto.indexOf) arrayProto.indexOf = indexOf; - if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf; -})(); -function $H(object) { - return new Hash(object); -}; - -var Hash = Class.create(Enumerable, (function() { - function initialize(object) { - this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); - } - - - function _each(iterator) { - for (var key in this._object) { - var value = this._object[key], pair = [key, value]; - pair.key = key; - pair.value = value; - iterator(pair); - } - } - - function set(key, value) { - return this._object[key] = value; - } - - function get(key) { - if (this._object[key] !== Object.prototype[key]) - return this._object[key]; - } - - function unset(key) { - var value = this._object[key]; - delete this._object[key]; - return value; - } - - function toObject() { - return Object.clone(this._object); - } - - - - function keys() { - return this.pluck('key'); - } - - function values() { - return this.pluck('value'); - } - - function index(value) { - var match = this.detect(function(pair) { - return pair.value === value; - }); - return match && match.key; - } - - function merge(object) { - return this.clone().update(object); - } - - function update(object) { - return new Hash(object).inject(this, function(result, pair) { - result.set(pair.key, pair.value); - return result; - }); - } - - function toQueryPair(key, value) { - if (Object.isUndefined(value)) return key; - return key + '=' + encodeURIComponent(String.interpret(value)); - } - - function toQueryString() { - return this.inject([], function(results, pair) { - var key = encodeURIComponent(pair.key), values = pair.value; - - if (values && typeof values == 'object') { - if (Object.isArray(values)) - return results.concat(values.map(toQueryPair.curry(key))); - } else results.push(toQueryPair(key, values)); - return results; - }).join('&'); - } - - function inspect() { - return '#'; - } - - function clone() { - return new Hash(this); - } - - return { - initialize: initialize, - _each: _each, - set: set, - get: get, - unset: unset, - toObject: toObject, - toTemplateReplacements: toObject, - keys: keys, - values: values, - index: index, - merge: merge, - update: update, - toQueryString: toQueryString, - inspect: inspect, - toJSON: toObject, - clone: clone - }; -})()); - -Hash.from = $H; -Object.extend(Number.prototype, (function() { - function toColorPart() { - return this.toPaddedString(2, 16); - } - - function succ() { - return this + 1; - } - - function times(iterator, context) { - $R(0, this, true).each(iterator, context); - return this; - } - - function toPaddedString(length, radix) { - var string = this.toString(radix || 10); - return '0'.times(length - string.length) + string; - } - - function abs() { - return Math.abs(this); - } - - function round() { - return Math.round(this); - } - - function ceil() { - return Math.ceil(this); - } - - function floor() { - return Math.floor(this); - } - - return { - toColorPart: toColorPart, - succ: succ, - times: times, - toPaddedString: toPaddedString, - abs: abs, - round: round, - ceil: ceil, - floor: floor - }; -})()); - -function $R(start, end, exclusive) { - return new ObjectRange(start, end, exclusive); -} - -var ObjectRange = Class.create(Enumerable, (function() { - function initialize(start, end, exclusive) { - this.start = start; - this.end = end; - this.exclusive = exclusive; - } - - function _each(iterator) { - var value = this.start; - while (this.include(value)) { - iterator(value); - value = value.succ(); - } - } - - function include(value) { - if (value < this.start) - return false; - if (this.exclusive) - return value < this.end; - return value <= this.end; - } - - return { - initialize: initialize, - _each: _each, - include: include - }; -})()); - - - -var Ajax = { - getTransport: function() { - return Try.these( - function() {return new XMLHttpRequest()}, - function() {return new ActiveXObject('Msxml2.XMLHTTP')}, - function() {return new ActiveXObject('Microsoft.XMLHTTP')} - ) || false; - }, - - activeRequestCount: 0 -}; - -Ajax.Responders = { - responders: [], - - _each: function(iterator) { - this.responders._each(iterator); - }, - - register: function(responder) { - if (!this.include(responder)) - this.responders.push(responder); - }, - - unregister: function(responder) { - this.responders = this.responders.without(responder); - }, - - dispatch: function(callback, request, transport, json) { - this.each(function(responder) { - if (Object.isFunction(responder[callback])) { - try { - responder[callback].apply(responder, [request, transport, json]); - } catch (e) { } - } - }); - } -}; - -Object.extend(Ajax.Responders, Enumerable); - -Ajax.Responders.register({ - onCreate: function() { Ajax.activeRequestCount++ }, - onComplete: function() { Ajax.activeRequestCount-- } -}); -Ajax.Base = Class.create({ - initialize: function(options) { - this.options = { - method: 'post', - asynchronous: true, - contentType: 'application/x-www-form-urlencoded', - encoding: 'UTF-8', - parameters: '', - evalJSON: true, - evalJS: true - }; - Object.extend(this.options, options || { }); - - this.options.method = this.options.method.toLowerCase(); - - if (Object.isString(this.options.parameters)) - this.options.parameters = this.options.parameters.toQueryParams(); - else if (Object.isHash(this.options.parameters)) - this.options.parameters = this.options.parameters.toObject(); - } -}); -Ajax.Request = Class.create(Ajax.Base, { - _complete: false, - - initialize: function($super, url, options) { - $super(options); - this.transport = Ajax.getTransport(); - this.request(url); - }, - - request: function(url) { - this.url = url; - this.method = this.options.method; - var params = Object.clone(this.options.parameters); - - if (!['get', 'post'].include(this.method)) { - params['_method'] = this.method; - this.method = 'post'; - } - - this.parameters = params; - - if (params = Object.toQueryString(params)) { - if (this.method == 'get') - this.url += (this.url.include('?') ? '&' : '?') + params; - else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) - params += '&_='; - } - - try { - var response = new Ajax.Response(this); - if (this.options.onCreate) this.options.onCreate(response); - Ajax.Responders.dispatch('onCreate', this, response); - - this.transport.open(this.method.toUpperCase(), this.url, - this.options.asynchronous); - - if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); - - this.transport.onreadystatechange = this.onStateChange.bind(this); - this.setRequestHeaders(); - - this.body = this.method == 'post' ? (this.options.postBody || params) : null; - this.transport.send(this.body); - - /* Force Firefox to handle ready state 4 for synchronous requests */ - if (!this.options.asynchronous && this.transport.overrideMimeType) - this.onStateChange(); - - } - catch (e) { - this.dispatchException(e); - } - }, - - onStateChange: function() { - var readyState = this.transport.readyState; - if (readyState > 1 && !((readyState == 4) && this._complete)) - this.respondToReadyState(this.transport.readyState); - }, - - setRequestHeaders: function() { - var headers = { - 'X-Requested-With': 'XMLHttpRequest', - 'X-Prototype-Version': Prototype.Version, - 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' - }; - - if (this.method == 'post') { - headers['Content-type'] = this.options.contentType + - (this.options.encoding ? '; charset=' + this.options.encoding : ''); - - /* Force "Connection: close" for older Mozilla browsers to work - * around a bug where XMLHttpRequest sends an incorrect - * Content-length header. See Mozilla Bugzilla #246651. - */ - if (this.transport.overrideMimeType && - (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) - headers['Connection'] = 'close'; - } - - if (typeof this.options.requestHeaders == 'object') { - var extras = this.options.requestHeaders; - - if (Object.isFunction(extras.push)) - for (var i = 0, length = extras.length; i < length; i += 2) - headers[extras[i]] = extras[i+1]; - else - $H(extras).each(function(pair) { headers[pair.key] = pair.value }); - } - - for (var name in headers) - this.transport.setRequestHeader(name, headers[name]); - }, - - success: function() { - var status = this.getStatus(); - return !status || (status >= 200 && status < 300); - }, - - getStatus: function() { - try { - return this.transport.status || 0; - } catch (e) { return 0 } - }, - - respondToReadyState: function(readyState) { - var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); - - if (state == 'Complete') { - try { - this._complete = true; - (this.options['on' + response.status] - || this.options['on' + (this.success() ? 'Success' : 'Failure')] - || Prototype.emptyFunction)(response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - var contentType = response.getHeader('Content-type'); - if (this.options.evalJS == 'force' - || (this.options.evalJS && this.isSameOrigin() && contentType - && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) - this.evalResponse(); - } - - try { - (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); - Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); - } catch (e) { - this.dispatchException(e); - } - - if (state == 'Complete') { - this.transport.onreadystatechange = Prototype.emptyFunction; - } - }, - - isSameOrigin: function() { - var m = this.url.match(/^\s*https?:\/\/[^\/]*/); - return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({ - protocol: location.protocol, - domain: document.domain, - port: location.port ? ':' + location.port : '' - })); - }, - - getHeader: function(name) { - try { - return this.transport.getResponseHeader(name) || null; - } catch (e) { return null; } - }, - - evalResponse: function() { - try { - return eval((this.transport.responseText || '').unfilterJSON()); - } catch (e) { - this.dispatchException(e); - } - }, - - dispatchException: function(exception) { - (this.options.onException || Prototype.emptyFunction)(this, exception); - Ajax.Responders.dispatch('onException', this, exception); - } -}); - -Ajax.Request.Events = - ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; - - - - - - - - -Ajax.Response = Class.create({ - initialize: function(request){ - this.request = request; - var transport = this.transport = request.transport, - readyState = this.readyState = transport.readyState; - - if ((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { - this.status = this.getStatus(); - this.statusText = this.getStatusText(); - this.responseText = String.interpret(transport.responseText); - this.headerJSON = this._getHeaderJSON(); - } - - if (readyState == 4) { - var xml = transport.responseXML; - this.responseXML = Object.isUndefined(xml) ? null : xml; - this.responseJSON = this._getResponseJSON(); - } - }, - - status: 0, - - statusText: '', - - getStatus: Ajax.Request.prototype.getStatus, - - getStatusText: function() { - try { - return this.transport.statusText || ''; - } catch (e) { return '' } - }, - - getHeader: Ajax.Request.prototype.getHeader, - - getAllHeaders: function() { - try { - return this.getAllResponseHeaders(); - } catch (e) { return null } - }, - - getResponseHeader: function(name) { - return this.transport.getResponseHeader(name); - }, - - getAllResponseHeaders: function() { - return this.transport.getAllResponseHeaders(); - }, - - _getHeaderJSON: function() { - var json = this.getHeader('X-JSON'); - if (!json) return null; - json = decodeURIComponent(escape(json)); - try { - return json.evalJSON(this.request.options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - }, - - _getResponseJSON: function() { - var options = this.request.options; - if (!options.evalJSON || (options.evalJSON != 'force' && - !(this.getHeader('Content-type') || '').include('application/json')) || - this.responseText.blank()) - return null; - try { - return this.responseText.evalJSON(options.sanitizeJSON || - !this.request.isSameOrigin()); - } catch (e) { - this.request.dispatchException(e); - } - } -}); - -Ajax.Updater = Class.create(Ajax.Request, { - initialize: function($super, container, url, options) { - this.container = { - success: (container.success || container), - failure: (container.failure || (container.success ? null : container)) - }; - - options = Object.clone(options); - var onComplete = options.onComplete; - options.onComplete = (function(response, json) { - this.updateContent(response.responseText); - if (Object.isFunction(onComplete)) onComplete(response, json); - }).bind(this); - - $super(url, options); - }, - - updateContent: function(responseText) { - var receiver = this.container[this.success() ? 'success' : 'failure'], - options = this.options; - - if (!options.evalScripts) responseText = responseText.stripScripts(); - - if (receiver = $(receiver)) { - if (options.insertion) { - if (Object.isString(options.insertion)) { - var insertion = { }; insertion[options.insertion] = responseText; - receiver.insert(insertion); - } - else options.insertion(receiver, responseText); - } - else receiver.update(responseText); - } - } -}); - -Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { - initialize: function($super, container, url, options) { - $super(options); - this.onComplete = this.options.onComplete; - - this.frequency = (this.options.frequency || 2); - this.decay = (this.options.decay || 1); - - this.updater = { }; - this.container = container; - this.url = url; - - this.start(); - }, - - start: function() { - this.options.onComplete = this.updateComplete.bind(this); - this.onTimerEvent(); - }, - - stop: function() { - this.updater.options.onComplete = undefined; - clearTimeout(this.timer); - (this.onComplete || Prototype.emptyFunction).apply(this, arguments); - }, - - updateComplete: function(response) { - if (this.options.decay) { - this.decay = (response.responseText == this.lastText ? - this.decay * this.options.decay : 1); - - this.lastText = response.responseText; - } - this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); - }, - - onTimerEvent: function() { - this.updater = new Ajax.Updater(this.container, this.url, this.options); - } -}); - - -function $(element) { - if (arguments.length > 1) { - for (var i = 0, elements = [], length = arguments.length; i < length; i++) - elements.push($(arguments[i])); - return elements; - } - if (Object.isString(element)) - element = document.getElementById(element); - return Element.extend(element); -} - -if (Prototype.BrowserFeatures.XPath) { - document._getElementsByXPath = function(expression, parentElement) { - var results = []; - var query = document.evaluate(expression, $(parentElement) || document, - null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); - for (var i = 0, length = query.snapshotLength; i < length; i++) - results.push(Element.extend(query.snapshotItem(i))); - return results; - }; -} - -/*--------------------------------------------------------------------------*/ - -if (!Node) var Node = { }; - -if (!Node.ELEMENT_NODE) { - Object.extend(Node, { - ELEMENT_NODE: 1, - ATTRIBUTE_NODE: 2, - TEXT_NODE: 3, - CDATA_SECTION_NODE: 4, - ENTITY_REFERENCE_NODE: 5, - ENTITY_NODE: 6, - PROCESSING_INSTRUCTION_NODE: 7, - COMMENT_NODE: 8, - DOCUMENT_NODE: 9, - DOCUMENT_TYPE_NODE: 10, - DOCUMENT_FRAGMENT_NODE: 11, - NOTATION_NODE: 12 - }); -} - - - -(function(global) { - - var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){ - try { - var el = document.createElement(''); - return el.tagName.toLowerCase() === 'input' && el.name === 'x'; - } - catch(err) { - return false; - } - })(); - - var element = global.Element; - - global.Element = function(tagName, attributes) { - attributes = attributes || { }; - tagName = tagName.toLowerCase(); - var cache = Element.cache; - if (HAS_EXTENDED_CREATE_ELEMENT_SYNTAX && attributes.name) { - tagName = '<' + tagName + ' name="' + attributes.name + '">'; - delete attributes.name; - return Element.writeAttribute(document.createElement(tagName), attributes); - } - if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); - return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); - }; - - Object.extend(global.Element, element || { }); - if (element) global.Element.prototype = element.prototype; - -})(this); - -Element.idCounter = 1; -Element.cache = { }; - -function purgeElement(element) { - var uid = element._prototypeUID; - if (uid) { - Element.stopObserving(element); - element._prototypeUID = void 0; - delete Element.Storage[uid]; - } -} - -Element.Methods = { - visible: function(element) { - return $(element).style.display != 'none'; - }, - - toggle: function(element) { - element = $(element); - Element[Element.visible(element) ? 'hide' : 'show'](element); - return element; - }, - - hide: function(element) { - element = $(element); - element.style.display = 'none'; - return element; - }, - - show: function(element) { - element = $(element); - element.style.display = ''; - return element; - }, - - remove: function(element) { - element = $(element); - element.parentNode.removeChild(element); - return element; - }, - - update: (function(){ - - var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){ - var el = document.createElement("select"), - isBuggy = true; - el.innerHTML = ""; - if (el.options && el.options[0]) { - isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION"; - } - el = null; - return isBuggy; - })(); - - var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){ - try { - var el = document.createElement("table"); - if (el && el.tBodies) { - el.innerHTML = "
      "; - var isBuggy = typeof el.tBodies[0] == "undefined"; - el = null; - return isBuggy; - } - } catch (e) { - return true; - } - })(); - - var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () { - var s = document.createElement("script"), - isBuggy = false; - try { - s.appendChild(document.createTextNode("")); - isBuggy = !s.firstChild || - s.firstChild && s.firstChild.nodeType !== 3; - } catch (e) { - isBuggy = true; - } - s = null; - return isBuggy; - })(); - - function update(element, content) { - element = $(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - while (i--) purgeElement(descendants[i]); - - if (content && content.toElement) - content = content.toElement(); - - if (Object.isElement(content)) - return element.update().insert(content); - - content = Object.toHTML(content); - - var tagName = element.tagName.toUpperCase(); - - if (tagName === 'SCRIPT' && SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) { - element.text = content; - return element; - } - - if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) { - if (tagName in Element._insertionTranslations.tags) { - while (element.firstChild) { - element.removeChild(element.firstChild); - } - Element._getContentFromAnonymousElement(tagName, content.stripScripts()) - .each(function(node) { - element.appendChild(node) - }); - } - else { - element.innerHTML = content.stripScripts(); - } - } - else { - element.innerHTML = content.stripScripts(); - } - - content.evalScripts.bind(content).defer(); - return element; - } - - return update; - })(), - - replace: function(element, content) { - element = $(element); - if (content && content.toElement) content = content.toElement(); - else if (!Object.isElement(content)) { - content = Object.toHTML(content); - var range = element.ownerDocument.createRange(); - range.selectNode(element); - content.evalScripts.bind(content).defer(); - content = range.createContextualFragment(content.stripScripts()); - } - element.parentNode.replaceChild(content, element); - return element; - }, - - insert: function(element, insertions) { - element = $(element); - - if (Object.isString(insertions) || Object.isNumber(insertions) || - Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) - insertions = {bottom:insertions}; - - var content, insert, tagName, childNodes; - - for (var position in insertions) { - content = insertions[position]; - position = position.toLowerCase(); - insert = Element._insertionTranslations[position]; - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - insert(element, content); - continue; - } - - content = Object.toHTML(content); - - tagName = ((position == 'before' || position == 'after') - ? element.parentNode : element).tagName.toUpperCase(); - - childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - - if (position == 'top' || position == 'after') childNodes.reverse(); - childNodes.each(insert.curry(element)); - - content.evalScripts.bind(content).defer(); - } - - return element; - }, - - wrap: function(element, wrapper, attributes) { - element = $(element); - if (Object.isElement(wrapper)) - $(wrapper).writeAttribute(attributes || { }); - else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); - else wrapper = new Element('div', wrapper); - if (element.parentNode) - element.parentNode.replaceChild(wrapper, element); - wrapper.appendChild(element); - return wrapper; - }, - - inspect: function(element) { - element = $(element); - var result = '<' + element.tagName.toLowerCase(); - $H({'id': 'id', 'className': 'class'}).each(function(pair) { - var property = pair.first(), - attribute = pair.last(), - value = (element[property] || '').toString(); - if (value) result += ' ' + attribute + '=' + value.inspect(true); - }); - return result + '>'; - }, - - recursivelyCollect: function(element, property, maximumLength) { - element = $(element); - maximumLength = maximumLength || -1; - var elements = []; - - while (element = element[property]) { - if (element.nodeType == 1) - elements.push(Element.extend(element)); - if (elements.length == maximumLength) - break; - } - - return elements; - }, - - ancestors: function(element) { - return Element.recursivelyCollect(element, 'parentNode'); - }, - - descendants: function(element) { - return Element.select(element, "*"); - }, - - firstDescendant: function(element) { - element = $(element).firstChild; - while (element && element.nodeType != 1) element = element.nextSibling; - return $(element); - }, - - immediateDescendants: function(element) { - var results = [], child = $(element).firstChild; - while (child) { - if (child.nodeType === 1) { - results.push(Element.extend(child)); - } - child = child.nextSibling; - } - return results; - }, - - previousSiblings: function(element, maximumLength) { - return Element.recursivelyCollect(element, 'previousSibling'); - }, - - nextSiblings: function(element) { - return Element.recursivelyCollect(element, 'nextSibling'); - }, - - siblings: function(element) { - element = $(element); - return Element.previousSiblings(element).reverse() - .concat(Element.nextSiblings(element)); - }, - - match: function(element, selector) { - element = $(element); - if (Object.isString(selector)) - return Prototype.Selector.match(element, selector); - return selector.match(element); - }, - - up: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return $(element.parentNode); - var ancestors = Element.ancestors(element); - return Object.isNumber(expression) ? ancestors[expression] : - Prototype.Selector.find(ancestors, expression, index); - }, - - down: function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return Element.firstDescendant(element); - return Object.isNumber(expression) ? Element.descendants(element)[expression] : - Element.select(element, expression)[index || 0]; - }, - - previous: function(element, expression, index) { - element = $(element); - if (Object.isNumber(expression)) index = expression, expression = false; - if (!Object.isNumber(index)) index = 0; - - if (expression) { - return Prototype.Selector.find(element.previousSiblings(), expression, index); - } else { - return element.recursivelyCollect("previousSibling", index + 1)[index]; - } - }, - - next: function(element, expression, index) { - element = $(element); - if (Object.isNumber(expression)) index = expression, expression = false; - if (!Object.isNumber(index)) index = 0; - - if (expression) { - return Prototype.Selector.find(element.nextSiblings(), expression, index); - } else { - var maximumLength = Object.isNumber(index) ? index + 1 : 1; - return element.recursivelyCollect("nextSibling", index + 1)[index]; - } - }, - - - select: function(element) { - element = $(element); - var expressions = Array.prototype.slice.call(arguments, 1).join(', '); - return Prototype.Selector.select(expressions, element); - }, - - adjacent: function(element) { - element = $(element); - var expressions = Array.prototype.slice.call(arguments, 1).join(', '); - return Prototype.Selector.select(expressions, element.parentNode).without(element); - }, - - identify: function(element) { - element = $(element); - var id = Element.readAttribute(element, 'id'); - if (id) return id; - do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id)); - Element.writeAttribute(element, 'id', id); - return id; - }, - - readAttribute: function(element, name) { - element = $(element); - if (Prototype.Browser.IE) { - var t = Element._attributeTranslations.read; - if (t.values[name]) return t.values[name](element, name); - if (t.names[name]) name = t.names[name]; - if (name.include(':')) { - return (!element.attributes || !element.attributes[name]) ? null : - element.attributes[name].value; - } - } - return element.getAttribute(name); - }, - - writeAttribute: function(element, name, value) { - element = $(element); - var attributes = { }, t = Element._attributeTranslations.write; - - if (typeof name == 'object') attributes = name; - else attributes[name] = Object.isUndefined(value) ? true : value; - - for (var attr in attributes) { - name = t.names[attr] || attr; - value = attributes[attr]; - if (t.values[attr]) name = t.values[attr](element, value); - if (value === false || value === null) - element.removeAttribute(name); - else if (value === true) - element.setAttribute(name, name); - else element.setAttribute(name, value); - } - return element; - }, - - getHeight: function(element) { - return Element.getDimensions(element).height; - }, - - getWidth: function(element) { - return Element.getDimensions(element).width; - }, - - classNames: function(element) { - return new Element.ClassNames(element); - }, - - hasClassName: function(element, className) { - if (!(element = $(element))) return; - var elementClassName = element.className; - return (elementClassName.length > 0 && (elementClassName == className || - new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); - }, - - addClassName: function(element, className) { - if (!(element = $(element))) return; - if (!Element.hasClassName(element, className)) - element.className += (element.className ? ' ' : '') + className; - return element; - }, - - removeClassName: function(element, className) { - if (!(element = $(element))) return; - element.className = element.className.replace( - new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); - return element; - }, - - toggleClassName: function(element, className) { - if (!(element = $(element))) return; - return Element[Element.hasClassName(element, className) ? - 'removeClassName' : 'addClassName'](element, className); - }, - - cleanWhitespace: function(element) { - element = $(element); - var node = element.firstChild; - while (node) { - var nextNode = node.nextSibling; - if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) - element.removeChild(node); - node = nextNode; - } - return element; - }, - - empty: function(element) { - return $(element).innerHTML.blank(); - }, - - descendantOf: function(element, ancestor) { - element = $(element), ancestor = $(ancestor); - - if (element.compareDocumentPosition) - return (element.compareDocumentPosition(ancestor) & 8) === 8; - - if (ancestor.contains) - return ancestor.contains(element) && ancestor !== element; - - while (element = element.parentNode) - if (element == ancestor) return true; - - return false; - }, - - scrollTo: function(element) { - element = $(element); - var pos = Element.cumulativeOffset(element); - window.scrollTo(pos[0], pos[1]); - return element; - }, - - getStyle: function(element, style) { - element = $(element); - style = style == 'float' ? 'cssFloat' : style.camelize(); - var value = element.style[style]; - if (!value || value == 'auto') { - var css = document.defaultView.getComputedStyle(element, null); - value = css ? css[style] : null; - } - if (style == 'opacity') return value ? parseFloat(value) : 1.0; - return value == 'auto' ? null : value; - }, - - getOpacity: function(element) { - return $(element).getStyle('opacity'); - }, - - setStyle: function(element, styles) { - element = $(element); - var elementStyle = element.style, match; - if (Object.isString(styles)) { - element.style.cssText += ';' + styles; - return styles.include('opacity') ? - element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; - } - for (var property in styles) - if (property == 'opacity') element.setOpacity(styles[property]); - else - elementStyle[(property == 'float' || property == 'cssFloat') ? - (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') : - property] = styles[property]; - - return element; - }, - - setOpacity: function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - return element; - }, - - makePositioned: function(element) { - element = $(element); - var pos = Element.getStyle(element, 'position'); - if (pos == 'static' || !pos) { - element._madePositioned = true; - element.style.position = 'relative'; - if (Prototype.Browser.Opera) { - element.style.top = 0; - element.style.left = 0; - } - } - return element; - }, - - undoPositioned: function(element) { - element = $(element); - if (element._madePositioned) { - element._madePositioned = undefined; - element.style.position = - element.style.top = - element.style.left = - element.style.bottom = - element.style.right = ''; - } - return element; - }, - - makeClipping: function(element) { - element = $(element); - if (element._overflow) return element; - element._overflow = Element.getStyle(element, 'overflow') || 'auto'; - if (element._overflow !== 'hidden') - element.style.overflow = 'hidden'; - return element; - }, - - undoClipping: function(element) { - element = $(element); - if (!element._overflow) return element; - element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; - element._overflow = null; - return element; - }, - - cumulativeOffset: function(element) { - var valueT = 0, valueL = 0; - if (element.parentNode) { - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - } - return Element._returnOffset(valueL, valueT); - }, - - positionedOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (element.tagName.toUpperCase() == 'BODY') break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - absolutize: function(element) { - element = $(element); - if (Element.getStyle(element, 'position') == 'absolute') return element; - - var offsets = Element.positionedOffset(element), - top = offsets[1], - left = offsets[0], - width = element.clientWidth, - height = element.clientHeight; - - element._originalLeft = left - parseFloat(element.style.left || 0); - element._originalTop = top - parseFloat(element.style.top || 0); - element._originalWidth = element.style.width; - element._originalHeight = element.style.height; - - element.style.position = 'absolute'; - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.width = width + 'px'; - element.style.height = height + 'px'; - return element; - }, - - relativize: function(element) { - element = $(element); - if (Element.getStyle(element, 'position') == 'relative') return element; - - element.style.position = 'relative'; - var top = parseFloat(element.style.top || 0) - (element._originalTop || 0), - left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); - - element.style.top = top + 'px'; - element.style.left = left + 'px'; - element.style.height = element._originalHeight; - element.style.width = element._originalWidth; - return element; - }, - - cumulativeScrollOffset: function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return Element._returnOffset(valueL, valueT); - }, - - getOffsetParent: function(element) { - if (element.offsetParent) return $(element.offsetParent); - if (element == document.body) return $(element); - - while ((element = element.parentNode) && element != document.body) - if (Element.getStyle(element, 'position') != 'static') - return $(element); - - return $(document.body); - }, - - viewportOffset: function(forElement) { - var valueT = 0, - valueL = 0, - element = forElement; - - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - - if (element.offsetParent == document.body && - Element.getStyle(element, 'position') == 'absolute') break; - - } while (element = element.offsetParent); - - element = forElement; - do { - if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - - return Element._returnOffset(valueL, valueT); - }, - - clonePosition: function(element, source) { - var options = Object.extend({ - setLeft: true, - setTop: true, - setWidth: true, - setHeight: true, - offsetTop: 0, - offsetLeft: 0 - }, arguments[2] || { }); - - source = $(source); - var p = Element.viewportOffset(source), delta = [0, 0], parent = null; - - element = $(element); - - if (Element.getStyle(element, 'position') == 'absolute') { - parent = Element.getOffsetParent(element); - delta = Element.viewportOffset(parent); - } - - if (parent == document.body) { - delta[0] -= document.body.offsetLeft; - delta[1] -= document.body.offsetTop; - } - - if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; - if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; - if (options.setWidth) element.style.width = source.offsetWidth + 'px'; - if (options.setHeight) element.style.height = source.offsetHeight + 'px'; - return element; - } -}; - -Object.extend(Element.Methods, { - getElementsBySelector: Element.Methods.select, - - childElements: Element.Methods.immediateDescendants -}); - -Element._attributeTranslations = { - write: { - names: { - className: 'class', - htmlFor: 'for' - }, - values: { } - } -}; - -if (Prototype.Browser.Opera) { - Element.Methods.getStyle = Element.Methods.getStyle.wrap( - function(proceed, element, style) { - switch (style) { - case 'left': case 'top': case 'right': case 'bottom': - if (proceed(element, 'position') === 'static') return null; - case 'height': case 'width': - if (!Element.visible(element)) return null; - - var dim = parseInt(proceed(element, style), 10); - - if (dim !== element['offset' + style.capitalize()]) - return dim + 'px'; - - var properties; - if (style === 'height') { - properties = ['border-top-width', 'padding-top', - 'padding-bottom', 'border-bottom-width']; - } - else { - properties = ['border-left-width', 'padding-left', - 'padding-right', 'border-right-width']; - } - return properties.inject(dim, function(memo, property) { - var val = proceed(element, property); - return val === null ? memo : memo - parseInt(val, 10); - }) + 'px'; - default: return proceed(element, style); - } - } - ); - - Element.Methods.readAttribute = Element.Methods.readAttribute.wrap( - function(proceed, element, attribute) { - if (attribute === 'title') return element.title; - return proceed(element, attribute); - } - ); -} - -else if (Prototype.Browser.IE) { - Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap( - function(proceed, element) { - element = $(element); - if (!element.parentNode) return $(document.body); - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - - $w('positionedOffset viewportOffset').each(function(method) { - Element.Methods[method] = Element.Methods[method].wrap( - function(proceed, element) { - element = $(element); - if (!element.parentNode) return Element._returnOffset(0, 0); - var position = element.getStyle('position'); - if (position !== 'static') return proceed(element); - var offsetParent = element.getOffsetParent(); - if (offsetParent && offsetParent.getStyle('position') === 'fixed') - offsetParent.setStyle({ zoom: 1 }); - element.setStyle({ position: 'relative' }); - var value = proceed(element); - element.setStyle({ position: position }); - return value; - } - ); - }); - - Element.Methods.getStyle = function(element, style) { - element = $(element); - style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); - var value = element.style[style]; - if (!value && element.currentStyle) value = element.currentStyle[style]; - - if (style == 'opacity') { - if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) - if (value[1]) return parseFloat(value[1]) / 100; - return 1.0; - } - - if (value == 'auto') { - if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) - return element['offset' + style.capitalize()] + 'px'; - return null; - } - return value; - }; - - Element.Methods.setOpacity = function(element, value) { - function stripAlpha(filter){ - return filter.replace(/alpha\([^\)]*\)/gi,''); - } - element = $(element); - var currentStyle = element.currentStyle; - if ((currentStyle && !currentStyle.hasLayout) || - (!currentStyle && element.style.zoom == 'normal')) - element.style.zoom = 1; - - var filter = element.getStyle('filter'), style = element.style; - if (value == 1 || value === '') { - (filter = stripAlpha(filter)) ? - style.filter = filter : style.removeAttribute('filter'); - return element; - } else if (value < 0.00001) value = 0; - style.filter = stripAlpha(filter) + - 'alpha(opacity=' + (value * 100) + ')'; - return element; - }; - - Element._attributeTranslations = (function(){ - - var classProp = 'className', - forProp = 'for', - el = document.createElement('div'); - - el.setAttribute(classProp, 'x'); - - if (el.className !== 'x') { - el.setAttribute('class', 'x'); - if (el.className === 'x') { - classProp = 'class'; - } - } - el = null; - - el = document.createElement('label'); - el.setAttribute(forProp, 'x'); - if (el.htmlFor !== 'x') { - el.setAttribute('htmlFor', 'x'); - if (el.htmlFor === 'x') { - forProp = 'htmlFor'; - } - } - el = null; - - return { - read: { - names: { - 'class': classProp, - 'className': classProp, - 'for': forProp, - 'htmlFor': forProp - }, - values: { - _getAttr: function(element, attribute) { - return element.getAttribute(attribute); - }, - _getAttr2: function(element, attribute) { - return element.getAttribute(attribute, 2); - }, - _getAttrNode: function(element, attribute) { - var node = element.getAttributeNode(attribute); - return node ? node.value : ""; - }, - _getEv: (function(){ - - var el = document.createElement('div'), f; - el.onclick = Prototype.emptyFunction; - var value = el.getAttribute('onclick'); - - if (String(value).indexOf('{') > -1) { - f = function(element, attribute) { - attribute = element.getAttribute(attribute); - if (!attribute) return null; - attribute = attribute.toString(); - attribute = attribute.split('{')[1]; - attribute = attribute.split('}')[0]; - return attribute.strip(); - }; - } - else if (value === '') { - f = function(element, attribute) { - attribute = element.getAttribute(attribute); - if (!attribute) return null; - return attribute.strip(); - }; - } - el = null; - return f; - })(), - _flag: function(element, attribute) { - return $(element).hasAttribute(attribute) ? attribute : null; - }, - style: function(element) { - return element.style.cssText.toLowerCase(); - }, - title: function(element) { - return element.title; - } - } - } - } - })(); - - Element._attributeTranslations.write = { - names: Object.extend({ - cellpadding: 'cellPadding', - cellspacing: 'cellSpacing' - }, Element._attributeTranslations.read.names), - values: { - checked: function(element, value) { - element.checked = !!value; - }, - - style: function(element, value) { - element.style.cssText = value ? value : ''; - } - } - }; - - Element._attributeTranslations.has = {}; - - $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + - 'encType maxLength readOnly longDesc frameBorder').each(function(attr) { - Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; - Element._attributeTranslations.has[attr.toLowerCase()] = attr; - }); - - (function(v) { - Object.extend(v, { - href: v._getAttr2, - src: v._getAttr2, - type: v._getAttr, - action: v._getAttrNode, - disabled: v._flag, - checked: v._flag, - readonly: v._flag, - multiple: v._flag, - onload: v._getEv, - onunload: v._getEv, - onclick: v._getEv, - ondblclick: v._getEv, - onmousedown: v._getEv, - onmouseup: v._getEv, - onmouseover: v._getEv, - onmousemove: v._getEv, - onmouseout: v._getEv, - onfocus: v._getEv, - onblur: v._getEv, - onkeypress: v._getEv, - onkeydown: v._getEv, - onkeyup: v._getEv, - onsubmit: v._getEv, - onreset: v._getEv, - onselect: v._getEv, - onchange: v._getEv - }); - })(Element._attributeTranslations.read.values); - - if (Prototype.BrowserFeatures.ElementExtensions) { - (function() { - function _descendants(element) { - var nodes = element.getElementsByTagName('*'), results = []; - for (var i = 0, node; node = nodes[i]; i++) - if (node.tagName !== "!") // Filter out comment nodes. - results.push(node); - return results; - } - - Element.Methods.down = function(element, expression, index) { - element = $(element); - if (arguments.length == 1) return element.firstDescendant(); - return Object.isNumber(expression) ? _descendants(element)[expression] : - Element.select(element, expression)[index || 0]; - } - })(); - } - -} - -else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1) ? 0.999999 : - (value === '') ? '' : (value < 0.00001) ? 0 : value; - return element; - }; -} - -else if (Prototype.Browser.WebKit) { - Element.Methods.setOpacity = function(element, value) { - element = $(element); - element.style.opacity = (value == 1 || value === '') ? '' : - (value < 0.00001) ? 0 : value; - - if (value == 1) - if (element.tagName.toUpperCase() == 'IMG' && element.width) { - element.width++; element.width--; - } else try { - var n = document.createTextNode(' '); - element.appendChild(n); - element.removeChild(n); - } catch (e) { } - - return element; - }; - - Element.Methods.cumulativeOffset = function(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == document.body) - if (Element.getStyle(element, 'position') == 'absolute') break; - - element = element.offsetParent; - } while (element); - - return Element._returnOffset(valueL, valueT); - }; -} - -if ('outerHTML' in document.documentElement) { - Element.Methods.replace = function(element, content) { - element = $(element); - - if (content && content.toElement) content = content.toElement(); - if (Object.isElement(content)) { - element.parentNode.replaceChild(content, element); - return element; - } - - content = Object.toHTML(content); - var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); - - if (Element._insertionTranslations.tags[tagName]) { - var nextSibling = element.next(), - fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); - parent.removeChild(element); - if (nextSibling) - fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); - else - fragments.each(function(node) { parent.appendChild(node) }); - } - else element.outerHTML = content.stripScripts(); - - content.evalScripts.bind(content).defer(); - return element; - }; -} - -Element._returnOffset = function(l, t) { - var result = [l, t]; - result.left = l; - result.top = t; - return result; -}; - -Element._getContentFromAnonymousElement = function(tagName, html) { - var div = new Element('div'), - t = Element._insertionTranslations.tags[tagName]; - if (t) { - div.innerHTML = t[0] + html + t[1]; - for (var i = t[2]; i--; ) { - div = div.firstChild; - } - } - else { - div.innerHTML = html; - } - return $A(div.childNodes); -}; - -Element._insertionTranslations = { - before: function(element, node) { - element.parentNode.insertBefore(node, element); - }, - top: function(element, node) { - element.insertBefore(node, element.firstChild); - }, - bottom: function(element, node) { - element.appendChild(node); - }, - after: function(element, node) { - element.parentNode.insertBefore(node, element.nextSibling); - }, - tags: { - TABLE: ['
      <%= image_tag post.image rescue nil %><%= image_tag post.image.url %> - <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> - <%= post.subtitle[I18n.locale].html_safe %> + <%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> + <%= post.subtitle.html_safe rescue '' %> <%= display_date(post.postdate) %><%= display_date(post.postdate) %>
      <%= image_tag post.image %> - <%= link_to post.title[I18n.locale], panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> - <%= post.subtitle[I18n.locale].html_safe %> + <%= link_to post.title, panel_news_front_end_news_bulletin_path(post), :class => 'news_title' %> + <%= post.subtitle.html_safe rescue '' %> <%= display_date(post.postdate) %>
      <%= page_context.page.path %>
      - <%= page_context.page.i18n_variable[I18n.locale] %> + <%= page_context.page.title %>
      <%= display_date_time(page_context.updated_at) %><%= User.find(page_context.create_user_id).name %><%= User.find(page_context.create_user_id).name rescue '' %>
      - <%= view_page_context.page.i18n_variable[I18n.locale] %> + <%= view_page_context.page.title %>
      - <%= f.fields_for :i18n_variable, (@web_link_category.new_record? ? @web_link_category.build_i18n_variable : @web_link_category.i18n_variable) do |f| %> + <%= f.fields_for :title_translations do |f| %> <% @site_valid_locales.each do |locale| %>
      <%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
      - <%= f.text_field locale, :class => 'input-xxlarge' %> + <%= f.text_field locale, :class => 'input-xxlarge', :value => (@web_link_category.title_translations[locale] rescue nil) %>
      <% end %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb index b17e634b1..4d1198c39 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_link_categorys/_web_link_category.html.erb @@ -6,14 +6,14 @@ <%if at_least_module_manager %>
      <% end -%>
      <%= web_link_category.i18n_variable[locale] rescue nil %><%= web_link_category.title_translations[locale] rescue nil %>
      <%= web_link.web_link_category.i18n_variable[I18n.locale] rescue nil %><%= web_link.web_link_category.title rescue nil %> - <%= link_to web_link.name[I18n.locale], panel_web_resource_back_end_web_link_path(web_link) %> + <%= link_to web_link.title, panel_web_resource_back_end_web_link_path(web_link) %>
      diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb index 8a300f7ae..d8215e9de 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/index.html.erb @@ -1,20 +1,18 @@ -<%= form_for :news_bulletins, :url => delete_panel_web_resource_back_end_web_links_path(:direction => params[:direction], :sort => params[:sort], :sort_options => params[:sort_options]), :html => {:id => 'delete_all'}, :remote => true do %> - <%= render 'filter' %> - - - - - - - - - - - - <%= render :partial => 'web_link', :collection => @web_links %> - -
      -<% end %> +<%= render 'filter' %> + + + + + + + + + + + + <%= render :partial => 'web_link', :collection => @web_links %> + +
      <%= link_to content_tag(:i, nil, :class => 'icon-plus icon-white') + t('announcement.add_new'), new_panel_web_resource_back_end_web_link_path, :class => 'btn btn-primary pull-right' %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb index 1eba06465..e69de29bb 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/back_end/web_links/show.html.erb @@ -1,57 +0,0 @@ -<% # encoding: utf-8 %> - -
      -
      -
      - -

      <%= flash_messages %>

      - -
        -
      • - <%= t('announcement.category') %> - <%= @bulletin.bulletin_category.i18n_variable[I18n.locale] rescue nil %> -
      • -
      • - <%= t('announcement.postdate') %> - <%= display_date(@bulletin.postdate) %> -
      • -
      • - <%= t('announcement.title') %> - <%= @bulletin.title %> -
      • -
      • - <%#= image_tag(@bulletin.image.url, :size => "320x240") if @bulletin.image.file %> - <%= link_to image_tag(@bulletin.image.url, :size => "320x240"), @bulletin.image.url, {:target => '_blank', :title => @bulletin.image_identifier} if @bulletin.image.file %> -
      • -
      • - <%= t('announcement.subtitle') %> - <%= @bulletin.subtitle %> -
      • -
      • - <%= t('announcement.text') %> - <%= @bulletin.text %> -
      • -
      • -
      • - <%= t('announcement.link') %> - <% @bulletin.bulletin_links.each do | blink | %> - <%= link_to blink.name, blink.url, :target => '_blank' %> - <% end %> -
      • -
      • - <%= t('announcement.file') %> - <% @bulletin.bulletin_files.each do | bfile | %> - <%= link_to bfile.filetitle, bfile.file.url, {:target => '_blank', :title => bfile.description} if bfile.file.file %> - <% end %> -
      • -
      • - <%= t('announcement.張貼者') %> - <%= User.find(@bulletin.create_user_id).name %> -
      • -
      • - <%= t('announcement.最後修改時間') %> - <%= display_date(@bulletin.updated_at) %> -
      • - - -<%= link_back %> diff --git a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb index 0d1626a5d..5bb346b14 100644 --- a/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb +++ b/vendor/built_in_modules/web_resource/app/views/panel/web_resource/front_end/web_links/index.html.erb @@ -15,10 +15,10 @@ <% @web_links.each do |post| %>
      <%= post.web_link_category.i18n_variable[I18n.locale] rescue nil %><%= post.web_link_category.title rescue nil %> - <%#= link_to post.name[I18n.locale], panel_web_resource_front_end_web_link_path(post) %> - <%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %> + <%#= link_to post.title, panel_web_resource_front_end_web_link_path(post) %> + <%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %>
      <%= post.web_link_category.i18n_variable[I18n.locale] rescue nil %><%= post.web_link_category.title rescue nil %> - <%= link_to post.name[I18n.locale], post.url, {:target => '_blank', :title => post.name[I18n.locale]} %> + <%= link_to post.title, post.url, {:target => '_blank', :title => post.title} %>
      test
      ', '
      ', 1], - TBODY: ['', '
      ', 2], - TR: ['', '
      ', 3], - TD: ['
      ', '
      ', 4], - SELECT: ['', 1] - } -}; - -(function() { - var tags = Element._insertionTranslations.tags; - Object.extend(tags, { - THEAD: tags.TBODY, - TFOOT: tags.TBODY, - TH: tags.TD - }); -})(); - -Element.Methods.Simulated = { - hasAttribute: function(element, attribute) { - attribute = Element._attributeTranslations.has[attribute] || attribute; - var node = $(element).getAttributeNode(attribute); - return !!(node && node.specified); - } -}; - -Element.Methods.ByTag = { }; - -Object.extend(Element, Element.Methods); - -(function(div) { - - if (!Prototype.BrowserFeatures.ElementExtensions && div['__proto__']) { - window.HTMLElement = { }; - window.HTMLElement.prototype = div['__proto__']; - Prototype.BrowserFeatures.ElementExtensions = true; - } - - div = null; - -})(document.createElement('div')); - -Element.extend = (function() { - - function checkDeficiency(tagName) { - if (typeof window.Element != 'undefined') { - var proto = window.Element.prototype; - if (proto) { - var id = '_' + (Math.random()+'').slice(2), - el = document.createElement(tagName); - proto[id] = 'x'; - var isBuggy = (el[id] !== 'x'); - delete proto[id]; - el = null; - return isBuggy; - } - } - return false; - } - - function extendElementWith(element, methods) { - for (var property in methods) { - var value = methods[property]; - if (Object.isFunction(value) && !(property in element)) - element[property] = value.methodize(); - } - } - - var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object'); - - if (Prototype.BrowserFeatures.SpecificElementExtensions) { - if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) { - return function(element) { - if (element && typeof element._extendedByPrototype == 'undefined') { - var t = element.tagName; - if (t && (/^(?:object|applet|embed)$/i.test(t))) { - extendElementWith(element, Element.Methods); - extendElementWith(element, Element.Methods.Simulated); - extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]); - } - } - return element; - } - } - return Prototype.K; - } - - var Methods = { }, ByTag = Element.Methods.ByTag; - - var extend = Object.extend(function(element) { - if (!element || typeof element._extendedByPrototype != 'undefined' || - element.nodeType != 1 || element == window) return element; - - var methods = Object.clone(Methods), - tagName = element.tagName.toUpperCase(); - - if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); - - extendElementWith(element, methods); - - element._extendedByPrototype = Prototype.emptyFunction; - return element; - - }, { - refresh: function() { - if (!Prototype.BrowserFeatures.ElementExtensions) { - Object.extend(Methods, Element.Methods); - Object.extend(Methods, Element.Methods.Simulated); - } - } - }); - - extend.refresh(); - return extend; -})(); - -if (document.documentElement.hasAttribute) { - Element.hasAttribute = function(element, attribute) { - return element.hasAttribute(attribute); - }; -} -else { - Element.hasAttribute = Element.Methods.Simulated.hasAttribute; -} - -Element.addMethods = function(methods) { - var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; - - if (!methods) { - Object.extend(Form, Form.Methods); - Object.extend(Form.Element, Form.Element.Methods); - Object.extend(Element.Methods.ByTag, { - "FORM": Object.clone(Form.Methods), - "INPUT": Object.clone(Form.Element.Methods), - "SELECT": Object.clone(Form.Element.Methods), - "TEXTAREA": Object.clone(Form.Element.Methods) - }); - } - - if (arguments.length == 2) { - var tagName = methods; - methods = arguments[1]; - } - - if (!tagName) Object.extend(Element.Methods, methods || { }); - else { - if (Object.isArray(tagName)) tagName.each(extend); - else extend(tagName); - } - - function extend(tagName) { - tagName = tagName.toUpperCase(); - if (!Element.Methods.ByTag[tagName]) - Element.Methods.ByTag[tagName] = { }; - Object.extend(Element.Methods.ByTag[tagName], methods); - } - - function copy(methods, destination, onlyIfAbsent) { - onlyIfAbsent = onlyIfAbsent || false; - for (var property in methods) { - var value = methods[property]; - if (!Object.isFunction(value)) continue; - if (!onlyIfAbsent || !(property in destination)) - destination[property] = value.methodize(); - } - } - - function findDOMClass(tagName) { - var klass; - var trans = { - "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", - "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", - "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", - "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", - "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": - "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": - "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": - "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": - "FrameSet", "IFRAME": "IFrame" - }; - if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName + 'Element'; - if (window[klass]) return window[klass]; - klass = 'HTML' + tagName.capitalize() + 'Element'; - if (window[klass]) return window[klass]; - - var element = document.createElement(tagName), - proto = element['__proto__'] || element.constructor.prototype; - - element = null; - return proto; - } - - var elementPrototype = window.HTMLElement ? HTMLElement.prototype : - Element.prototype; - - if (F.ElementExtensions) { - copy(Element.Methods, elementPrototype); - copy(Element.Methods.Simulated, elementPrototype, true); - } - - if (F.SpecificElementExtensions) { - for (var tag in Element.Methods.ByTag) { - var klass = findDOMClass(tag); - if (Object.isUndefined(klass)) continue; - copy(T[tag], klass.prototype); - } - } - - Object.extend(Element, Element.Methods); - delete Element.ByTag; - - if (Element.extend.refresh) Element.extend.refresh(); - Element.cache = { }; -}; - - -document.viewport = { - - getDimensions: function() { - return { width: this.getWidth(), height: this.getHeight() }; - }, - - getScrollOffsets: function() { - return Element._returnOffset( - window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, - window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); - } -}; - -(function(viewport) { - var B = Prototype.Browser, doc = document, element, property = {}; - - function getRootElement() { - if (B.WebKit && !doc.evaluate) - return document; - - if (B.Opera && window.parseFloat(window.opera.version()) < 9.5) - return document.body; - - return document.documentElement; - } - - function define(D) { - if (!element) element = getRootElement(); - - property[D] = 'client' + D; - - viewport['get' + D] = function() { return element[property[D]] }; - return viewport['get' + D](); - } - - viewport.getWidth = define.curry('Width'); - - viewport.getHeight = define.curry('Height'); -})(document.viewport); - - -Element.Storage = { - UID: 1 -}; - -Element.addMethods({ - getStorage: function(element) { - if (!(element = $(element))) return; - - var uid; - if (element === window) { - uid = 0; - } else { - if (typeof element._prototypeUID === "undefined") - element._prototypeUID = Element.Storage.UID++; - uid = element._prototypeUID; - } - - if (!Element.Storage[uid]) - Element.Storage[uid] = $H(); - - return Element.Storage[uid]; - }, - - store: function(element, key, value) { - if (!(element = $(element))) return; - - if (arguments.length === 2) { - Element.getStorage(element).update(key); - } else { - Element.getStorage(element).set(key, value); - } - - return element; - }, - - retrieve: function(element, key, defaultValue) { - if (!(element = $(element))) return; - var hash = Element.getStorage(element), value = hash.get(key); - - if (Object.isUndefined(value)) { - hash.set(key, defaultValue); - value = defaultValue; - } - - return value; - }, - - clone: function(element, deep) { - if (!(element = $(element))) return; - var clone = element.cloneNode(deep); - clone._prototypeUID = void 0; - if (deep) { - var descendants = Element.select(clone, '*'), - i = descendants.length; - while (i--) { - descendants[i]._prototypeUID = void 0; - } - } - return Element.extend(clone); - }, - - purge: function(element) { - if (!(element = $(element))) return; - purgeElement(element); - - var descendants = element.getElementsByTagName('*'), - i = descendants.length; - - while (i--) purgeElement(descendants[i]); - - return null; - } -}); - -(function() { - - function toDecimal(pctString) { - var match = pctString.match(/^(\d+)%?$/i); - if (!match) return null; - return (Number(match[1]) / 100); - } - - function getPixelValue(value, property) { - if (Object.isElement(value)) { - element = value; - value = element.getStyle(property); - } - if (value === null) { - return null; - } - - if ((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(value)) { - return window.parseFloat(value); - } - - if (/\d/.test(value) && element.runtimeStyle) { - var style = element.style.left, rStyle = element.runtimeStyle.left; - element.runtimeStyle.left = element.currentStyle.left; - element.style.left = value || 0; - value = element.style.pixelLeft; - element.style.left = style; - element.runtimeStyle.left = rStyle; - - return value; - } - - if (value.include('%')) { - var decimal = toDecimal(value); - var whole; - if (property.include('left') || property.include('right') || - property.include('width')) { - whole = $(element.parentNode).measure('width'); - } else if (property.include('top') || property.include('bottom') || - property.include('height')) { - whole = $(element.parentNode).measure('height'); - } - - return whole * decimal; - } - - return 0; - } - - function toCSSPixels(number) { - if (Object.isString(number) && number.endsWith('px')) { - return number; - } - return number + 'px'; - } - - function isDisplayed(element) { - var originalElement = element; - while (element && element.parentNode) { - var display = element.getStyle('display'); - if (display === 'none') { - return false; - } - element = $(element.parentNode); - } - return true; - } - - var hasLayout = Prototype.K; - if ('currentStyle' in document.documentElement) { - hasLayout = function(element) { - if (!element.currentStyle.hasLayout) { - element.style.zoom = 1; - } - return element; - }; - } - - function cssNameFor(key) { - if (key.include('border')) key = key + '-width'; - return key.camelize(); - } - - Element.Layout = Class.create(Hash, { - initialize: function($super, element, preCompute) { - $super(); - this.element = $(element); - - Element.Layout.PROPERTIES.each( function(property) { - this._set(property, null); - }, this); - - if (preCompute) { - this._preComputing = true; - this._begin(); - Element.Layout.PROPERTIES.each( this._compute, this ); - this._end(); - this._preComputing = false; - } - }, - - _set: function(property, value) { - return Hash.prototype.set.call(this, property, value); - }, - - set: function(property, value) { - throw "Properties of Element.Layout are read-only."; - }, - - get: function($super, property) { - var value = $super(property); - return value === null ? this._compute(property) : value; - }, - - _begin: function() { - if (this._prepared) return; - - var element = this.element; - if (isDisplayed(element)) { - this._prepared = true; - return; - } - - var originalStyles = { - position: element.style.position || '', - width: element.style.width || '', - visibility: element.style.visibility || '', - display: element.style.display || '' - }; - - element.store('prototype_original_styles', originalStyles); - - var position = element.getStyle('position'), - width = element.getStyle('width'); - - element.setStyle({ - position: 'absolute', - visibility: 'hidden', - display: 'block' - }); - - var positionedWidth = element.getStyle('width'); - - var newWidth; - if (width && (positionedWidth === width)) { - newWidth = getPixelValue(width); - } else if (width && (position === 'absolute' || position === 'fixed')) { - newWidth = getPixelValue(width); - } else { - var parent = element.parentNode, pLayout = $(parent).getLayout(); - - newWidth = pLayout.get('width') - - this.get('margin-left') - - this.get('border-left') - - this.get('padding-left') - - this.get('padding-right') - - this.get('border-right') - - this.get('margin-right'); - } - - element.setStyle({ width: newWidth + 'px' }); - - this._prepared = true; - }, - - _end: function() { - var element = this.element; - var originalStyles = element.retrieve('prototype_original_styles'); - element.store('prototype_original_styles', null); - element.setStyle(originalStyles); - this._prepared = false; - }, - - _compute: function(property) { - var COMPUTATIONS = Element.Layout.COMPUTATIONS; - if (!(property in COMPUTATIONS)) { - throw "Property not found."; - } - return this._set(property, COMPUTATIONS[property].call(this, this.element)); - }, - - toObject: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var obj = {}; - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - var value = this.get(key); - if (value != null) obj[key] = value; - }, this); - return obj; - }, - - toHash: function() { - var obj = this.toObject.apply(this, arguments); - return new Hash(obj); - }, - - toCSS: function() { - var args = $A(arguments); - var keys = (args.length === 0) ? Element.Layout.PROPERTIES : - args.join(' ').split(' '); - var css = {}; - - keys.each( function(key) { - if (!Element.Layout.PROPERTIES.include(key)) return; - if (Element.Layout.COMPOSITE_PROPERTIES.include(key)) return; - - var value = this.get(key); - if (value != null) css[cssNameFor(key)] = value + 'px'; - }, this); - return css; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Element.Layout, { - PROPERTIES: $w('height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height'), - - COMPOSITE_PROPERTIES: $w('padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height'), - - COMPUTATIONS: { - 'height': function(element) { - if (!this._preComputing) this._begin(); - - var bHeight = this.get('border-box-height'); - if (bHeight <= 0) return 0; - - var bTop = this.get('border-top'), - bBottom = this.get('border-bottom'); - - var pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - if (!this._preComputing) this._end(); - - return bHeight - bTop - bBottom - pTop - pBottom; - }, - - 'width': function(element) { - if (!this._preComputing) this._begin(); - - var bWidth = this.get('border-box-width'); - if (bWidth <= 0) return 0; - - var bLeft = this.get('border-left'), - bRight = this.get('border-right'); - - var pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - if (!this._preComputing) this._end(); - - return bWidth - bLeft - bRight - pLeft - pRight; - }, - - 'padding-box-height': function(element) { - var height = this.get('height'), - pTop = this.get('padding-top'), - pBottom = this.get('padding-bottom'); - - return height + pTop + pBottom; - }, - - 'padding-box-width': function(element) { - var width = this.get('width'), - pLeft = this.get('padding-left'), - pRight = this.get('padding-right'); - - return width + pLeft + pRight; - }, - - 'border-box-height': function(element) { - return element.offsetHeight; - }, - - 'border-box-width': function(element) { - return element.offsetWidth; - }, - - 'margin-box-height': function(element) { - var bHeight = this.get('border-box-height'), - mTop = this.get('margin-top'), - mBottom = this.get('margin-bottom'); - - if (bHeight <= 0) return 0; - - return bHeight + mTop + mBottom; - }, - - 'margin-box-width': function(element) { - var bWidth = this.get('border-box-width'), - mLeft = this.get('margin-left'), - mRight = this.get('margin-right'); - - if (bWidth <= 0) return 0; - - return bWidth + mLeft + mRight; - }, - - 'top': function(element) { - var offset = element.positionedOffset(); - return offset.top; - }, - - 'bottom': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pHeight = parent.measure('height'); - - var mHeight = this.get('border-box-height'); - - return pHeight - mHeight - offset.top; - }, - - 'left': function(element) { - var offset = element.positionedOffset(); - return offset.left; - }, - - 'right': function(element) { - var offset = element.positionedOffset(), - parent = element.getOffsetParent(), - pWidth = parent.measure('width'); - - var mWidth = this.get('border-box-width'); - - return pWidth - mWidth - offset.left; - }, - - 'padding-top': function(element) { - return getPixelValue(element, 'paddingTop'); - }, - - 'padding-bottom': function(element) { - return getPixelValue(element, 'paddingBottom'); - }, - - 'padding-left': function(element) { - return getPixelValue(element, 'paddingLeft'); - }, - - 'padding-right': function(element) { - return getPixelValue(element, 'paddingRight'); - }, - - 'border-top': function(element) { - return Object.isNumber(element.clientTop) ? element.clientTop : - getPixelValue(element, 'borderTopWidth'); - }, - - 'border-bottom': function(element) { - return Object.isNumber(element.clientBottom) ? element.clientBottom : - getPixelValue(element, 'borderBottomWidth'); - }, - - 'border-left': function(element) { - return Object.isNumber(element.clientLeft) ? element.clientLeft : - getPixelValue(element, 'borderLeftWidth'); - }, - - 'border-right': function(element) { - return Object.isNumber(element.clientRight) ? element.clientRight : - getPixelValue(element, 'borderRightWidth'); - }, - - 'margin-top': function(element) { - return getPixelValue(element, 'marginTop'); - }, - - 'margin-bottom': function(element) { - return getPixelValue(element, 'marginBottom'); - }, - - 'margin-left': function(element) { - return getPixelValue(element, 'marginLeft'); - }, - - 'margin-right': function(element) { - return getPixelValue(element, 'marginRight'); - } - } - }); - - if ('getBoundingClientRect' in document.documentElement) { - Object.extend(Element.Layout.COMPUTATIONS, { - 'right': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.right - rect.right).round(); - }, - - 'bottom': function(element) { - var parent = hasLayout(element.getOffsetParent()); - var rect = element.getBoundingClientRect(), - pRect = parent.getBoundingClientRect(); - - return (pRect.bottom - rect.bottom).round(); - } - }); - } - - Element.Offset = Class.create({ - initialize: function(left, top) { - this.left = left.round(); - this.top = top.round(); - - this[0] = this.left; - this[1] = this.top; - }, - - relativeTo: function(offset) { - return new Element.Offset( - this.left - offset.left, - this.top - offset.top - ); - }, - - inspect: function() { - return "#".interpolate(this); - }, - - toString: function() { - return "[#{left}, #{top}]".interpolate(this); - }, - - toArray: function() { - return [this.left, this.top]; - } - }); - - function getLayout(element, preCompute) { - return new Element.Layout(element, preCompute); - } - - function measure(element, property) { - return $(element).getLayout().get(property); - } - - function getDimensions(element) { - var layout = $(element).getLayout(); - return { - width: layout.get('width'), - height: layout.get('height') - }; - } - - function getOffsetParent(element) { - if (isDetached(element)) return $(document.body); - - var isInline = (Element.getStyle(element, 'display') === 'inline'); - if (!isInline && element.offsetParent) return $(element.offsetParent); - if (element === document.body) return $(element); - - while ((element = element.parentNode) && element !== document.body) { - if (Element.getStyle(element, 'position') !== 'static') { - return (element.nodeName === 'HTML') ? $(document.body) : $(element); - } - } - - return $(document.body); - } - - - function cumulativeOffset(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - } while (element); - return new Element.Offset(valueL, valueT); - } - - function positionedOffset(element) { - var layout = element.getLayout(); - - var valueT = 0, valueL = 0; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - element = element.offsetParent; - if (element) { - if (isBody(element)) break; - var p = Element.getStyle(element, 'position'); - if (p !== 'static') break; - } - } while (element); - - valueL -= layout.get('margin-top'); - valueT -= layout.get('margin-left'); - - return new Element.Offset(valueL, valueT); - } - - function cumulativeScrollOffset(element) { - var valueT = 0, valueL = 0; - do { - valueT += element.scrollTop || 0; - valueL += element.scrollLeft || 0; - element = element.parentNode; - } while (element); - return new Element.Offset(valueL, valueT); - } - - function viewportOffset(forElement) { - var valueT = 0, valueL = 0, docBody = document.body; - - var element = forElement; - do { - valueT += element.offsetTop || 0; - valueL += element.offsetLeft || 0; - if (element.offsetParent == docBody && - Element.getStyle(element, 'position') == 'absolute') break; - } while (element = element.offsetParent); - - element = forElement; - do { - if (element != docBody) { - valueT -= element.scrollTop || 0; - valueL -= element.scrollLeft || 0; - } - } while (element = element.parentNode); - return new Element.Offset(valueL, valueT); - } - - function absolutize(element) { - element = $(element); - - if (Element.getStyle(element, 'position') === 'absolute') { - return element; - } - - var offsetParent = getOffsetParent(element); - var eOffset = element.viewportOffset(), - pOffset = offsetParent.viewportOffset(); - - var offset = eOffset.relativeTo(pOffset); - var layout = element.getLayout(); - - element.store('prototype_absolutize_original_styles', { - left: element.getStyle('left'), - top: element.getStyle('top'), - width: element.getStyle('width'), - height: element.getStyle('height') - }); - - element.setStyle({ - position: 'absolute', - top: offset.top + 'px', - left: offset.left + 'px', - width: layout.get('width') + 'px', - height: layout.get('height') + 'px' - }); - - return element; - } - - function relativize(element) { - element = $(element); - if (Element.getStyle(element, 'position') === 'relative') { - return element; - } - - var originalStyles = - element.retrieve('prototype_absolutize_original_styles'); - - if (originalStyles) element.setStyle(originalStyles); - return element; - } - - Element.addMethods({ - getLayout: getLayout, - measure: measure, - getDimensions: getDimensions, - getOffsetParent: getOffsetParent, - cumulativeOffset: cumulativeOffset, - positionedOffset: positionedOffset, - cumulativeScrollOffset: cumulativeScrollOffset, - viewportOffset: viewportOffset, - absolutize: absolutize, - relativize: relativize - }); - - function isBody(element) { - return element.nodeName.toUpperCase() === 'BODY'; - } - - function isDetached(element) { - return element !== document.body && - !Element.descendantOf(element, document.body); - } - - if ('getBoundingClientRect' in document.documentElement) { - Element.addMethods({ - viewportOffset: function(element) { - element = $(element); - if (isDetached(element)) return new Element.Offset(0, 0); - - var rect = element.getBoundingClientRect(), - docEl = document.documentElement; - return new Element.Offset(rect.left - docEl.clientLeft, - rect.top - docEl.clientTop); - }, - - positionedOffset: function(element) { - element = $(element); - var parent = element.getOffsetParent(); - if (isDetached(element)) return new Element.Offset(0, 0); - - if (element.offsetParent && - element.offsetParent.nodeName.toUpperCase() === 'HTML') { - return positionedOffset(element); - } - - var eOffset = element.viewportOffset(), - pOffset = isBody(parent) ? viewportOffset(parent) : - parent.viewportOffset(); - var retOffset = eOffset.relativeTo(pOffset); - - var layout = element.getLayout(); - var top = retOffset.top - layout.get('margin-top'); - var left = retOffset.left - layout.get('margin-left'); - - return new Element.Offset(left, top); - } - }); - } -})(); -window.$$ = function() { - var expression = $A(arguments).join(', '); - return Prototype.Selector.select(expression, document); -}; - -Prototype.Selector = (function() { - - function select() { - throw new Error('Method "Prototype.Selector.select" must be defined.'); - } - - function match() { - throw new Error('Method "Prototype.Selector.match" must be defined.'); - } - - function find(elements, expression, index) { - index = index || 0; - var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i; - - for (i = 0; i < length; i++) { - if (match(elements[i], expression) && index == matchIndex++) { - return Element.extend(elements[i]); - } - } - } - - function extendElements(elements) { - for (var i = 0, length = elements.length; i < length; i++) { - Element.extend(elements[i]); - } - return elements; - } - - - var K = Prototype.K; - - return { - select: select, - match: match, - find: find, - extendElements: (Element.extend === K) ? K : extendElements, - extendElement: Element.extend - }; -})(); -Prototype._original_property = window.Sizzle; -/*! - * Sizzle CSS Selector Engine - v1.0 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true; - -[0, 0].sort(function(){ - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function(selector, context, results, seed) { - results = results || []; - var origContext = context = context || document; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context), - soFar = selector; - - while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context ); - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) - selector += parts.shift(); - - set = posProcess( selector, set ); - } - } - } else { - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - var ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0]; - } - - if ( context ) { - var ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray(set); - } else { - prune = false; - } - - while ( parts.length ) { - var cur = parts.pop(), pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - throw "Syntax error, unrecognized expression: " + (cur || selector); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - } else if ( context && context.nodeType === 1 ) { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - } else { - for ( var i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function(results){ - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort(sortOrder); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[i-1] ) { - results.splice(i--, 1); - } - } - } - } - - return results; -}; - -Sizzle.matches = function(expr, set){ - return Sizzle(expr, null, null, set); -}; - -Sizzle.find = function(expr, context, isXML){ - var set, match; - - if ( !expr ) { - return []; - } - - for ( var i = 0, l = Expr.order.length; i < l; i++ ) { - var type = Expr.order[i], match; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - var left = match[1]; - match.splice(1,1); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace(/\\/g, ""); - set = Expr.find[ type ]( match, context, isXML ); - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = context.getElementsByTagName("*"); - } - - return {set: set, expr: expr}; -}; - -Sizzle.filter = function(expr, set, inplace, not){ - var old = expr, result = [], curLoop = set, match, anyFound, - isXMLFilter = set && set[0] && isXML(set[0]); - - while ( expr && set.length ) { - for ( var type in Expr.filter ) { - if ( (match = Expr.match[ type ].exec( expr )) != null ) { - var filter = Expr.filter[ type ], found, item; - anyFound = false; - - if ( curLoop == result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( var i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - var pass = not ^ !!found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - } else { - curLoop[i] = false; - } - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - if ( expr == old ) { - if ( anyFound == null ) { - throw "Syntax error, unrecognized expression: " + expr; - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - match: { - ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/ - }, - leftMatch: {}, - attrMap: { - "class": "className", - "for": "htmlFor" - }, - attrHandle: { - href: function(elem){ - return elem.getAttribute("href"); - } - }, - relative: { - "+": function(checkSet, part, isXML){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !/\W/.test(part), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag && !isXML ) { - part = part.toUpperCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - ">": function(checkSet, part, isXML){ - var isPartStr = typeof part === "string"; - - if ( isPartStr && !/\W/.test(part) ) { - part = isXML ? part : part.toUpperCase(); - - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName === part ? parent : false; - } - } - } else { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - "": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( !/\W/.test(part) ) { - var nodeCheck = part = isXML ? part : part.toUpperCase(); - checkFn = dirNodeCheck; - } - - checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML); - }, - "~": function(checkSet, part, isXML){ - var doneName = done++, checkFn = dirCheck; - - if ( typeof part === "string" && !/\W/.test(part) ) { - var nodeCheck = part = isXML ? part : part.toUpperCase(); - checkFn = dirNodeCheck; - } - - checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML); - } - }, - find: { - ID: function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? [m] : []; - } - }, - NAME: function(match, context, isXML){ - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], results = context.getElementsByName(match[1]); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - TAG: function(match, context){ - return context.getElementsByTagName(match[1]); - } - }, - preFilter: { - CLASS: function(match, curLoop, inplace, result, not, isXML){ - match = " " + match[1].replace(/\\/g, "") + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").indexOf(match) >= 0) ) { - if ( !inplace ) - result.push( elem ); - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - ID: function(match){ - return match[1].replace(/\\/g, ""); - }, - TAG: function(match, curLoop){ - for ( var i = 0; curLoop[i] === false; i++ ){} - return curLoop[i] && isXML(curLoop[i]) ? match[1] : match[1].toUpperCase(); - }, - CHILD: function(match){ - if ( match[1] == "nth" ) { - var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec( - match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - - match[0] = done++; - - return match; - }, - ATTR: function(match, curLoop, inplace, result, not, isXML){ - var name = match[1].replace(/\\/g, ""); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - PSEUDO: function(match, curLoop, inplace, result, not){ - if ( match[1] === "not" ) { - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - if ( !inplace ) { - result.push.apply( result, ret ); - } - return false; - } - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - POS: function(match){ - match.unshift( true ); - return match; - } - }, - filters: { - enabled: function(elem){ - return elem.disabled === false && elem.type !== "hidden"; - }, - disabled: function(elem){ - return elem.disabled === true; - }, - checked: function(elem){ - return elem.checked === true; - }, - selected: function(elem){ - elem.parentNode.selectedIndex; - return elem.selected === true; - }, - parent: function(elem){ - return !!elem.firstChild; - }, - empty: function(elem){ - return !elem.firstChild; - }, - has: function(elem, i, match){ - return !!Sizzle( match[3], elem ).length; - }, - header: function(elem){ - return /h\d/i.test( elem.nodeName ); - }, - text: function(elem){ - return "text" === elem.type; - }, - radio: function(elem){ - return "radio" === elem.type; - }, - checkbox: function(elem){ - return "checkbox" === elem.type; - }, - file: function(elem){ - return "file" === elem.type; - }, - password: function(elem){ - return "password" === elem.type; - }, - submit: function(elem){ - return "submit" === elem.type; - }, - image: function(elem){ - return "image" === elem.type; - }, - reset: function(elem){ - return "reset" === elem.type; - }, - button: function(elem){ - return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON"; - }, - input: function(elem){ - return /input|select|textarea|button/i.test(elem.nodeName); - } - }, - setFilters: { - first: function(elem, i){ - return i === 0; - }, - last: function(elem, i, match, array){ - return i === array.length - 1; - }, - even: function(elem, i){ - return i % 2 === 0; - }, - odd: function(elem, i){ - return i % 2 === 1; - }, - lt: function(elem, i, match){ - return i < match[3] - 0; - }, - gt: function(elem, i, match){ - return i > match[3] - 0; - }, - nth: function(elem, i, match){ - return match[3] - 0 == i; - }, - eq: function(elem, i, match){ - return match[3] - 0 == i; - } - }, - filter: { - PSEUDO: function(elem, match, i, array){ - var name = match[1], filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || "").indexOf(match[3]) >= 0; - } else if ( name === "not" ) { - var not = match[3]; - - for ( var i = 0, l = not.length; i < l; i++ ) { - if ( not[i] === elem ) { - return false; - } - } - - return true; - } - }, - CHILD: function(elem, match){ - var type = match[1], node = elem; - switch (type) { - case 'only': - case 'first': - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) return false; - } - if ( type == 'first') return true; - node = elem; - case 'last': - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) return false; - } - return true; - case 'nth': - var first = match[2], last = match[3]; - - if ( first == 1 && last == 0 ) { - return true; - } - - var doneName = match[0], - parent = elem.parentNode; - - if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) { - var count = 0; - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - parent.sizcache = doneName; - } - - var diff = elem.nodeIndex - last; - if ( first == 0 ) { - return diff == 0; - } else { - return ( diff % first == 0 && diff / first >= 0 ); - } - } - }, - ID: function(elem, match){ - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - TAG: function(elem, match){ - return (match === "*" && elem.nodeType === 1) || elem.nodeName === match; - }, - CLASS: function(elem, match){ - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - ATTR: function(elem, match){ - var name = match[1], - result = Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value != check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - POS: function(elem, match, i, array){ - var name = match[2], filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + /(?![^\[]*\])(?![^\(]*\))/.source ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source ); -} - -var makeArray = function(array, results) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 ); - -} catch(e){ - makeArray = function(array, results) { - var ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - } else { - if ( typeof array.length === "number" ) { - for ( var i = 0, l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - } else { - for ( var i = 0; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( "sourceIndex" in document.documentElement ) { - sortOrder = function( a, b ) { - if ( !a.sourceIndex || !b.sourceIndex ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var ret = a.sourceIndex - b.sourceIndex; - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} else if ( document.createRange ) { - sortOrder = function( a, b ) { - if ( !a.ownerDocument || !b.ownerDocument ) { - if ( a == b ) { - hasDuplicate = true; - } - return 0; - } - - var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange(); - aRange.setStart(a, 0); - aRange.setEnd(a, 0); - bRange.setStart(b, 0); - bRange.setEnd(b, 0); - var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange); - if ( ret === 0 ) { - hasDuplicate = true; - } - return ret; - }; -} - -(function(){ - var form = document.createElement("div"), - id = "script" + (new Date).getTime(); - form.innerHTML = ""; - - var root = document.documentElement; - root.insertBefore( form, root.firstChild ); - - if ( !!document.getElementById( id ) ) { - Expr.find.ID = function(match, context, isXML){ - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : []; - } - }; - - Expr.filter.ID = function(elem, match){ - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - root = form = null; // release memory in IE -})(); - -(function(){ - - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function(match, context){ - var results = context.getElementsByTagName(match[1]); - - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - div.innerHTML = ""; - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - Expr.attrHandle.href = function(elem){ - return elem.getAttribute("href", 2); - }; - } - - div = null; // release memory in IE -})(); - -if ( document.querySelectorAll ) (function(){ - var oldSizzle = Sizzle, div = document.createElement("div"); - div.innerHTML = "

      "; - - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function(query, context, extra, seed){ - context = context || document; - - if ( !seed && context.nodeType === 9 && !isXML(context) ) { - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(e){} - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - div = null; // release memory in IE -})(); - -if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ - var div = document.createElement("div"); - div.innerHTML = "
      "; - - if ( div.getElementsByClassName("e").length === 0 ) - return; - - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) - return; - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function(match, context, isXML) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - div = null; // release memory in IE -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - var sibDir = dir == "previousSibling" && !isXML; - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - if ( sibDir && elem.nodeType === 1 ){ - elem.sizcache = doneName; - elem.sizset = i; - } - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem.sizcache = doneName; - elem.sizset = i; - } - - if ( elem.nodeName === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - var sibDir = dir == "previousSibling" && !isXML; - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - if ( elem ) { - if ( sibDir && elem.nodeType === 1 ) { - elem.sizcache = doneName; - elem.sizset = i; - } - elem = elem[dir]; - var match = false; - - while ( elem ) { - if ( elem.sizcache === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem.sizcache = doneName; - elem.sizset = i; - } - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -var contains = document.compareDocumentPosition ? function(a, b){ - return a.compareDocumentPosition(b) & 16; -} : function(a, b){ - return a !== b && (a.contains ? a.contains(b) : true); -}; - -var isXML = function(elem){ - return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || - !!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML"; -}; - -var posProcess = function(selector, context){ - var tmpSet = [], later = "", match, - root = context.nodeType ? [context] : context; - - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet ); - } - - return Sizzle.filter( later, tmpSet ); -}; - - -window.Sizzle = Sizzle; - -})(); - -;(function(engine) { - var extendElements = Prototype.Selector.extendElements; - - function select(selector, scope) { - return extendElements(engine(selector, scope || document)); - } - - function match(element, selector) { - return engine.matches(selector, [element]).length == 1; - } - - Prototype.Selector.engine = engine; - Prototype.Selector.select = select; - Prototype.Selector.match = match; -})(Sizzle); - -window.Sizzle = Prototype._original_property; -delete Prototype._original_property; - -var Form = { - reset: function(form) { - form = $(form); - form.reset(); - return form; - }, - - serializeElements: function(elements, options) { - if (typeof options != 'object') options = { hash: !!options }; - else if (Object.isUndefined(options.hash)) options.hash = true; - var key, value, submitted = false, submit = options.submit; - - var data = elements.inject({ }, function(result, element) { - if (!element.disabled && element.name) { - key = element.name; value = $(element).getValue(); - if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted && - submit !== false && (!submit || key == submit) && (submitted = true)))) { - if (key in result) { - if (!Object.isArray(result[key])) result[key] = [result[key]]; - result[key].push(value); - } - else result[key] = value; - } - } - return result; - }); - - return options.hash ? data : Object.toQueryString(data); - } -}; - -Form.Methods = { - serialize: function(form, options) { - return Form.serializeElements(Form.getElements(form), options); - }, - - getElements: function(form) { - var elements = $(form).getElementsByTagName('*'), - element, - arr = [ ], - serializers = Form.Element.Serializers; - for (var i = 0; element = elements[i]; i++) { - arr.push(element); - } - return arr.inject([], function(elements, child) { - if (serializers[child.tagName.toLowerCase()]) - elements.push(Element.extend(child)); - return elements; - }) - }, - - getInputs: function(form, typeName, name) { - form = $(form); - var inputs = form.getElementsByTagName('input'); - - if (!typeName && !name) return $A(inputs).map(Element.extend); - - for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { - var input = inputs[i]; - if ((typeName && input.type != typeName) || (name && input.name != name)) - continue; - matchingInputs.push(Element.extend(input)); - } - - return matchingInputs; - }, - - disable: function(form) { - form = $(form); - Form.getElements(form).invoke('disable'); - return form; - }, - - enable: function(form) { - form = $(form); - Form.getElements(form).invoke('enable'); - return form; - }, - - findFirstElement: function(form) { - var elements = $(form).getElements().findAll(function(element) { - return 'hidden' != element.type && !element.disabled; - }); - var firstByIndex = elements.findAll(function(element) { - return element.hasAttribute('tabIndex') && element.tabIndex >= 0; - }).sortBy(function(element) { return element.tabIndex }).first(); - - return firstByIndex ? firstByIndex : elements.find(function(element) { - return /^(?:input|select|textarea)$/i.test(element.tagName); - }); - }, - - focusFirstElement: function(form) { - form = $(form); - form.findFirstElement().activate(); - return form; - }, - - request: function(form, options) { - form = $(form), options = Object.clone(options || { }); - - var params = options.parameters, action = form.readAttribute('action') || ''; - if (action.blank()) action = window.location.href; - options.parameters = form.serialize(true); - - if (params) { - if (Object.isString(params)) params = params.toQueryParams(); - Object.extend(options.parameters, params); - } - - if (form.hasAttribute('method') && !options.method) - options.method = form.method; - - return new Ajax.Request(action, options); - } -}; - -/*--------------------------------------------------------------------------*/ - - -Form.Element = { - focus: function(element) { - $(element).focus(); - return element; - }, - - select: function(element) { - $(element).select(); - return element; - } -}; - -Form.Element.Methods = { - - serialize: function(element) { - element = $(element); - if (!element.disabled && element.name) { - var value = element.getValue(); - if (value != undefined) { - var pair = { }; - pair[element.name] = value; - return Object.toQueryString(pair); - } - } - return ''; - }, - - getValue: function(element) { - element = $(element); - var method = element.tagName.toLowerCase(); - return Form.Element.Serializers[method](element); - }, - - setValue: function(element, value) { - element = $(element); - var method = element.tagName.toLowerCase(); - Form.Element.Serializers[method](element, value); - return element; - }, - - clear: function(element) { - $(element).value = ''; - return element; - }, - - present: function(element) { - return $(element).value != ''; - }, - - activate: function(element) { - element = $(element); - try { - element.focus(); - if (element.select && (element.tagName.toLowerCase() != 'input' || - !(/^(?:button|reset|submit)$/i.test(element.type)))) - element.select(); - } catch (e) { } - return element; - }, - - disable: function(element) { - element = $(element); - element.disabled = true; - return element; - }, - - enable: function(element) { - element = $(element); - element.disabled = false; - return element; - } -}; - -/*--------------------------------------------------------------------------*/ - -var Field = Form.Element; - -var $F = Form.Element.Methods.getValue; - -/*--------------------------------------------------------------------------*/ - -Form.Element.Serializers = { - input: function(element, value) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - return Form.Element.Serializers.inputSelector(element, value); - default: - return Form.Element.Serializers.textarea(element, value); - } - }, - - inputSelector: function(element, value) { - if (Object.isUndefined(value)) return element.checked ? element.value : null; - else element.checked = !!value; - }, - - textarea: function(element, value) { - if (Object.isUndefined(value)) return element.value; - else element.value = value; - }, - - select: function(element, value) { - if (Object.isUndefined(value)) - return this[element.type == 'select-one' ? - 'selectOne' : 'selectMany'](element); - else { - var opt, currentValue, single = !Object.isArray(value); - for (var i = 0, length = element.length; i < length; i++) { - opt = element.options[i]; - currentValue = this.optionValue(opt); - if (single) { - if (currentValue == value) { - opt.selected = true; - return; - } - } - else opt.selected = value.include(currentValue); - } - } - }, - - selectOne: function(element) { - var index = element.selectedIndex; - return index >= 0 ? this.optionValue(element.options[index]) : null; - }, - - selectMany: function(element) { - var values, length = element.length; - if (!length) return null; - - for (var i = 0, values = []; i < length; i++) { - var opt = element.options[i]; - if (opt.selected) values.push(this.optionValue(opt)); - } - return values; - }, - - optionValue: function(opt) { - return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; - } -}; - -/*--------------------------------------------------------------------------*/ - - -Abstract.TimedObserver = Class.create(PeriodicalExecuter, { - initialize: function($super, element, frequency, callback) { - $super(callback, frequency); - this.element = $(element); - this.lastValue = this.getValue(); - }, - - execute: function() { - var value = this.getValue(); - if (Object.isString(this.lastValue) && Object.isString(value) ? - this.lastValue != value : String(this.lastValue) != String(value)) { - this.callback(this.element, value); - this.lastValue = value; - } - } -}); - -Form.Element.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.Observer = Class.create(Abstract.TimedObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); - -/*--------------------------------------------------------------------------*/ - -Abstract.EventObserver = Class.create({ - initialize: function(element, callback) { - this.element = $(element); - this.callback = callback; - - this.lastValue = this.getValue(); - if (this.element.tagName.toLowerCase() == 'form') - this.registerFormCallbacks(); - else - this.registerCallback(this.element); - }, - - onElementEvent: function() { - var value = this.getValue(); - if (this.lastValue != value) { - this.callback(this.element, value); - this.lastValue = value; - } - }, - - registerFormCallbacks: function() { - Form.getElements(this.element).each(this.registerCallback, this); - }, - - registerCallback: function(element) { - if (element.type) { - switch (element.type.toLowerCase()) { - case 'checkbox': - case 'radio': - Event.observe(element, 'click', this.onElementEvent.bind(this)); - break; - default: - Event.observe(element, 'change', this.onElementEvent.bind(this)); - break; - } - } - } -}); - -Form.Element.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.Element.getValue(this.element); - } -}); - -Form.EventObserver = Class.create(Abstract.EventObserver, { - getValue: function() { - return Form.serialize(this.element); - } -}); -(function() { - - var Event = { - KEY_BACKSPACE: 8, - KEY_TAB: 9, - KEY_RETURN: 13, - KEY_ESC: 27, - KEY_LEFT: 37, - KEY_UP: 38, - KEY_RIGHT: 39, - KEY_DOWN: 40, - KEY_DELETE: 46, - KEY_HOME: 36, - KEY_END: 35, - KEY_PAGEUP: 33, - KEY_PAGEDOWN: 34, - KEY_INSERT: 45, - - cache: {} - }; - - var docEl = document.documentElement; - var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl - && 'onmouseleave' in docEl; - - var _isButton; - if (Prototype.Browser.IE) { - var buttonMap = { 0: 1, 1: 4, 2: 2 }; - _isButton = function(event, code) { - return event.button === buttonMap[code]; - }; - } else if (Prototype.Browser.WebKit) { - _isButton = function(event, code) { - switch (code) { - case 0: return event.which == 1 && !event.metaKey; - case 1: return event.which == 1 && event.metaKey; - default: return false; - } - }; - } else { - _isButton = function(event, code) { - return event.which ? (event.which === code + 1) : (event.button === code); - }; - } - - function isLeftClick(event) { return _isButton(event, 0) } - - function isMiddleClick(event) { return _isButton(event, 1) } - - function isRightClick(event) { return _isButton(event, 2) } - - function element(event) { - event = Event.extend(event); - - var node = event.target, type = event.type, - currentTarget = event.currentTarget; - - if (currentTarget && currentTarget.tagName) { - if (type === 'load' || type === 'error' || - (type === 'click' && currentTarget.tagName.toLowerCase() === 'input' - && currentTarget.type === 'radio')) - node = currentTarget; - } - - if (node.nodeType == Node.TEXT_NODE) - node = node.parentNode; - - return Element.extend(node); - } - - function findElement(event, expression) { - var element = Event.element(event); - if (!expression) return element; - while (element) { - if (Object.isElement(element) && Prototype.Selector.match(element, expression)) { - return Element.extend(element); - } - element = element.parentNode; - } - } - - function pointer(event) { - return { x: pointerX(event), y: pointerY(event) }; - } - - function pointerX(event) { - var docElement = document.documentElement, - body = document.body || { scrollLeft: 0 }; - - return event.pageX || (event.clientX + - (docElement.scrollLeft || body.scrollLeft) - - (docElement.clientLeft || 0)); - } - - function pointerY(event) { - var docElement = document.documentElement, - body = document.body || { scrollTop: 0 }; - - return event.pageY || (event.clientY + - (docElement.scrollTop || body.scrollTop) - - (docElement.clientTop || 0)); - } - - - function stop(event) { - Event.extend(event); - event.preventDefault(); - event.stopPropagation(); - - event.stopped = true; - } - - Event.Methods = { - isLeftClick: isLeftClick, - isMiddleClick: isMiddleClick, - isRightClick: isRightClick, - - element: element, - findElement: findElement, - - pointer: pointer, - pointerX: pointerX, - pointerY: pointerY, - - stop: stop - }; - - - var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { - m[name] = Event.Methods[name].methodize(); - return m; - }); - - if (Prototype.Browser.IE) { - function _relatedTarget(event) { - var element; - switch (event.type) { - case 'mouseover': element = event.fromElement; break; - case 'mouseout': element = event.toElement; break; - default: return null; - } - return Element.extend(element); - } - - Object.extend(methods, { - stopPropagation: function() { this.cancelBubble = true }, - preventDefault: function() { this.returnValue = false }, - inspect: function() { return '[object Event]' } - }); - - Event.extend = function(event, element) { - if (!event) return false; - if (event._extendedByPrototype) return event; - - event._extendedByPrototype = Prototype.emptyFunction; - var pointer = Event.pointer(event); - - Object.extend(event, { - target: event.srcElement || element, - relatedTarget: _relatedTarget(event), - pageX: pointer.x, - pageY: pointer.y - }); - - return Object.extend(event, methods); - }; - } else { - Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__; - Object.extend(Event.prototype, methods); - Event.extend = Prototype.K; - } - - function _createResponder(element, eventName, handler) { - var registry = Element.retrieve(element, 'prototype_event_registry'); - - if (Object.isUndefined(registry)) { - CACHE.push(element); - registry = Element.retrieve(element, 'prototype_event_registry', $H()); - } - - var respondersForEvent = registry.get(eventName); - if (Object.isUndefined(respondersForEvent)) { - respondersForEvent = []; - registry.set(eventName, respondersForEvent); - } - - if (respondersForEvent.pluck('handler').include(handler)) return false; - - var responder; - if (eventName.include(":")) { - responder = function(event) { - if (Object.isUndefined(event.eventName)) - return false; - - if (event.eventName !== eventName) - return false; - - Event.extend(event, element); - handler.call(element, event); - }; - } else { - if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED && - (eventName === "mouseenter" || eventName === "mouseleave")) { - if (eventName === "mouseenter" || eventName === "mouseleave") { - responder = function(event) { - Event.extend(event, element); - - var parent = event.relatedTarget; - while (parent && parent !== element) { - try { parent = parent.parentNode; } - catch(e) { parent = element; } - } - - if (parent === element) return; - - handler.call(element, event); - }; - } - } else { - responder = function(event) { - Event.extend(event, element); - handler.call(element, event); - }; - } - } - - responder.handler = handler; - respondersForEvent.push(responder); - return responder; - } - - function _destroyCache() { - for (var i = 0, length = CACHE.length; i < length; i++) { - Event.stopObserving(CACHE[i]); - CACHE[i] = null; - } - } - - var CACHE = []; - - if (Prototype.Browser.IE) - window.attachEvent('onunload', _destroyCache); - - if (Prototype.Browser.WebKit) - window.addEventListener('unload', Prototype.emptyFunction, false); - - - var _getDOMEventName = Prototype.K, - translations = { mouseenter: "mouseover", mouseleave: "mouseout" }; - - if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) { - _getDOMEventName = function(eventName) { - return (translations[eventName] || eventName); - }; - } - - function observe(element, eventName, handler) { - element = $(element); - - var responder = _createResponder(element, eventName, handler); - - if (!responder) return element; - - if (eventName.include(':')) { - if (element.addEventListener) - element.addEventListener("dataavailable", responder, false); - else { - element.attachEvent("ondataavailable", responder); - element.attachEvent("onfilterchange", responder); - } - } else { - var actualEventName = _getDOMEventName(eventName); - - if (element.addEventListener) - element.addEventListener(actualEventName, responder, false); - else - element.attachEvent("on" + actualEventName, responder); - } - - return element; - } - - function stopObserving(element, eventName, handler) { - element = $(element); - - var registry = Element.retrieve(element, 'prototype_event_registry'); - if (!registry) return element; - - if (!eventName) { - registry.each( function(pair) { - var eventName = pair.key; - stopObserving(element, eventName); - }); - return element; - } - - var responders = registry.get(eventName); - if (!responders) return element; - - if (!handler) { - responders.each(function(r) { - stopObserving(element, eventName, r.handler); - }); - return element; - } - - var responder = responders.find( function(r) { return r.handler === handler; }); - if (!responder) return element; - - if (eventName.include(':')) { - if (element.removeEventListener) - element.removeEventListener("dataavailable", responder, false); - else { - element.detachEvent("ondataavailable", responder); - element.detachEvent("onfilterchange", responder); - } - } else { - var actualEventName = _getDOMEventName(eventName); - if (element.removeEventListener) - element.removeEventListener(actualEventName, responder, false); - else - element.detachEvent('on' + actualEventName, responder); - } - - registry.set(eventName, responders.without(responder)); - - return element; - } - - function fire(element, eventName, memo, bubble) { - element = $(element); - - if (Object.isUndefined(bubble)) - bubble = true; - - if (element == document && document.createEvent && !element.dispatchEvent) - element = document.documentElement; - - var event; - if (document.createEvent) { - event = document.createEvent('HTMLEvents'); - event.initEvent('dataavailable', true, true); - } else { - event = document.createEventObject(); - event.eventType = bubble ? 'ondataavailable' : 'onfilterchange'; - } - - event.eventName = eventName; - event.memo = memo || { }; - - if (document.createEvent) - element.dispatchEvent(event); - else - element.fireEvent(event.eventType, event); - - return Event.extend(event); - } - - Event.Handler = Class.create({ - initialize: function(element, eventName, selector, callback) { - this.element = $(element); - this.eventName = eventName; - this.selector = selector; - this.callback = callback; - this.handler = this.handleEvent.bind(this); - }, - - start: function() { - Event.observe(this.element, this.eventName, this.handler); - return this; - }, - - stop: function() { - Event.stopObserving(this.element, this.eventName, this.handler); - return this; - }, - - handleEvent: function(event) { - var element = event.findElement(this.selector); - if (element) this.callback.call(this.element, event, element); - } - }); - - function on(element, eventName, selector, callback) { - element = $(element); - if (Object.isFunction(selector) && Object.isUndefined(callback)) { - callback = selector, selector = null; - } - - return new Event.Handler(element, eventName, selector, callback).start(); - } - - Object.extend(Event, Event.Methods); - - Object.extend(Event, { - fire: fire, - observe: observe, - stopObserving: stopObserving, - on: on - }); - - Element.addMethods({ - fire: fire, - - observe: observe, - - stopObserving: stopObserving, - - on: on - }); - - Object.extend(document, { - fire: fire.methodize(), - - observe: observe.methodize(), - - stopObserving: stopObserving.methodize(), - - on: on.methodize(), - - loaded: false - }); - - if (window.Event) Object.extend(window.Event, Event); - else window.Event = Event; -})(); - -(function() { - /* Support for the DOMContentLoaded event is based on work by Dan Webb, - Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */ - - var timer; - - function fireContentLoadedEvent() { - if (document.loaded) return; - if (timer) window.clearTimeout(timer); - document.loaded = true; - document.fire('dom:loaded'); - } - - function checkReadyState() { - if (document.readyState === 'complete') { - document.stopObserving('readystatechange', checkReadyState); - fireContentLoadedEvent(); - } - } - - function pollDoScroll() { - try { document.documentElement.doScroll('left'); } - catch(e) { - timer = pollDoScroll.defer(); - return; - } - fireContentLoadedEvent(); - } - - if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false); - } else { - document.observe('readystatechange', checkReadyState); - if (window == top) - timer = pollDoScroll.defer(); - } - - Event.observe(window, 'load', fireContentLoadedEvent); -})(); - -Element.addMethods(); - -/*------------------------------- DEPRECATED -------------------------------*/ - -Hash.toQueryString = Object.toQueryString; - -var Toggle = { display: Element.toggle }; - -Element.Methods.childOf = Element.Methods.descendantOf; - -var Insertion = { - Before: function(element, content) { - return Element.insert(element, {before:content}); - }, - - Top: function(element, content) { - return Element.insert(element, {top:content}); - }, - - Bottom: function(element, content) { - return Element.insert(element, {bottom:content}); - }, - - After: function(element, content) { - return Element.insert(element, {after:content}); - } -}; - -var $continue = new Error('"throw $continue" is deprecated, use "return" instead'); - -var Position = { - includeScrollOffsets: false, - - prepare: function() { - this.deltaX = window.pageXOffset - || document.documentElement.scrollLeft - || document.body.scrollLeft - || 0; - this.deltaY = window.pageYOffset - || document.documentElement.scrollTop - || document.body.scrollTop - || 0; - }, - - within: function(element, x, y) { - if (this.includeScrollOffsets) - return this.withinIncludingScrolloffsets(element, x, y); - this.xcomp = x; - this.ycomp = y; - this.offset = Element.cumulativeOffset(element); - - return (y >= this.offset[1] && - y < this.offset[1] + element.offsetHeight && - x >= this.offset[0] && - x < this.offset[0] + element.offsetWidth); - }, - - withinIncludingScrolloffsets: function(element, x, y) { - var offsetcache = Element.cumulativeScrollOffset(element); - - this.xcomp = x + offsetcache[0] - this.deltaX; - this.ycomp = y + offsetcache[1] - this.deltaY; - this.offset = Element.cumulativeOffset(element); - - return (this.ycomp >= this.offset[1] && - this.ycomp < this.offset[1] + element.offsetHeight && - this.xcomp >= this.offset[0] && - this.xcomp < this.offset[0] + element.offsetWidth); - }, - - overlap: function(mode, element) { - if (!mode) return 0; - if (mode == 'vertical') - return ((this.offset[1] + element.offsetHeight) - this.ycomp) / - element.offsetHeight; - if (mode == 'horizontal') - return ((this.offset[0] + element.offsetWidth) - this.xcomp) / - element.offsetWidth; - }, - - - cumulativeOffset: Element.Methods.cumulativeOffset, - - positionedOffset: Element.Methods.positionedOffset, - - absolutize: function(element) { - Position.prepare(); - return Element.absolutize(element); - }, - - relativize: function(element) { - Position.prepare(); - return Element.relativize(element); - }, - - realOffset: Element.Methods.cumulativeScrollOffset, - - offsetParent: Element.Methods.getOffsetParent, - - page: Element.Methods.viewportOffset, - - clone: function(source, target, options) { - options = options || { }; - return Element.clonePosition(target, source, options); - } -}; - -/*--------------------------------------------------------------------------*/ - -if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){ - function iter(name) { - return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]"; - } - - instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ? - function(element, className) { - className = className.toString().strip(); - var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className); - return cond ? document._getElementsByXPath('.//*' + cond, element) : []; - } : function(element, className) { - className = className.toString().strip(); - var elements = [], classNames = (/\s/.test(className) ? $w(className) : null); - if (!classNames && !className) return elements; - - var nodes = $(element).getElementsByTagName('*'); - className = ' ' + className + ' '; - - for (var i = 0, child, cn; child = nodes[i]; i++) { - if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) || - (classNames && classNames.all(function(name) { - return !name.toString().blank() && cn.include(' ' + name + ' '); - })))) - elements.push(Element.extend(child)); - } - return elements; - }; - - return function(className, parentElement) { - return $(parentElement || document.body).getElementsByClassName(className); - }; -}(Element.Methods); - -/*--------------------------------------------------------------------------*/ - -Element.ClassNames = Class.create(); -Element.ClassNames.prototype = { - initialize: function(element) { - this.element = $(element); - }, - - _each: function(iterator) { - this.element.className.split(/\s+/).select(function(name) { - return name.length > 0; - })._each(iterator); - }, - - set: function(className) { - this.element.className = className; - }, - - add: function(classNameToAdd) { - if (this.include(classNameToAdd)) return; - this.set($A(this).concat(classNameToAdd).join(' ')); - }, - - remove: function(classNameToRemove) { - if (!this.include(classNameToRemove)) return; - this.set($A(this).without(classNameToRemove).join(' ')); - }, - - toString: function() { - return $A(this).join(' '); - } -}; - -Object.extend(Element.ClassNames.prototype, Enumerable); - -/*--------------------------------------------------------------------------*/ - -(function() { - window.Selector = Class.create({ - initialize: function(expression) { - this.expression = expression.strip(); - }, - - findElements: function(rootElement) { - return Prototype.Selector.select(this.expression, rootElement); - }, - - match: function(element) { - return Prototype.Selector.match(element, this.expression); - }, - - toString: function() { - return this.expression; - }, - - inspect: function() { - return "#"; - } - }); - - Object.extend(Selector, { - matchElements: function(elements, expression) { - var match = Prototype.Selector.match, - results = []; - - for (var i = 0, length = elements.length; i < length; i++) { - var element = elements[i]; - if (match(element, expression)) { - results.push(Element.extend(element)); - } - } - return results; - }, - - findElement: function(elements, expression, index) { - index = index || 0; - var matchIndex = 0, element; - for (var i = 0, length = elements.length; i < length; i++) { - element = elements[i]; - if (Prototype.Selector.match(element, expression) && index === matchIndex++) { - return Element.extend(element); - } - } - }, - - findChildElements: function(element, expressions) { - var selector = expressions.toArray().join(', '); - return Prototype.Selector.select(selector, element || document); - } - }); -})(); diff --git a/vendor/impressionist/test_app/public/javascripts/rails.js b/vendor/impressionist/test_app/public/javascripts/rails.js deleted file mode 100644 index 4283ed898..000000000 --- a/vendor/impressionist/test_app/public/javascripts/rails.js +++ /dev/null @@ -1,175 +0,0 @@ -(function() { - // Technique from Juriy Zaytsev - // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ - function isEventSupported(eventName) { - var el = document.createElement('div'); - eventName = 'on' + eventName; - var isSupported = (eventName in el); - if (!isSupported) { - el.setAttribute(eventName, 'return;'); - isSupported = typeof el[eventName] == 'function'; - } - el = null; - return isSupported; - } - - function isForm(element) { - return Object.isElement(element) && element.nodeName.toUpperCase() == 'FORM' - } - - function isInput(element) { - if (Object.isElement(element)) { - var name = element.nodeName.toUpperCase() - return name == 'INPUT' || name == 'SELECT' || name == 'TEXTAREA' - } - else return false - } - - var submitBubbles = isEventSupported('submit'), - changeBubbles = isEventSupported('change') - - if (!submitBubbles || !changeBubbles) { - // augment the Event.Handler class to observe custom events when needed - Event.Handler.prototype.initialize = Event.Handler.prototype.initialize.wrap( - function(init, element, eventName, selector, callback) { - init(element, eventName, selector, callback) - // is the handler being attached to an element that doesn't support this event? - if ( (!submitBubbles && this.eventName == 'submit' && !isForm(this.element)) || - (!changeBubbles && this.eventName == 'change' && !isInput(this.element)) ) { - // "submit" => "emulated:submit" - this.eventName = 'emulated:' + this.eventName - } - } - ) - } - - if (!submitBubbles) { - // discover forms on the page by observing focus events which always bubble - document.on('focusin', 'form', function(focusEvent, form) { - // special handler for the real "submit" event (one-time operation) - if (!form.retrieve('emulated:submit')) { - form.on('submit', function(submitEvent) { - var emulated = form.fire('emulated:submit', submitEvent, true) - // if custom event received preventDefault, cancel the real one too - if (emulated.returnValue === false) submitEvent.preventDefault() - }) - form.store('emulated:submit', true) - } - }) - } - - if (!changeBubbles) { - // discover form inputs on the page - document.on('focusin', 'input, select, texarea', function(focusEvent, input) { - // special handler for real "change" events - if (!input.retrieve('emulated:change')) { - input.on('change', function(changeEvent) { - input.fire('emulated:change', changeEvent, true) - }) - input.store('emulated:change', true) - } - }) - } - - function handleRemote(element) { - var method, url, params; - - var event = element.fire("ajax:before"); - if (event.stopped) return false; - - if (element.tagName.toLowerCase() === 'form') { - method = element.readAttribute('method') || 'post'; - url = element.readAttribute('action'); - params = element.serialize(); - } else { - method = element.readAttribute('data-method') || 'get'; - url = element.readAttribute('href'); - params = {}; - } - - new Ajax.Request(url, { - method: method, - parameters: params, - evalScripts: true, - - onComplete: function(request) { element.fire("ajax:complete", request); }, - onSuccess: function(request) { element.fire("ajax:success", request); }, - onFailure: function(request) { element.fire("ajax:failure", request); } - }); - - element.fire("ajax:after"); - } - - function handleMethod(element) { - var method = element.readAttribute('data-method'), - url = element.readAttribute('href'), - csrf_param = $$('meta[name=csrf-param]')[0], - csrf_token = $$('meta[name=csrf-token]')[0]; - - var form = new Element('form', { method: "POST", action: url, style: "display: none;" }); - element.parentNode.insert(form); - - if (method !== 'post') { - var field = new Element('input', { type: 'hidden', name: '_method', value: method }); - form.insert(field); - } - - if (csrf_param) { - var param = csrf_param.readAttribute('content'), - token = csrf_token.readAttribute('content'), - field = new Element('input', { type: 'hidden', name: param, value: token }); - form.insert(field); - } - - form.submit(); - } - - - document.on("click", "*[data-confirm]", function(event, element) { - var message = element.readAttribute('data-confirm'); - if (!confirm(message)) event.stop(); - }); - - document.on("click", "a[data-remote]", function(event, element) { - if (event.stopped) return; - handleRemote(element); - event.stop(); - }); - - document.on("click", "a[data-method]", function(event, element) { - if (event.stopped) return; - handleMethod(element); - event.stop(); - }); - - document.on("submit", function(event) { - var element = event.findElement(), - message = element.readAttribute('data-confirm'); - if (message && !confirm(message)) { - event.stop(); - return false; - } - - var inputs = element.select("input[type=submit][data-disable-with]"); - inputs.each(function(input) { - input.disabled = true; - input.writeAttribute('data-original-value', input.value); - input.value = input.readAttribute('data-disable-with'); - }); - - var element = event.findElement("form[data-remote]"); - if (element) { - handleRemote(element); - event.stop(); - } - }); - - document.on("ajax:after", "form", function(event, element) { - var inputs = element.select("input[type=submit][disabled=true][data-disable-with]"); - inputs.each(function(input) { - input.value = input.readAttribute('data-original-value'); - input.removeAttribute('data-original-value'); - input.disabled = false; - }); - }); -})(); diff --git a/vendor/impressionist/test_app/public/robots.txt b/vendor/impressionist/test_app/public/robots.txt deleted file mode 100644 index 085187fa5..000000000 --- a/vendor/impressionist/test_app/public/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file -# -# To ban all spiders from the entire site uncomment the next two lines: -# User-Agent: * -# Disallow: / diff --git a/vendor/impressionist/test_app/public/stylesheets/.gitkeep b/vendor/impressionist/test_app/public/stylesheets/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/impressionist/test_app/script/cucumber b/vendor/impressionist/test_app/script/cucumber deleted file mode 100755 index 7fa5c9208..000000000 --- a/vendor/impressionist/test_app/script/cucumber +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env ruby - -vendored_cucumber_bin = Dir["#{File.dirname(__FILE__)}/../vendor/{gems,plugins}/cucumber*/bin/cucumber"].first -if vendored_cucumber_bin - load File.expand_path(vendored_cucumber_bin) -else - require 'rubygems' unless ENV['NO_RUBYGEMS'] - require 'cucumber' - load Cucumber::BINARY -end diff --git a/vendor/impressionist/test_app/script/rails b/vendor/impressionist/test_app/script/rails deleted file mode 100755 index f8da2cffd..000000000 --- a/vendor/impressionist/test_app/script/rails +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env ruby -# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. - -APP_PATH = File.expand_path('../../config/application', __FILE__) -require File.expand_path('../../config/boot', __FILE__) -require 'rails/commands' diff --git a/vendor/impressionist/test_app/spec/controllers/controller_spec.rb b/vendor/impressionist/test_app/spec/controllers/controller_spec.rb deleted file mode 100644 index a48b3a06d..000000000 --- a/vendor/impressionist/test_app/spec/controllers/controller_spec.rb +++ /dev/null @@ -1,125 +0,0 @@ -require 'spec_helper' - -describe ArticlesController do - fixtures :articles,:impressions,:posts,:widgets - render_views - - it "should make the impressionable_hash available" do - get "index" - response.body.include?("false").should eq true - end - - it "should log an impression with a message" do - get "index" - Impression.all.size.should eq 12 - Article.first.impressions.last.message.should eq "this is a test article impression" - Article.first.impressions.last.controller_name.should eq "articles" - Article.first.impressions.last.action_name.should eq "index" - end - - it "should log an impression without a message" do - get "show", :id=> 1 - Impression.all.size.should eq 12 - Article.first.impressions.last.message.should eq nil - Article.first.impressions.last.controller_name.should eq "articles" - Article.first.impressions.last.action_name.should eq "show" - end - - it "should log the user_id if user is authenticated (@current_user before_filter method)" do - session[:user_id] = 123 - get "show", :id=> 1 - Article.first.impressions.last.user_id.should eq 123 - end - - it "should not log the user_id if user is authenticated" do - get "show", :id=> 1 - Article.first.impressions.last.user_id.should eq nil - end - - it "should log the request_hash, ip_address, referrer and session_hash" do - get "show", :id=> 1 - Impression.last.request_hash.size.should eq 64 - Impression.last.ip_address.should eq "0.0.0.0" - Impression.last.session_hash.size.should eq 32 - Impression.last.referrer.should eq nil - end - - it "should log the referrer when you click a link" do - visit article_url(Article.first) - click_link "Same Page" - Impression.last.referrer.should eq "http://test.host/articles/1" - end -end - -describe PostsController do - it "should log impression at the action level" do - get "show", :id=> 1 - Impression.all.size.should eq 12 - Impression.last.controller_name.should eq "posts" - Impression.last.action_name.should eq "show" - Impression.last.impressionable_type.should eq "Post" - Impression.last.impressionable_id.should eq 1 - end - - it "should log the user_id if user is authenticated (current_user helper method)" do - session[:user_id] = 123 - get "show", :id=> 1 - Post.first.impressions.last.user_id.should eq 123 - end -end - -describe WidgetsController do - - before(:each) do - @widget = Widget.find(1) - Widget.stub(:find).and_return(@widget) - end - - it "should log impression at the per action level" do - get "show", :id=> 1 - Impression.all.size.should eq 12 - get "index" - Impression.all.size.should eq 13 - get "new" - Impression.all.size.should eq 13 - end - - it "should not log impression when user-agent is in wildcard list" do - request.stub!(:user_agent).and_return('somebot') - get "show", :id=> 1 - Impression.all.size.should eq 11 - end - - it "should not log impression when user-agent is in the bot list" do - request.stub!(:user_agent).and_return('Acoon Robot v1.50.001') - get "show", :id=> 1 - Impression.all.size.should eq 11 - end - - describe "impressionist unique options" do - - it "should log unique impressions at the per action level" do - get "show", :id=> 1 - Impression.all.size.should eq 12 - get "show", :id=> 2 - Impression.all.size.should eq 13 - get "show", :id => 2 - Impression.all.size.should eq 13 - get "index" - Impression.all.size.should eq 14 - end - - it "should log unique impressions only once per id" do - get "show", :id=> 1 - Impression.all.size.should eq 12 - get "show", :id=> 2 - Impression.all.size.should eq 13 - get "show", :id => 2 - Impression.all.size.should eq 13 - get "index" - Impression.all.size.should eq 14 - end - - end - -end diff --git a/vendor/impressionist/test_app/spec/controllers/impressionist_uniqueness_spec.rb b/vendor/impressionist/test_app/spec/controllers/impressionist_uniqueness_spec.rb deleted file mode 100644 index f9c3fc3e5..000000000 --- a/vendor/impressionist/test_app/spec/controllers/impressionist_uniqueness_spec.rb +++ /dev/null @@ -1,310 +0,0 @@ -require 'spec_helper' - -# we use the posts controller as it uses the impressionsist module. any such controller would do. -describe DummyController do - - before do - @impression_count = Impression.all.size - end - - describe "impressionist filter uniqueness" do - - it "should ignore uniqueness if not requested" do - controller.impressionist_subapp_filter(nil, nil) - controller.impressionist_subapp_filter(nil, nil) - Impression.should have(@impression_count + 2).records - end - - it "should recognize unique session" do - controller.stub!(:session_hash).and_return(request.session_options[:id]) - controller.impressionist_subapp_filter(nil, [:session_hash]) - controller.impressionist_subapp_filter(nil, [:session_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique ip" do - controller.request.stub!(:remote_ip).and_return("1.2.3.4") - controller.impressionist_subapp_filter(nil, [:ip_address]) - controller.impressionist_subapp_filter(nil, [:ip_address]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique request" do - controller.impressionist_subapp_filter(nil, [:request_hash]) - controller.impressionist_subapp_filter(nil, [:request_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique action" do - controller.stub!(:action_name).and_return("test_action") - controller.impressionist_subapp_filter(nil, [:action_name]) - controller.impressionist_subapp_filter(nil, [:action_name]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique controller" do - controller.stub!(:controller_name).and_return("post") - controller.impressionist_subapp_filter(nil, [:controller_name]) - controller.impressionist_subapp_filter(nil, [:controller_name]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique user" do - controller.stub!(:user_id).and_return(42) - controller.impressionist_subapp_filter(nil, [:user_id]) - controller.impressionist_subapp_filter(nil, [:user_id]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique referer" do - controller.request.stub!(:referer).and_return("http://foo/bar") - controller.impressionist_subapp_filter(nil, [:referrer]) - controller.impressionist_subapp_filter(nil, [:referrer]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique id" do - controller.stub!(:params).and_return({:id => "666"}) # for correct impressionable id in filter - controller.impressionist_subapp_filter(nil, [:impressionable_id]) - controller.impressionist_subapp_filter(nil, [:impressionable_id]) - Impression.should have(@impression_count + 1).records - end - - # extra redundant test for important controller and action combination. - it "should recognize different controller and action" do - controller.stub!(:controller_name).and_return("post") - controller.stub!(:action_name).and_return("test_action") - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - Impression.should have(@impression_count + 1).records - controller.stub!(:action_name).and_return("another_action") - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - Impression.should have(@impression_count + 2).records - controller.stub!(:controller_name).and_return("article") - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - controller.impressionist_subapp_filter(nil, [:controller_name, :action_name]) - Impression.should have(@impression_count + 3).records - end - - it "should recognize different action" do - controller.stub!(:action_name).and_return("test_action") - controller.impressionist_subapp_filter(nil, [:action_name]) - controller.impressionist_subapp_filter(nil, [:action_name]) - Impression.should have(@impression_count + 1).records - controller.stub!(:action_name).and_return("another_action") - controller.impressionist_subapp_filter(nil, [:action_name]) - controller.impressionist_subapp_filter(nil, [:action_name]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different controller" do - controller.stub!(:controller_name).and_return("post") - controller.impressionist_subapp_filter(nil, [:controller_name]) - controller.impressionist_subapp_filter(nil, [:controller_name]) - Impression.should have(@impression_count + 1).records - controller.stub!(:controller_name).and_return("article") - controller.impressionist_subapp_filter(nil, [:controller_name]) - controller.impressionist_subapp_filter(nil, [:controller_name]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different session" do - controller.stub!(:session_hash).and_return("foo") - controller.impressionist_subapp_filter(nil, [:session_hash]) - controller.impressionist_subapp_filter(nil, [:session_hash]) - Impression.should have(@impression_count + 1).records - controller.stub!(:session_hash).and_return("bar") - controller.impressionist_subapp_filter(nil, [:session_hash]) - controller.impressionist_subapp_filter(nil, [:session_hash]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different ip" do - controller.request.stub!(:remote_ip).and_return("1.2.3.4") - controller.impressionist_subapp_filter(nil, [:ip_address]) - controller.impressionist_subapp_filter(nil, [:ip_address]) - Impression.should have(@impression_count + 1).records - controller.request.stub!(:remote_ip).and_return("5.6.7.8") - controller.impressionist_subapp_filter(nil, [:ip_address]) - controller.impressionist_subapp_filter(nil, [:ip_address]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different referer" do - controller.request.stub!(:referer).and_return("http://foo/bar") - controller.impressionist_subapp_filter(nil, [:referrer]) - controller.impressionist_subapp_filter(nil, [:referrer]) - Impression.should have(@impression_count + 1).records - controller.request.stub!(:referer).and_return("http://bar/fo") - controller.impressionist_subapp_filter(nil, [:referrer]) - controller.impressionist_subapp_filter(nil, [:referrer]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different id" do - controller.stub!(:params).and_return({:id => "666"}) # for correct impressionable id in filter - controller.impressionist_subapp_filter(nil, [:impressionable_type, :impressionable_id]) - controller.impressionist_subapp_filter(nil, [:impressionable_type, :impressionable_id]) - controller.stub!(:params).and_return({:id => "42"}) # for correct impressionable id in filter - controller.impressionist_subapp_filter(nil, [:impressionable_type, :impressionable_id]) - controller.impressionist_subapp_filter(nil, [:impressionable_type, :impressionable_id]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize combined uniqueness" do - controller.stub!(:action_name).and_return("test_action") - controller.impressionist_subapp_filter(nil, [:ip_address, :request_hash, :action_name]) - controller.impressionist_subapp_filter(nil, [:request_hash, :ip_address, :action_name]) - controller.impressionist_subapp_filter(nil, [:request_hash, :action_name]) - controller.impressionist_subapp_filter(nil, [:ip_address, :action_name]) - controller.impressionist_subapp_filter(nil, [:ip_address, :request_hash]) - controller.impressionist_subapp_filter(nil, [:action_name]) - controller.impressionist_subapp_filter(nil, [:ip_address]) - controller.impressionist_subapp_filter(nil, [:request_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize combined non-uniqueness" do - controller.stub!(:action_name).and_return(nil) - controller.impressionist_subapp_filter(nil, [:ip_address, :action_name]) - controller.stub!(:action_name).and_return("test_action") - controller.impressionist_subapp_filter(nil, [:ip_address, :action_name]) - controller.stub!(:action_name).and_return("another_action") - controller.impressionist_subapp_filter(nil, [:ip_address, :action_name]) - Impression.should have(@impression_count + 3).records - end - - end - - describe "impressionist method uniqueness for impressionables" do - - # in this test we reuse the post model. might break if model changes. - - it "should ignore uniqueness if not requested" do - impressionable = Post.create - controller.impressionist impressionable - controller.impressionist impressionable - Impression.should have(@impression_count + 2).records - end - - it "should recognize unique session" do - controller.stub!(:session_hash).and_return(request.session_options[:id]) - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique ip" do - controller.request.stub!(:remote_ip).and_return("1.2.3.4") - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique request" do - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:request_hash]) - controller.impressionist(impressionable, nil, :unique => [:request_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique user" do - controller.stub!(:user_id).and_return(666) - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:user_id]) - controller.impressionist(impressionable, nil, :unique => [:user_id]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize unique referer" do - controller.request.stub!(:referer).and_return("http://foo/bar") - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:referrer]) - controller.impressionist(impressionable, nil, :unique => [:referrer]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize different session" do - impressionable = Post.create - controller.stub!(:session_hash).and_return("foo") - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - Impression.should have(@impression_count + 1).records - controller.stub!(:session_hash).and_return("bar") - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different ip" do - controller.request.stub!(:remote_ip).and_return("1.2.3.4") - impressionable = Post.create - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - Impression.should have(@impression_count + 1).records - controller.request.stub!(:remote_ip).and_return("5.6.7.8") - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize different user" do - impressionable = Post.create - controller.stub!(:user_id).and_return(666) - controller.impressionist(impressionable, nil, :unique => [:user_id]) - controller.impressionist(impressionable, nil, :unique => [:user_id]) - Impression.should have(@impression_count + 1).records - controller.stub!(:user_id).and_return(42) - controller.impressionist(impressionable, nil, :unique => [:user_id]) - controller.impressionist(impressionable, nil, :unique => [:user_id]) - Impression.should have(@impression_count + 2).records - end - - it "should recognize combined uniqueness" do - impressionable = Post.create - controller.stub!(:session_hash).and_return("foo") - controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash, :session_hash]) - controller.impressionist(impressionable, nil, :unique => [:request_hash, :ip_address, :session_hash]) - controller.impressionist(impressionable, nil, :unique => [:request_hash, :session_hash]) - controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash]) - controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash]) - controller.impressionist(impressionable, nil, :unique => [:session_hash]) - controller.impressionist(impressionable, nil, :unique => [:ip_address]) - controller.impressionist(impressionable, nil, :unique => [:request_hash]) - Impression.should have(@impression_count + 1).records - end - - it "should recognize combined non-uniqueness" do - impressionable = Post.create - controller.stub!(:session_hash).and_return(nil) - controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash]) - controller.stub!(:session_hash).and_return("foo") - controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash]) - controller.stub!(:session_hash).and_return("bar") - controller.impressionist(impressionable, nil, :unique => [:ip_address, :session_hash]) - Impression.should have(@impression_count + 3).records - end - - end - - describe "impressionist filter and method uniqueness" do - - it "should recognize uniqueness" do - impressionable = Post.create - controller.stub!(:controller_name).and_return("posts") # for correct impressionable type in filter - controller.stub!(:params).and_return({:id => impressionable.id.to_s}) # for correct impressionable id in filter - controller.stub!(:session_hash).and_return("foo") - controller.request.stub!(:remote_ip).and_return("1.2.3.4") - # order of the following methods is important for the test! - controller.impressionist_subapp_filter(nil, [:ip_address, :request_hash, :session_hash]) - controller.impressionist(impressionable, nil, :unique => [:ip_address, :request_hash, :session_hash]) - Impression.should have(@impression_count + 1).records - end - - end - -end - diff --git a/vendor/impressionist/test_app/spec/fixtures/articles.yml b/vendor/impressionist/test_app/spec/fixtures/articles.yml deleted file mode 100644 index 0a0867df3..000000000 --- a/vendor/impressionist/test_app/spec/fixtures/articles.yml +++ /dev/null @@ -1,3 +0,0 @@ -one: - id: 1 - name: Test Article diff --git a/vendor/impressionist/test_app/spec/fixtures/impressions.yml b/vendor/impressionist/test_app/spec/fixtures/impressions.yml deleted file mode 100644 index 7342af546..000000000 --- a/vendor/impressionist/test_app/spec/fixtures/impressions.yml +++ /dev/null @@ -1,43 +0,0 @@ -<% 1.upto(7) do |i| %> -impression<%= i %>: - impressionable_type: Article - impressionable_id: 1 - request_hash: a<%=i%> - session_hash: b<%=i%> - ip_address: 127.0.0.<%=i%> - created_at: 2011-01-01 -<% end %> - - -impression8: - impressionable_type: Article - impressionable_id: 1 - request_hash: a1 - session_hash: b1 - ip_address: 127.0.0.1 - created_at: 2010-01-01 - -impression9: - impressionable_type: Article - impressionable_id: 1 - request_hash: a1 - session_hash: b2 - ip_address: 127.0.0.1 - created_at: 2011-01-03 - -impression10: - impressionable_type: Article - impressionable_id: 1 - request_hash: a9 - session_hash: b3 - ip_address: 127.0.0.8 - created_at: 2010-01-01 - -impression11: - impressionable_type: Article - impressionable_id: 1 - request_hash: a10 - session_hash: b4 - ip_address: 127.0.0.1 - created_at: 2010-01-01 - diff --git a/vendor/impressionist/test_app/spec/fixtures/posts.yml b/vendor/impressionist/test_app/spec/fixtures/posts.yml deleted file mode 100644 index b85e6799c..000000000 --- a/vendor/impressionist/test_app/spec/fixtures/posts.yml +++ /dev/null @@ -1,3 +0,0 @@ -one: - id: 1 - name: Test Post diff --git a/vendor/impressionist/test_app/spec/fixtures/widgets.yml b/vendor/impressionist/test_app/spec/fixtures/widgets.yml deleted file mode 100644 index 119624660..000000000 --- a/vendor/impressionist/test_app/spec/fixtures/widgets.yml +++ /dev/null @@ -1,4 +0,0 @@ -one: - id: 1 - name: A Widget - impressions_count: 0 diff --git a/vendor/impressionist/test_app/spec/initializers/initializers_spec.rb b/vendor/impressionist/test_app/spec/initializers/initializers_spec.rb deleted file mode 100644 index 879a82a48..000000000 --- a/vendor/impressionist/test_app/spec/initializers/initializers_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'spec_helper' - -describe Impressionist do - it "should be extended from ActiveRecord::Base" do - method = RUBY_VERSION.match("1.8") ? "is_impressionable" : :is_impressionable - ActiveRecord::Base.methods.include?(method).should be_true - end - - it "should include methods in ApplicationController" do - method = RUBY_VERSION.match("1.8") ? "impressionist" : :impressionist - ApplicationController.instance_methods.include?(method).should be_true - end - - it "should include the before_filter method in ApplicationController" do - filters = ApplicationController._process_action_callbacks.select { |c| c.kind == :before } - filters.collect{|filter|filter.filter}.include?(:impressionist_app_filter).should be_true - end -end diff --git a/vendor/impressionist/test_app/spec/models/bots_spec.rb b/vendor/impressionist/test_app/spec/models/bots_spec.rb deleted file mode 100644 index a29835875..000000000 --- a/vendor/impressionist/test_app/spec/models/bots_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require 'spec_helper' - -describe Impressionist::Bots do - - describe "self.bot?" do - it "is true if user_agent is matches wild card" do - Impressionist::Bots.bot?("google.com bot").should be_true - end - - it "is true if user_agent is on bot list" do - Impressionist::Bots.bot?("A-Online Search").should be_true - end - - it "is false if user_agent is blank" do - Impressionist::Bots.bot?("").should be_false - Impressionist::Bots.bot?(nil).should be_false - end - - it "is false if user_agent is safe" do - Impressionist::Bots.bot?('127.0.0.1').should be_false - end - - it "is false if user_agent not given" do - Impressionist::Bots.bot?.should be_false - end - end -end \ No newline at end of file diff --git a/vendor/impressionist/test_app/spec/models/counter_caching_spec.rb b/vendor/impressionist/test_app/spec/models/counter_caching_spec.rb deleted file mode 100644 index 552bf6474..000000000 --- a/vendor/impressionist/test_app/spec/models/counter_caching_spec.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'spec_helper' - -describe Impression do - fixtures :widgets - - before(:each) do - @widget = Widget.find(1) - Impression.destroy_all - end - - describe "self#impressionist_counter_caching?" do - it "should know when counter caching is enabled" do - Widget.should be_impressionist_counter_caching - end - - it "should know when counter caching is disabled" do - Article.should_not be_impressionist_counter_caching - end - end - - describe "self#counter_caching?" do - it "should know when counter caching is enabled" do - ActiveSupport::Deprecation.should_receive(:warn) - Widget.should be_counter_caching - end - - it "should know when counter caching is disabled" do - ActiveSupport::Deprecation.should_receive(:warn) - Article.should_not be_counter_caching - end - - end - - describe "#update_impressionist_counter_cache" do - it "should update the counter cache column to reflect the correct number of impressions" do - lambda { - @widget.impressions.create(:request_hash => 'abcd1234') - @widget.reload - }.should change(@widget, :impressions_count).from(0).to(1) - end - end - -end diff --git a/vendor/impressionist/test_app/spec/models/model_spec.rb b/vendor/impressionist/test_app/spec/models/model_spec.rb deleted file mode 100644 index 54601662a..000000000 --- a/vendor/impressionist/test_app/spec/models/model_spec.rb +++ /dev/null @@ -1,94 +0,0 @@ -require 'spec_helper' - -describe Impression do - fixtures :articles,:impressions,:posts - - before(:each) do - @article = Article.find(1) - end - - it "should save a blank impression for an Article that has 10 impressions" do - @article.impressions.create - @article.impressions.size.should eq 12 - end - - it "should save an impression with a message" do - @article.impressions.create(:message=>"test message") - @article.impressions.last.message.should eq "test message" - end - - it "should return the impression count for all with no date range specified" do - @article.impressionist_count(:filter=>:all).should eq 11 - end - - it "should return unique impression count with no date range specified" do - @article.impressionist_count.should eq 9 - end - - it "should return impression count with only start date specified" do - @article.impressionist_count(:start_date=>"2011-01-01",:filter=>:all).should eq 8 - end - - it "should return impression count with whole date range specified" do - @article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02",:filter=>:all).should eq 7 - end - - it "should return unique impression count with only start date specified" do - @article.impressionist_count(:start_date=>"2011-01-01").should eq 7 - end - - it "should return unique impression count with date range specified" do - @article.impressionist_count(:start_date=>"2011-01-01",:end_date=>"2011-01-02").should eq 7 - end - - it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do - @article.impressionist_count(:filter=>:ip_address).should eq 8 - end - - it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do - @article.impressionist_count(:filter=>:session_hash).should eq 7 - end - - # tests :dependent => :destroy - it "should delete impressions on deletion of impressionable" do - impressions_count = Impression.all.size - a = Article.create - i = a.impressions.create - a.destroy - a.destroyed?.should be_true - i.destroyed?.should be_true - end - - #OLD COUNT METHODS. DEPRECATE SOON - it "should return the impression count with no date range specified" do - @article.impression_count.should eq 11 - end - - it "should return unique impression count with no date range specified" do - @article.unique_impression_count.should eq 9 - end - - it "should return impression count with only start date specified" do - @article.impression_count("2011-01-01").should eq 8 - end - - it "should return impression count with whole date range specified" do - @article.impression_count("2011-01-01","2011-01-02").should eq 7 - end - - it "should return unique impression count with only start date specified" do - @article.unique_impression_count("2011-01-01").should eq 7 - end - - it "should return unique impression count with date range specified" do - @article.unique_impression_count("2011-01-01","2011-01-02").should eq 7 - end - - it "should return unique impression count using ip address (which in turn eliminates duplicate request_hashes)" do - @article.unique_impression_count_ip.should eq 8 - end - - it "should return unique impression count using session_hash (which in turn eliminates duplicate request_hashes)" do - @article.unique_impression_count_session.should eq 7 - end -end diff --git a/vendor/impressionist/test_app/spec/rails_generators/rails_generators_spec.rb b/vendor/impressionist/test_app/spec/rails_generators/rails_generators_spec.rb deleted file mode 100644 index 2b5ea938c..000000000 --- a/vendor/impressionist/test_app/spec/rails_generators/rails_generators_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require 'spec_helper' -require 'systemu' - -# FIXME this test might break the others if run before them -# -describe Impressionist do - fixtures :articles,:impressions,:posts - it "should delete existing migration and generate the migration file" do - pending - migrations_dir = "#{Rails.root}/db/migrate" - impressions_migration = Dir.entries(migrations_dir).grep(/impressions/)[0] - File.delete("#{migrations_dir}/#{impressions_migration}") unless impressions_migration.blank? - generator_output = systemu("rails g impressionist")[1] - migration_name = generator_output.split("migrate/")[1].strip - Dir.entries(migrations_dir).include?(migration_name).should be_true - end - - it "should run the migration created in the previous spec" do - pending - migrate_output = systemu("rake db:migrate RAILS_ENV=test") - migrate_output[1].include?("CreateImpressionsTable: migrated").should be_true - end -end diff --git a/vendor/impressionist/test_app/spec/spec_helper.rb b/vendor/impressionist/test_app/spec/spec_helper.rb deleted file mode 100644 index 9cbe63b77..000000000 --- a/vendor/impressionist/test_app/spec/spec_helper.rb +++ /dev/null @@ -1,36 +0,0 @@ -ENV["RAILS_ENV"] ||= 'test' -unless ENV['CI'] - require 'simplecov' - SimpleCov.start 'rails' -end -require File.expand_path("../../config/environment", __FILE__) -require 'rspec/rails' - -# Requires supporting ruby files with custom matchers and macros, etc, -# in spec/support/ and its subdirectories. -Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} - -RSpec.configure do |config| - # == Mock Framework - # - # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line: - # - # config.mock_with :mocha - # config.mock_with :flexmock - # config.mock_with :rr - config.mock_with :rspec - - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" - - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true - - # make the rails logger usable in the tests as logger.xxx "..." - def logger - Rails.logger - end - -end diff --git a/vendor/impressionist/upgrade_migrations/version_0_3_0.rb b/vendor/impressionist/upgrade_migrations/version_0_3_0.rb deleted file mode 100644 index 466812505..000000000 --- a/vendor/impressionist/upgrade_migrations/version_0_3_0.rb +++ /dev/null @@ -1,27 +0,0 @@ -class CreateImpressionsTable < ActiveRecord::Migration - def self.up - add_column :impressions, :session_hash, :string - remove_index :impressions, :name => :poly_index - remove_index :impressions, :name => :controlleraction_index - add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash], :name => "poly_request_index", :unique => false - add_index :impressions, [:impressionable_type, :impressionable_id, :ip_address], :name => "poly_ip_index", :unique => false - add_index :impressions, [:impressionable_type, :impressionable_id, :session_hash], :name => "poly_session_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:request_hash], :name => "controlleraction_request_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:ip_address], :name => "controlleraction_ip_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:session_hash], :name => "controlleraction_session_index", :unique => false - - end - - def self.down - remove_column :impressions, :session_hash - remove_index :impressions, :name => :poly_request_index - remove_index :impressions, :name => :poly_ip_index - remove_index :impressions, :name => :poly_session_index - remove_index :impressions, :name => :controlleraction_request_index - remove_index :impressions, :name => :controlleraction_ip_index - remove_index :impressions, :name => :controlleraction_session_index - remove_index :impressions, :user_id - add_index :impressions, [:impressionable_type, :impressionable_id, :request_hash, :ip_address], :name => "poly_index", :unique => false - add_index :impressions, [:controller_name,:action_name,:request_hash,:ip_address], :name => "controlleraction_index", :unique => false - end -end diff --git a/vendor/impressionist/upgrade_migrations/version_0_4_0.rb b/vendor/impressionist/upgrade_migrations/version_0_4_0.rb deleted file mode 100644 index ebd7fac5a..000000000 --- a/vendor/impressionist/upgrade_migrations/version_0_4_0.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Version04UpdateImpressionsTable < ActiveRecord::Migration - def self.up - add_column :impressions, :referrer, :string - end - - def self.down - remove_column :impressions, :referrer - end -end diff --git a/vendor/impressionist/upgrade_migrations/version_1_1_2.rb b/vendor/impressionist/upgrade_migrations/version_1_1_2.rb deleted file mode 100644 index a4ef8e9a0..000000000 --- a/vendor/impressionist/upgrade_migrations/version_1_1_2.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Version04UpdateImpressionsTable < ActiveRecord::Migration - def self.up - add_index :impressions, [:impressionable_type, :message, :impressionable_id], :name => "impressionable_type_message_index", :unique => false - end - - def self.down - remove_index :impressions, :impressionable_type_message_index - end -end