Skip to content

Commit

Permalink
Merged Doug
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Aug 23, 2011
2 parents 78b324e + a138ceb commit a573b35
Show file tree
Hide file tree
Showing 116 changed files with 1,433 additions and 866 deletions.
1 change: 1 addition & 0 deletions .rvmrc
@@ -0,0 +1 @@
rvm 1.9.2-p290@Webiva
2 changes: 2 additions & 0 deletions app/controllers/edit_controller.rb
Expand Up @@ -26,6 +26,7 @@ class EditController < ModuleController # :nodoc: all
[:navigation, 'Navigation','Use Navigation Paragraphs' ],
[:member, 'Member','Use Member Paragraphs' ],
[:media, 'Media','Use Media Paragraphs' ],
[:action, 'System','Use System Paragraphs' ],
[:module, 'Module Paragraphs','Use any module paragraphs' ],
[:content, 'Publication','Use Publication paragraphs' ]
]
Expand All @@ -34,6 +35,7 @@ class EditController < ModuleController # :nodoc: all
register_action '/editor/auth/logout', :description => 'User Logged Out', :level => 2
register_action '/editor/auth/cookie', :description => 'User Cookie Login', :level => 2
register_action '/members/edit', :description => 'Admin account edit', :level => 2
register_action '/editor/auth/user_registration', :description => 'User Registered'


private
Expand Down
8 changes: 5 additions & 3 deletions app/controllers/editor/auth_controller.rb
Expand Up @@ -10,7 +10,7 @@ class Editor::AuthController < ParagraphController #:nodoc:all
editor_for :login, :name => 'User Login', :features => ['login']
editor_for :enter_vip, :name => 'Enter VIP #', :features => ['enter_vip'], :triggers => [['Failed VIP Login','failure'],['Successful VIP Login','success' ],['Repeat Successful VIP Login','repeat']]

editor_for :user_register, :name => 'User Registration', :feature => 'user_register', :triggers => [ ['Successful Registration','action'] ]
editor_for :user_register, :name => 'User Registration', :feature => 'user_register', :triggers => [ ['Successful Registration','action'] ], :inputs => { :source => [[:source, 'Source',:path]], :tag => [[:add_tag,'Tag',:path ]] }

editor_for :user_activation, :name => 'User Activation', :feature => 'user_activation', :triggers => [ ['Successful Activation','action'] ]

Expand All @@ -20,7 +20,7 @@ class Editor::AuthController < ParagraphController #:nodoc:all

editor_for :email_list, :name => 'Email List Signup', :triggers => [ ['Signed Up','action']], :features => ['email_list'], :inputs => [ [:source,"Source URL",:path ]]
editor_for :splash, :name => 'Splash Page'
editor_for :view_account, :name => 'View Account', :no_options => true
editor_for :view_account, :name => 'View Account', :no_options => true, :feature => :view_account

class UserRegisterOptions < HashModel

Expand Down Expand Up @@ -69,6 +69,7 @@ def available_field_list
:password_confirmation => [ 'Confirm Password'.t, :password_field, :password_confirmation ],
:first_name => ['First Name'.t,:text_field,:first_name],
:middle_name => ['Middle Name'.t,:text_field,:middle_name],
:dob => [ 'Date of Birth'.t,:text_field,:dob],
:last_name => ['Last Name'.t,:text_field,:last_name],
:gender => ['Gender'.t, :radio_buttons, :gender, { :options => [ ['Male'.t,'m'],['Female'.t,'f' ] ] } ],
:introduction => ['Introduction'.t, :radio_buttons, :introduction, { :options => [ ['Mr.'.t,'Mr.'],['Mrs.'.t,'Mrs.' ], ['Ms.'.t, 'Ms.'] ] } ],
Expand Down Expand Up @@ -133,7 +134,8 @@ def available_address_field_list
:address => [ 'Address'.t, :text_field,:address],
:address_2 => [ 'Address (Line 2)'.t, :text_field,:address_2],
:city => [ 'City'.t, :text_field,:city],
:state => [ 'State'.t, :select,:state,{ :options => ContentModel.state_select_options } ],
:state => (self.country == 'United States' ? [ 'State'.t, :select,:state,{ :options => ContentModel.state_select_options } ] :
[ 'State'.t, :text_field,:state] ),
:zip => [ 'Zip Code'.t, :text_field,:zip],
:country => [ 'Country'.t, :country_select, :country]
}
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/editor/auth_feature.rb
Expand Up @@ -62,8 +62,8 @@ def user_register_feature(data)
end

if data[:options].publication
c.fields_for_tag('register:publication',:model) { |t| data[:model] }
c.publication_field_tags("register:publication",data[:options].publication)
c.fields_for_tag('register:publication',:model,:local => 'pub') { |t| data[:model] }
c.publication_field_tags("register:publication",data[:options].publication, :local => 'pub')
else
c.expansion_tag('register:publication') { |t| nil }
end
Expand Down Expand Up @@ -173,7 +173,7 @@ def user_fields_helper(prefix,c,fields_name,data,required_fields=[])
req = required_fields.include? fld[0].to_s
content_tag("label",
t.locals.send(fields_name)[1][0] + (req ? "<em>*</em>" : ""),
:for => "#{frm.object_name}_#{fld[1[2]]}")
{:for => "#{frm.object_name}_#{fld[1[2]]}"}, false)
end
c.value_tag("#{prefix}:#{fields_name}:control") do |t|
frm = t.locals.form
Expand Down
14 changes: 13 additions & 1 deletion app/controllers/editor/auth_renderer.rb
Expand Up @@ -107,7 +107,10 @@ def user_register
@failed = true unless all_valid

if all_valid
set_source_conn, set_source_val = page_connection(:source)

@usr.lead_source = @options.source unless @options.source.blank?
@usr.lead_source = set_source_val if set_source_val.present?

if params[:address]
@address.save
Expand All @@ -131,6 +134,15 @@ def user_register

@usr.tag_names_add(@options.add_tags) unless @options.add_tags.blank?

add_tags_conn, add_tags_ids = page_connection(:tag)
if add_tags_ids.present?
@usr.tag_names_add(add_tags_ids)
paragraph_action(@usr.action('/editor/auth/registration_tag',:identifier => add_tags_ids))
end




session[:user_tracking] = nil

@address.update_attribute(:end_user_id,@usr.id) if @address.id
Expand Down Expand Up @@ -454,7 +466,7 @@ def user_activation
@status = 'invalid'
end

if @user && ( (request.post? && params[:activate]) || @status == 'activated' )
if !editor? && @user && ( (request.post? && params[:activate]) || @status == 'activated' )
if @status == 'activation' && params[:activate][:accept].blank?
@acceptance_error = true

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/editor/content_feature.rb
Expand Up @@ -23,7 +23,7 @@ def content_node_tags(prefix, c, data)
c.h_tag(prefix + ':category') { |t| t.locals.content.content_type.type_description if t.locals.content.content_type }
c.h_tag(prefix + ':type') { |t| t.locals.content.content_type.content_name if t.locals.content.content_type }
c.link_tag(prefix + ':content') { |t| t.locals.content.link }
c.date_tag(prefix + ':updated_at',DEFAULT_DATETIME_FORMAT.t) { |t| t.locals.content.updated_at }
c.date_tag(prefix + ':created_at',DEFAULT_DATETIME_FORMAT.t) { |t| t.locals.content.created_at }
c.datetime_tag(prefix + ':updated_at') { |t| t.locals.content.updated_at }
c.datetime_tag(prefix + ':created_at') { |t| t.locals.content.created_at }
end
end
7 changes: 5 additions & 2 deletions app/controllers/editor/publication_controller.rb
Expand Up @@ -8,15 +8,18 @@ class Editor::PublicationController < ParagraphController #:nodoc:all

#
editor_for :create, :name => 'Entry Create Form', :features => ['publication_entry_create_form'], :hidden => true,
:inputs => [ [ :entry_id, 'Entry Identifier', :integer ] ]
:inputs => { :input => [ [ :entry_id, 'Entry Identifier', :integer ] ],
:content => [ [ :content_id, "Content Identifier", :content ],
[ :target_id, "Content Target", :target ]] }
editor_for :view, :name => 'Entry Display Form', :features => ['publication_entry_display_form'], :hidden => true,
:inputs => [ [ :entry_id, 'Entry Identifier', :integer ], [:entry_offset, 'Entry Offset', :integer ]],
:outputs => [[:content_id, 'Content Identifier', :content]]
editor_for :list, :name => 'Entry List', :features => ['publication_entry_list'], :hidden => true

editor_for :edit, :name => 'Entry Edit',
:features => ['publication_entry_edit'],
:inputs => [ [ :entry_id, 'Entry ID', :integer ] ],
:inputs => { :input => [ [ :entry_id, 'Entry ID', :integer ] ],
:content => [ [ :content_id, "Content Identifier", :content ], [ :target_id, "Content Target", :target ]] },
:hidden => true

editor_for :admin_list, :name => 'Entry Admin List', :features => ['publication_entry_admin_list'], :hidden => true
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/editor/publication_feature.rb
Expand Up @@ -22,6 +22,10 @@ def form_feature(publication,data)
data[:submitted] ? nil : data[:entry]
end

if publication.publication_type == 'edit'
c.define_button_tag('form:delete',:name => "entry_#{publication.id}[delete]", :value => 'Delete')
end

c.expansion_tag('submitted') { |t| data[:submitted] }
c.value_tag('submitted:success_text') { |t| data[:options].success_text}

Expand Down
50 changes: 39 additions & 11 deletions app/controllers/editor/publication_renderer.rb
Expand Up @@ -33,12 +33,14 @@ def create
if !editor?
if request.post? && params['entry_' + publication.id.to_s] && !params['partial_form']
pc,pc_id = page_connection

content_conn,content_id = page_connection(:content)


entry = publication.content_model.content_model.new()


publication.update_entry(entry,params['entry_' + publication.id.to_s],renderer_state)
publication.update_entry(entry,params['entry_' + publication.id.to_s],renderer_state.merge(:content_id => content_id))

if entry.errors.length == 0 && entry.save
expire_content(publication.content_model_id)
Expand Down Expand Up @@ -182,6 +184,8 @@ def edit

options = {}

content_conn,content_id = page_connection(:content)

if entry_id && entry_id.to_i != 0
publication.each_page_connection_input do |filter_name,fld|
conn_type,conn_id = page_connection(filter_name)
Expand All @@ -200,8 +204,13 @@ def edit
return_page = pub_options.return_page_url

if request.post? && params['entry_' + publication.id.to_s]

if params['entry_' + publication.id.to_s]['delete']
entry.destroy
return redirect_paragraph(return_page)
end

publication.update_entry(entry,params['entry_' + publication.id.to_s],renderer_state)
publication.update_entry(entry,params['entry_' + publication.id.to_s],renderer_state.merge(:content_id => content_id))
new_entry = entry.id ? false : true

if entry.save
Expand Down Expand Up @@ -237,10 +246,21 @@ def edit

def admin_list
publication = paragraph.content_publication

if publication.view_action_count > 0
publication.run_triggered_actions(myself,'view',myself)
end

options = paragraph.data || {}
detail_page = SiteNode.get_node_path(options[:edit_page],'#')

detail_page = SiteNode.get_node_path(options[:detail_page],'#')

if request.post? && params["filter_#{paragraph.id}"] && !params["clear_filter_#{paragraph.id}"]
filter_data = DefaultsHashObject.new(params["filter_#{paragraph.id}"])
searching = params["filter_#{paragraph.id}"].values.detect { |fld| !fld.blank? }
else
filter_data = DefaultsHashObject.new({})
searching = false
end

if request.post? && params['delete']
entry = publication.content_model.content_model.find_by_id(params['delete'])
if entry
Expand All @@ -256,13 +276,21 @@ def admin_list
end
end



publication.each_page_connection_input do |filter_name,fld|
conn_type,conn_id = page_connection(filter_name)
options[conn_type] = conn_id.is_a?(Array) ? conn_id[1] : conn_id unless conn_id.blank?
end


entries = publication.get_list_data(params[:page],options,filter_data.to_hash)

entries = publication.get_list_data(params[:page]) #content_model.content_model.find(:all)
require_css('gallery')

render_paragraph :partial => '/editor/publication/list',
:locals => { :publication => publication,
:entries => entries,
:detail_page => detail_page }
data ={ :detail_page => detail_page, :entries => entries[1], :pages => entries[0], :filter => filter_data, :searching => searching }
render_paragraph :text => list_feature(publication,data)

end


Expand All @@ -286,7 +314,7 @@ def list

publication.each_page_connection_input do |filter_name,fld|
conn_type,conn_id = page_connection(filter_name)
options[conn_type] = conn_id unless conn_id.blank?
options[conn_type] = conn_id.is_a?(Array) ? conn_id[1] : conn_id unless conn_id.blank?
end


Expand Down
4 changes: 2 additions & 2 deletions app/controllers/emarketing_controller.rb
Expand Up @@ -99,7 +99,7 @@ def referrer_sources(display=true)
:sources => @traffic.collect{|t| t[:sources]},
:total_values => @traffic.collect{|t| t[:total_value].to_f > 0.0 ? number_to_currency(t[:total_value]) : ''},
:days => @traffic.collect{|t| t[:started_at].localize('%A'.t)},
:dates => @traffic.collect{|t| t[:started_at].localize(DEFAULT_DATE_FORMAT.t)}
:dates => @traffic.collect{|t| t[:started_at].localize(Configuration.date_format)}
}
end
end
Expand Down Expand Up @@ -229,7 +229,7 @@ def charts
return render :json => data
elsif @format == 'csv'
report = StringIO.new
csv_data = FasterCSV.generate do |writter|
csv_data = CSV.generate do |writter|
writter << ['Title', 'Visitors', 'Hits', 'Subscribers', 'Leads', 'Conversions']
@stats.each do |stat|
writter << [stat.target.send(@title), stat.visits, stat.hits, stat.subscribers, stat.leads, stat.conversions]
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/file_controller.rb
Expand Up @@ -186,8 +186,11 @@ def upload
filenames = params[:upload_file][:filename]
filenames = [filenames] unless filenames.is_a?(Array)

config = Configuration.file_types
processor = config.default

domain_file_ids = filenames.collect do |filename|
@upload_file = DomainFile.create(:filename => filename, :parent_id => folder.id, :encoding => encoding, :creator_id => myself.id, :skip_transform => true, :skip_post_processing => true)
@upload_file = DomainFile.create(:filename => filename, :parent_id => folder.id, :encoding => encoding, :creator_id => myself.id, :processor => processor, :process_immediately => true)
@upload_file.id
end.compact

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/module_controller.rb
Expand Up @@ -28,11 +28,11 @@ def self.user_actions(names)

def active_module(adm=false)
info = self.class.get_component_info
return adm ? get_module(adm) : SiteModule.module_enabled?(info[0])

return adm ? get_module_info(adm) : SiteModule.module_enabled?(info[0])
end

def get_module(adm=false)
def get_module_info(adm=false)
return @mod if @mod
info = self.class.get_component_info

Expand Down

0 comments on commit a573b35

Please sign in to comment.