diff --git a/app/controllers/admin/seminar_signups_controller.rb b/app/controllers/admin/seminar_signups_controller.rb
index 7e80fde..0ee586b 100644
--- a/app/controllers/admin/seminar_signups_controller.rb
+++ b/app/controllers/admin/seminar_signups_controller.rb
@@ -60,16 +60,7 @@ class Admin::SeminarSignupsController < OrbitAdminController
@seminar_signup.destroy
- redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup"
- end
-
- def get_predefined_text
- seminar = SeminarMain.find(params[:seminar_id])
- text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
- render :json => {
- "success" => true,
- "html" => text
- }
+ redirect_to "/admin/seminars/#{@seminar_main_id}/seminar_signup?type=table"
end
private
diff --git a/app/controllers/admin/seminars_controller.rb b/app/controllers/admin/seminars_controller.rb
index 483f4bd..5bf88dc 100644
--- a/app/controllers/admin/seminars_controller.rb
+++ b/app/controllers/admin/seminars_controller.rb
@@ -699,6 +699,38 @@ class Admin::SeminarsController < OrbitAdminController
redirect_to admin_seminars_path
end
+ def send_notifying_email
+ sent_time = DateTime.now
+ @seminar = SeminarMain.find_by(:id => params[:seminar_id])
+ seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first
+ if !seminar_signup.blank?
+ extra_text = "
#{nl2br(params[:text])}
"
+ if params[:type] == "reset_password"
+ seminar_signup.status = 'C'
+ token = seminar_signup.generate_token
+ extra_text += "#{t("seminar.click_here_to_confirm")} "
+ end
+ send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
+ seminar_signup.emails_sent << params[:type]
+ seminar_signup.emails_sent_time << sent_time
+ seminar_signup.save
+ end
+ render :json => {
+ "type" => t("seminar.#{params[:type]}"),
+ "sent_time" => sent_time.strftime("%Y/%m/%d %H:%M"),
+ "success" => true
+ }.to_json
+ end
+
+ def get_predefined_text
+ seminar = SeminarMain.find(params[:seminar_id])
+ text = seminar.seminar_email_sets.where(:field_name => params[:type]).first.content[I18n.locale]
+ render :json => {
+ "success" => true,
+ "html" => text
+ }
+ end
+
private
def set_seminar
diff --git a/app/controllers/seminars_controller.rb b/app/controllers/seminars_controller.rb
index f46feba..ed92d6d 100644
--- a/app/controllers/seminars_controller.rb
+++ b/app/controllers/seminars_controller.rb
@@ -295,7 +295,7 @@ class SeminarsController < ApplicationController
if last_path.include?("?")
referer_url = split_path[0...-1].join('/') + '/' + last_path.split('?')[0]
uri_query = last_path.split("?")[1..-1].join('?')
- uri_query.gsub!(/notice=[^&]*/,'').gsub!(/&+$/,'')
+ uri_query = uri_query.gsub(/notice=[^&]*/,'').gsub(/&+$/,'')
if uri_query.blank?
referer_url = referer_url + "?notice=#{notice_words}"
else
@@ -379,7 +379,20 @@ class SeminarsController < ApplicationController
seminar_signup = SeminarSignup.new
- time_now = Time.now
+ time_now = Time.now
+
+ referer_url = OrbitHelper.request.referer
+
+ if (referer_url.nil? || referer_url.match(/(\?|&)method=show_privacy/).nil?) && !OrbitHelper.request.flash[:notice]
+ return {
+ "seminar" => seminar,
+ "seminar_signup" => seminar_signup,
+ "time_now" => time_now,
+ "redirect_to" => "#{OrbitHelper.url_to_show(seminar.to_param)}?method=show_privacy"
+ }
+ end
+
+
{
"seminar" => seminar,
"seminar_signup" => seminar_signup,
@@ -420,6 +433,11 @@ class SeminarsController < ApplicationController
end
def create
+ referer_url = request.referer
+ if referer_url
+ params[:url] = URI.parse(referer_url).path.sub(/\/[^\/]*$/, '').sub(/^\/#{I18n.locale}/, '')
+ end
+ OrbitHelper.set_params(params, current_user)
seminar_id = params[:seminar_signup][:seminar_main_id]
@seminar = SeminarMain.where(id: seminar_id).first
if @seminar.enable_recaptcha && (!gotcha_valid?)
@@ -522,9 +540,9 @@ class SeminarsController < ApplicationController
def update_signup_form
params = OrbitHelper.params
+ tmp_seminar_signup_params = seminar_signup_params
@seminar_signup = SeminarSignup.find(params[:signup_id])
- @seminar_signup.update_attributes(seminar_signup_params)
-
+ @seminar_signup.update_attributes(tmp_seminar_signup_params)
if !params[:seminar_signup_values].nil?
params[:seminar_signup_values].each_with_index do |r,i|
field_value = r.last[:id].present?
@@ -540,6 +558,20 @@ class SeminarsController < ApplicationController
@seminar.unassigned_seminar_signup_ids = unassigned_seminar_signup_ids
@seminar.save
end
+ extra_text = " #{I18n.t('seminar_signup.serial_number')}: #{@seminar_signup.display_serial_number}"
+ if tmp_seminar_signup_params['status']=='C'
+ status_param = '&status='
+ if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
+ extra_text += " "
+ end
+ send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
+ else
+ status_param = ''
+ if(@seminar.seminar_email_sets.where(:field_name => "signup").first.is_confirmation)
+ extra_text += " "
+ end
+ send_mail('signup',tmp_seminar_signup_params[:email],tmp_seminar_signup_params[:seminar_main_id],extra_text)
+ end
redirect_to "#{params[:referer_url].to_s.chomp('/').gsub(/\/([^\/?#]+)(|[^\/]+)$/){|f| '/'+$1}}?method=con_upload"
end
@@ -755,7 +787,7 @@ class SeminarsController < ApplicationController
end
- def edit_login_seminar_signup
+ def edit_login_seminar_signup #copy from show
if !@@session[:seminar_main_id].blank?
seminar = SeminarMain.find_by(id: @@session[:seminar_main_id])
seminar_signup = SeminarSignup.find_by(_id: @@session[:seminar_signup_id], seminar_main_id: @@session[:seminar_main_id] ) rescue nil
@@ -818,7 +850,11 @@ class SeminarsController < ApplicationController
def confirm_email_page
confirm = false
params = OrbitHelper.params
- seminar = SeminarMain.where(:uid => params[:uid]).first
+ uid = params[:uid]
+ if uid.nil?
+ uid = params[:page].split('-').last
+ end
+ seminar = SeminarMain.where(:uid => uid).first
if(!seminar.nil?)
signup = seminar.seminar_signups.where(:id => params[:cid], :token => params[:token], :is_confirmed => false).first
if(!signup.nil?)
@@ -890,44 +926,7 @@ class SeminarsController < ApplicationController
params.require(:seminar_signup_contribute).permit!
end
- def send_notifying_email
- @seminar = SeminarMain.find_by(:id => params[:seminar_id])
- seminar_signup = @seminar.seminar_signups.where(:email => params[:email]).first
- if !seminar_signup.blank?
- extra_text = " #{params[:text]}
"
- if params[:type] == "reset_password"
- token = seminar_signup.generate_token
- extra_text += "#{t("seminar.click_here_to_confirm")} "
- end
- send_mail(params[:type], seminar_signup.email, @seminar.id.to_s, extra_text)
- seminar_signup.emails_sent << params[:type]
- seminar_signup.save
- end
- render :json => {
- "type" => t("seminar.#{params[:type]}"),
- "success" => true
- }.to_json
- end
-
def seminar_signup_values_params
params.require(:seminar_signup_values).permit!
end
- def send_mail(field_name,email,seminar_id,extra_text="")
- email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name}
- if email_set.length==0
- mail = Email.create(mail_to:[email],
- module_app_key:"seminar",
- template:"email/#{field_name}_email.html.erb",
- mail_sentdate:Time.current,
- mail_subject: t("seminar.email_#{field_name}_success"),
- template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
- elsif !(email_set[0].disabled)
- mail = Email.create(mail_to:[email],
- module_app_key:"seminar",
- template:"email/#{field_name}_email.html.erb",
- mail_sentdate:Time.current,
- mail_subject: email_set[0].title[I18n.locale],
- template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
- end
- end
end
diff --git a/app/helpers/admin/seminars_field_helper.rb b/app/helpers/admin/seminars_field_helper.rb
index 942df54..f6e53b8 100644
--- a/app/helpers/admin/seminars_field_helper.rb
+++ b/app/helpers/admin/seminars_field_helper.rb
@@ -7,6 +7,7 @@ module Admin::SeminarsFieldHelper
include ActionView::Helpers::RenderingHelper
include ActionView::Context
include OrbitBasis::RenderAnywhere
+ include ::MemberHelper
include OrbitFormHelper
@@ -168,7 +169,9 @@ module Admin::SeminarsFieldHelper
key = can_muti_lang_input_for_sm? ? "#{key}" : I18n.locale
place_holder= typeD["placeholder"][key] rescue ''
name1 = can_muti_lang_input_for_sm? ? (get_field_name_base + "[#{key}]") : get_field_name_base
- text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'ckeditor input-medium form-control'))
+ text_area_tag(name1, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', :maxlength=> 300)) + (content_tag :p do
+ "(#{I18n.t("seminar.text_area_hint")})"
+ end)
end
end
@@ -187,14 +190,32 @@ module Admin::SeminarsFieldHelper
add_more_blank = can_add_more ? "[]" : ""
key_field = can_muti_lang_input? ? "[#{key}]" : ""
field_name = [get_field_name_base,add_more_blank,key_field].join
- file_required =@require ? 'required="required"' : ''
+ file_required =@require && !value ? 'required="required"' : ''
"#{value}".html_safe
end
end
+ def render_email
+ a = control_group_wrapper_for_sm do |key,value|
+ place_holder= typeA["placeholder"][I18n.locale] rescue ''
+ email_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', title: I18n.t("seminar.email_hint"))) +
+ (content_tag :div,:class=>"loader" do
+ end)
+ end
+ end
+
+ def render_phone
+ a = control_group_wrapper_for_sm do |key,value|
+ place_holder= typeA["placeholder"][I18n.locale] rescue ''
+ text_field_tag(get_field_name_base, value, @markup_options.merge(:placeholder=>place_holder,:class=>'input-medium form-control', pattern: "[\\d\\+\\-\\(\\)]+", title: I18n.t("seminar.phone_hint"))) + (content_tag :p do
+ "(#{I18n.t("seminar.phone_hint")})"
+ end)
+ end
+ end
+
def date_is_range?
is_range = "false"
data = get_data
diff --git a/app/helpers/admin/seminars_helper.rb b/app/helpers/admin/seminars_helper.rb
index 57e7457..c6e79ae 100644
--- a/app/helpers/admin/seminars_helper.rb
+++ b/app/helpers/admin/seminars_helper.rb
@@ -50,6 +50,24 @@ module Admin::SeminarsHelper
end
# return "/#{I18n.locale}#{page.url}/#{seminar.to_param}"
end
+ def send_mail(field_name,email,seminar_id,extra_text="")
+ email_set = @seminar.seminar_email_sets.select{|v| v.field_name == field_name}
+ if email_set.length==0
+ mail = Email.create(mail_to:[email],
+ module_app_key:"seminar",
+ template:"email/#{field_name}_email.html.erb",
+ mail_sentdate:Time.current,
+ mail_subject: t("seminar.email_#{field_name}_success"),
+ template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
+ elsif !(email_set[0].disabled)
+ mail = Email.create(mail_to:[email],
+ module_app_key:"seminar",
+ template:"email/#{field_name}_email.html.erb",
+ mail_sentdate:Time.current,
+ mail_subject: email_set[0].title[I18n.locale],
+ template_data:{'seminar_id'=>seminar_id,'locale'=>I18n.locale,'extra_text'=> extra_text})
+ end
+ end
module MultiLang
extend self
extend ActionView::Helpers::FormTagHelper
diff --git a/app/models/seminar_signup.rb b/app/models/seminar_signup.rb
index 3d47b0e..7ff726c 100644
--- a/app/models/seminar_signup.rb
+++ b/app/models/seminar_signup.rb
@@ -14,6 +14,7 @@ class SeminarSignup
field :is_confirmed_date, type: DateTime
field :signup_confirmed_date, type: DateTime
field :emails_sent, type: Array, default: []
+ field :emails_sent_time, type: Array, default: []
field :name # become Last Name for TICC
field :tel, type: String # become First Name for TICC
field :unit, localize: true #Only localize for preserving old record
@@ -190,4 +191,8 @@ class SeminarSignup
return all_fields
end
end
+
+ def emails_sent_groups
+ emails_sent.zip([nil]*(emails_sent.length-emails_sent_time.length) + emails_sent_time.collect{|v| v.in_time_zone})
+ end
end
diff --git a/app/views/admin/seminar_signups/edit.html.erb b/app/views/admin/seminar_signups/edit.html.erb
index bc5f1c0..75a9555 100644
--- a/app/views/admin/seminar_signups/edit.html.erb
+++ b/app/views/admin/seminar_signups/edit.html.erb
@@ -14,7 +14,15 @@
<%= javascript_include_tag "lib/file-type" %>
<%= javascript_include_tag "lib/module-area" %>
<% end %>
-
+
@@ -127,8 +135,18 @@
<%= t("seminar_signup.emails_already_sent") %>
- <% @seminar_signup.emails_sent.each do |em| %>
- <%= t("seminar.#{em}") %>
+ <% @seminar_signup.emails_sent_groups.each do |em, em_date| %>
+
+
+ <%= t("seminar.#{em}") %>
+
+
+
+ <% if em_date %>
+ <%= em_date.strftime("%Y/%m/%d %H:%M") %>
+ <% end %>
+
+
<% end %>
@@ -246,11 +264,14 @@ $(document).ready(function(){
if($(this).val() != ""){
let type = $(this).val();
$.ajax({
- url : "/admin/seminar_signups/get_predefined_text",
+ url : "/admin/seminars/get_predefined_text",
data : {"type" : type, "seminar_id": "<%= @seminar.id %>"},
dataType : "json",
type : "get",
success : function(data){
+ if (type === 'reset_password'){
+ $('#seminar_signup_status_c').click();
+ }
if( data.success == true ){
$("#predefined_text").html(data.html);
}
@@ -265,7 +286,7 @@ $(document).ready(function(){
}
if($("#send_email").val() != ""){
$.ajax({
- url : "/xhr/seminars/send_notifying_email",
+ url : "/admin/seminars/send_notifying_email",
data : {
"type" : $("#send_email").val(),
"email" : $("#seminar_signup_email").val(),
@@ -277,7 +298,7 @@ $(document).ready(function(){
success : function(data){
if( data.success == true ){
alert("Email Sent");
- $("#emails_sent").append('
'+ data.type +' ');
+ $("#emails_sent").append('
'+ data.type +' ' +data.sent_time +' ');
}
}
})
diff --git a/app/views/admin/seminars/_seminar_signup_render_table.html.erb b/app/views/admin/seminars/_seminar_signup_render_table.html.erb
index 6a721ca..ecc3dab 100644
--- a/app/views/admin/seminars/_seminar_signup_render_table.html.erb
+++ b/app/views/admin/seminars/_seminar_signup_render_table.html.erb
@@ -52,8 +52,12 @@
val += "
"
if @can_edit
- val += "#{t(:edit)}
- #{t(:delete_)} "
+ val += content_tag :li do
+ link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
+ end
+ val += content_tag :li do
+ link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
+ end
end
val += "
"
@@ -83,8 +87,12 @@
val += "
"
if @can_edit
- val += "#{t(:edit)}
- #{t(:delete_)} "
+ val += content_tag :li do
+ link_to t(:edit), edit_admin_seminar_signup_path(seminar_signup.id)
+ end
+ val += content_tag :li do
+ link_to t(:delete_), admin_seminar_signup_path(seminar_signup.id), class: "text-error", method: :delete, "data-confirm" => "Are you sure?"
+ end
end
val += "
"
diff --git a/app/views/seminars/edit_login_seminar_signup.html.erb b/app/views/seminars/edit_login_seminar_signup.html.erb
index 4066bfd..b66faf9 100644
--- a/app/views/seminars/edit_login_seminar_signup.html.erb
+++ b/app/views/seminars/edit_login_seminar_signup.html.erb
@@ -1,8 +1,8 @@
<%
- data = action_data
- @seminar = data["seminar"]
- @seminar_signup = data["seminar_signup"]
- @time_now = data["time_now"]
+ data = action_data
+ @seminar = data["seminar"]
+ @seminar_signup = data["seminar_signup"]
+ @time_now = data["time_now"]
@form_index = 0
if data["prefix_url"]
prefix_url = data["prefix_url"]
@@ -58,7 +58,7 @@
margin: 0;
}
-<%= form_for @seminar_signup, url: update_signup_form_seminars_path, html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
+<%= form_for @seminar_signup, url: (@seminar_signup.new_record? ? seminars_path : update_signup_form_seminars_path), html: {class: "content form-horizontal" , :id=>"new-seminar-signup", multipart: true} do |f| %>
@@ -81,7 +81,7 @@
<% if @seminar.seminar_signup_field_sets.count != 0 %>
<% @seminar.seminar_signup_field_sets.each do |signup_field| %>
- <% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' %>
+ <% if !(signup_field.disabled) && signup_field.field_name != 'recaptcha' && signup_field.field_name != 'password' %>
" id="<%= signup_field.field_name == 'password' ? 'registration_status' : '' %>">
<% if !(['address','note'].include? signup_field.field_name) %>
@@ -129,7 +129,7 @@
<% elsif signup_field.field_name == 'email' %>
- <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
+ <%= f.email_field :email, :class=>"input-medium form-control availibility", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, :title => t("seminar_signup.email_check") %>
<% elsif signup_field.field_name == 'password' %>
@@ -155,6 +155,11 @@
+ <% elsif signup_field.field_name == 'tel' %>
+
+ <%= f.text_field :tel, :class=>"input-medium form-control", :placeholder=> signup_field.placeholder[I18n.locale], :required => true, pattern: "[\\d\\+\\-\\(\\)]+", title: t("seminar.phone_hint") %>
+
(<%= t("seminar.phone_hint") %>)
+
<% else %>
<%= f.text_field signup_field['field_name'], :class=>"input-medium form-control", :id=>signup_field['field_name'], :placeholder=> signup_field.placeholder[I18n.locale], :required => true %>
@@ -192,7 +197,7 @@
@@ -200,7 +205,7 @@
@@ -224,7 +229,11 @@
<% end %>
<% if(idx % 5 == 0) && idx != 0 %>
<% group += 1 %>
+ <% if @seminar_signup.seminar_signup_values[@form_index] && !@seminar_signup.seminar_signup_values[@form_index].value.blank? %>
+
+ <% else %>
+ <% end %>
<% end %>
<% counter += 1 %>
@@ -249,7 +258,7 @@
- <% if @seminar.seminar_signup_field_sets.count != 0 %>
+ <% if @seminar.seminar_signup_field_sets.count != 0 && @seminar_signup.new_record? %>
<% if !(@seminar.seminar_signup_field_sets.select{|v| v.field_name=='recaptcha'}[0].disabled) %>