diff --git a/.gitignore b/.gitignore index d1369322f..71494e306 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,14 @@ db/*.sqlite3 log/*.log tmp/**/* public/uploads/**/* +uploads/**/* + +.DS_Store + +*.swp + +public/javascripts +public/stylesheets +config/application.rb + +.rvmrc diff --git a/.rvmrc b/.rvmrc new file mode 100644 index 000000000..cf0bc52da --- /dev/null +++ b/.rvmrc @@ -0,0 +1 @@ +rvm ruby-1.9.2-p290@rails31rc4 diff --git a/Gemfile b/Gemfile index c17b77c5f..c2fad117f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,21 +1,33 @@ source 'http://rubygems.org' - -gem 'rails', '3.0.6' +gem 'rails' gem 'yajl-ruby', :require => 'yajl' gem 'bson_ext' -gem 'carrierwave' +gem 'carrierwave', '0.5.4' gem 'ckeditor' gem 'devise' gem 'mini_magick' +gem 'rubyzip' +gem 'sinatra' +gem 'execjs' +gem 'mongoid' -gem 'mongoid', '2.0.0' +gem 'rake' +gem 'jquery-rails' -gem 'rake', '0.8.7' +gem 'sprockets' + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails' + gem 'coffee-rails' + gem 'uglifier' +end # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) # gem 'ruby-debug' -# gem 'ruby-debug19' + gem 'ruby-debug19' group :test, :development do gem "rspec", "~> 2.0" @@ -28,4 +40,4 @@ group :test, :development do # gem "capybara" # gem 'yard' # gem "bluecloth" -end \ No newline at end of file +end diff --git a/Gemfile.lock b/Gemfile.lock index 17a74fc9a..a94a968de 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,136 +1,204 @@ GEM remote: http://rubygems.org/ specs: - abstract (1.0.0) - actionmailer (3.0.6) - actionpack (= 3.0.6) - mail (~> 2.2.15) - actionpack (3.0.6) - activemodel (= 3.0.6) - activesupport (= 3.0.6) - builder (~> 2.1.2) - erubis (~> 2.6.6) - i18n (~> 0.5.0) - rack (~> 1.2.1) - rack-mount (~> 0.6.14) - rack-test (~> 0.5.7) - tzinfo (~> 0.3.23) - activemodel (3.0.6) - activesupport (= 3.0.6) - builder (~> 2.1.2) - i18n (~> 0.5.0) - activerecord (3.0.6) - activemodel (= 3.0.6) - activesupport (= 3.0.6) - arel (~> 2.0.2) - tzinfo (~> 0.3.23) - activeresource (3.0.6) - activemodel (= 3.0.6) - activesupport (= 3.0.6) - activesupport (3.0.6) - arel (2.0.10) - bcrypt-ruby (2.1.4-x86-mingw32) - bson (1.3.1) - bson_ext (1.3.1) - builder (2.1.2) + actionmailer (3.1.1) + actionpack (= 3.1.1) + mail (~> 2.3.0) + actionpack (3.1.1) + activemodel (= 3.1.1) + activesupport (= 3.1.1) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6) + rack (~> 1.3.2) + rack-cache (~> 1.1) + rack-mount (~> 0.8.2) + rack-test (~> 0.6.1) + sprockets (~> 2.0.2) + activemodel (3.1.1) + activesupport (= 3.1.1) + builder (~> 3.0.0) + i18n (~> 0.6) + activerecord (3.1.1) + activemodel (= 3.1.1) + activesupport (= 3.1.1) + arel (~> 2.2.1) + tzinfo (~> 0.3.29) + activeresource (3.1.1) + activemodel (= 3.1.1) + activesupport (= 3.1.1) + activesupport (3.1.1) + multi_json (~> 1.0) + archive-tar-minitar (0.5.2) + arel (2.2.1) + bcrypt-ruby (3.0.1) + bson (1.4.1) + bson_ext (1.4.1) + builder (3.0.0) carrierwave (0.5.4) activesupport (~> 3.0) - chronic (0.3.0) - ckeditor (3.5.4) - mime-types (>= 1.16) - delorean (1.0.0) + chronic (0.6.4) + ckeditor (3.6.3) + mime-types (~> 1.16) + orm_adapter (~> 0.0.5) + coffee-rails (3.1.1) + coffee-script (>= 2.2.0) + railties (~> 3.1.0) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.2) + columnize (0.3.4) + delorean (1.1.0) chronic - devise (1.3.4) - bcrypt-ruby (~> 2.1.2) + devise (1.4.8) + bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) warden (~> 1.0.3) - diff-lcs (1.1.2) - erubis (2.6.6) - abstract (>= 1.0.0) - factory_girl (1.3.3) - factory_girl_rails (1.0.1) - factory_girl (~> 1.3) + diff-lcs (1.1.3) + erubis (2.7.0) + execjs (1.2.9) + multi_json (~> 1.0) + factory_girl (2.2.0) + activesupport + factory_girl_rails (1.3.0) + factory_girl (~> 2.2.0) railties (>= 3.0.0) - i18n (0.5.0) - mail (2.2.19) - activesupport (>= 2.3.6) + hike (1.2.1) + i18n (0.6.0) + jquery-rails (1.0.16) + railties (~> 3.0) + thor (~> 0.14) + json (1.6.1) + linecache19 (0.5.12) + ruby_core_source (>= 0.1.4) + mail (2.3.0) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.16) - mini_magick (3.2.1) - subexec (~> 0.0.4) - mongo (1.3.1) - bson (>= 1.3.1) - mongoid (2.0.0) - activemodel (~> 3.0) - mongo (~> 1.2) + mini_magick (3.3) + subexec (~> 0.1.0) + mongo (1.4.1) + bson (= 1.4.1) + mongoid (2.3.2) + activemodel (~> 3.1) + mongo (~> 1.4) tzinfo (~> 0.3.22) - will_paginate (~> 3.0.pre) + multi_json (1.0.3) orm_adapter (0.0.5) - polyglot (0.3.1) - rack (1.2.3) - rack-mount (0.6.14) + polyglot (0.3.2) + rack (1.3.4) + rack-cache (1.1) + rack (>= 0.4) + rack-mount (0.8.3) rack (>= 1.0.0) - rack-test (0.5.7) + rack-protection (1.1.4) + rack + rack-ssl (1.3.2) + rack + rack-test (0.6.1) rack (>= 1.0) - rails (3.0.6) - actionmailer (= 3.0.6) - actionpack (= 3.0.6) - activerecord (= 3.0.6) - activeresource (= 3.0.6) - activesupport (= 3.0.6) + rails (3.1.1) + actionmailer (= 3.1.1) + actionpack (= 3.1.1) + activerecord (= 3.1.1) + activeresource (= 3.1.1) + activesupport (= 3.1.1) bundler (~> 1.0) - railties (= 3.0.6) - railties (3.0.6) - actionpack (= 3.0.6) - activesupport (= 3.0.6) + railties (= 3.1.1) + railties (3.1.1) + actionpack (= 3.1.1) + activesupport (= 3.1.1) + rack-ssl (~> 1.3.2) rake (>= 0.8.7) - thor (~> 0.14.4) - rake (0.8.7) - rcov (0.9.9) - rspec (2.6.0) - rspec-core (~> 2.6.0) - rspec-expectations (~> 2.6.0) - rspec-mocks (~> 2.6.0) - rspec-core (2.6.3) - rspec-expectations (2.6.0) + rdoc (~> 3.4) + thor (~> 0.14.6) + rake (0.9.2) + rcov (0.9.11) + rdoc (3.11) + json (~> 1.4) + rspec (2.7.0) + rspec-core (~> 2.7.0) + rspec-expectations (~> 2.7.0) + rspec-mocks (~> 2.7.0) + rspec-core (2.7.0) + rspec-expectations (2.7.0) diff-lcs (~> 1.1.2) - rspec-mocks (2.6.0) - rspec-rails (2.6.1) + rspec-mocks (2.7.0) + rspec-rails (2.7.0) actionpack (~> 3.0) activesupport (~> 3.0) railties (~> 3.0) - rspec (~> 2.6.0) - shoulda-matchers (1.0.0.beta2) - subexec (0.0.4) + rspec (~> 2.7.0) + ruby-debug-base19 (0.11.25) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby_core_source (>= 0.1.4) + ruby-debug19 (0.11.6) + columnize (>= 0.3.1) + linecache19 (>= 0.5.11) + ruby-debug-base19 (>= 0.11.19) + ruby_core_source (0.1.5) + archive-tar-minitar (>= 0.5.2) + rubyzip (0.9.4) + sass (3.1.10) + sass-rails (3.1.4) + actionpack (~> 3.1.0) + railties (~> 3.1.0) + sass (>= 3.1.4) + sprockets (~> 2.0.0) + tilt (~> 1.3.2) + shoulda-matchers (1.0.0.beta3) + sinatra (1.3.1) + rack (~> 1.3, >= 1.3.4) + rack-protection (~> 1.1, >= 1.1.2) + tilt (~> 1.3, >= 1.3.3) + sprockets (2.0.3) + hike (~> 1.2) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + subexec (0.1.0) thor (0.14.6) - treetop (1.4.9) + tilt (1.3.3) + treetop (1.4.10) + polyglot polyglot (>= 0.3.1) - tzinfo (0.3.27) - warden (1.0.4) + tzinfo (0.3.30) + uglifier (1.0.3) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + warden (1.0.6) rack (>= 1.0) watchr (0.7) - will_paginate (3.0.pre2) - yajl-ruby (0.8.2) + yajl-ruby (1.0.0) PLATFORMS - x86-mingw32 + ruby DEPENDENCIES bson_ext - carrierwave + carrierwave (= 0.5.4) ckeditor + coffee-rails delorean devise + execjs factory_girl_rails + jquery-rails mini_magick - mongoid (= 2.0.0) - rails (= 3.0.6) - rake (= 0.8.7) + mongoid + rails + rake rcov rspec (~> 2.0) rspec-rails (~> 2.0) + ruby-debug19 + rubyzip + sass-rails shoulda-matchers + sinatra + sprockets + uglifier watchr yajl-ruby diff --git a/app/assets/images/75.png b/app/assets/images/75.png new file mode 100644 index 000000000..ff8aef6e9 Binary files /dev/null and b/app/assets/images/75.png differ diff --git a/app/assets/images/Jobs.jpg b/app/assets/images/Jobs.jpg new file mode 100644 index 000000000..6d6627e40 Binary files /dev/null and b/app/assets/images/Jobs.jpg differ diff --git a/app/assets/images/Thumbs.db b/app/assets/images/Thumbs.db new file mode 100644 index 000000000..f9d32b5f6 Binary files /dev/null and b/app/assets/images/Thumbs.db differ diff --git a/app/assets/images/add_mamber.png b/app/assets/images/add_mamber.png new file mode 100644 index 000000000..1af415902 Binary files /dev/null and b/app/assets/images/add_mamber.png differ diff --git a/public/images/bar_bg.png b/app/assets/images/bar_bg.png similarity index 100% rename from public/images/bar_bg.png rename to app/assets/images/bar_bg.png diff --git a/app/assets/images/bar_border.png b/app/assets/images/bar_border.png new file mode 100644 index 000000000..4e71f036f Binary files /dev/null and b/app/assets/images/bar_border.png differ diff --git a/app/assets/images/bar_btn.png b/app/assets/images/bar_btn.png new file mode 100644 index 000000000..59d5938d1 Binary files /dev/null and b/app/assets/images/bar_btn.png differ diff --git a/app/assets/images/bar_id.png b/app/assets/images/bar_id.png new file mode 100644 index 000000000..18b007347 Binary files /dev/null and b/app/assets/images/bar_id.png differ diff --git a/app/assets/images/bar_orbit.png b/app/assets/images/bar_orbit.png new file mode 100644 index 000000000..feaca6b83 Binary files /dev/null and b/app/assets/images/bar_orbit.png differ diff --git a/app/assets/images/bar_pw.png b/app/assets/images/bar_pw.png new file mode 100644 index 000000000..9f5d5cc24 Binary files /dev/null and b/app/assets/images/bar_pw.png differ diff --git a/app/assets/images/body.jpg b/app/assets/images/body.jpg new file mode 100644 index 000000000..9ffff8d72 Binary files /dev/null and b/app/assets/images/body.jpg differ diff --git a/app/assets/images/bought_btn.png b/app/assets/images/bought_btn.png new file mode 100644 index 000000000..c8b5529b1 Binary files /dev/null and b/app/assets/images/bought_btn.png differ diff --git a/app/assets/images/buy_btn.png b/app/assets/images/buy_btn.png new file mode 100644 index 000000000..d1d64915f Binary files /dev/null and b/app/assets/images/buy_btn.png differ diff --git a/app/assets/images/h1_bg.jpg b/app/assets/images/h1_bg.jpg new file mode 100644 index 000000000..edf2a0a37 Binary files /dev/null and b/app/assets/images/h1_bg.jpg differ diff --git a/app/assets/images/h1_bg.png b/app/assets/images/h1_bg.png new file mode 100644 index 000000000..d6e901601 Binary files /dev/null and b/app/assets/images/h1_bg.png differ diff --git a/public/images/home.png b/app/assets/images/home.png similarity index 100% rename from public/images/home.png rename to app/assets/images/home.png diff --git a/app/assets/images/hr_cover.png b/app/assets/images/hr_cover.png new file mode 100644 index 000000000..74ebf4866 Binary files /dev/null and b/app/assets/images/hr_cover.png differ diff --git a/app/assets/images/html.png b/app/assets/images/html.png new file mode 100644 index 000000000..889b3b406 Binary files /dev/null and b/app/assets/images/html.png differ diff --git a/app/assets/images/icon.png b/app/assets/images/icon.png new file mode 100644 index 000000000..a3fc685b1 Binary files /dev/null and b/app/assets/images/icon.png differ diff --git a/app/assets/images/icon1.png b/app/assets/images/icon1.png new file mode 100644 index 000000000..cd9847b82 Binary files /dev/null and b/app/assets/images/icon1.png differ diff --git a/app/assets/images/icon2.png b/app/assets/images/icon2.png new file mode 100644 index 000000000..a3f79ba90 Binary files /dev/null and b/app/assets/images/icon2.png differ diff --git a/app/assets/images/line.png b/app/assets/images/line.png new file mode 100644 index 000000000..6b16a9494 Binary files /dev/null and b/app/assets/images/line.png differ diff --git a/app/assets/images/orbitbar.png b/app/assets/images/orbitbar.png new file mode 100644 index 000000000..4f27a0a27 Binary files /dev/null and b/app/assets/images/orbitbar.png differ diff --git a/app/assets/images/orbitbar1.png b/app/assets/images/orbitbar1.png new file mode 100644 index 000000000..4f27a0a27 Binary files /dev/null and b/app/assets/images/orbitbar1.png differ diff --git a/app/assets/images/person.png b/app/assets/images/person.png new file mode 100644 index 000000000..653cfaeb0 Binary files /dev/null and b/app/assets/images/person.png differ diff --git a/app/assets/images/preview.png b/app/assets/images/preview.png new file mode 100644 index 000000000..0bab69dbe Binary files /dev/null and b/app/assets/images/preview.png differ diff --git a/public/images/rails.png b/app/assets/images/rails.png similarity index 100% rename from public/images/rails.png rename to app/assets/images/rails.png diff --git a/app/assets/images/roles_type.jpg b/app/assets/images/roles_type.jpg new file mode 100644 index 000000000..97791f3bf Binary files /dev/null and b/app/assets/images/roles_type.jpg differ diff --git a/app/assets/images/search_bg.png b/app/assets/images/search_bg.png new file mode 100644 index 000000000..c00c431b5 Binary files /dev/null and b/app/assets/images/search_bg.png differ diff --git a/app/assets/images/search_block_bg.jpg b/app/assets/images/search_block_bg.jpg new file mode 100644 index 000000000..19e8e30e8 Binary files /dev/null and b/app/assets/images/search_block_bg.jpg differ diff --git a/app/assets/images/service_btn.png b/app/assets/images/service_btn.png new file mode 100644 index 000000000..8a386406f Binary files /dev/null and b/app/assets/images/service_btn.png differ diff --git a/app/assets/images/sidebar_li.jpg b/app/assets/images/sidebar_li.jpg new file mode 100644 index 000000000..a3aaeb988 Binary files /dev/null and b/app/assets/images/sidebar_li.jpg differ diff --git a/app/assets/images/switch.png b/app/assets/images/switch.png new file mode 100644 index 000000000..e4b1930a8 Binary files /dev/null and b/app/assets/images/switch.png differ diff --git a/public/images/tree_list.png b/app/assets/images/tree_list.png similarity index 100% rename from public/images/tree_list.png rename to app/assets/images/tree_list.png diff --git a/public/images/tree_list_h.png b/app/assets/images/tree_list_h.png similarity index 100% rename from public/images/tree_list_h.png rename to app/assets/images/tree_list_h.png diff --git a/app/assets/images/upload_but.png b/app/assets/images/upload_but.png new file mode 100644 index 000000000..300fb2ca6 Binary files /dev/null and b/app/assets/images/upload_but.png differ diff --git a/app/assets/images/wood_floor.jpg b/app/assets/images/wood_floor.jpg new file mode 100644 index 000000000..5d1c23628 Binary files /dev/null and b/app/assets/images/wood_floor.jpg differ diff --git a/public/javascripts/.DS_Store b/app/assets/javascripts/.DS_Store similarity index 100% rename from public/javascripts/.DS_Store rename to app/assets/javascripts/.DS_Store diff --git a/public/javascripts/application.js b/app/assets/javascripts/application.js similarity index 62% rename from public/javascripts/application.js rename to app/assets/javascripts/application.js index 948e3f921..ecc46ce09 100644 --- a/public/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,3 +1,13 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . + // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults @@ -26,4 +36,4 @@ $(function () { $(window).bind("popstate", function () { $.getScript(location.href); }); -}); \ No newline at end of file +}); diff --git a/app/assets/javascripts/design.js b/app/assets/javascripts/design.js new file mode 100644 index 000000000..dee720fac --- /dev/null +++ b/app/assets/javascripts/design.js @@ -0,0 +1,2 @@ +// Place all the behaviors and hooks related to the matching controller here. +// All this logic will automatically be available in application.js. diff --git a/app/assets/javascripts/design_temp.js b/app/assets/javascripts/design_temp.js new file mode 100644 index 000000000..2c8ccb1ca --- /dev/null +++ b/app/assets/javascripts/design_temp.js @@ -0,0 +1,71 @@ +function r_editor(tgetUrl,tpostUrl,tfilename,toption){ + if(!toption){ toption =new Array();} + if(!toption['width']){toption['width']=400;} + if(!toption['height']){toption['height']=300;} + var editor = this; + editor.filename = tfilename; + editor.getUrl = tgetUrl; + editor.postUrl = tpostUrl; + editor.nodeToBeChanged="" + editor.width = toption['width']; + editor.height = toption['height']; + var html=''; + editor.init = function(){ + code = ""; + html = $(code); + html.children("textarea").load(editor.getUrl); + html.children("input.discard").click(function(){ + editor.destroy(); + }); + html.children("input.send").click(function(){ + editor.send(); + }); + return html; + }; + editor.reload = function(){ + $.get(editor.getUrl,function(data){ + html.children("textarea").text(data); + }); + }; + editor.send = function(){ + $.post(editor.postUrl,{filename:editor.filename,context:html.children("textarea").val(),authenticity_token:$('meta[name=csrf-token]').attr('content')},null,"script"); + }; + editor.destroy = function(){ + html.remove(); + }; +} + +$(".r_edit").live("click",function(){ + new_editor = new r_editor($(this).attr("path"),"edit_file",$(this).attr("filename")); + $(this).after(new_editor.init()); +}); + + +$(".r_snapshot").live({ + mouseenter: + function(){ + $(this).append($("").html('

')); + }, + mouseleave: + function(){ + $(this).find("span:last").remove(); + } + } +); + +$('input.multi_files').live("change", function(){ + $(this).parent().prev("ul").append("
  • " + $(this).val() + "
  • "); + new_node = $(this).parent().clone(); + $(this).parent().css("display","none"); + new_node.children('input.multi_files').val(""); + $(this).parent().before(new_node); +}); + +$('a.remove_mark').live("click",function(){ + $(this).prev("input").val("true"); + $(this).parent().css("text-decoration","line-through") + $(this).parent().removeClass("r_snapshot"); + $(this).next().remove(); + $(this).remove(); + return false; +}); diff --git a/public/javascripts/easy.js b/app/assets/javascripts/easy.js similarity index 100% rename from public/javascripts/easy.js rename to app/assets/javascripts/easy.js diff --git a/app/assets/javascripts/page.js b/app/assets/javascripts/page.js new file mode 100644 index 000000000..4b413ddf0 --- /dev/null +++ b/app/assets/javascripts/page.js @@ -0,0 +1,3 @@ +$("#page_design_id").live('change', function() { + $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes'); +}); \ No newline at end of file diff --git a/app/assets/javascripts/plugin.js b/app/assets/javascripts/plugin.js new file mode 100644 index 000000000..2c80827e0 --- /dev/null +++ b/app/assets/javascripts/plugin.js @@ -0,0 +1,3 @@ +$(function (){ + $(".engine_loading").load($(this).attr("widget_path")); + }); diff --git a/public/stylesheets/.gitkeep b/app/assets/stylesheets/.gitkeep similarity index 100% rename from public/stylesheets/.gitkeep rename to app/assets/stylesheets/.gitkeep diff --git a/app/assets/stylesheets/admin.css.erb b/app/assets/stylesheets/admin.css.erb new file mode 100644 index 000000000..8b5531aa1 --- /dev/null +++ b/app/assets/stylesheets/admin.css.erb @@ -0,0 +1,354 @@ +html, body{ + height: 100%; + margin: 0; + padding: 0; +} +html{ + background: url(<%= asset_path "body.jpg" %>) no-repeat scroll 0 0 transparent; + background-size: cover; +} + +body{ + color: #000000; + font-family: helvetica,arial,sans-serif; + margin: 0; + padding: 0; +} + +#panel_banner_link{ + background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0; + height: 52px; + left: 0; + position: absolute; + top: 0; + width: 100%; +} +.hmenu{ + height: 40px; + position: absolute; + right: 0; + top: 1px; + width: 250px; +} + + +#orbit{ + background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; + cursor:pointer; + height: 43px; + left: 10px; + position: relative; + width: 41px; +} + +#orbit:hover{ + background-position:0 -43px; + box-shadow: 0 3px 3px #000000; +} +#orbit:hover #orblist{ + display:block; +} +#orblist{ + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 0 3px 3px 3px; + box-shadow: 0 3px 3px #000000; + display: none; + margin: 0; + padding: 10px; + position: absolute; + top: 43px; + width: 130px; +} +#orblist li{ + border-bottom:1px solid #aaa; + list-style:none; +} +.orblink{ + color: #333333; + display: block; + font: 12px/100% arial,sans-serif; + padding: 5px; + text-decoration: none; +} +.orblink:hover{ + background:#eee; + color:#333; +} + +#log_out a{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; + border: medium none !important; + display: block !important; + height: 40px !important; + line-height: normal !important; + padding: 0 !important; + position: absolute; + right: 0px; + text-indent: -10000px; + top: 0px; + width: 43px !important; +} +#log_out a:hover{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; +} +.lang{ + color: #FFFFFF; + font-size: 15px; + line-height: 40px; + position: absolute; + right: 55px; + top: 0; +} + +.lang a{ + color:#fff; + text-decoration:none; +} + +.lang a:hover{ + text-decoration:underline; +} + +#panel_container{ + height: 100%; +} + +#panel_container h1{ + color: #FFFFFF; + font: 32px/100% helvetica,arial,sans-serif; + margin: 0 0 20px; + padding: 0; + text-shadow: 0 0 5px #000000; +} + +#panel_header{ + background: none repeat scroll 0 0 #F1F1F1; + border-bottom: 1px solid #818181; + padding: 10px; +} +#panel_header :after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#panel_header #nav{ + margin:0; + padding:0; + width:100%; +} + +#panel_header #nav li{ + float: left; + list-style: none outside none; +} + +#panel_header #nav li a{ + background: none repeat scroll 0 0 #fff; + border-radius: 13px 13px 13px 13px; + border: 1px solid #D6D6D6; + color: #000000; + float: left; + font-size:15px; + margin: 0 20px 0 0; + padding: 5px 10px; + text-decoration: none; +} + +#panel_header #nav li a:hover{ + background: none repeat scroll 0 0 #818181; + border-radius: 13px 13px 13px 13px; + color: #fff; +} + +#panel_content{ + height: 100%; +} + +.main{ + float: left; + height: 100%; + padding: 0 1%; + width: 81%; +} +.main2{ + padding: 62px 0 0; +} +.main table{ + border-collapse: collapse; + width:100%; +} +.main table th{ + border-bottom: 1px solid #222222; + color: #FFFFFF; + font: 20px/100% helvetica,arial,sans-serif; + letter-spacing: 0.05em; + padding: 10px; + text-shadow: 0 0 3px #000000; +} +.main table td{ + background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5); + border-bottom: 1px solid #222222; + color: #FFFFFF; + padding: 10px; + text-align: center; +} + +.main table td a{ + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 5px 5px 5px 5px; + color: #000000; + padding: 5px; + text-decoration: none; +} + +.main table td a:hover{ + background: none repeat scroll 0 0 #eee; + border-radius: 5px 5px 5px 5px; + color: #333; +} +.secondary{ + background: none repeat scroll 0 0 rgba(0, 0, 0, 0.75); + box-shadow: 3px 0 3px #000000; + float: left; + height: 100%; + padding: 0 1%; + width: 14%; +} +.secondary2{ + padding: 62px 0 0; +} +.secondary ul{ + margin: 0; + padding: 0; +} +.secondary ul li{ + list-style:none; +} +.secondary ul li a{ + border-bottom: 1px solid #333; + color: #AAAAAA; + display: block; + padding: 14px 0; + text-align: left; + text-decoration: none; +} +.seclink1{ + background: url(<%= asset_path "icon1.png" %>) no-repeat scroll 20px 8px transparent; + border-bottom: 1px solid #333; + color: #AAAAAA; + display: block; + padding: 14px 0 14px 60px !important; + text-align: left; + text-decoration: none; +} +.seclink2{ + background: url(<%= asset_path "icon2.png" %>) no-repeat scroll 20px 14px transparent; + border-bottom: 1px solid #333; + color: #AAAAAA; + display: block; + padding: 14px 0 14px 60px !important; + text-align: left; + text-decoration: none; +} +.secondary ul li a:hover{ + color: #fff; +} + +#panel_footer{ + background: none repeat scroll 0 0 #FFFFFF; + display:none; + clear: both; + padding: 10px; +} +#panel_footer p{ + margin:0; +} +label{ + color: #FFFFFF; + display: block; + text-shadow: 0 0 5px #000000; + width: 130px; +} +p{ + margin:0 0 10px; +} +#panel_main p label{ + float: left; + padding: 3px; + width: 100px; +} +#panel_main .translation_missing{ + float: left; + padding: 3px; + width: 100px; + +} +.text{ + border: 1px solid #818181; + border-radius: 3px 3px 3px 3px; + font: 12px/100% helvetica,arial,sans-serif; + padding: 3px; + width: 205px; +} + +#site_info{ + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 5px 5px 5px 5px; + box-shadow: 0 0 5px #000000; +/* height: 289px;*/ + margin: 0 0 20px; + overflow: hidden; + width: 600px; +} +#siteinfo_title{ + background: none repeat scroll 0 0 #333333; + color: #FFFFFF; + font: 24px/50px arial,sans-serif; + height: 50px; + margin: 0; + padding: 0 0 0 20px; + text-shadow: 0 1px 0 #000000; +} +#siteinfo_tb{ + background: none repeat scroll 0 0 #FFFFFF; +} +#siteinfo_tb td{ + background: none repeat scroll 0 0 transparent; + border-bottom: 1px solid #333333; + color: #333333; +} + +.buy_btn{ + float:left; + margin: 0 10px 0 0; +} +.main table td .buy_btn a{ + background: url("/assets/buy_btn.png") no-repeat scroll 0 0 transparent; + color: #000000; + display: block; + font-size: 22px; + height: 37px; + line-height: 37px; + text-align: center; + text-decoration: none; + text-shadow: 0 1px 0 #FFFFFF; + width: 170px; + padding: 0px; +} +.buy_btn a:hover{ + background-position:0 bottom; +} +.bought_btn{ + background: url("/assets/bought_btn.png") no-repeat scroll 0 0 transparent; + color: #FFFFFF; + float:left; + font-size: 22px; + height: 37px; + line-height: 37px; + margin: 0 10px 0 0; + text-align: center; + text-shadow: 0 1px 0 #C06408; + width: 170px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 000000000..9833ffda0 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + *This is a manifest file that'll automatically include all the stylesheets available in this directory + *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 + +*/ diff --git a/app/assets/stylesheets/content.css.erb b/app/assets/stylesheets/content.css.erb new file mode 100644 index 000000000..2d3cd2d08 --- /dev/null +++ b/app/assets/stylesheets/content.css.erb @@ -0,0 +1,230 @@ + +html, body{ + height: 100%; + margin: 0; + padding: 0; +} +html{ + background: url(<%= asset_path "body.jpg" %>) no-repeat scroll 0 0 transparent; + background-size: cover; +} +body{ + color: #000000; + font-family: helvetica,arial,sans-serif; + margin: 0; + padding: 0; +} + +#panel_banner_link{ + background: url(<%= asset_path "orbitbar1.png" %>) repeat-x scroll 0 0; + height: 52px; + left: 0; + position: absolute; + top: 0; + width: 100%; +} +.hmenu{ + height: 40px; + position: absolute; + right: 0; + top: 1px; + width: 250px; +} + + +#orbit{ + background: url(<%= asset_path "bar_orbit.png" %>) no-repeat scroll 0 0 transparent; + cursor:pointer; + height: 43px; + left: 10px; + position: relative; + width: 41px; +} + +#orbit:hover{ + background-position:0 -43px; + box-shadow: 0 3px 3px #000000; +} +#orbit:hover #orblist{ + display:block; +} +#orblist{ + background: none repeat scroll 0 0 #FFFFFF; + border-radius: 0 3px 3px 3px; + box-shadow: 0 3px 3px #000000; + display: none; + margin: 0; + padding: 10px; + position: absolute; + top: 43px; + width: 130px; + z-index:10; +} +#orblist li{ + border-bottom:1px solid #aaa; + list-style:none; +} +.orblink{ + color: #333333; + display: block; + font: 12px/100% arial,sans-serif; + padding: 5px; + text-decoration: none; +} +.orblink:hover{ + background:#eee; + color:#333; +} + +#log_out a{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right 0 transparent; + border: medium none !important; + display: block !important; + height: 40px !important; + line-height: normal !important; + padding: 0 !important; + position: absolute; + right: 0px; + text-indent: -10000px; + top: 0px; + width: 43px !important; +} +#log_out a:hover{ + background: url(<%= asset_path "service_btn.png" %>) no-repeat scroll right bottom transparent !important; +} +.lang{ + color: #FFFFFF; + font-size: 15px; + line-height: 40px; + position: absolute; + right: 55px; + top: 0; +} + +.lang a{ + color:#fff; + text-decoration:none; +} + +.lang a:hover{ + text-decoration:underline; +} + +#panel_container{ + height: 100%; +} + +#panel_container h1{ + font: 28px/100% helvetica,arial,sans-serif; + margin: 0 0 20px; + padding: 0; +} + +#panel_header{ + background: none repeat scroll 0 0 #F1F1F1; + border-bottom: 1px solid #818181; + padding: 10px; +} +#panel_header:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} +#panel_header #panel_nav{ + margin:0; + padding:0; + width:100%; +} + +#panel_header #panel_nav li{ + float: left; + list-style: none outside none; +} + +#panel_header #panel_nav li a{ + background: none repeat scroll 0 0 #fff; + border-radius: 13px 13px 13px 13px; + border: 1px solid #D6D6D6; + color: #000000; + float: left; + font-size:15px; + margin: 0 20px 0 0; + padding: 5px 10px; + text-decoration: none; +} + +#panel_header #panel_nav li a:hover{ + background: none repeat scroll 0 0 #818181; + border-radius: 13px 13px 13px 13px; + color: #fff; +} + +#panel_content{ + height: 100%; +} + + + +#panel_sidebar2{ + background: none repeat scroll 0 0 rgba(0, 0, 0, 0.75); + box-shadow: 3px 0 3px #000000; + float: left; + height: 100%; + width: 16%; +} +#panel_sidebar{ + padding: 62px 0 0; +} +#panel_sidebar ul{ + background: none repeat scroll 0 0 #13547C; + margin: 0; + padding: 0 0 0 10px; +} +#panel_sidebar ul li{ + background: none repeat scroll 0 0 #13547C; + border-top: 1px solid #145B87; + color: #FFFFFF; + font-size: 11px; + line-height: 29px; + list-style: none outside none; +} +#panel_sidebar li ul{ +} +#panel_sidebar li ul ul{ +} +#panel_sidebar a{ + color: #FFFFFF; + font-size: 11px; + text-decoration: none; +} +#panel_sidebar a:hover{} +#panel_main2{ + background:#fff; + float: left; + height: 100%; + padding: 0 1%; + width: 82%; +} +#panel_main{ + padding: 62px 0 0; +} + +#panel_main p label{ + display: block; + padding: 3px; +} +#panel_main .translation_missing{ + float: left; + padding: 3px; + width: 100px; + +} +.text{ + border: 1px solid #818181; + border-radius: 3px 3px 3px 3px; + font: 12px/100% helvetica,arial,sans-serif; + padding: 3px; + width: 205px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/design.css b/app/assets/stylesheets/design.css new file mode 100644 index 000000000..afad32db0 --- /dev/null +++ b/app/assets/stylesheets/design.css @@ -0,0 +1,4 @@ +/* + Place all the styles related to the matching controller here. + They will automatically be included in application.css. +*/ diff --git a/app/assets/stylesheets/design_temp.css b/app/assets/stylesheets/design_temp.css new file mode 100644 index 000000000..27f874007 --- /dev/null +++ b/app/assets/stylesheets/design_temp.css @@ -0,0 +1,12 @@ +.z-preview * { + width: 100%; + height: 100%; +} +.z-preview { + background: white; + border: solid; + position: absolute; + width: 200px; + float: right; + height: 200px; +} diff --git a/public/stylesheets/devise.css b/app/assets/stylesheets/devise.css similarity index 100% rename from public/stylesheets/devise.css rename to app/assets/stylesheets/devise.css diff --git a/public/stylesheets/ie.css b/app/assets/stylesheets/ie.css similarity index 100% rename from public/stylesheets/ie.css rename to app/assets/stylesheets/ie.css diff --git a/public/stylesheets/main.css b/app/assets/stylesheets/main.css similarity index 100% rename from public/stylesheets/main.css rename to app/assets/stylesheets/main.css diff --git a/app/assets/stylesheets/member.css.erb b/app/assets/stylesheets/member.css.erb new file mode 100644 index 000000000..05b66b0f1 --- /dev/null +++ b/app/assets/stylesheets/member.css.erb @@ -0,0 +1,507 @@ +/* + *This is a manifest file that'll automatically include all the stylesheets available in this directory + *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 + +*/ +a, a:hover { + text-decoration: none; + outline:none; +} +html,body { + height:100%; + margin:0; + font-family: Helvetica, '微軟正黑體'; + overflow-x:hidden +} +ul { + list-style:none; + list-style-image:none; + margin:0; + padding:0; +} +.info_input input{ + border:none; + padding:5px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} +input:focus, select:focus, textarea:focus { + outline:none; + -moz-outline-radius: 0; +} +.clear:after { + content:"."; + clear:both; + height:0; + display:block; + visibility:hidden; +} +#content{ + height:100%; +} +#sidebar { + position:fixed; + top:0; + left:0; + height: 100%; + width:220px; + /*background-color:rgba(245,245,245,1);*/ + background:url(<%= asset_path '75.png' %>) repeat left top; + -moz-box-shadow: 3px 0px 4px #472a12; /* Firefox */ + -webkit-box-shadow: 3px 0px 4px #472a12;/* Safari 和 Chrome */ + box-shadow: 3px 0px 4px #472a12; /* Opera 10.5 + */ +} +#search { + background:url(<%= asset_path 'search_block_bg.jpg' %>) repeat-x left top; + margin-top:43px; + padding:15px 12px; + height:20px; +} +#search input { + background:url(<%= asset_path 'search_bg.png' %>) no-repeat left top; + border:none; + width:154px; + height:20px; + padding: 0 20px; + font-family:Helvetica; +} +h1 { + background:url(<%= asset_path 'h1_bg.png' %>) repeat-x left top; + margin:0; + line-height:21px; + height:21px; + font-size:12px; + padding-left:10px; + font-weight:normal; + text-shadow:0px -1px 0px #000; + color:#FFF; + border-top:1px solid #424344; + border-bottom:1px solid #1b1b1b; +} +#user_list .member_setup ul li.set_1 { + background-position:left bottom; + border-top:1px solid #406cc3; + border-bottom:1px solid #242628; +} +#roles_list .member_setup ul li.set_2 { + background-position:left bottom; + border-top:1px solid #406cc3; + border-bottom:1px solid #242628; +} +#infos_list .member_setup ul li.set_3 { + background-position:left bottom; + border-top:1px solid #406cc3; + border-bottom:1px solid #242628; +} +#user_list .member_setup ul li.set_1 a span { + background-position:left bottom; + color:#eeeeee; +} +#roles_list .member_setup ul li.set_2 a span { + background-position:left bottom; + color:#eeeeee; +} +.member_setup ul { + color:#fff; + font-size:12px; + background:url(<%= asset_path 'line.png' %>) repeat-x left bottom; +} +.member_setup ul li { + background:url(<%= asset_path 'sidebar_li.jpg' %>) repeat-x left top; +/* line-height:31px;*/ + border-top:1px solid #424344; + border-bottom:1px solid #000000; +} +.member_setup ul li:hover { + background-position:left bottom; + border-top:1px solid #406cc3; + border-bottom:1px solid #242628; +} +.member_setup ul li a { + display: block; + padding: 7px 0 6px 12px; + color:#c4c4c4; +} +.member_setup ul li a span { + background:url(<%= asset_path 'add_mamber.png' %>) left top no-repeat; + text-shadow: 0px 1px 0px #000; + line-height: 18px; + padding: 2px 0 1px 35px; +} +.member_setup ul li a:hover span { + background-position:left bottom; + color:#eeeeee; +} +#main{ + position: relative; + margin-left: 260px; + padding-right: 40px; + height:100%; +} +.main_list { + padding-top:70px; +} +.main_list ul { + clear:both; +} +.main_list li { + background:url(<%= asset_path '75.png' %>) repeat left top; + margin-bottom:20px; +} +.main_list li span { + display:inline-block; + float:left; + padding-left:20px; + color:#fff; + font-size:14px; + line-height:40px; + width:18%; +} +.main_list li.list_head { + background:none; + margin-bottom:10px; +} +.main_list li.list_head span { + font-size:16px; + line-height:inherit; + text-shadow: 0px 1px 1px #3e2914; +} +.main_list li.list_item { + position:relative; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 6px #291508; /* Firefox */ + -webkit-box-shadow: 0px 0px 6px #291508;/* Safari 和 Chrome */ + box-shadow: 0px 0px 6px #291508; /* Opera 10.5 + */ +} +.main_list li.list_item:hover { + border:1px solid #3699dd; +} +.main_list li.disable { + opacity:0.6; +} +.main_list li.list_item:hover span { + line-height:38px; +} +.main_list li .roles { +} +.main_list li .name { +} +.main_list li .email { +} +.main_list li .admin{ +} +.main_list li .action{ + float: right; + width:10%; +} +#main .action a{ + background-image:url(<%= asset_path 'icon.png' %>); + text-indent:-9999px; + display:inline-block; + width:19px; + height:19px; + margin-top:8px; + margin-right:10px; +} +#main .action a.show{ + background-position:left top; +} +#main .action a.edit{ + background-position:-19px top; +} +#main .action a.delete{ + background-position:-38px top; +} +#main a.switch{ + background:url(<%= asset_path 'switch.png' %>) no-repeat left 3px; + width:40px; +} +#main .disable a.switch{ + background:url(<%= asset_path 'switch.png' %>) no-repeat left bottom; +} +#main .action a.show:hover{ + background-position:left -19px; +} +#main .action a.edit:hover{ + background-position:-19px -19px; +} +#main .action a.delete:hover{ + background-position:-38px -19px; +} +#main .list_item .roles { + background-image:url(<%= asset_path 'roles_type.jpg' %>); + background-repeat:repeat-x; + border-radius: 5px 0 0 5px; + -moz-border-radius: 5px 0 0 5px; + -webkit-border-radius: 5px 0 0 5px; +} +#roles_list .roles_block .action a{ + margin-top:0; + margin-right:0; +} +.student { + background-position:0 -5px; +} +.teacher { + background-position:0 -54px; +} +#add_new a { + background-position:-54px -17px; +} +#add_new a:hover { + background-position: -54px 3px; +} +.buttom { + float:right; +} +#confirm a{ + background-position:4px -70px; +} +#confirm a:hover{ + background-position: 4px -51px; +} +#create a{ + background-image: none; + padding: 0 10px; +} +#update a{ + background-position:4px -112px; +} +#update a:hover{ + background-position:4px -89px; +} +#back a{ + background-position:4px -156px; +} +#back a:hover{ + background-position:4px -133px; +} +.buttom a { + margin:0 0 20px 10px; + background-image:url(<%= asset_path 'icon.png' %>); + background-repeat:no-repeat; + font-size:12px; + color:#FFF; + display:inline-block; + padding:0 10px 0 25px; + background-color: rgba(0, 0, 0, 0.75); + line-height:24px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 3px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 3px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 3px 0px 4px #180902; /* Opera 10.5 + */ +} +.buttom a:hover { + color:#000; + font-weight:bold; + background-color: rgba(255, 255, 255, 1); +} +#porfile{ + padding-top:100px; +} +#porfile h2 { + color: #FFFFFF; + font-weight: normal; + margin: 0; + padding: 0; + text-shadow: 0 3px 2px #000000; + position:absolute; + top:-30px; +} +#porfile .user_mail { + text-align: center; + background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top; + border:none; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + padding:3px 10px 1px; + margin-top:10px; + width:110px; + height: 21px; + font-size: 12px; + color:#666666; + text-shadow: 0 1px 0 #FFFFFF; +} +#porfile label { + display:block; + text-shadow: 0 1px 0 #FFFFFF; + background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top; + height: 25px; + width:110px; + padding: 0 0 0 18px; + border:1px solid #d8d8d8; + margin-top:10px; + color:#666666; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} +#porfile label:hover{ + background-position:left bottom; + color:#000; + border:1px solid #a6a6a6; +} +#porfile label input { + border:none; + margin: 6px 15px 0 0; + float:left; +} +#porfile label span { + display:block; + float:left; + line-height:27px; + font-size:12px; +} +.roles_block { + min-width:710px; + margin-bottom:50px; + position:relative; + padding-bottom: 20px; + background:url(<%= asset_path '75.png' %>) repeat left top; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +#user_list .roles_block { + margin-left:180px; +} +#person { + text-align:center; + left: 265px; + position: fixed; + top: 75px; +} +#person img { + background-color:#FFF; + padding:5px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + -moz-box-shadow: 0px 0px 4px #180902; /* Firefox */ + -webkit-box-shadow: 0px 0px 4px #180902;/* Safari 和 Chrome */ + box-shadow: 0px 0px 4px #180902; /* Opera 10.5 + */ +} +#person .mail { + color: #FFFFFF; + font-size: 12px; + text-shadow:0px 1px 0px #333; + font-weight:bold; + background:url(<%= asset_path 'line.png' %>) repeat-x left top; + padding-top:10px; +} +#upload, #edit{ + margin: 0 auto; + display:block; + text-shadow: 0 1px 0 #FFFFFF; + background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top; + height: 25px; + line-height:27px; + color:#666666; + width:128px; + text-align:center; + font-size:12px; + border:1px solid #d8d8d8; + margin-top:10px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; +} +#upload:hover{ + background-position:left bottom; + color:#000; + border:1px solid #a6a6a6; +} +#main hr{ + 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; + border-bottom:1px solid #000; +} +#basic_block hr{ + background-color:#666666; +} +#teacher_block hr{ + background-color:#0071a9; +} +#student_block hr{ + background-color:#af0045; +} +.info_input { + padding:10px 20px; +} +.info_input table { + color:#fff; + width:100%; + font-size:14px; +} +.info_input table td { + padding:5px 10px 5px 0; + width: 10%; +} +.info_input .list_head { + background:url(<%= asset_path 'line.png' %>) left bottom repeat-x; +} +.info_input .list_head td { +} +.info_input .list_item { + color:#AEAEAE; +} +.info_input .add { + display:block; + padding-left:22px; + font-size:12px; + line-height:21px; + height:19px; + background:url(<%= asset_path 'icon.png' %>) no-repeat -59px 0; + margin-top: 10px; + color: #DDDDDD; +} +.info_input .add:hover { + color:#FFF; + background-position:-59px -19px; +} +.info_input li { + height:30px; + margin-bottom: 5px; +} +.info_input li span { + display:inline-block; + float:left; + color:#fff; + font-size:14px; + line-height:30px; + margin-right:10px; +} +#user_list .info_input li span { + width: 25%; +} +#roles_list .info_input li span { + width:15%; +} +.info_input li span:last-child { +} +#person select { + background:url(<%= asset_path 'upload_but.png' %>) repeat-x left top; + border:1px solid #d8d8d8; + margin-top: 10px; + width: 130px; + padding:3px 6px 3px 14px; + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border:none; +} \ No newline at end of file diff --git a/app/assets/stylesheets/messy.css.erb b/app/assets/stylesheets/messy.css.erb new file mode 100644 index 000000000..3cc491d80 --- /dev/null +++ b/app/assets/stylesheets/messy.css.erb @@ -0,0 +1,305 @@ +body{ + background:url(<%= asset_path 'wood_floor.jpg' %>) fixed center 0; + /*background:url(images/jobs.jpg) fixed center bottom;*/ + -moz-background-size:cover; + background-size:cover; + color: #000000; + margin: 0; + padding: 0; +} +#hmenu{ + background:url(<%= asset_path 'orbitbar1.png' %>) repeat-x 0 0; + height: 50px; + position:fixed; + top:0; + left:0; + width:100%; + z-index: 5; +} +#orbit_icon { + margin-left: 10px; +} +#orbit_icon a { + background:url(<%= asset_path 'bar_orbit.png' %>) no-repeat scroll left top transparent; + height: 43px; + width: 41px; + display:block; + text-indent:-9999px; +} +#orbit_icon a:hover { + background:url(<%= asset_path 'bar_orbit.png' %>) no-repeat scroll left 50% transparent; +} +#hmenu #left{ + left: 51px; + position: absolute; + top: 1px; +} +#hmenu #left a{ + border-left: 1px solid #000000; + border-right: 1px solid #7F8488; + color: #FFFFFF; + display: block; + font-size: 17px; + height: 40px; + line-height: 40px; + padding: 0 10px; + text-align: center; + text-decoration: none; +} +#hmenu #left a:hover{ + background:#000; + color: #FFFFFF; +} +#hmenu #right{ + position: absolute; + right: 10px; + top: 1px; + width: 393px; +} +#hmenu #right a{ + border-left: 1px solid #7F8488; + border-right: 1px solid #7F8488; + color: #FFFFFF; + display: block; + font-size: 17px; + height: 40px; + line-height: 40px; + padding: 0 10px; + text-align: center; + text-decoration: none; + width: 65px; +} +#hmenu #right a:hover{ + background:#000; + color: #FFFFFF; +} +#hmenu form{ + left: 27px; + position: absolute; + top: 8px; +} +#login_id{ + background:url(<%= asset_path 'bar_id.png' %>) no-repeat scroll 0 0 transparent; + border: medium none; + color: #818181; + font-family: arial,sans-serif; + height: 26px; + left: 70px; + position: absolute; + top: 0; + width: 119px; +} +#login_id input { + background: none repeat scroll 0 0 transparent; + border: medium none; + font-family: arial,sans-serif; + height: 15px; + left: 21px; + position: absolute; + top: 4px; + width: 92px; +} + +#login_pw { + background:url(<%= asset_path 'bar_pw.png' %>) no-repeat scroll 0 0 transparent; + border: medium none; + color: #818181; + font-family: arial,sans-serif; + height: 26px; + left: 193px; + position: absolute; + top: 0; + width: 119px; +} + +#login_pw input { + background: none repeat scroll 0 0 transparent; + border: medium none; + font-family: arial,sans-serif; + height: 15px; + left: 21px; + position: absolute; + top: 4px; + width: 92px; +} +#login_btn input { + background:url(<%= asset_path 'bar_btn.png' %>) no-repeat scroll 0 0 transparent; + border: medium none; + color: #FFFFFF; + cursor: pointer; + font-family: arial,sans-serif; + height: 26px; + left: 316px; + margin: 0; + padding: 0 0 2px; + position: absolute; + top: 0; + width: 50px; +} + +#log_out a{ + background:url(<%= asset_path 'service_btn.png' %>) no-repeat scroll right 0 transparent; + border: medium none !important; + display: block !important; + height: 40px !important; + line-height: normal !important; + padding: 0 !important; + position: absolute; +/* right: -9px;*/ + text-indent: -10000px; + top: 0px; + width: 43px !important; +} +#log_out a:hover{ + background:url(<%= asset_path 'service_btn.png' %>) no-repeat scroll right bottom transparent !important; +} + +#hmenu #right select{ + font-family: helvetica,arial,sans-serif; + left: 97px; + position: absolute; + top: 10px; + width: 120px; +} +.content{ + padding: 10px; +} + +#user_info{ + background: none repeat scroll 0 0 #FEFEFE; + border: 1px solid #818181; + border-radius: 5px 5px 5px 5px; + margin: 0 0 20px; + padding: 10px; + width: 250px; +} + +#user_info table{ + border-collapse: collapse; + width: 100%; +} +#user_info table td{ + padding: 3px; +} + +#sites_info{ + background: -webkit-gradient(linear, left top, left bottom, from(white), to(#F8F8F8)); + border: 1px solid #818181; + border-radius: 5px 5px 5px 5px; + float: left; + margin: 0 20px 20px 0; + width: 30%; + min-width: 320px; +} +#sites_info h3{ + background: none repeat scroll 0 0 #EEEEEE; + border: 1px solid #DDDDDD; + border-radius: 5px 5px 5px 5px; + font: 24px/100% helvetica,arial,sans-serif; + margin: 2% 2% 0; + padding: 1%; +} +#sites_info table{ + background: none repeat scroll 0 0 #fff; + border: 1px solid #DDDDDD; + border-radius: 5px 5px 5px 5px; + margin: 2%; + width: 96%; +} +#sites_info table td{ + padding: 10px 5px; +} +#sites_info table th{ + border-right: 1px solid #DDDDDD; + color: #808080; + font-size: 18px; + font-weight: normal; + padding: 10px 5px; + text-align: right; + width: 20%; +} + + +#purchases{ + background: -webkit-gradient(linear, left top, left bottom, from(white), to(#F8F8F8)); + border: 1px solid #818181; + border-radius: 5px 5px 5px 5px; + float: left; + width: 30%; + min-width: 320px; +} +#purchases h3{ + background: none repeat scroll 0 0 #EEEEEE; + border: 1px solid #DDDDDD; + border-radius: 5px 5px 5px 5px; + font: 24px/100% helvetica,arial,sans-serif; + margin: 2% 2% 0; + padding: 1%; +} +#purchases table{ + background: none repeat scroll 0 0 #fff; + border: 1px solid #DDDDDD; + border-radius: 5px 5px 5px 5px; + margin: 2%; + width: 96%; +} +#purchases table th{ + border-right: 1px solid #DDDDDD; + color: #808080; + font-size: 18px; + font-weight: normal; + padding: 10px 5px; + text-align: right; + width: 20%; +} +#purchases table td{ + padding: 10px 5px; +} +.design_page{ +} +.style_list{ + background:url(<%= asset_path 'preview.png' %>) no-repeat 0 0; + height:246px; + margin: 20px 0; + padding: 0 0 0 236px; +} +.style_list ul{ + margin:0; + padding:0; +} +.style_list li{ + color: #EDA330; + font-size: 20px; + list-style: none outside none; + margin: 0 0 20px; +} +.list_title{ + color: #818181; + display: block; + font: 24px/100% ·L³n¥¿¶ÂÅé,sans-serif; +} +.buy_btn a{ + background:url(<%= asset_path "buy_btn.png" %>) no-repeat scroll 0 0 transparent; + color: #000000; + display: block; + font-size: 22px; + height: 37px; + line-height: 37px; + text-align: center; + text-decoration: none; + text-shadow: 0 1px 0 #FFFFFF; + width: 170px; +} +.buy_btn a:hover{ + background-position:0 bottom; +} +.bought_btn{ + background:url(<%= asset_path "bought_btn.png" %>) no-repeat scroll 0 0 transparent; + color: #FFFFFF; + font-size: 22px; + height: 37px; + line-height: 37px; + text-align: center; + text-shadow: 0 1px 0 #C06408; + width: 170px; +} \ No newline at end of file diff --git a/public/stylesheets/easy.css b/app/assets/stylesheets/rulingcom/easy.css similarity index 100% rename from public/stylesheets/easy.css rename to app/assets/stylesheets/rulingcom/easy.css diff --git a/public/stylesheets/easyprint.css b/app/assets/stylesheets/rulingcom/easyprint.css similarity index 99% rename from public/stylesheets/easyprint.css rename to app/assets/stylesheets/rulingcom/easyprint.css index e3ee52b0b..cb826cf06 100644 --- a/public/stylesheets/easyprint.css +++ b/app/assets/stylesheets/rulingcom/easyprint.css @@ -147,4 +147,4 @@ .inner, .content, .cols, .fixed{display:block;min-height:1%;} * html .inner, * html .content, * html .cols, * html .fixed{height:1%;} -/* // clearfix */ \ No newline at end of file +/* // clearfix */ diff --git a/app/controllers/admin/.designs_controller.rb.swp b/app/controllers/admin/.designs_controller.rb.swp new file mode 100644 index 000000000..5131583d8 Binary files /dev/null and b/app/controllers/admin/.designs_controller.rb.swp differ diff --git a/app/controllers/admin/designs_controller.rb b/app/controllers/admin/designs_controller.rb new file mode 100644 index 000000000..5930d1bfb --- /dev/null +++ b/app/controllers/admin/designs_controller.rb @@ -0,0 +1,147 @@ +class Admin::DesignsController < ApplicationController + require "net/http" + require "uri" + require 'zip/zip' + + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? + + def upload_package + if !params[:design].nil? + temp_file = Tempfile.new("temp_file") + original_file = params[:design][:package_file] + #if original_file.content_type == 'application/zip' + temp_file.write(original_file.read.force_encoding('UTF-8')) + temp_file.rewind + filename = File.basename(original_file.original_filename,".zip") + unzip_design(temp_file, filename) + #else + # flash[:error] = "Upload file should be in zip format" + #end + temp_file.close + end + end + + def index + @designs = Design.all.entries + end + + def new + @design = Design.new + end + + def update + @design = Design.find(params[:id]) + if @design.update_attributes(params[:design]) + flash[:notice] = "Successfully updated design and tasks." + redirect_to admin_designs_url(@design) + else + render :action => 'edit' + end + end + + def edit_file + @design = Design.find(params[:id]) + filename = params[:filename] + files = @design.themes + @design.javascripts + @design.images + file_to_removed = files.find{ |obj| + obj.file_filename == filename + } + type = file_to_removed._type + new_file = "" + Dir.mktmpdir('design_temp'){ |dir| + temp_file = File.new(dir+'/'+filename,'w+') + temp_file.write params[:context] + replace_target = eval("@design.#{type.downcase.pluralize}") + new_file = replace_target.build(:file => temp_file,:to_save=>true) + file_to_removed.destroy + new_file.save + temp_file.close + } + respond_to do |format| + format.js {} + end + end + + def edit + @design = Design.find(params[:id]) + end + + def destroy + @design = Design.find(params[:id]) + @design.destroy + redirect_to admin_designs_url + end + + def create + @design = Design.new(params[:design]) + if @design.save + flash[:notice] = "Successfully created design and tasks." + redirect_to admin_designs_url + else + render :action => 'new' + end + end + + protected + + def unzip_design(file, zip_name) + Zip::ZipFile.open(file) { |zip_file| + design = Design.new.from_json(zip_file.read("#{zip_name}/info.json")) + Dir.mktmpdir('f_path') { |dir| + design.build_layout + themes_entries = [] + javascripts_entries = [] + images_entries = [] + + zip_file.entries.each do |entry| + case (path = entry.to_s) + when /\A(#{zip_name})\/(default\.css)\z/ #for default css + filename = File.basename(entry.to_s) + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.write (zip_file.read entry ).force_encoding('UTF-8') + default_css = design.build_default_css + default_css.file = temp_file + default_css.file_filename = filename + default_css.to_save = true + when /\A(#{zip_name})\/(reset\.css)\z/ #for reset css + filename = File.basename(entry.to_s) + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.write (zip_file.read entry ).force_encoding('UTF-8') + reset_css = design.build_reset_css + reset_css.file = temp_file + reset_css.file_filename = filename + reset_css.to_save = true + when /\A(#{zip_name})\/(layout\.html)\z/ #for layout html + filename = File.basename(entry.to_s) + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.write (zip_file.read entry ).force_encoding('UTF-8') + design.layout.file = temp_file + design.layout.to_save=true + when /\A(#{zip_name})\/(themes)\/.*(\.css)\z/ #for themes css + themes_entries << entry + when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js + javascripts_entries << entry + when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img + images_entries << entry + end + end + + ['themes', 'javascripts', 'images'].each do |type| + eval("#{type}_entries").each do |entry| + filename = File.basename entry.to_s + temp_file = File.new(dir + '/' + filename, 'w+') + temp_file.write (zip_file.read entry).force_encoding('UTF-8') + build_and_store = eval("design.#{type}").build + build_and_store.file = temp_file + build_and_store.file_filename = filename + build_and_store.to_save = true + end + end + } + design.save + } + end + +end diff --git a/app/controllers/admin/items_controller.rb b/app/controllers/admin/items_controller.rb index 19fbd56db..9c9f81e5b 100644 --- a/app/controllers/admin/items_controller.rb +++ b/app/controllers/admin/items_controller.rb @@ -12,7 +12,7 @@ class Admin::ItemsController < ApplicationController if params[:item_id] @item = Item.find(params[:item_id]) else - @item = Item.first(:conditions => {:parent_id => nil}) + @item = get_homepage end end diff --git a/app/controllers/admin/layouts_controller.rb b/app/controllers/admin/layouts_controller.rb deleted file mode 100644 index 6661720c2..000000000 --- a/app/controllers/admin/layouts_controller.rb +++ /dev/null @@ -1,54 +0,0 @@ -class Admin::LayoutsController < ApplicationController - - layout "admin" - before_filter :authenticate_user! - before_filter :is_admin? - - def index - @layouts = Layout.all.entries - end - - def show - #TODO -# @layout = Layout.find(params[:id]) -# redirect_to "/#{@layout.name}" - end - - def new - @layout = Layout.new - end - - def edit - @layout = Layout.find(params[:id]) - end - - def create - @layout = Layout.new(params[:layout]) - - if @layout.save - flash[:notice] = t('admin.create_success_layout') - redirect_to admin_layouts_url - else - render :action => 'new' - end - end - - def update - @layout = Layout.find(params[:id]) - - if @layout.update_attributes(params[:layout]) - flash[:notice] = t('admin.update_success_layout') - redirect_to admin_layouts_url - else - render :action => "edit" - end - end - - def destroy - @layout = Layout.find(params[:id]) - @layout.destroy - - redirect_to admin_layouts_url - end - -end diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index cde4a4254..ffa1e687b 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -28,6 +28,7 @@ class Admin::PagePartsController < ApplicationController @partial = 'edit_text' @part_locale = params[:part_locale] || I18n.locale.to_s when 'module' + @plugins=[{:module=>"Blog",:widgets=>[{:name=>"Blog",:path=>"panel/blog/widget_latest_post"},{:name=>"Blog",:path=>"panel/blog/widget_index"}]}] when 'snippet' end end diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb index d6992c71d..4ea26f12c 100644 --- a/app/controllers/admin/pages_controller.rb +++ b/app/controllers/admin/pages_controller.rb @@ -21,14 +21,15 @@ class Admin::PagesController < ApplicationController @item = Page.new @item.is_published = true @item.parent_id = @parent_item.id rescue nil + @designs = Design.all.entries + @default_design = Design.first end def edit @item = Page.find(params[:id]) - # @item.content = parse_content(@item.content, {:locale => 'show'}) - @item.content = parse_page_code(@item) @i18n_variable = @item.i18n_variable - @code = params[:code] + @designs = Design.all.entries + @design = @item.design end def create @@ -52,11 +53,10 @@ class Admin::PagesController < ApplicationController def update @item = Page.find(params[:id]) - parse_content_update_code(@item, params[:page][:content]) - if @item.update_attributes(params[:item]) + if @item.update_attributes(params[:page]) flash[:notice] = t('admin.update_success_page') respond_to do |format| - format.html { + format.html { redirect_to admin_page_url(@item) } format.js {} @@ -86,4 +86,12 @@ class Admin::PagesController < ApplicationController end end + def reload_themes + @design = Design.find(params[:id]) + @themes = @design.themes + respond_to do |format| + format.js {} + end + end + end diff --git a/app/controllers/admin/purchases_controller.rb b/app/controllers/admin/purchases_controller.rb new file mode 100644 index 000000000..40a042f44 --- /dev/null +++ b/app/controllers/admin/purchases_controller.rb @@ -0,0 +1,186 @@ +class Admin::PurchasesController < ApplicationController + require "net/http" + require "uri" + require 'zip/zip' + + layout "admin" + + def index + @purchases = Purchase.all.entries + end + + def download + @purchase = Purchase.first(:conditions => {:id => params[:id]}) + download_purchase(@purchase, request.env['REQUEST_URI'].split('admin')[0].chop) + @purchase.downloaded = true + @purchase.save + redirect_to admin_purchases_url + end + + def install_app + unzip_app + redirect_to admin_purchases_url + + end + + protected + + def download_purchase(purchase, url) + uri = URI.parse("http://#{APP_CONFIG['store_ip']}/download/purchase") + http = Net::HTTP.new(uri.host, uri.port) + request = Net::HTTP::Post.new(uri.request_uri) + + 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, + :roaming_id => Site.find(session[:site]).roaming_id, + :url => url}.to_json) + + request.set_form_data({ :purchase => encrypted_data}) + response = http.request(request) + temp_file = Tempfile.new("temp_file") + temp_file.binmode + temp_file.write response.body + temp_file.rewind + zip_name = response['content-disposition'].split('filename=')[1].gsub(/[\\\"]|.zip/, '') rescue '' + case purchase._type + when 'Pdesign' + unzip_design(temp_file, zip_name) + when 'PModuleApp' + unzip_module_app(temp_file, zip_name) + end + temp_file.close + temp_file.unlink + end + + def unzip_design(file, zip_name) + Zip::ZipFile.open(file) do |zip_file| + encrypted = {} + ['encrypted_data', 'encrypted_key', 'encrypted_iv'].each do |e| + encrypted.merge!(e => zip_file.read(e)) + end + orig_file = decrypt_data(encrypted['encrypted_data'], encrypted['encrypted_key'], encrypted['encrypted_iv']) + + temp_file = Tempfile.new("temp_file_zip") + temp_file.binmode + temp_file.write orig_file + temp_file.rewind + + Zip::ZipFile.open(temp_file) { |orig_zip| + design = Design.new.from_json(orig_zip.read("#{zip_name}/#{zip_name}.json")) + Dir.mktmpdir('f_path') { |dir| + + build_file(orig_zip, zip_name, dir, design.layout) if design.layout + build_file(orig_zip, zip_name, dir, design.default_css) if design.default_css + build_file(orig_zip, zip_name, dir, design.reset_css) if design.reset_css + + ['themes', 'javascripts', 'images'].each do |type| + design.send(type).each do |object| + build_file(orig_zip, zip_name, dir, object, type) + end + end + } + temp_file.close + temp_file.unlink + design.save + } + + end + end + + def unzip_app + zip_name = "NewBlog" + file = "#{Rails.root}/lib/NewBlog.zip" + destination = "#{Rails.root}/vendor/plugins" + + Zip::ZipFile.open(file) do |zip_file| + orig_file = file + + temp_file = Tempfile.new("temp_file_zip") + temp_file.binmode + temp_file.write orig_file + temp_file.rewind + + app = AppModule.new.from_json(zip_file.read("#{zip_name}/#{zip_name}/#{zip_name}.json")) + zip_file.each do |f| + if (f.to_s=~/^#{zip_name}\/#{zip_name}\/*/) + f_path=File.join(destination, f.name.gsub(/^#{zip_name}\//, '')) + FileUtils.mkdir_p(File.dirname(f_path)) + zip_file.extract(f, f_path) unless File.exist?(f_path) + end + end + + log = Logger.new(STDOUT) + log.level = Logger::WARN + log.warn("App unzip procress is finished,please restart the server to apply effect") + + #TODO Perform touch tmp/restart to restart in production env + end + end + + def unzip_module_app(file, zip_name) + destination = "#{Rails.root}/vendor/plugins" + Zip::ZipFile.open(file) do |zip_file| + encrypted = {} + ['encrypted_data', 'encrypted_key', 'encrypted_iv'].each do |e| + encrypted.merge!(e => zip_file.read(e)) + end + orig_file = decrypt_data(encrypted['encrypted_data'], encrypted['encrypted_key'], encrypted['encrypted_iv']) + + temp_file = Tempfile.new("temp_file_zip") + temp_file.binmode + temp_file.write orig_file + temp_file.rewind + + Zip::ZipFile.open(temp_file) { |orig_zip| + module_app = ModuleApp.new.from_json(orig_zip.read("#{zip_name}/#{zip_name}.json")) + orig_zip.remove("#{zip_name}/#{zip_name}.json") + + orig_zip.each do |orig| + inner_temp_file = Tempfile.new("inner_temp_file_zip") + inner_temp_file.binmode + inner_temp_file.write orig_zip.read(orig) + inner_temp_file.rewind + + Zip::ZipFile.open(inner_temp_file) {|inner_zip| + inner_zip.each do |f| + if (f.to_s=~/^#{zip_name}\/*/) + f_path = File.join(destination, f.name) + FileUtils.mkdir_p(File.dirname(f_path)) + inner_zip.extract(f, f_path) unless File.exist?(f_path) + end + end + } + inner_temp_file.close + inner_temp_file.unlink + end + + module_app.save + + log = Logger.new(STDOUT) + log.level = Logger::WARN + log.warn("App unzip procress is finished,please restart the server to apply effect") + } + + temp_file.close + temp_file.unlink + + end + end + + + + + def build_file(orig_zip, zip_name, dir, object, type = nil) + title = object.file_filename + temp = File.new(dir + '/' + title, 'w+') + temp.write orig_zip.read(zip_name + '/' + (type ? (type + '/') : '') + title) + object.file = temp + object.to_save = true + end + + def unzip_file (file, destination) + + end + +end \ No newline at end of file diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb new file mode 100644 index 000000000..9475e7084 --- /dev/null +++ b/app/controllers/admin/sites_controller.rb @@ -0,0 +1,16 @@ +class Admin::SitesController < ApplicationController + + layout "admin" + before_filter :authenticate_user! + before_filter :is_admin? + + def index + @site = Site.first + redirect_to :action => :new unless @site + end + + def new + @site = Site.new + end + +end diff --git a/app/controllers/admin/snippets_controller.rb b/app/controllers/admin/snippets_controller.rb index 7e7e44135..4473ad5b2 100644 --- a/app/controllers/admin/snippets_controller.rb +++ b/app/controllers/admin/snippets_controller.rb @@ -5,6 +5,8 @@ class Admin::SnippetsController < ApplicationController before_filter :find_parent_item before_filter :is_admin? + #Snippet is a object admin user can define his own tag and being used later on in parser + def show #TODO end diff --git a/app/controllers/admin/user_attributes_controller.rb b/app/controllers/admin/user_attributes_controller.rb index c7021c740..127f4c7f8 100644 --- a/app/controllers/admin/user_attributes_controller.rb +++ b/app/controllers/admin/user_attributes_controller.rb @@ -1,6 +1,6 @@ class Admin::UserAttributesController < ApplicationController - layout "admin" + layout "member" before_filter :authenticate_user! def index diff --git a/app/controllers/admin/user_info_models_controller.rb b/app/controllers/admin/user_info_models_controller.rb index 7660d699f..29a26dba5 100644 --- a/app/controllers/admin/user_info_models_controller.rb +++ b/app/controllers/admin/user_info_models_controller.rb @@ -1,6 +1,6 @@ class Admin::UserInfoModelsController < ApplicationController - layout "admin" + layout "member" before_filter :authenticate_user! before_filter :is_admin? before_filter :set_attribute, :only => [:index, :show, :new, :edit] diff --git a/app/controllers/admin/user_role_models_controller.rb b/app/controllers/admin/user_role_models_controller.rb index b4145a8f5..ecb8b5a2b 100644 --- a/app/controllers/admin/user_role_models_controller.rb +++ b/app/controllers/admin/user_role_models_controller.rb @@ -1,6 +1,6 @@ class Admin::UserRoleModelsController < ApplicationController - layout "admin" + layout "member" before_filter :authenticate_user! before_filter :is_admin? before_filter :set_attribute, :only => [:index, :show, :new, :edit] diff --git a/app/controllers/panel/users_controller.rb b/app/controllers/admin/users_controller.rb similarity index 85% rename from app/controllers/panel/users_controller.rb rename to app/controllers/admin/users_controller.rb index 7abf6e1f3..46d7ed96e 100644 --- a/app/controllers/panel/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,6 +1,6 @@ -class Panel::UsersController < ApplicationController +class Admin::UsersController < ApplicationController - layout "panel" + layout "member" before_filter :authenticate_user! def index @@ -28,7 +28,7 @@ class Panel::UsersController < ApplicationController user_role.save user_role.attribute_values.each(&:save) end - flash[:notice] = t('panel.create_success_user') + flash[:notice] = t('admin.create_success_user') redirect_to :action => :index else render :action => :new @@ -48,10 +48,10 @@ class Panel::UsersController < ApplicationController @user.avatar = params[:file] if params[:file] if @user.id.to_s.eql?(session['warden.user.user.key'][1].to_s) && @user.admin != params[:user][:admin].to_i.to_b - flash.now[:error] = t('panel.cant_revoke_self_admin') + flash.now[:error] = t('admin.cant_revoke_self_admin') end if !flash[:error] && @user.update_attributes(params[:user]) - flash[:notice] = t('panel.update_success_user') + flash[:notice] = t('admin.update_success_user') redirect_to :action => :index else get_info_role_models @@ -61,7 +61,7 @@ class Panel::UsersController < ApplicationController def destroy if params[:id].eql?(session['warden.user.user.key'][1].to_s) - flash[:error] = t('panel.cant_delete_self') + flash[:error] = t('admin.cant_delete_self') else @user = User.find(params[:id]) @user.destroy diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2dd99b4a0..68b322385 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,6 +6,25 @@ class ApplicationController < ActionController::Base helper :all before_filter :set_locale, :set_site + def get_all_app_engines + ary = ["vender/plugins/NewBlog"] + app_engines = ary.collect{|t| + Rails::Engine.find t + } + app_engines.each{ |t| + # t. + } + end + + def flaten_controller + ary=[] + Find.find(File.join(Rails.root , 'vendor/plugins/')) { |name| + require_dependency(name) if /_controller\.rb$/ =~ name + ary << name + } + ary + end + # Find the parent for the given item def find_parent_item @parent_item = Item.first(:conditions => { :id => BSON::ObjectId(params[:parent_id]) }) rescue nil @@ -25,6 +44,8 @@ class ApplicationController < ActionController::Base end end + protected + # Set I18n.locale def set_locale # update session if passed @@ -55,5 +76,27 @@ class ApplicationController < ActionController::Base def set_current_item session[:current_page] = params[:id] || @item.id rescue nil end + + def decrypt_data(encrypted_data, encrypted_key, encrypted_iv) + site = Site.find(session[:site]) + if encrypted_data + private_key = OpenSSL::PKey::RSA.new(site.private_key) + cipher = OpenSSL::Cipher.new('aes-256-cbc') + cipher.decrypt + cipher.key = private_key.private_decrypt(encrypted_key) + cipher.iv = private_key.private_decrypt(encrypted_iv) + + decrypted_data = cipher.update(encrypted_data) + decrypted_data << cipher.final + else + '' + end + end + + def get_homepage + Item.first(:conditions => {:parent_id => nil}) + end + + end diff --git a/app/controllers/gridfs_controller.rb b/app/controllers/gridfs_controller.rb new file mode 100644 index 000000000..8a95a5811 --- /dev/null +++ b/app/controllers/gridfs_controller.rb @@ -0,0 +1,18 @@ +require 'mongo' + +class GridfsController < ActionController::Metal + + def serve + gridfs_path = env["PATH_INFO"].gsub("/gridfs/", "") + begin + gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(gridfs_path, 'r') + self.response_body = gridfs_file.read + self.content_type = gridfs_file.content_type + rescue + self.status = :file_not_found + self.content_type = 'text/plain' + self.response_body = '' + end + end + +end \ No newline at end of file diff --git a/app/controllers/sites_controller.rb b/app/controllers/sites_controller.rb deleted file mode 100644 index cb820fbb1..000000000 --- a/app/controllers/sites_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class SitesController < ApplicationController - - #layout 'set_up' - - def index - @site = Site.first - if @site - @title = "site" - else - redirect_to :action => :new - end - end - - def new - @site = Site.new - end - -end diff --git a/app/helpers/admin/item_helper.rb b/app/helpers/admin/item_helper.rb index 7994cb250..c28c9b8fc 100644 --- a/app/helpers/admin/item_helper.rb +++ b/app/helpers/admin/item_helper.rb @@ -12,7 +12,7 @@ module Admin::ItemHelper ret << "