Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Andrea Frigido 2011-06-01 18:34:28 +02:00
commit cf246268e7
97 changed files with 1546 additions and 87 deletions

2
.gitignore vendored
View File

@ -30,3 +30,5 @@ config/deploy.rb
perf/*.rb
gem_graph.png
sites/
permanent
doc/bushido

17
Gemfile
View File

@ -2,6 +2,8 @@ source :rubygems
# add in all the runtime dependencies
gem 'rake', '0.8.7'
gem 'rails', '>= 3.0.7'
gem 'warden'
@ -20,12 +22,11 @@ gem 'inherited_resources', '~> 1.1.2'
gem 'rmagick', '2.12.2'
gem 'locomotive_carrierwave', '0.5.0.1.beta3', :require => 'carrierwave'
gem 'custom_fields', '1.0.0.beta.12'
gem 'custom_fields', '1.0.0.beta.13'
gem 'fog', '0.3.7'
gem 'mimetype-fu'
gem 'actionmailer-with-request', :require => 'actionmailer_with_request'
gem 'heroku', '1.19.1'
gem 'bushido'
gem 'httparty', '>= 0.6.1'
gem 'RedCloth', '4.2.7'
gem 'delayed_job', '2.1.4'
@ -42,8 +43,16 @@ group :development do
end
group :test, :development do
gem "ruby-debug", :platforms => :mri_18
gem "ruby-debug19", :platforms => :mri_19
gem 'ruby-debug', :platforms => :mri_18
gem 'ruby-debug19', :platforms => :mri_19
gem 'bushido_stub', :git => 'git://github.com/did/bushido_stub.git'
# :path => '../gems/bushido_stub'
# gem 'bushido'
end
group :production do
gem 'bushido'
end
group :test do

View File

@ -1,6 +1,13 @@
GIT
remote: git://github.com/did/bushido_stub.git
revision: 6b83b2c4847832ffe7a213e725d2ceb7f864e360
specs:
bushido_stub (0.0.1)
activesupport (>= 3.0.7)
GIT
remote: git://github.com/floehopper/mocha.git
revision: 7dd9512a874f89b8037d7320fe7988c222f439e1
revision: 6da1242f26b12a24c4fcf67bf5921a25bc1bc88d
specs:
mocha (0.9.12.20110213002255)
@ -58,7 +65,7 @@ GEM
bson (1.3.1)
bson_ext (1.3.1)
builder (2.1.2)
bushido (0.0.12)
bushido (0.0.14)
highline (>= 1.6.1)
json (>= 1.4.6)
rest-client (>= 1.6.1)
@ -74,7 +81,6 @@ GEM
celerity (0.8.9)
childprocess (0.1.9)
ffi (~> 1.0.6)
closure-compiler (1.1.1)
columnize (0.3.2)
configuration (1.2.0)
crack (0.1.8)
@ -87,7 +93,7 @@ GEM
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.15)
custom_fields (1.0.0.beta.12)
custom_fields (1.0.0.beta.13)
activesupport (>= 3.0.7)
locomotive_carrierwave
mongoid (~> 2.0.1)
@ -110,7 +116,7 @@ GEM
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
ffi (1.0.8)
ffi (1.0.9)
fog (0.3.7)
builder
excon (>= 0.2.3)
@ -120,7 +126,7 @@ GEM
net-ssh (~> 2.0.23)
nokogiri (~> 1.4.3.1)
ruby-hmac
formatador (0.1.3)
formatador (0.1.4)
formtastic (1.2.3)
actionpack (>= 2.3.7)
activesupport (>= 2.3.7)
@ -141,12 +147,11 @@ GEM
inherited_resources (1.1.2)
has_scope (~> 0.5.0)
responders (~> 0.6.0)
jammit (0.6.0)
closure-compiler (>= 0.1.0)
yui-compressor (>= 0.9.1)
jammit (0.6.3)
yui-compressor (>= 0.9.3)
json (1.5.1)
json_pure (1.4.6)
kgio (2.4.0)
kgio (2.4.1)
launchy (0.3.7)
configuration (>= 0.0.5)
rake (>= 0.8.1)
@ -172,11 +177,10 @@ GEM
mimetype-fu (0.1.2)
mongo (1.3.1)
bson (>= 1.3.1)
mongoid (2.0.1)
mongoid (2.0.2)
activemodel (~> 3.0)
mongo (~> 1.3)
tzinfo (~> 0.3.22)
will_paginate (~> 3.0.pre)
net-ssh (2.0.24)
nokogiri (1.4.3.1)
open4 (1.0.1)
@ -185,7 +189,7 @@ GEM
rake
polyglot (0.3.1)
proxies (0.2.1)
rack (1.2.2)
rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
@ -245,7 +249,7 @@ GEM
ffi (>= 1.0.7)
json_pure
rubyzip
spork (0.8.4)
spork (0.8.5)
term-ansicolor (1.0.5)
thor (0.14.6)
treetop (1.4.9)
@ -257,7 +261,7 @@ GEM
rack
warden (0.10.7)
rack (>= 1.0.0)
will_paginate (3.0.pre2)
will_paginate (2.3.15)
yui-compressor (0.9.6)
POpen4 (>= 0.1.4)
@ -272,10 +276,11 @@ DEPENDENCIES
autotest
bson_ext (~> 1.3.0)
bushido
bushido_stub!
capybara
cucumber (= 0.8.5)
cucumber-rails
custom_fields (= 1.0.0.beta.12)
custom_fields (= 1.0.0.beta.13)
database_cleaner
delayed_job (= 2.1.4)
delayed_job_mongoid (= 1.0.2)
@ -298,6 +303,7 @@ DEPENDENCIES
mongoid (~> 2.0.1)
pickle
rails (>= 3.0.7)
rake (= 0.8.7)
rmagick (= 2.12.2)
rspec-rails (= 2.3.1)
ruby-debug

View File

@ -5,7 +5,7 @@ module Admin
layout '/admin/layouts/application'
before_filter :authenticate_admin!
before_filter :require_admin
before_filter :require_site
@ -28,6 +28,10 @@ module Admin
protected
def require_admin
authenticate_admin!
end
def begin_of_association_chain
current_site
end

View File

@ -7,7 +7,7 @@ module Admin
skip_before_filter :validate_site_membership
before_filter :authenticate_admin!, :only => :new
before_filter :require_admin, :only => :new
def new
if site = current_admin.sites.detect { |s| s._id.to_s == params[:target_id] }

View File

@ -5,7 +5,7 @@ module Admin
skip_before_filter :require_site
skip_before_filter :authenticate_admin!
skip_before_filter :require_admin
skip_before_filter :verify_authenticity_token
@ -42,13 +42,7 @@ module Admin
@site = Site.create_first_one(params[:site])
if @site.valid?
begin
unless params[:zipfile].blank?
Locomotive::Import::Job.run!(params[:zipfile], @site, { :samples => true })
end
rescue Exception => e
logger.error "Import failed because of #{e.message}"
end
Site.install_template(@site, params)
redirect_to last_url
else
@ -61,8 +55,8 @@ module Admin
def is_step_already_done?
case params[:step].to_i
when 1 # already an account in db
if Account.count > 0
@step_done = t('admin.installation.step_1.done', Account.first.attributes)
if account = Account.first
@step_done = I18n.t('admin.installation.step_1.done', :name => account.name, :email => account.email)
render 'step_1' and return false
end
else

View File

@ -1,7 +1,7 @@
module Admin
class SitemapsController < BaseController
skip_before_filter :authenticate_admin!, :validate_site_membership, :set_locale
skip_before_filter :require_admin, :validate_site_membership, :set_locale
before_filter :require_site

View File

@ -25,7 +25,6 @@ class ContentInstance
after_create :send_notifications
## named scopes ##
scope :persisted, where(:updated_at.ne => nil)
scope :latest_updated, :order_by => :updated_at.desc, :limit => Locomotive.config.lastest_items_nb
## methods ##

View File

@ -70,6 +70,10 @@ class ContentType
end
end
def latest_updated_contents
self.contents.latest_updated.reject { |c| !c.persisted? }
end
def ordered_contents(conditions = {})
column = self.order_by.to_sym

View File

@ -13,6 +13,24 @@ module Extensions
site
end
def install_template(site, options = {})
default_template = Boolean.set(options.delete(:default_site_template)) || false
zipfile = options.delete(:zipfile)
# do not try to process anything if said so
return unless default_template || zipfile.present?
# default template options has a higher priority than the zipfile
source = default_template ? Locomotive.default_site_template_path : zipfile
begin
Locomotive::Import::Job.run!(source, site, { :samples => true })
rescue Exception => e
logger.error "The import of the site template failed because of #{e.message}"
end
end
end
end
end

View File

@ -5,6 +5,7 @@
- content_for :head do
= include_stylesheets :installation
= include_javascripts :installation
= semantic_form_for(@site, :url => admin_installation_step_url(2), :html => { :multipart => true }) do |f|
.inner
@ -18,9 +19,16 @@
- if multi_sites?
= f.input :subdomain, :required => true
%li{ :class => 'string optional', :id => 'zipfile_input' }
- if Locomotive.default_site_template_present?
%li{ :class => 'question', :id => 'default_site_template_input' }
= check_box_tag 'default_site_template', '1', params[:default_site_template].blank? || params[:default_site_template] == '1'
%label{ :for => 'default_site_template' }!= t('formtastic.labels.import.new.default_site_template')
%li{ :class => 'string optional', :id => 'zipfile_input', :style => "#{'display: none' if Locomotive.default_site_template_present?}" }
%label{ :for => 'zipfile' }= t('formtastic.labels.import.new.source')
= file_field_tag 'zipfile'
- if Locomotive.default_site_template_present?
%p.inline-hints!= t('.back_to_default_template')
.footer
= box_button_tag t('.next')

View File

@ -15,7 +15,7 @@
.inner
%h2!= t('admin.contents.index.lastest_items')
%ul
- content_type.contents.persisted.latest_updated.each do |content|
- content_type.latest_updated_contents.each do |content|
%li
= link_to truncate(content.send(content_type.highlighted_field_name).to_s, :length => 20), edit_admin_content_path(content_type.slug, content)
%span= time_ago_in_words(content.updated_at)

View File

@ -7,6 +7,9 @@ s3_secret_access_key: <%= ENV['S3_SECRET_KEY'] %>
javascripts:
box:
- public/javascripts/admin/jquery.js
installation:
- public/javascripts/admin/jquery.js
- public/javascripts/admin/installation.js
common:
- public/javascripts/admin/jquery.js
- public/javascripts/admin/jquery.ui.js

View File

@ -3,5 +3,6 @@
"platform_version": 3,
"ruby_version": "1.9.2",
"sql": false,
"mongodb": true
"mongodb": true,
"start_page": "admin/pages"
}

View File

@ -27,4 +27,14 @@ Locomotive::Application.configure do
:port => 1025,
:domain => "example.com"
}
# set up the bushido stub (uncomment it)
# config.bushido_stub_env = false
# config.bushido_stub_env = {
# 'APP_TLD' => 'bushi.do',
# 'BUSHIDO_APP' => 'san_francisco',
# 'BUSHIDO_HOST' => 'bushi.do',
# 'LOCOMOTIVE_SITE_NAME' => 'Locomotive TEST',
# 'BUSHIDO_CLAIMED' => 'true'
# }
end

View File

@ -259,8 +259,8 @@ en:
imports:
new:
title: Import
help: "Be careful when you upload a new theme for your existing website, your current data could be modified or even removed."
title: Import site template
help: "Be careful when you upload a new template for your existing website, your current data could be modified or even removed."
show:
title: Import in progress
help: "Your site is being updated from the theme zip file you have just uploaded. It lasts a couple of seconds."
@ -289,5 +289,6 @@ en:
next: Create account
step_2:
title: "Step 2/2 &mdash; Create your first site"
explanations: "This is the last step of the installation. You can upload a theme as a zip file. We have free available themes <a href=\"http://www.locomotivecms.com/support/themes\">here</a>."
explanations: "If you already uploaded the default site template (see instructions), you can use it right away. Or you can upload a site template as a zip file (free available templates <a href=\"http://www.locomotivecms.com/support/themes\">here</a>)."
back_to_default_template: "Click <a href='#'>here</a> to select the default site template instead"
next: Create site

View File

@ -258,8 +258,8 @@ fr:
imports:
new:
title: Import
help: "Faites attention quand vous envoyez un nouveau theme sur votre site, les données de celui-ci pourront être modifiées voire même supprimées."
title: Importer template de site
help: "Faites attention quand vous envoyez un nouveau template sur votre site, les données de celui-ci pourront être modifiées voire même supprimées."
show:
title: Import en cours
help: "Votre site est en train d'être mis à jour à partir du fichier zip précédemment envoyé sur le serveur. Cette opération peut durer quelques secondes."
@ -288,5 +288,6 @@ fr:
next: Créer compte
step_2:
title: "Étape 2/2 &mdash; Créer votre premier site"
explanations: "C'est la dernière étape de l'installation. Vous pouvez uploader un theme sous forme d'un fichier zip. Nous avons quelques themes disponibles <a href=\"http://www.locomotivecms.com/support/themes\">ici</a>."
explanations: "Si vous avez déjà uploadé le template de site par défaut (voir instructions), vous pouvez l'utiliser dès maintenant. Ou vous pouvez uploader un template de site sous forme d'un fichier zip (quelques themes disponibles <a href=\"http://www.locomotivecms.com/support/themes\">ici</a>)."
back_to_default_template: "Cliquez <a href='#'>ici</a> pour sélectionner à la place le template de site par défault"
next: Créer site

View File

@ -36,6 +36,7 @@ en:
source: File
samples: Copy samples
reset: Reset site
default_site_template: "Use the default site template. Click <a href='#'>here</a> to upload a site template as a zip file instead."
content_type:
api_accounts: Notified Accounts
account:

View File

@ -14,7 +14,7 @@ it:
membership_email: Email account
file: File
preview: Anteprima
options: Opzioni
options: Opzioni avanzate
custom_fields: Campi personalizzati
other_fields: Altre informazioni
presentation: Presentazione

View File

@ -1,28 +1,25 @@
BOARD:
x bugs:
x #50
x #51
~ editable_elements: inheritable: false (Mattias) => seems to be fixed by Dirk's last pull request (#44) => content tag
- bushido version
- upgrade warning if new version of locomotive (maybe based on the commit id)
- duostack version
x 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)
- seo section for the page form: seo title, seo keywords, seo description
- icon for redirection page in the pages section (back-office)
- write my first tutorial about locomotive
- default template
BACKLOG:
- custom_fields:
- validation: regexp (pre-defined regexps ?)
- new type: belongs_to => association
x new type: belongs_to => association
- inline editing (http://www.aloha-editor.com/wiki/index.php/Aloha_PHP_Example)
- html view in the aloha popup
- editable elements should wrap a tag: div, h1, ...etc (default span)
- edit images (upload new ones, ...etc) => wait for aloha or send them an email ?
- global regions: keyword in editable element (http://www.mongodb.org/display/DOCS/Updating)
- cucumber features for admin pages (in progress)
(- duostack/doutcloud version)
- icon for redirection page in the pages section (back-office)
- write my first tutorial about locomotive
- upgrade warning if new version of locomotive (maybe based on the commit id)
REFACTORING:
@ -212,3 +209,6 @@ x pull request #44
x bug on dates (https://github.com/locomotivecms/engine/issues#issue/48)
x generated sitemaps are invalid (url + date)
x integrate new locomotivecms home
x seo section for the page form: seo title, seo keywords, seo description
x bugs: #50, #51
x 2 different sites on the same main domain (one in www, the other one in something else) (Raphael Costa)

View File

@ -0,0 +1,10 @@
Feature: Manage Contents
In order to manage instances from custom content types
As an administrator
I want to add/edit/delete custom contents of my site
Background:
Given I have the site: "test site" set up
And I am an authenticated user

View File

@ -8,7 +8,6 @@ require 'locomotive/logger'
require 'locomotive/liquid'
require 'locomotive/mongoid'
require 'locomotive/carrierwave'
require 'locomotive/hosting'
require 'locomotive/custom_fields'
require 'locomotive/httparty'
require 'locomotive/inherited_resources'
@ -20,6 +19,7 @@ require 'locomotive/import'
require 'locomotive/delayed_job'
require 'locomotive/middlewares'
require 'locomotive/session_store'
require 'locomotive/hosting'
module Locomotive
@ -39,6 +39,14 @@ module Locomotive
self.const_defined?('Engine')
end
def self.default_site_template_present?
File.exists?(self.default_site_template_path)
end
def self.default_site_template_path
File.join(Rails.root, 'tmp/default_site_template.zip')
end
def self.configure
self.config ||= Configuration.new
@ -58,7 +66,7 @@ module Locomotive
# Devise
mail_address = self.config.mailer_sender
Devise.mailer_sender = mail_address =~ /.+@.+/ ? mail_address : "#{mail_address}@#{Locomotive.config.domain}"
::Devise.mailer_sender = mail_address =~ /.+@.+/ ? mail_address : "#{mail_address}@#{Locomotive.config.domain}"
# cookies stored in mongodb (mongoid_store)
Rails.application.config.session_store :mongoid_store, {
@ -96,7 +104,7 @@ module Locomotive
if self.config.multi_sites?
self.config.manage_subdomain = self.config.manage_domains = true
else
# Note: (Did) modify the code below if Locomotive handles a new hosting solution
# Note: (Did) modify the code below if Locomotive handles a new hosting solution (not a perfect solution though)
self.config.manage_domains = self.heroku? || self.bushido?
self.config.manage_subdomain = self.bushido?
end

View File

@ -1,3 +1,8 @@
# Custom options for CustomFields
CustomFields.options = {
:reserved_aliases => Mongoid.destructive_fields + %w(created_at updated_at)
}
# Set correct paths
module CustomFields
module Types
@ -17,4 +22,3 @@ module CustomFields
end
end

View File

@ -1,6 +1,9 @@
require 'bushido'
require 'locomotive/hosting/bushido/custom_domain'
require 'locomotive/hosting/bushido/first_installation'
require 'locomotive/hosting/bushido/account_ext'
require 'locomotive/hosting/bushido/middleware'
require 'locomotive/hosting/bushido/devise'
module Locomotive
module Hosting
@ -22,22 +25,35 @@ module Locomotive
(self.config.hosting == :auto && ENV['APP_TLD'] == 'bushi.do')
end
def bushido_app_claimed?
ENV['BUSHIDO_CLAIMED'].present? && ENV['BUSHIDO_CLAIMED'].to_s.downcase == 'true'
end
def enable_bushido
self.config.domain = ENV['APP_TLD'] unless self.config.multi_sites?
self.enhance_site_model_with_bushido
self.enhance_models_with_bushido
self.disable_authentication_for_not_claimed_app
self.setup_smtp_settings
self.config.delayed_job = true # force the use of delayed_job
self.add_middleware
self.config.delayed_job = true # force to use delayed_job
self.bushido_domains = ::Bushido::App.domains
self.bushido_subdomain = ::Bushido::App.subdomain
end
def enhance_site_model_with_bushido
def enhance_models_with_bushido
Site.send :include, Locomotive::Hosting::Bushido::CustomDomain
Site.send :include, Locomotive::Hosting::Bushido::FirstInstallation
Account.send :include, Locomotive::Hosting::Bushido::AccountExt
end
def disable_authentication_for_not_claimed_app
Admin::BaseController.send :include, Locomotive::Hosting::Bushido::Devise
end
def setup_smtp_settings
@ -53,6 +69,12 @@ module Locomotive
}
end
def add_middleware
::Locomotive::Application.configure do |config|
config.middleware.use '::Locomotive::Hosting::Bushido::Middleware'
end
end
# manage domains
def add_bushido_domain(name)

View File

@ -0,0 +1,19 @@
module Locomotive
module Hosting
module Bushido
module AccountExt
extend ActiveSupport::Concern
included do
field :bushido_user_id, :type => Integer
end
end
end
end
end

View File

@ -0,0 +1,28 @@
module Locomotive
module Hosting
module Bushido
module Devise
extend ActiveSupport::Concern
included do
alias_method_chain :require_admin, :bushido
end
module InstanceMethods
def require_admin_with_bushido
if ::Locomotive.bushido_app_claimed?
require_admin_without_bushido
else
# open back-office for everybody as long as the application is not claimed
sign_in(Account.order_by(:created_at).first)
end
end
end
end
end
end
end

View File

@ -0,0 +1,48 @@
require 'rack/utils'
module Locomotive
module Hosting
module Bushido
class Middleware
# BUSHIDO_JS_URL = 'http://localhost:4567/javascripts/bushido.js'
BUSHIDO_JS_URL = 'http://bushi.do/api/bushido.js'
include Rack::Utils
def initialize(app, opts = {})
@app = app
@bushido_app_name = ENV['BUSHIDO_APP']
@bushido_claimed = ::Locomotive.bushido_app_claimed?
end
def call(env)
status, headers, response = @app.call(env)
content = ""
response.each { |part| content += part }
# "claiming" bar + stats ?
content.gsub!(/<\/body>/i, <<-STR
<script type="text/javascript">
var _bushido_app = '#{@bushido_app_name}';
var _bushido_claimed = #{@bushido_claimed.to_s};
(function() {
var bushido = document.createElement('script'); bushido.type = 'text/javascript'; bushido.async = true;
bushido.src = '#{BUSHIDO_JS_URL}';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(bushido, s);
})();
</script>
</body>
STR
)
headers['content-length'] = bytesize(content).to_s
[status, headers, [content]]
end
end
end
end
end

View File

@ -7,3 +7,9 @@ require 'locomotive/import/asset_collections'
require 'locomotive/import/content_types'
require 'locomotive/import/snippets'
require 'locomotive/import/pages'
module Locomotive
module Import
DEFAULT_SITE_TEMPLATE = 'https://github.com/locomotivecms/default-site-template/zipball/master'
end
end

View File

@ -79,7 +79,7 @@ module Locomotive
value = (case field.kind.downcase
when 'file' then self.open_sample_asset(value)
when 'boolean' then Boolean.set(value)
when 'date' then Date.parse(value)
when 'date' then value.is_a?(Date) ? value : Date.parse(value)
when 'category'
if field.category_items.detect { |item| item.name == value }.nil?
field.category_items.build :name => value

View File

@ -70,6 +70,7 @@ module Locomotive
job = self.new(zipfile, site, options)
if Locomotive.config.delayed_job
puts "delayed::JOB !"
Delayed::Job.enqueue job, { :site => site, :job_type => 'import' }
else
job.perform

View File

@ -10,7 +10,11 @@ module Locomotive
def call(env)
if env["PATH_INFO"] =~ @path_regexp
if Locomotive.config.multi_sites?
site = fetch_site(env['SERVER_NAME'])
else
site = Site.first
end
if site.nil?
@app.call(env)

View File

@ -1,14 +1,86 @@
require 'bushido'
require 'jammit'
require 'net/http'
namespace :bushido do
desc "Prepare an app to run on the Bushido hosting platform, only called during the initial installation. Called just before booting the app."
task :install do
task :install => :environment do
# re-built assets
Jammit.package!
if ENV['BUSHIDO_USER_EMAIL'] && ENV['BUSHIDO_USER_ID']
# already logged in in Bushido
account = Account.create!({
:email => ENV['BUSHIDO_USER_EMAIL'],
:name => ENV['BUSHIDO_USER_NAME'] || ENV['BUSHIDO_USER_EMAIL'].split('@').first,
:bushido_user_id => ENV['BUSHIDO_USER_ID'],
:password => ActiveSupport::SecureRandom.base64(6)
})
else
# create an anonymous account right away
account = Account.create!({
:email => "#{ENV['BUSHIDO_APP']}@#{ENV['BUSHIDO_HOST']}",
:name => ENV['BUSHIDO_APP'],
:password => ActiveSupport::SecureRandom.base64(6)
})
end
# create the site
site = Site.create_first_one(:name => ENV['LOCOMOTIVE_SITE_NAME'] || ENV['BUSHIDO_APP'])
# fetch the site template
template_url = ENV['SITE_TEMPLATE_URL'] || Locomotive::Import::DEFAULT_SITE_TEMPLATE
template_url = "http://#{template_url}" unless template_url =~ /^https?:\/\//
template_local_path = "#{Rails.root}/permanent/site_template.zip"
uri = URI.parse(template_url)
http = Net::HTTP.new(uri.host, uri.port)
if template_url.starts_with?('https') # ssl request ?
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
case http.request(Net::HTTP::Get.new(uri.request_uri))
when Net::HTTPSuccess, Net::HTTPFound
`curl -L -s -o #{template_local_path} #{template_url}`
tmp, Locomotive.config.delayed_job = Locomotive.config.delayed_job, false # disable DJ during this import
Locomotive::Import::Job.run!(File.open(template_local_path), site, { :samples => true })
Locomotive.config.delayed_job = tmp # restore DJ flag
else
# do nothing
end
end
desc "Perform custom actions triggered by the Bushido hosting platform."
task :event => :environment do
event = ::Bushido::Event.last
puts "processing...#{event.inspect}"
case event.category.to_s
when 'app'
case event.name.to_s
when 'claimed'
# an user has just claimed his application
account = Account.order_by(:created_at).first
account.email = event.data['bushido_user_email']
account.bushido_user_id = event.data['bushido_user_id']
account.save!
end
end
end
desc "Prepare an app to run on the Bushido hosting platform, called on every update. Called just before booting the app."
task :update do
# re-built assets
Jammit.package!
end
end

12
lib/tasks/locomotive.rake Normal file
View File

@ -0,0 +1,12 @@
namespace :locomotive do
desc 'Fetch the Locomotive default site template for the installation'
task :fetch_default_site_template => :environment do
puts "Downloading default site template from '#{Locomotive::Import.DEFAULT_SITE_TEMPLATE}'"
`curl -L -s -o #{Rails.root}/tmp/default_site_template.zip #{Locomotive::Import.DEFAULT_SITE_TEMPLATE}`
puts '...done'
end
end

View File

@ -37,7 +37,7 @@ Gem::Specification.new do |s|
s.add_dependency "rmagick", "2.12.2"
s.add_dependency "locomotive_carrierwave", "0.5.0.1.beta3"
s.add_dependency "custom_fields", "1.0.0.beta.12"
s.add_dependency "custom_fields", "1.0.0.beta.13"
s.add_dependency "fog", "0.3.7"
s.add_dependency "mimetype-fu"
s.add_dependency "actionmailer-with-request"

View File

@ -0,0 +1,48 @@
body {
font-family: sans-serif;
}
body {
background-color: #ccc;
}
#bodyContent {
font-size:0.9em;
}
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
padding-bottom:0.1em;
padding-top:0.5em;
}
h1 {
border-bottom:1px solid #AAAAAA;
}
h1 { font-size: 188%; }
h2 { font-size: 150%; }
h3 { font-size: 132%; }
h4 { font-size: 116%; }
h5 { font-size: 100%; }
h6 { font-size: 80%; }
#main {
width: 650px;
margin-top: 40px;
margin-left: auto ;
margin-right: auto ;
padding: 70px;
background-color: white;
border-radius: 1px;
-moz-border-radius: 1px;
box-shadow: 5px 5px rgba(0,0,0,0.3);
-webkit-box-shadow: 5px 5px rgba(0,0,0,0.3);
-moz-box-shadow: 5px 5px rgba(0,0,0,0.3);
}
abbr, acronym
{
border-bottom: .1em dotted;
cursor: help;
}

View File

@ -0,0 +1,69 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Aloha, Abbreviations !</title>
<script>GENTICS_Aloha_base="../../../";</script>
<script type="text/javascript" src="../../../core/include.js"></script>
<script type="text/javascript" src="../../../plugins/com.gentics.aloha.plugins.Format/plugin.js"></script>
<script type="text/javascript" src="../plugin.js"></script>
<link rel="stylesheet" href="AlohaAbbr.css" />
<!-- turn an element into editable Aloha continuous text -->
<script type="text/javascript">
GENTICS.Aloha.settings = {
logLevels: {'error': true, 'warn': true, 'info': true, 'debug': false},
errorhandling : false,
ribbon: false,
"i18n": {
// let the system detect the users language
//"acceptLanguage": '<?=$_SERVER['HTTP_ACCEPT_LANGUAGE']?>'
"acceptLanguage": 'de-de,de;q=0.8,it;q=0.6,en-us;q=0.7,en;q=0.2'
},
"plugins": {
"com.gentics.aloha.plugins.Abbr": {
'config': ['abbr']
}
}
};
$(document).ready(function() {
$('#content').aloha();
});
</script>
</head>
<body>
<div id="main">
<div id="bodyContent">
<div id="content" class="article">
<h1>Aloha</h1>
<h2>Etymology</h2>
<p>The word aloha derives from the Proto-Polynesian root <i>*qalofa</i>. It has cognates in other Polynesian languages, such as Samoan alofa
and Māori aroha, also meaning "love."</p>
<p><abbr title="Aloha Editor">AE</abbr> is the word's most advanced browser based <abbr title="Rich Text Editor">RTE</abbr> made with aloha passion.</p>
<p>A folk etymology claims that it derives from a compound of the Hawaiian words alo meaning "presence", "front", "face", or "share"; and
ha, meaning "breath of life" or "essence of life." Although alo does indeed mean "presence" etc., the word for breath is spelled with a macron
or kahakō over the a (hā) whereas the word aloha does not have a long a.</p>
<h2>Usage</h2>
<p>Before contact with the West, the words used for greeting were welina and anoai. Today, "aloha kakahiaka" is the phrase for "good
morning." "Aloha ʻauinalā" means "good afternoon" and "aloha ahiahi" means "good evening." "Aloha kākou" is a common form of "welcome to all."</p>
<p>In modern Hawaiʻi, numerous businesses have aloha in their names, with more than 3 pages of listings in the Oʻahu phone book alone.</p>
<h2>Trends</h2>
<p>Recent trends are popularizing the term elsewhere in the United States. Popular entertainer, Broadway star and Hollywood actress Bette
Midler, born in Honolulu, uses the greeting frequently in national appearances. The word was also used frequently in the hit television drama
Hawaii Five-O. In the influential 1982 film comedy Fast Times at Ridgemont High, the eccentric teacher Mr. Hand makes use of the greeting. The
Aloha Spirit is a major concept in Lilo and Stitch, a very popular Disney series of movies and TV shows, set in Hawaiʻi. The drama series Lost,
shot in Hawaiʻi, has a thank you note at the end of the credits saying "We thank the people of Hawaiʻi and their Aloha Spirit". Aloha is a term
also used in the Nickelodeon program Rocket Power.</p>
<ul>
<li>Arguably the most famous historical Hawaiian song, "Aloha ʻOe" was written by the last queen of Hawaii, Liliʻuokalani.</li>
<li>The term inspired the name of the ALOHA Protocol introduced in the 1970s by the University of Hawaii.</li>
<li>In Hawaii someone can be said to have or show aloha in the way they treat others; whether family, friend, neighbor or stranger.</li>
</ul>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,4 @@
floatingmenu.tab.abbr=Abkürzung
button.addabbr.tooltip=Abkürzung einfügen
button.abbr.tooltip=Als Abkürzung formatieren
newabbr.defaulttext=Abb

View File

@ -0,0 +1,4 @@
floatingmenu.tab.abbr=Abbreviation
button.addabbr.tooltip=insert abbreviation
button.abbr.tooltip=format as abbreviation
newabbr.defaulttext=Abbr

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
GENTICS.Aloha.Abbr=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Abbr");GENTICS.Aloha.Abbr.languages=["en","de"];GENTICS.Aloha.Abbr.config=["abbr"];GENTICS.Aloha.Abbr.init=function(){this.createButtons();this.subscribeEvents();this.bindInteractions()};GENTICS.Aloha.Abbr.createButtons=function(){var that=this;this.formatAbbrButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_abbr",size:"small",onclick:function(){that.formatAbbr()},tooltip:this.i18n("button.abbr.tooltip"),toggle:true});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.formatAbbrButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.format"),1);this.insertAbbrButton=new GENTICS.Aloha.ui.Button({iconClass:"GENTICS_button GENTICS_button_abbr",size:"small",onclick:function(){that.insertAbbr(false)},tooltip:this.i18n("button.addabbr.tooltip"),toggle:false});GENTICS.Aloha.FloatingMenu.addButton("GENTICS.Aloha.continuoustext",this.insertAbbrButton,GENTICS.Aloha.i18n(GENTICS.Aloha,"floatingmenu.tab.insert"),1);GENTICS.Aloha.FloatingMenu.createScope(this.getUID("abbr"),"GENTICS.Aloha.continuoustext");this.abbrField=new GENTICS.Aloha.ui.AttributeField({width:320});GENTICS.Aloha.FloatingMenu.addButton(this.getUID("abbr"),this.abbrField,this.i18n("floatingmenu.tab.abbr"),1)};GENTICS.Aloha.Abbr.bindInteractions=function(){var that=this;this.abbrField.addListener("blur",function(obj,event){if(this.getValue()==""){that.removeAbbr()}});for(var i=0;i<GENTICS.Aloha.editables.length;i++){GENTICS.Aloha.editables[i].obj.keydown(function(e){if(e.metaKey&&e.which==71){if(that.findAbbrMarkup()){GENTICS.Aloha.FloatingMenu.userActivatedTab=that.i18n("floatingmenu.tab.abbr");GENTICS.Aloha.FloatingMenu.doLayout();that.abbrField.focus()}else{that.insertAbbr()}return false}})}};GENTICS.Aloha.Abbr.subscribeEvents=function(){var that=this;GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"selectionChanged",function(event,rangeObject){if(GENTICS.Aloha.activeEditable){var config=that.getEditableConfig(GENTICS.Aloha.activeEditable.obj);if(jQuery.inArray("abbr",config)!=-1){that.formatAbbrButton.show();that.insertAbbrButton.show()}else{that.formatAbbrButton.hide();that.insertAbbrButton.hide();return}var foundMarkup=that.findAbbrMarkup(rangeObject);if(foundMarkup){that.insertAbbrButton.hide();that.formatAbbrButton.setPressed(true);GENTICS.Aloha.FloatingMenu.setScope(that.getUID("abbr"));that.abbrField.setTargetObject(foundMarkup,"title")}else{that.formatAbbrButton.setPressed(false);that.abbrField.setTargetObject(null)}GENTICS.Aloha.FloatingMenu.doLayout()}})};GENTICS.Aloha.Abbr.findAbbrMarkup=function(range){if(typeof range=="undefined"){var range=GENTICS.Aloha.Selection.getRangeObject()}if(GENTICS.Aloha.activeEditable){return range.findMarkup(function(){return this.nodeName.toLowerCase()=="abbr"},GENTICS.Aloha.activeEditable.obj)}else{return null}};GENTICS.Aloha.Abbr.formatAbbr=function(){var range=GENTICS.Aloha.Selection.getRangeObject();if(GENTICS.Aloha.activeEditable){if(this.findAbbrMarkup(range)){this.removeAbbr()}else{this.insertAbbr()}}};GENTICS.Aloha.Abbr.insertAbbr=function(extendToWord){if(this.findAbbrMarkup(range)){return}GENTICS.Aloha.FloatingMenu.userActivatedTab=this.i18n("floatingmenu.tab.abbr");var range=GENTICS.Aloha.Selection.getRangeObject();if(range.isCollapsed()&&extendToWord!=false){GENTICS.Utils.Dom.extendToWord(range)}if(range.isCollapsed()){var abbrText=this.i18n("newabbr.defaulttext");var newAbbr=jQuery('<abbr title="">'+abbrText+"</abbr>");GENTICS.Utils.Dom.insertIntoDOM(newAbbr,range,jQuery(GENTICS.Aloha.activeEditable.obj));range.startContainer=range.endContainer=newAbbr.contents().get(0);range.startOffset=0;range.endOffset=abbrText.length}else{var newAbbr=jQuery('<abbr title=""></abbr>');GENTICS.Utils.Dom.addMarkup(range,newAbbr,false)}range.select();this.abbrField.focus()};GENTICS.Aloha.Abbr.removeAbbr=function(){var range=GENTICS.Aloha.Selection.getRangeObject();var foundMarkup=this.findAbbrMarkup();if(foundMarkup){GENTICS.Utils.Dom.removeFromDOM(foundMarkup,range,true);GENTICS.Aloha.activeEditable.obj[0].focus();range.select()}};GENTICS.Aloha.Abbr.makeClean=function(obj){};

View File

@ -0,0 +1,30 @@
button.b.tooltip=Fett
button.i.tooltip=Kursiv
button.u.tooltip=Unterstrichen
button.cite.tooltip=Zitat
button.q.tooltip=
button.code.tooltip=Code
button.abbr.tooltip=Abkürzung
button.del.tooltip=Durchgestrichen
button.sub.tooltip=Tiefgestellt
button.sup.tooltip=Hochgestellt
button.p.tooltip=Absatz
button.h1.tooltip=Überschrift 1
button.h2.tooltip=Überschrift 2
button.h3.tooltip=Überschrift 3
button.h4.tooltip=Überschrift 4
button.h5.tooltip=Überschrift 5
button.h6.tooltip=Überschrift 6
button.pre.tooltip=Vorformatierter text
button.title.tooltip=Titel
button.removeFormat.tooltip=Formatierung entfernen
button.removeFormat.text=Formatierung entfernen
GENTICS_button_p=GENTICS_button_p_de
GENTICS_button_h1=GENTICS_button_h1_de
GENTICS_button_h2=GENTICS_button_h2_de
GENTICS_button_h3=GENTICS_button_h3_de
GENTICS_button_h4=GENTICS_button_h4_de
GENTICS_button_h5=GENTICS_button_h5_de
GENTICS_button_h6=GENTICS_button_h6_de
GENTICS_button_pre=GENTICS_button_pre_de
GENTICS_button_title=GENTICS_button_title_de

View File

@ -0,0 +1,30 @@
button.b.tooltip=Bold
button.i.tooltip=Italic
button.u.tooltip=Underline
button.cite.tooltip=Cite
button.q.tooltip=
button.code.tooltip=Code
button.abbr.tooltip=Abbreviation
button.del.tooltip=Strikethrough
button.sub.tooltip=Subscript
button.sup.tooltip=Superscript
button.p.tooltip=Paragraph
button.h1.tooltip=Heading 1
button.h2.tooltip=Heading 2
button.h3.tooltip=Heading 3
button.h4.tooltip=Heading 4
button.h5.tooltip=Heading 5
button.h6.tooltip=Heading 6
button.pre.tooltip=Pre formated text
button.title.tooltip=Title
button.removeFormat.tooltip=Remove formatting
button.removeFormat.text=Remove formatting
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,29 @@
button.i.tooltip=Oblikvigi
button.u.tooltip=Substreki
button.cite.tooltip=Citi
button.q.tooltip=
button.code.tooltip=Kodo
button.abbr.tooltip=Mallongigo
button.del.tooltip=Marki forviþita
button.sub.tooltip=Superskripto
button.sup.tooltip=Subskripto
button.p.tooltip=Alineo
button.h1.tooltip=Titolo 1
button.h2.tooltip=Subtitolo 2
button.h3.tooltip=Subtitolo 3
button.h4.tooltip=Subtitolo 4
button.h5.tooltip=Subtitolo 5
button.h6.tooltip=Subtitolo 6
button.pre.tooltip=Antaýformatigita teksto
button.title.tooltip=Titolo
button.removeFormat.tooltip=Forviþi la formatigon
button.removeFormat.text=Forviþi la formatigon
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,30 @@
button.b.tooltip=Lihavointi
button.i.tooltip=Kursiivi
button.u.tooltip=Alleviivaus
button.cite.tooltip=Lainaus
button.q.tooltip=
button.code.tooltip=Koodi
button.abbr.tooltip=Lyhennelmä
button.del.tooltip=Yliviivaus
button.sub.tooltip=Alaindeksi
button.sup.tooltip=Yläindeksi
button.p.tooltip=Tekstikappale
button.h1.tooltip=Otsikko 1
button.h2.tooltip=Otsikko 2
button.h3.tooltip=Otsikko 3
button.h4.tooltip=Otsikko 4
button.h5.tooltip=Otsikko 5
button.h6.tooltip=Otsikko 6
button.pre.tooltip=Muotoiltu teksti
button.title.tooltip=Otsikko
button.removeFormat.tooltip=Poista muotoilut
button.removeFormat.text=Poista muotoilut
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,30 @@
button.b.tooltip=Gras
button.i.tooltip=Italique
button.u.tooltip=Souligner
button.cite.tooltip=Cité
button.q.tooltip=Quote
button.code.tooltip=Code
button.abbr.tooltip=Abréviation
button.del.tooltip=Barré
button.sub.tooltip=Indice
button.sup.tooltip=Exposant
button.p.tooltip=Paragraphe
button.h1.tooltip=Titre1
button.h2.tooltip=Rubrique2
button.h3.tooltip=Rubrique3
button.h4.tooltip=Rubrique4
button.h5.tooltip=Rubrique5
button.h6.tooltip=Rubrique6
button.pre.tooltip=texte préformaté
button.title.tooltip=Titre
button.removeFormat.tooltip=Supprimer le formatage
button.removeFormat.text=Supprimer le formatage
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,30 @@
button.b.tooltip=Grassetto
button.i.tooltip=Corsivo
button.u.tooltip=Sottolineato
button.cite.tooltip=Citazione
button.q.tooltip=
button.code.tooltip=Codice
button.abbr.tooltip=Abbreviazione
button.del.tooltip=Barrato
button.sub.tooltip=Pedice
button.sup.tooltip=Apice
button.p.tooltip=Paragrafo
button.h1.tooltip=Titolo 1
button.h2.tooltip=Titolo 2
button.h3.tooltip=Titolo 3
button.h4.tooltip=Titolo 4
button.h5.tooltip=Titolo 5
button.h6.tooltip=Titolo 6
button.pre.tooltip=Testo pre formattato
button.title.tooltip=Titolo
button.removeFormat.tooltip=Rimuovi formattazione
button.removeFormat.text=Rimuovi formattazione
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,30 @@
button.b.tooltip=Pogrubienie
button.i.tooltip=Kursywa
button.u.tooltip=Podkreślenie
button.cite.tooltip=Cytat
button.q.tooltip=
button.code.tooltip=Kod
button.abbr.tooltip=Skrót
button.del.tooltip=Przekreślenie
button.sub.tooltip=Indeks dolny
button.sup.tooltip=Indeks górny
button.p.tooltip=Paragraf
button.h1.tooltip=Nagłówek 1
button.h2.tooltip=Nagłówek 2
button.h3.tooltip=Nagłówek 3
button.h4.tooltip=Nagłówek 4
button.h5.tooltip=Nagłówek 5
button.h6.tooltip=Nagłówek 6
button.pre.tooltip=Tekst preformatowany
button.title.tooltip=Tytuł
button.removeFormat.tooltip=Usuń formatowanie
button.removeFormat.text=Usuń formatowanie
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

View File

@ -0,0 +1,30 @@
button.b.tooltip=Полужирный
button.i.tooltip=Курсив
button.u.tooltip=Подчеркивание
button.cite.tooltip=Цитировать
button.q.tooltip=Цитата
button.code.tooltip=Код
button.abbr.tooltip=Аббривиатура
button.del.tooltip=Перечеркивание
button.sub.tooltip=Нижний индекс
button.sup.tooltip=Верхний индекс
button.p.tooltip=Параграф
button.h1.tooltip=Заголовок 1
button.h2.tooltip=Заголовок 2
button.h3.tooltip=Заголовок 3
button.h4.tooltip=Заголовок 4
button.h5.tooltip=Заголовок 5
button.h6.tooltip=Заголовок 6
button.pre.tooltip=Отформатированный текс
button.title.tooltip=Название
button.removeFormat.tooltip=Убрать форматирование
button.removeFormat.text=Убрать форматирование
GENTICS_button_p=GENTICS_button_p
GENTICS_button_h1=GENTICS_button_h1
GENTICS_button_h2=GENTICS_button_h2
GENTICS_button_h3=GENTICS_button_h3
GENTICS_button_h4=GENTICS_button_h4
GENTICS_button_h5=GENTICS_button_h5
GENTICS_button_h6=GENTICS_button_h6
GENTICS_button_pre=GENTICS_button_pre
GENTICS_button_title=GENTICS_button_title

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
/*!
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
.GENTICS_editable_highlight {
outline: #FFE767 solid 5px !important;
}
.GENTICS_editable_active, .GENTICS_editable_active[contenteditable=true]:focus {
outline: #B7D6FA solid 5px !important;
}

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
GENTICS.Aloha.HighlightEditables=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.highlighteditables");GENTICS.Aloha.HighlightEditables.init=function(){var that=this;GENTICS.Utils.Position.addMouseMoveCallback(function(){for(var i=0;i<GENTICS.Aloha.editables.length;i++){var editable=GENTICS.Aloha.editables[i];if(!GENTICS.Aloha.activeEditable&&!editable.isDisabled()){editable.obj.addClass("GENTICS_editable_highlight")}}});GENTICS.Utils.Position.addMouseStopCallback(function(){that.fade()});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableActivated",function(jEvent,aEvent){aEvent.editable.obj.addClass("GENTICS_editable_active");that.fade()});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableDeactivated",function(jEvent,aEvent){aEvent.editable.obj.removeClass("GENTICS_editable_active")})};GENTICS.Aloha.HighlightEditables.fade=function(){for(var i=0;i<GENTICS.Aloha.editables.length;i++){var editable=GENTICS.Aloha.editables[i].obj;if(editable.hasClass("GENTICS_editable_highlight")){editable.removeClass("GENTICS_editable_highlight").css("outline","5px solid #FFE767").animate({outlineWidth:"0px"},300,"swing",function(){jQuery(this).css("outline","")})}}};

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
if(!GENTICS.Aloha.Repositories){GENTICS.Aloha.Repositories={}}GENTICS.Aloha.Repositories.LinkList=new GENTICS.Aloha.Repository("com.gentics.aloha.repositories.LinkList");GENTICS.Aloha.Repositories.LinkList.settings.data=[{name:"Aloha Editor - The HTML5 Editor",url:"http://aloha-editor.com",type:"website"},{name:"Aloha Logo",url:"http://www.aloha-editor.com/images/aloha-editor-logo.png",type:"image"}];GENTICS.Aloha.Repositories.LinkList.folder=[];GENTICS.Aloha.Repositories.LinkList.init=function(){for(var i=0;i<this.settings.data.length;i++){var e=this.settings.data[i];e.repositoryId=this.repositoryId;e.id=e.id?e.id:e.url;var u=e.uri=this.parseUri(e.url);var path=this.addFolder("",u.host);var pathparts=u.path.split("/");for(j=0;j<pathparts.length;j++){if(pathparts[j]&&pathparts[j].lastIndexOf(".")<0){path=this.addFolder(path,pathparts[j])}}e.parentId=path;this.settings.data[i]=new GENTICS.Aloha.Repository.Document(e)}this.repositoryName="Linklist"};GENTICS.Aloha.Repositories.LinkList.addFolder=function(path,name){var type=path?"folder":"hostname";var p=path?path+"/"+name:name;if(name&&!this.folder[p]){this.folder[p]=new GENTICS.Aloha.Repository.Folder({id:p,name:(name)?name:p,parentId:path,type:"host",repositoryId:this.repositoryId})}return p};GENTICS.Aloha.Repositories.LinkList.query=function(p,callback){var d=this.settings.data.filter(function(e,i,a){var r=new RegExp(p.queryString,"i");var ret=false;return((!p.queryString||e.name.match(r)||e.url.match(r))&&(!p.objectTypeFilter||jQuery.inArray(e.type,p.objectTypeFilter)>-1)&&(!p.inFolderId||p.inFolderId==e.parentId))});callback.call(this,d)};GENTICS.Aloha.Repositories.LinkList.getChildren=function(p,callback){var d=[];for(e in this.folder){var l=this.folder[e].parentId;if(typeof this.folder[e]!="function"&&(this.folder[e].parentId==p.inFolderId||(!this.folder[e].parentId&&p.inFolderId==this.repositoryId))){d.push(this.folder[e])}}callback.call(this,d)};GENTICS.Aloha.Repositories.LinkList.parseUri=function(str){var o={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},m=o.parser[o.strictMode?"strict":"loose"].exec(str),uri={},i=14;while(i--){uri[o.key[i]]=m[i]||""}uri[o.q.name]={};uri[o.key[12]].replace(o.q.parser,function($0,$1,$2){if($1){uri[o.q.name][$1]=$2}});return uri};

View File

@ -0,0 +1,15 @@
/*!
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
.GENTICS_link_pointer {
cursor: pointer;
}
.GENTICS_link_text {
cursor: text;
}

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
if(!GENTICS.Aloha.Repositories){GENTICS.Aloha.Repositories={}}GENTICS.Aloha.Repositories.delicious=new GENTICS.Aloha.Repository("com.gentics.aloha.repositories.delicious");GENTICS.Aloha.Repositories.delicious.settings.username="draftkraft";GENTICS.Aloha.Repositories.delicious.settings.weight=0.35;GENTICS.Aloha.Repositories.delicious.init=function(){var that=this;if(this.settings.weight+0.15>1){this.settings.weight=1-0.15}this.deliciousURL="http://feeds.delicious.com/v2/json/";if(this.settings.username){this.deliciousURL+=this.settings.username+"/";this.repositoryName="deliciuos/"+this.settings.username;this.tags=[];jQuery.ajax({type:"GET",dataType:"jsonp",url:"http://feeds.delicious.com/v2/json/tags/"+that.settings.username,success:function(data){for(var tag in data){that.tags.push(tag)}}})}else{this.repositoryName="deliciuos/"+popular;this.deliciousURL+="tag/"}};GENTICS.Aloha.Repositories.delicious.query=function(p,callback){var that=this;if(p.objectTypeFilter&&jQuery.inArray("website",p.objectTypeFilter)==-1){callback.call(this,[])}else{var tags=[];if(this.settings.username){var queryTags=p.queryString?p.queryString.split(" "):[];for(var i=0;i<queryTags.length;i++){var queryTag=queryTags[i].trim();if(jQuery.inArray(queryTag,that.tags)==-1){var newtags=that.tags.filter(function(e,i,a){var r=new RegExp(queryTag,"i");return(e.match(r))});if(newtags.length>0){tags.push(newtags[0])}}else{tags.push(queryTag)}}}else{tags=p.queryString.split(" ")}var folderTags=p.inFolderId?p.inFolderId.split("+"):[];jQuery.extend(tags,folderTags);if(p.queryString&&tags.length==0){callback.call(that,[]);return}jQuery.ajax({type:"GET",dataType:"jsonp",url:that.deliciousURL+tags.join("+"),success:function(data){var items=[];for(var i=0;i<data.length;i++){if(typeof data[i]!="function"){items.push(new GENTICS.Aloha.Repository.Document({id:data[i].u,name:data[i].d,repositoryId:that.repositoryId,type:"website",url:data[i].u,weight:that.settings.weight+(15-1)/100}))}}callback.call(that,items)}})}};GENTICS.Aloha.Repositories.delicious.getChildren=function(p,callback){var that=this;if(this.settings.username){var items=[];if(p.inFolderId==this.repositoryId){for(var i=0;i<this.tags.length;i++){if(typeof this.tags[i]!="function"){items.push(new GENTICS.Aloha.Repository.Folder({id:this.tags[i],name:this.tags[i],repositoryId:this.repositoryId,type:"tag",url:"http://feeds.delicious.com/v2/rss/tags/"+that.settings.username+"/"+this.tags[i]}))}}callback.call(this,items)}else{jQuery.ajax({type:"GET",dataType:"jsonp",url:"http://feeds.delicious.com/v2/json/tags/"+that.settings.username+"/"+p.inFolderId,success:function(data){var items=[];for(var tag in data){var id=(p.inFolderId)?p.inFolderId+"+"+tag:tag;if(typeof data[tag]!="function"){items.push(new GENTICS.Aloha.Repository.Folder({id:id,name:tag,repositoryId:that.repositoryId,type:"tag",url:"http://feeds.delicious.com/v2/rss/tags/"+that.settings.username+"/"+id,hasMoreItems:true}))}}callback.call(that,items)}})}}else{callback.call(this,[])}};

View File

@ -0,0 +1,4 @@
button.addlink.tooltip=Verweis einfügen
button.removelink.tooltip=Verweis entfernen
newlink.defaulttext=Neuer Verweis
floatingmenu.tab.link=Verweis

View File

@ -0,0 +1,4 @@
button.addlink.tooltip=Insert Link
button.removelink.tooltip=Remove Link
newlink.defaulttext=New Link
floatingmenu.tab.link=Link

View File

@ -0,0 +1,4 @@
button.addlink.tooltip=Insérer un lien
button.removelink.tooltip=Supprimer le lien
newlink.defaulttext=Nouveau lien
floatingmenu.tab.link=Lien

View File

@ -0,0 +1,4 @@
button.addlink.tooltip=Dodaj link
button.removelink.tooltip=Usuń link
newlink.defaulttext=Nowy link
floatingmenu.tab.link=Link

View File

@ -0,0 +1,4 @@
button.addlink.tooltip=Вставить ссылку
button.removelink.tooltip=Убрать ссылку
newlink.defaulttext=Новая ссылка
floatingmenu.tab.link=Ссылка

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
/*!
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
.GENTICS_link_error {
color: red !important;
}
.GENTICS_link_warn {
color: red !important;
}

View File

@ -0,0 +1,49 @@
body {
font-family: sans-serif;
}
body {
background-color: #ccc;
}
#bodyContent {
font-size:0.9em;
}
h1, h2, h3, h4, h5, h6 {
font-family: sans-serif;
padding-bottom:0.1em;
padding-top:0.5em;
}
h1 {
border-bottom:1px solid #AAAAAA;
}
h1 { font-size: 188%; }
h2 { font-size: 150%; }
h3 { font-size: 132%; }
h4 { font-size: 116%; }
h5 { font-size: 100%; }
h6 { font-size: 80%; }
#main {
width: 650px;
margin-top: 40px;
margin-left: auto ;
margin-right: auto ;
padding: 70px;
background-color: white;
border-radius: 1px;
-moz-border-radius: 1px;
box-shadow: 5px 5px rgba(0,0,0,0.3);
-webkit-box-shadow: 5px 5px rgba(0,0,0,0.3);
-moz-box-shadow: 5px 5px rgba(0,0,0,0.3);
}
.GENTICS_link_error {
color: red;
}
.GENTICS_link_warn {
color: orange;
}

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Aloha, link checker!</title>
<script>GENTICS_Aloha_base="../../../";</script>
<script type="text/javascript" src="../../../core/include.js"></script>
<script type="text/javascript" src="../../../plugins/com.gentics.aloha.plugins.Link/plugin.js"></script>
<script type="text/javascript" src="../plugin.js"></script>
<link rel="stylesheet" href="AlohaLinkChecker.css" />
<!-- turn an element into editable Aloha continuous text -->
<script type="text/javascript">
GENTICS.Aloha.settings = {
logLevels: {'error': true, 'warn': true, 'info': true, 'debug': false},
errorhandling : false,
ribbon: false,
"i18n": {
// let the system detect the users language
//"acceptLanguage": '<?=$_SERVER['HTTP_ACCEPT_LANGUAGE']?>'
"acceptLanguage": 'de-de,de;q=0.8,it;q=0.6,en-us;q=0.7,en;q=0.2'
},
"plugins": {
"com.gentics.aloha.plugins.LinkChecker": {
'config': ['a'],
// use a proxy when you call it through a webserver
// 'proxyUrl': 'http://localhost:8888/Sites/Aloha-Editor/WebContent/plugins/com.gentics.aloha.plugins.LinkChecker/proxy.php?url='
}
}
};
$(document).ready(function() {
$('#content').aloha();
});
</script>
<style type="text/css">
.GENTICS_link_error {
color: red;
}
.GENTICS_link_warn {
color: red;
}
</style>
</head>
<body>
<div id="main">
<div id="bodyContent">
<div id="content" class="article">
<h1>Aloha</h1>
<h2>Etymology</h2>
<p>The word <a href="http://en.wikipedia.org/wiki/Aloha" target="_blank" class="external">aloha</a> derives from the Proto-Polynesian root <i>*qalofa</i>. It has cognates in other Polynesian languages, such as Samoan alofa
and Māori aroha, also meaning "love."</p>
<p><a href="http://aloha-editor.com/invalid">invalid Aloha Editor</a> is the word's most advanced browser based Editor made with aloha passion.</p>
<p>A folk etymology claims that it derives from a compound of the <a href="http://en.wikipedia.org/wiki/Hawaii" target="_blank" class="external">Hawaiian</a> words alo meaning "presence", "front", "face", or "share"; and
ha, meaning "breath of life" or "essence of life." Although alo does indeed mean "presence" etc., the word for breath is spelled with a macron
or kahakō over the a (hā) whereas the word aloha does not have a long a.</p>
<p>Links are the web's <a title="Aloha Editor rocks." href="http://rocket-power.org/not-working">Rocket Power</a>.</p>
<h2>Usage</h2>
<p>Before contact with the West, the words used for greeting were welina and anoai. Today, "aloha kakahiaka" is the phrase for "good
morning." "Aloha ʻauinalā" means "good afternoon" and "aloha ahiahi" means "good evening." "Aloha kākou" is a common form of "welcome to all."</p>
<p>In modern Hawaiʻi, numerous businesses have aloha in their names, with more than 3 pages of listings in the Oʻahu phone book alone.</p>
<h2>Trends</h2>
<p>Recent trends are popularizing the term elsewhere in the United States. Popular entertainer, Broadway star and Hollywood actress Bette
Midler, born in Honolulu, uses the greeting frequently in national appearances. The word was also used frequently in the hit television drama
Hawaii Five-O. In the influential 1982 film comedy Fast Times at Ridgemont High, the eccentric teacher Mr. Hand makes use of the greeting. The
Aloha Spirit is a major concept in Lilo and Stitch, a very popular Disney series of movies and TV shows, set in Hawaiʻi. The drama series Lost,
shot in Hawaiʻi, has a thank you note at the end of the credits saying "We thank the people of Hawaiʻi and their Aloha Spirit". Aloha is a term
also used in the Nickelodeon program Rocket Power.</p>
<ul>
<li>Arguably the most famous historical Hawaiian song, "Aloha ʻOe" was written by the last queen of Hawaii, Liliʻuokalani.</li>
<li>The term inspired the name of the ALOHA Protocol introduced in the 1970s by the University of Hawaii.</li>
<li>In Hawaii someone can be said to have or show aloha in the way they treat others; whether family, friend, neighbor or stranger.</li>
</ul>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,27 @@
error.0=An Error occurred checking this URL.
error.400=Bad Request. The request cannot be fulfilled due to bad syntax.
error.401=Unauthorized. Authentication has failed or not yet been provided.
error.402=Payment Required.
error.403=Forbidden. The request was a legal request, but the server is refusing to respond to it.
error.404=Not Found. The requested resource could not be found, but may be available in the future.
error.405=Method Not Allowed.
error.406=Not Acceptable. Your browser does not support the content.
error.407=Proxy Authentication Required.
error.408=Request Timeout. The server timed out waiting for the request.
error.409=Conflict in the request.
error.410=This resource is gone.
error.411=Length Required by server. This Link may work in the browsers.
error.412=Precondition Failed. This Link may work in the browsers.
error.413=Request Entity Too Large. The request is larger than the server is willing or able to process.
error.414=Request-URI Too Long. The URI provided was too long for the server to process.
error.415=Unsupported Media Type. The request entity has a media type which the server or resource does not support.
error.416=Requested Range Not Satisfiable. The client has asked for a portion of the file, but the server cannot supply that portion.
error.417=Expectation Failed. The server cannot meet the requirements of your browser.
error.418=I'm a teapot. ;-)
error.500=Internal Server Error. A generic error message, given when no more specific message is suitable.
error.501=Not Implemented. The server either does not recognise the request method, or it lacks the ability to fulfill the request.
error.502=Bad Gateway. The server was acting as a gateway or proxy and received an invalid response from the upstream server.
error.503=Service Unavailable. The server is currently unavailable (because it is overloaded or down for maintenance). Generally, this is a temporary state.
error.504=Gateway Timeout. The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
error.505=HTTP Version Not Supported. The server does not support the HTTP protocol version used in the request.

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
GENTICS.Aloha.LinkChecker=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.LinkChecker");GENTICS.Aloha.LinkChecker.languages=["en"];GENTICS.Aloha.LinkChecker.errorCodes=[400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,500,501,502,503,504,505,506];GENTICS.Aloha.LinkChecker.warningCodes=[404,411,412,413,500,503,504,505];GENTICS.Aloha.LinkChecker.init=function(){this.proxyUrl=null;if(GENTICS.Aloha.LinkChecker.settings.proxyUrl!=undefined){this.proxyUrl=GENTICS.Aloha.LinkChecker.settings.proxyUrl}this.timer={};this.xhr={};var that=this;GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableActivated",function(jEvent,aEvent){aEvent.editable.obj.find("a").each(function(){that.checkLink(this,jQuery(this).attr("href"),0)})});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableDeactivated",function(jEvent,aEvent){that.makeClean(aEvent.editable.obj)});GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"hrefChanged",function(jEvent,aEvent){that.checkLink(aEvent.obj,"hrefChanged")})};GENTICS.Aloha.LinkChecker.checkLink=function(obj,scope,delay,timeout){var that=this;var url=jQuery(obj).attr("href");var cleanUrl=url;if(typeof url=="string"&&!/^http/.test(url.toLowerCase())){this.makeCleanLink(obj);return}if(this.proxyUrl){url=this.proxyUrl+url}if(this.xhr[scope]){this.xhr[scope].abort();this.xhr[scope]=undefined}this.timer[scope]=this.urlExists(url,function(xhr){that.makeCleanLink(obj)},function(xhr){if(obj){if(jQuery.inArray(xhr.status,that.errorCodes)>=0){var e=xhr.status}else{var e="0"}var o=jQuery(obj);if(o.attr("title")&&!o.attr("data-invalid")){o.attr("data-title",o.attr("title"))}o.attr("data-invalid","true");o.attr("title",cleanUrl+". "+that.i18n("error."+e));if(jQuery.inArray(xhr.status,that.warningCodes)>=0){o.addClass("GENTICS_link_warn")}else{o.addClass("GENTICS_link_error")}}},scope,timeout,delay)};GENTICS.Aloha.LinkChecker.urlExists=function(url,successFunc,failureFunc,scope,timeout,delay){var that=this;clearTimeout(this.timer[scope]);delay=(delay!=null&&delay!=undefined)?delay:700;var newTimer=setTimeout(function(){that.xhr[scope]=jQuery.ajax({url:url,timeout:timeout?10000:timeout,type:"HEAD",complete:function(xhr){clearTimeout(newTimer);try{if(xhr.status<400){successFunc.call(this,xhr)}else{failureFunc.call(this,xhr)}}catch(e){failureFunc.call(this,{status:0})}}})},delay);return newTimer};GENTICS.Aloha.LinkChecker.makeCleanLink=function(obj){if(obj){var o=jQuery(obj);if(o.attr("data-title")){o.attr("title",o.attr("data-title"))}else{o.removeAttr("title")}o.removeAttr("data-title");o.removeAttr("data-invalid");o.removeClass("GENTICS_link_error");o.removeClass("GENTICS_link_warn")}};GENTICS.Aloha.LinkChecker.makeClean=function(editable){var that=this;editable.find("a").each(function(){that.makeCleanLink(this)})};GENTICS.Aloha.LinkChecker.urlencode=function(str){str=(str+"").toString();return encodeURIComponent(str).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A").replace(/%20/g,"+")};

View File

@ -0,0 +1,235 @@
<?php
/**
* Gentics Aloha Editor AJAX Gateway
* Copyright (c) 2010 Gentics Software GmbH
* Licensed unter the terms of http://www.aloha-editor.com/license.html
* aloha-sales@gentics.com
* Author Haymo Meran h.meran@gentics.com
* Author Johannes Schüth j.schuet@gentics.com
* Author Tobias Steiner t.steiner@gentics.com
*
* Testing from the command line:
* function getallheaders(){return array('X-Gentics' => 'X');};
* https url example: https://google.com/adsense
*
*/
// for debugging
//$_SERVER['SERVER_PROTOCOL'] = 'HTTP/1.0';
//$_SERVER['REQUEST_METHOD'] = 'HEAD';
//error_reporting(E_ALL);
$request = array(
'method' => $_SERVER['REQUEST_METHOD'],
'protocol' => $_SERVER['SERVER_PROTOCOL'],
'headers' => getallheaders(),
//possibly use $HTTP_RAW_POST_DATA if available
'payload' => http_build_query($_POST),
);
// read url parameter
if (array_key_exists('url', $_GET)) {
$request['url'] = urldecode($_GET['url']);
} else {
header("HTTP/1.0 400 Bad Request");
echo "Gentics AJAX Gateway failed because parameter url is missing.";
exit();
}
// check if link exists
$response = http_request($request);
// Note HEAD does not always work even if specified...
// We use HEAD for Linkchecking so we do a 2nd request.
if (strtoupper($method) == 'HEAD' && (int)$response['status'] >= 400 ) {
$request['method'] = 'GET';
$response = http_request($request);
//since we handle a HEAD, we don't need to proxy any contents
fclose($response['socket']);
$response['socket'] = null;
}
// forward each returned header...
foreach ($response['headers'] as $key => $value) {
header("$key: $value");
}
//there is no need to specify a content length since we don't do keep
//alive, and this can cause problems for integration (e.g. gzip output,
//which would change the content length)
header('Content-Length:');
// output the contents if any
if (null !== $response['socket']) {
fpassthru($response['socket']);
fclose($response['socket']);
}
exit;
/**
* Query an HTTP(S) URL with the given request parameters and return the
* response headers and status code. The socket is returned as well and
* will point to the begining of the response payload (after all headers
* have been read), and must be closed with fclose().
* @param $url the request URL
* @param $request the request method may optionally be overridden.
* @param $timeout connection and read timeout in seconds
*/
function http_request($request, $timeout = 5) {
$url = $request['url'];
// Extract the hostname from url
$parts = parse_url($url);
if (array_key_exists('host', $parts)) {
$remote = $parts['host'];
} else {
return myErrorHandler("url ($url) has no host. Is it relative?");
}
if (array_key_exists('port', $parts)) {
$port = $parts['port'];
} else {
$port = 0;
}
// Beware that RFC2616 (HTTP/1.1) defines header fields as case-insensitive entities.
$request_headers = "";
foreach ($request['headers'] as $name => $value) {
switch (strtolower($name)) {
//ommit some headers
case "keep-alive":
case "connection":
case "cookie":
//TPDP: we don't handle any compressions encodings. this is only
//a problem if client communication is already compressed (which
//would double compress the content, once from the remote server
//to us, and once from us to the client, but the client would
//de-compress only once).
case "accept-encoding":
break;
// correct the host parameter
case "host":
$host_info = $remote;
if ($port) {
$host_info .= ':' . $port;
}
$request_headers .= "$name: $host_info\r\n";
break;
// forward all other headers
default:
$request_headers .= "$name: $value\r\n";
break;
}
}
//set fsockopen transport scheme, and the default port
switch (strtolower($parts['scheme'])) {
case 'https':
$scheme = 'ssl://';
if ( ! $port ) $port = 443;
break;
case 'http':
$scheme = '';
if ( ! $port ) $port = 80;
break;
default:
//some other transports are available but not really supported
//by this script: http://php.net/manual/en/transports.inet.php
$scheme = $parts['scheme'] . '://';
if ( ! $port ) {
return myErrorHandler("Unknown scheme ($scheme) and no port.");
}
break;
}
//we make the request with socket operations since we don't want to
//depend on the curl extension, and the higher level wrappers don't
//give us usable error information.
$sock = @fsockopen("$scheme$remote", $port, $errno, $errstr, $timeout);
if ( ! $sock ) {
return myErrorHandler("Unable to open URL ($url): $errstr");
}
//timeout in fsockopen is only for the connection, the following is
//for reading the content
stream_set_timeout($sock, $timeout);
//absolute url should only be specified for proxy requests
if (array_key_exists('path', $parts)) {
$path_info = $parts['path'];
} else {
$path_info = '/';
}
if (array_key_exists('query', $parts)) $path_info .= '?' . $parts['query'];
if (array_key_exists('fragment', $parts)) $path_info .= '#' . $parts['fragment'];
$out = $request["method"]." ".$path_info." ".$request["protocol"]."\r\n"
. $request_headers
. "Connection: Close\r\n\r\n";
fwrite($sock, $out);
fwrite($sock, $request['payload']);
$header_str = stream_get_line($sock, 1024*16, "\r\n\r\n");
$headers = http_parse_headers($header_str);
// get http status
preg_match('|HTTP/\d+\.\d+\s+(\d+)\s+.*|i',$headers[0],$match);
$status = $match[1];
return array('headers' => $headers, 'socket' => $sock, 'status' => $status);
}
/**
* Parses a string containing multiple HTTP header lines into an array
* of key => values.
* Inspired by HTTP::Daemon (CPAN).
*/
function http_parse_headers($header_str) {
$headers = array();
//ignore leading blank lines
$header_str = preg_replace("/^(?:\x0D?\x0A)+/", '', $header_str);
while (preg_match("/^([^\x0A]*?)\x0D?(?:\x0A|\$)/", $header_str, $matches)) {
$header_str = substr($header_str, strlen($matches[0]));
$header_line = $matches[1];
if (empty($headers)) {
// the status line
$headers[] = $header_line;
}
elseif (preg_match('/^([^:\s]+)\s*:\s*(.*)/', $header_line, $matches)) {
if (isset($key)) {
//previous header is finished (was potentially multi-line)
$headers[$key] = $val;
}
list(,$key,$val) = $matches;
}
elseif (preg_match('/^\s+(.*)/', $header_line, $matches)) {
//continue a multi-line header
$val .= " ".$matches[1];
}
else {
//empty (possibly malformed) header signals the end of all headers
break;
}
}
if (isset($key)) {
$headers[$key] = $val;
}
return $headers;
}
function myErrorHandler($msg)
{
// 500 could be misleading...
// Should we return a special Error when a proxy error occurs?
header("HTTP/1.0 500 Internal Error");
echo "Gentics Aloha Editor AJAX Gateway Error: $msg";
exit();
}
//EOF

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Unsortierte Liste einfügen
button.createolist.tooltip=Sortierte Liste einfügen

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Insert Unordered List
button.createolist.tooltip=Insert Ordered List

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Enmeti senordan liston
button.createolist.tooltip=Enmeti ordan liston

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Lisää järjestelemätön lista
button.createolist.tooltip=Lisää järjestelty lista

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Insérer une liste non ordonnée
button.createolist.tooltip=Insérer liste ordonnée

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Inserisci una lista
button.createolist.tooltip=Inserisci una lista numerata

View File

@ -0,0 +1,2 @@
button.createulist.tooltip=Вставить Список
button.createolist.tooltip=Вставить Упорядоченный Список

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/*
* Aloha Editor
* Author & Copyright (c) 2010 Gentics Software GmbH
* aloha-sales@gentics.com
* Licensed unter the terms of http://www.aloha-editor.com/license.html
*/
GENTICS.Aloha.PastePlugin=new GENTICS.Aloha.Plugin("com.gentics.aloha.plugins.Paste");GENTICS.Aloha.PastePlugin.pasteHandlers=[];GENTICS.Aloha.PastePlugin.init=function(){var that=this;this.pasteDiv=jQuery('<div style="position:absolute; top:-100000px; left:-100000px"></div>');this.pasteDiv.attr("contentEditable","true");jQuery("body").append(this.pasteDiv);GENTICS.Aloha.EventRegistry.subscribe(GENTICS.Aloha,"editableCreated",function(event,editable){if(jQuery.browser.msie){editable.obj.bind("beforepaste",function(event){that.redirectPaste()})}else{editable.obj.bind("paste",function(event){that.redirectPaste();window.setTimeout(function(){that.getPastedContent()},10)})}});if(jQuery.browser.msie){this.pasteDiv.bind("paste",function(event){window.setTimeout(function(){that.getPastedContent()},10)})}};GENTICS.Aloha.PastePlugin.redirectPaste=function(){this.currentRange=new GENTICS.Utils.RangeObject(true);this.currentEditable=GENTICS.Aloha.activeEditable;this.pasteDiv.text("");if(this.currentEditable){this.currentEditable.blur()}GENTICS.Utils.Dom.setCursorInto(this.pasteDiv.get(0));this.pasteDiv.focus()};GENTICS.Aloha.PastePlugin.getPastedContent=function(){var that=this;for(var i=0;i<this.pasteHandlers.length;++i){this.pasteHandlers[i].handlePaste(this.pasteDiv)}if(this.currentRange&&this.currentEditable){var pasteDivContents=this.pasteDiv.contents();for(var i=pasteDivContents.length-1;i>=0;--i){GENTICS.Utils.Dom.insertIntoDOM(jQuery(pasteDivContents.get(i)),that.currentRange,that.currentEditable.obj,false)}this.currentEditable.activate();this.currentEditable.obj.focus();if(pasteDivContents.length>0){GENTICS.Utils.Dom.setCursorAfter(pasteDivContents.get(pasteDivContents.length-1))}else{this.currentRange.select()}}this.currentRange=false;this.currentEditable=false;this.pasteDiv.text("")};GENTICS.Aloha.PastePlugin.register=function(pasteHandler){this.pasteHandlers.push(pasteHandler)};GENTICS.Aloha.PastePlugin.PasteHandler=function(){GENTICS.Aloha.PastePlugin.register(this)};GENTICS.Aloha.PastePlugin.PasteHandler.prototype.handlePaste=function(jqPasteDiv){};

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
button.addtoc.tooltip=Inhaltsverzeichnis

View File

@ -0,0 +1 @@
button.addtoc.tooltip=Table of contents

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
floatingmenu.tab.table=Tabelle
deleterows.confirm=Wollen Sie die ausgewählten Zeilen wirklich löschen?
deletecolumns.confirm=Wollen Sie die ausgewählten Spalten wirklich löschen?
deletetable.confirm=Wollen Sie wirklich die ganze Tabelle löschen?
Table=Tabelle
button.createtable.tooltip=Tabelle einfügen
button.addcolleft.tooltip=Spalte links einfügen
button.addcolright.tooltip=Spalte rechts einfügen
button.delcols.tooltip=Spalten löschen
button.addrowbefore.tooltip=Zeile darüber einfügen
button.addrowafter.tooltip=Zeile darunter einfügen
button.delrows.tooltip=Zeilen löschen
button.caption.tooltip=Tabellen Bezeichnung
empty.caption=Tabellen Bezeichnung

View File

@ -0,0 +1,14 @@
floatingmenu.tab.table=Table
deleterows.confirm=Do you really want to delete the selected rows?
deletecolumns.confirm=Do you really want to delete the selected columns?
deletetable.confirm=Do you really want to delete the table?
Table=Table
button.createtable.tooltip=Insert Table
button.addcolleft.tooltip=Add Column left
button.addcolright.tooltip=Add Column right
button.delcols.tooltip=Delete Columns
button.addrowbefore.tooltip=Add Row before
button.addrowafter.tooltip=Add Row after
button.delrows.tooltip=Delete Rows
button.caption.tooltip=Table caption
empty.caption=Table caption

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Tabelo
deleterows.confirm=Æu vi vere volas viþi la elektitajn vicojn?
deletecolumns.confirm=Æu vi vere volas viþi la elektitajn kolumnojn?
deletetable.confirm=Æu vi vere volas forviþi la tabelon?
Table=Tabelo
button.createtable.tooltip=Enmeti tabelon
button.addcolleft.tooltip=Aldoni kolumnon maldekstre
button.addcolright.tooltip=Aldoni kolumnon dekstre
button.delcols.tooltip=Forviþi kolumnojn
button.addrowbefore.tooltip=Aldoni vicon antaýe
button.addrowafter.tooltip=Aldoni vicon poste
button.delrows.tooltip=Forviþi vicojn

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Taulukko
deleterows.confirm=Oletko varma että haluat poistaa valitut rivit?
deletecolumns.confirm=Oletko varma että haluat poistaa valitut sarakkeet?
deletetable.confirm=Oletko varma että haluat poistaa taulukon?
Table=Taulukko
button.createtable.tooltip=Lisää taulukko
button.addcolleft.tooltip=Lisää sarake vasemmalle
button.addcolright.tooltip=Lisää sarake oikealle
button.delcols.tooltip=Poista sarakkeet
button.addrowbefore.tooltip=Lisää rivi ennen
button.addrowafter.tooltip=Lisää rivi jälkeen
button.delrows.tooltip=Poista rivit

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Table
deleterows.confirm=Voulez-vous vraiment supprimer les lignes sélectionnées ?
deletecolumns.confirm=Voulez-vous vraiment supprimer les colonnes sélectionnées ?
deletetable.confirm=Voulez-vous vraiment supprimer la table ?
Table=Tableau
button.createtable.tooltip=Insérer un tableau
button.addcolleft.tooltip=Ajouter une colonne à gauche
button.addcolright.tooltip=Ajouter Colonne à droite
button.delcols.tooltip=Colonnes Supprimer
button.addrowbefore.tooltip=Ajouter une ligne avant
button.addrowafter.tooltip=Ajouter une ligne après
button.delrows.tooltip=supprimer des lignes

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Tabella
deleterows.confirm=Vuoi davvero eliminare le righe selezionate?
deletecolumns.confirm=Vuoi davvero eliminare le colonne selezionate?
deletetable.confirm=Vuoi davvero eliminare la tabella?
Table=Tabella
button.createtable.tooltip=Crea una nuova tabella
button.addcolleft.tooltip=Aggiungi una colonna a sinistra
button.addcolright.tooltip=Aggiungi una colonna a destra
button.delcols.tooltip=Elimina colonne
button.addrowbefore.tooltip=Aggiungi una riga prima
button.addrowafter.tooltip=Aggiungi una riga dopo
button.delrows.tooltip=Elimina righe

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Tabela
deleterows.confirm=Czy na pewno chcesz usunąć zaznaczone wiersze?
deletecolumns.confirm=Czy na pewno chcesz usunąć zaznaczone kolumny?
deletetable.confirm=Czy na pewno chcesz usunąć tabelę?
Table=Tabela
button.createtable.tooltip=Wstaw tabelę
button.addcolleft.tooltip=Dodaj kolumnę na lewo
button.addcolright.tooltip=Dodaj kolumnę na prawo
button.delcols.tooltip=Usuń kolumny
button.addrowbefore.tooltip=Dodaj wiersz przed
button.addrowafter.tooltip=Dodaj wiersz po
button.delrows.tooltip=Usuń wiersze

View File

@ -0,0 +1,12 @@
floatingmenu.tab.table=Таблица
deleterows.confirm=Вы действительно хотите удалить выбранные строки?
deletecolumns.confirm=Вы действительно хотите удалить выбранные колонки?
deletetable.confirm=Вы действительно хотите удалить таблицу?
Table=Таблица
button.createtable.tooltip=Вставить Таблицу
button.addcolleft.tooltip=Добавить колонку слева
button.addcolright.tooltip=Добавить колонку справа
button.delcols.tooltip=Удалить Колонки
button.addrowbefore.tooltip=Удалить пердыдущую строку
button.addrowafter.tooltip=Удалть следующую строку
button.delrows.tooltip=Удалить Строки

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 B

View File

@ -0,0 +1,112 @@
/**
* Hide the border for contenteditables
*/
.GENTICS_Table_Cell_editable,
.GENTICS_Aloha_Table_wrapper {
outline: 0px solid transparent;
}
/* :TODO: make custom cursors visible in IE */
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td.GENTICS_Aloha_Table_leftUpperCorner,
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td.GENTICS_Aloha_Table_leftUpperCorner:hover {
cursor: default;
background-color: transparent;
}
tr.GENTICS_Aloha_Table_selectColumn td,
td.GENTICS_Aloha_Table_selectRow {
visibility: hidden;
}
.GENTICS_editable_active tr.GENTICS_Aloha_Table_selectColumn td,
.GENTICS_editable_active td.GENTICS_Aloha_Table_selectRow {
visibility: visible;
}
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn {
height: 10px;
}
.GENTICS_Aloha_Table td .GENTICS_Table_Cell_editable {
cursor: text !important;
}
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td {
cursor: url(down.cur),default;
}
/* :TODO: make custom cursors visible in IE */
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_selectRow {
cursor: url(left.cur),default;
}
.GENTICS_WAI_RED {
background-image: url(wai_red.png);
}
.GENTICS_WAI_GREEN {
background-image: url(wai_green.png);
}
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_leftUpperCorner div {
cursor: pointer !important;
}
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_selectRow,
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td {
border: 0;
margin:0;
padding:0;
background-color: #D0D0D0;
font-size: 0.01em;
}
.GENTICS_Aloha_Table td.GENTICS_Aloha_Table_selectRow:hover,
.GENTICS_Aloha_Table tr.GENTICS_Aloha_Table_selectColumn td:hover {
background-color: #C0C0C0;
}
/**
* Create dialog
*/
.GENTICS_Table_Createdialog {
z-index: 99999;
position: absolute;
background-color: #F0F0F0;
border: 1px solid #cccccc;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
}
.GENTICS_Table_Createdialog table {
padding: 0px;
margin: 0px;
}
.GENTICS_Table_Createdialog table td {
margin: 0px;
padding: 0px;
border: 1px solid #AFAFAF;
font-size: 8px;
width: 15px;
height: 15px;
}
.GENTICS_Table_Createdialog table td.hover {
background-color: #1c94c4;
}
.GENTICS_Table_Createdialog #table-size-info {
text-align: center;
font-size: 0.8em;
}
.GENTICS_Aloha_Cell_selected {
background-color: #3399FF !important;
color: #FFF;
}
div.GENTICS_Table_Cell_editable {
height: 100%;
min-height: 100%;
width: 100%;
z-index: 99999;
}
button.GENTICS_button_table_caption {
background-position: -320px 0px !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,17 @@
$(document).ready(function() {
$('#default_site_template_input label a').click(function(e) {
$('#default_site_template_input input[type=checkbox]').attr('checked', '');
$('#default_site_template_input').hide();
$('#zipfile_input').show();
e.preventDefault();
});
$('#zipfile_input p.inline-hints a').click(function(e) {
$('#default_site_template_input input[type=checkbox]').attr('checked', 'checked');
$('#zipfile_input').hide();
$('#default_site_template_input').show();
e.preventDefault();
});
});

View File

@ -4,20 +4,20 @@
color: #222;
}
#panel .inner p.explanations {
margin-top: 10px;
font-size: 1.2em;
}
#panel .inner p.explanations a {
#panel .inner a {
color: #1F82BC;
text-decoration: none;
}
#panel .inner p.explanations a:hover {
#panel .inner a:hover {
text-decoration: underline;
}
#panel .inner p.explanations {
margin-top: 10px;
font-size: 1.2em;
}
#panel .inner p.done {
margin: 20px 0px 15px;
font-size: 1.2em;
@ -45,6 +45,18 @@
}
#panel .inner dd p {
}
/* ___ custom ___ */
#panel fieldset ol li.question input[type=checkbox] {
display: inline;
width: auto;
margin-right: 10px;
}
#panel fieldset ol li.question label {
display: inline;
font-weight: normal;
}

Binary file not shown.

View File

@ -22,7 +22,7 @@ describe Locomotive::Import::Job do
it 'adds content types' do
@site.content_types.count.should == 2
content_type = @site.content_types.where(:slug => 'projects').first
content_type.content_custom_fields.size.should == 6
content_type.content_custom_fields.size.should == 7
end
it 'converts correctly the order_by option for content types' do

View File

@ -17,20 +17,20 @@ describe ContentType do
# Validations ##
%w{site name}.each do |field|
it "should validate presence of #{field}" do
it "requires the presence of #{field}" do
content_type = Factory.build(:content_type, field.to_sym => nil)
content_type.should_not be_valid
content_type.errors[field.to_sym].should == ["can't be blank"]
end
end
it 'should validate presence of slug' do
it 'requires the presence of slug' do
content_type = Factory.build(:content_type, :name => nil, :slug => nil)
content_type.should_not be_valid
content_type.errors[:slug].should == ["can't be blank"]
end
it 'should validate uniqueness of slug' do
it 'is not valid if slug is not unique' do
content_type = Factory.build(:content_type)
content_type.content_custom_fields.build :label => 'anything', :kind => 'String'
content_type.save
@ -38,12 +38,21 @@ describe ContentType do
content_type.errors[:slug].should == ["is already taken"]
end
it 'should validate size of content custom fields' do
it 'is not valid if there is not at least one field' do
content_type = Factory.build(:content_type)
content_type.should_not be_valid
content_type.errors[:content_custom_fields].should == ["is too small (minimum element number is 1)"]
end
%w(created_at updated_at).each do |_alias|
it "does not allow #{_alias} as alias" do
content_type = Factory.build(:content_type)
field = content_type.content_custom_fields.build :label => 'anything', :kind => 'String', :_alias => _alias
field.valid?.should be_false
field.errors[:_alias].should == ['is reserved']
end
end
end
context '#ordered_contents' do