This commit is contained in:
BoHung Chiu 2022-10-16 19:56:14 +08:00
parent e541d53b3b
commit 8db03faa6b
3 changed files with 395 additions and 387 deletions

View File

@ -26,25 +26,30 @@ class Filefield
@app_path = self.prevpath(@app_path) @app_path = self.prevpath(@app_path)
field :title, :type=> String ,default:"patchfile" field :title, :type=> String ,default:"patchfile"
#field :file_show, :type=> Hash ,default:{"ckeditor"=>0,"site-preference(two-site-logo)"=>0,"member"=>0,"accessibility"=>0} #field :file_show, :type=> Hash ,default:{"ckeditor"=>0,"site-preference(two-site-logo)"=>0,"member"=>0,"accessibility"=>0}
field :file_show, :type=> Hash ,default:{"ckeditor"=>{:files=>{'config@js@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=> @ckeditor_path}, field :file_show, :type=> Hash ,default: {
'ckeditor@js'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=> @ckeditor_path} "accessibility"=>{:files=>{
},:status=>0} ,
"site-preference(two-site-logo)"=>{:files=>{'site@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path},
'application_helper@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@helper_path},
'preference@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/sites/'}
},:status=>0} ,
"member"=>{:files=>{'member_profile@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path},
'admin/members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
'members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
'_user_basic_passwd@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/members/'},
'attribute_value@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path}
},:status=>0} ,
"accessibility"=>{:files=>{'back_end@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'layouts/'},
'_form@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'page_parts/'},
'jquery-ui-1@13@2/'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>Rails.root.to_s + '/app/assets/stylesheets/lib/jquery-ui-1.13.2/'}, 'jquery-ui-1@13@2/'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>Rails.root.to_s + '/app/assets/stylesheets/lib/jquery-ui-1.13.2/'},
'orbit_bar/'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'orbit_bar/'}
},:status=>0} },:status=>0}
} }
# field :file_show, :type=> Hash ,default:{"ckeditor"=>{:files=>{'config@js@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=> @ckeditor_path},
# 'ckeditor@js'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=> @ckeditor_path}
# },:status=>0} ,
# "site-preference(two-site-logo)"=>{:files=>{'site@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path},
# 'application_helper@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@helper_path},
# 'preference@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/sites/'}
# },:status=>0} ,
# "member"=>{:files=>{'member_profile@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path},
# 'admin/members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
# 'members_controller@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@controller_path},
# '_user_basic_passwd@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/admin/', :dest=>@views_path+'admin/members/'},
# 'attribute_value@rb'=>{:status=>0, :sc=>@app_path+'/updatefiles/', :dest=>@model_path}
# },:status=>0} ,
# "accessibility"=>{:files=>{'back_end@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'layouts/'},
# '_form@html@erb'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'page_parts/'},
# 'jquery-ui-1@13@2/'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>Rails.root.to_s + '/app/assets/stylesheets/lib/jquery-ui-1.13.2/'},
# 'orbit_bar/'=>{:status=>0, :sc=>@app_path+'/updatefiles/accessibility/', :dest=>@views_path+'orbit_bar/'}
# },:status=>0}
# }
field :recovery, :type=> String , default:"false" field :recovery, :type=> String , default:"false"
field :last_message , :type=> String , default:"" field :last_message , :type=> String , default:""
field :num , default: 0 field :num , default: 0
@ -157,11 +162,10 @@ class Filefield
self.last_message += ('backuping '+file_name+'</br>') self.last_message += ('backuping '+file_name+'</br>')
begin begin
backup_file(file_name,sub_property[:dest]) backup_file(file_name,sub_property[:dest])
puts 'finish backup</br>' puts 'finish backup'
self.last_message += '<span style="color:green;">finish backup</span></br>' self.last_message += '<span style="color:green;">finish backup</span></br>'
rescue rescue
puts Dir.pwd puts 'error backup'
puts 'error backup</br>'
self.last_message += ('<span style="color:red;">Dir: '+Dir.pwd+'</span></br>') self.last_message += ('<span style="color:red;">Dir: '+Dir.pwd+'</span></br>')
self.last_message += '<span style="color:red;">error backup</span></br>' self.last_message += '<span style="color:red;">error backup</span></br>'
end end
@ -172,7 +176,6 @@ class Filefield
puts 'finish copy' puts 'finish copy'
self.last_message += '<span style="color:green;">finish copy</span></br>' self.last_message += '<span style="color:green;">finish copy</span></br>'
rescue rescue
puts Dir.pwd
self.last_message += ('<span style="color:red;">Dir: '+Dir.pwd+'</span></br>') self.last_message += ('<span style="color:red;">Dir: '+Dir.pwd+'</span></br>')
puts 'error copy' puts 'error copy'
self.last_message += '<span style="color:red;">error copy</span></br>' self.last_message += '<span style="color:red;">error copy</span></br>'

View File

@ -59,6 +59,13 @@
<br> <br>
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button> <button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>
<button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button> <button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button>
<%
default_file_show = @file_to_show..fields['file_show'].options[:default]
if @file_to_show.file_show.count != default_file_show.count
@file_to_show.file_show = default_file_show
@file_to_show.save
end
%>
<%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%> <%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
<%= file.fields_for :file_show do |filefield|%> <%= file.fields_for :file_show do |filefield|%>
<div id="fileform"> <div id="fileform">
@ -170,14 +177,12 @@
}); });
$("#clickall").off("click").on("click",function(){ $("#clickall").off("click").on("click",function(){
for(var i =0;i<$(".sub_checkbox").length ; i++){ for(var i =0;i<$(".sub_checkbox").length ; i++){
if($(".checkbox").eq(i).is(":checked") == false) $(".checkbox").prop('checked', true);
$(".checkbox").eq(i).click();
} }
}); });
$("#unclickall").off("click").on("click",function(){ $("#unclickall").off("click").on("click",function(){
for(var i =0;i<$(".sub_checkbox").length ; i++){ for(var i =0;i<$(".sub_checkbox").length ; i++){
if($(".checkbox").eq(i).is(":checked") == true) $(".checkbox").prop('checked', false);
$(".checkbox").eq(i).click();
} }
}); });
function seelogfcn(){ function seelogfcn(){