2019-09-28 11:48:59 +00:00
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<% @i = 0 %>
|
2019-09-30 00:35:34 +00:00
|
|
|
|
<button id="clickall"><%= (I18n.locale.to_s == "zh_tw") ? "全選" : "select all" %></button>
|
|
|
|
|
<button id="unclickall"><%= (I18n.locale.to_s == "zh_tw") ? "取消全選" : "unselect all" %></button>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%=form_for @file_to_show ,:url=>{:controller=>"patchfiles" ,:action=>"edit"} do |file|%>
|
|
|
|
|
<%= file.fields_for :file_show do |filefield|%>
|
2019-09-30 00:35:34 +00:00
|
|
|
|
<div id="fileform">
|
2019-09-30 11:04:37 +00:00
|
|
|
|
|
|
|
|
|
<% @file_to_show.file_show.each do |name,property| %>
|
|
|
|
|
<span style="clear:both;">
|
|
|
|
|
<%if property[:status].to_i == 1%>
|
|
|
|
|
<%=filefield.check_box name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%else%>
|
2019-09-30 11:04:37 +00:00
|
|
|
|
<%=filefield.check_box name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"checkbox",:style=>"float:left;"}%>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%end%>
|
2019-09-30 11:04:37 +00:00
|
|
|
|
<label for="<%="checkbox"+@i.to_s%>" class="checklabel" style="float:left;"><%=name%></label>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<div style="clear:both;"></div>
|
2019-09-30 11:04:37 +00:00
|
|
|
|
<% @i = @i+1 %>
|
|
|
|
|
<% @j = 0 %>
|
|
|
|
|
<%= file.fields_for :sub_file_fields do |each_files|%>
|
|
|
|
|
<%= each_files.fields_for name do |each_file|%>
|
|
|
|
|
<% property[:files].each do |file_name,sub_property| %>
|
|
|
|
|
<%if sub_property[:status].to_i == 1%>
|
|
|
|
|
<%=each_file.check_box file_name,{:checked=>true,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
|
|
|
|
<%else%>
|
|
|
|
|
<%=each_file.check_box file_name,{:checked=>false,:id=>"checkbox"+@i.to_s,:class=>"sub_checkbox",:style=>"float:left;margin-left:1em;",:index=>@j}%>
|
|
|
|
|
<%end%>
|
|
|
|
|
<% file_name = file_name.gsub("@",".") %>
|
|
|
|
|
<label for="<%="checkbox"+@i.to_s%>" class="sub_checklabel" style="float:left;"><%=file_name%></label>
|
|
|
|
|
<div style="clear:both;"></div>
|
|
|
|
|
<% @i = @i+1 %>
|
|
|
|
|
<% @j = @j+1 %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%end%>
|
|
|
|
|
<%end%>
|
|
|
|
|
</span>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%end%>
|
2019-09-30 00:35:34 +00:00
|
|
|
|
</div>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%end%>
|
2019-09-30 00:35:34 +00:00
|
|
|
|
<%=file.submit "#{t(:updatefont)}",{:id=>"updatebtn",:onclick=>"return updatefcn()"}%>
|
|
|
|
|
<%=file.text_field :recovery_btn, {:id=>"hidden-recovery",:type => "hidden",:value=>"false"} %>
|
2019-09-30 11:04:37 +00:00
|
|
|
|
<button id="seemessage" onclick="return seelogfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "查看上次更新的logs" : "see logs of prev update "%></button>
|
2019-09-30 00:35:34 +00:00
|
|
|
|
<button id="recoverybtn" onclick="return recoveryfcn()"><%=(I18n.locale.to_s =="zh_tw") ? "復原到上次更新的檔案狀態" : "recovery to prev file status"%></button>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<%end%>
|
2019-10-28 11:39:05 +00:00
|
|
|
|
<a>網站目錄根路徑:<%=Dir.pwd.to_s%></a>
|
2019-09-28 11:48:59 +00:00
|
|
|
|
<li id ="ckeditorFont" class="show_li">
|
|
|
|
|
<a title="CKEDITOR現有字形">CKEDITOR現有字形</a>
|
|
|
|
|
<% @ckicktosee_str = (I18n.locale.to_s == "en") ? "click me to see all font which CKEDITOR have now" : "點擊我來查看編輯器所有目前擁有的字形" %>
|
|
|
|
|
<a id="clicktosee" title="<%= @ckicktosee_str %>" class="Toggleclass"><%= @ckicktosee_str %></a>
|
|
|
|
|
<ul>
|
|
|
|
|
<% @font_array.each do |font|%>
|
|
|
|
|
<li><a title="<%= font %>"><%= font %></a></li>
|
|
|
|
|
<%end%>
|
|
|
|
|
</ul>
|
|
|
|
|
</li>
|
|
|
|
|
<a></a>
|
|
|
|
|
<style type="text/css">
|
|
|
|
|
.show_li,.show_li *{
|
|
|
|
|
list-style:none;
|
|
|
|
|
color:balck;
|
|
|
|
|
}
|
|
|
|
|
.show_li ul{
|
|
|
|
|
display:none;
|
|
|
|
|
}
|
|
|
|
|
#clicktosee{
|
|
|
|
|
color:blue;
|
|
|
|
|
cursor:pointer;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<script>
|
|
|
|
|
$('.Toggleclass').off("click").on("click",function(){
|
|
|
|
|
$(this).parent().find(">ul").slideToggle();
|
|
|
|
|
});
|
2019-09-30 11:04:37 +00:00
|
|
|
|
$('.checkbox').off('click').on('click',function(){
|
|
|
|
|
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
|
|
|
|
if($(this).is(":checked") == false){
|
|
|
|
|
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true)
|
|
|
|
|
$(this).parent().find('.sub_checkbox').eq(i).click();
|
|
|
|
|
}else{
|
|
|
|
|
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == false)
|
|
|
|
|
$(this).parent().find('.sub_checkbox').eq(i).click();
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
$('.sub_checkbox').off('click').on('click',function(){
|
|
|
|
|
var num = 0;
|
|
|
|
|
var index = 0;
|
|
|
|
|
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
|
|
|
|
if($(this).parent().find('.sub_checkbox').eq(i).is(":checked") == true){
|
|
|
|
|
num += 1;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
if( num == $(this).parent().find('.sub_checkbox').length){
|
|
|
|
|
if( $(this).parent().find('.checkbox').is(":checked") == false)
|
|
|
|
|
$(this).parent().find('.checkbox').click();
|
|
|
|
|
}else{
|
|
|
|
|
if( $(this).parent().find('.checkbox').is(":checked") == true){
|
|
|
|
|
$(this).parent().find('.checkbox').click();
|
|
|
|
|
for(var i = 0;i<$(this).parent().find('.sub_checkbox').length;i++){
|
|
|
|
|
if($(this).parent().find('.sub_checkbox').eq(i).attr('id') != $(this).attr('id'))
|
|
|
|
|
$(this).parent().find('.sub_checkbox').eq(i).click();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-09-30 00:35:34 +00:00
|
|
|
|
$("#clickall").off("click").on("click",function(){
|
2019-09-30 11:04:37 +00:00
|
|
|
|
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
2019-09-30 00:35:34 +00:00
|
|
|
|
if($(".checkbox").eq(i).is(":checked") == false)
|
2019-09-30 11:04:37 +00:00
|
|
|
|
$(".checkbox").eq(i).click();
|
2019-09-30 00:35:34 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$("#unclickall").off("click").on("click",function(){
|
2019-09-30 11:04:37 +00:00
|
|
|
|
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
2019-09-30 00:35:34 +00:00
|
|
|
|
if($(".checkbox").eq(i).is(":checked") == true)
|
2019-09-30 11:04:37 +00:00
|
|
|
|
$(".checkbox").eq(i).click();
|
2019-09-30 00:35:34 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
2019-09-30 11:04:37 +00:00
|
|
|
|
function seelogfcn(){
|
|
|
|
|
if($( "#dialog-confirm" ).length != 0)
|
|
|
|
|
$( "#dialog-confirm" ).remove();
|
|
|
|
|
if(I18n.locale == "zh_tw"){
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='上次更新的logs'></div>");
|
|
|
|
|
}else{
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='logs of prev update?'></div>");
|
|
|
|
|
};
|
|
|
|
|
$( "#dialog-confirm" ).append($.parseHTML("<%= @file_to_show.last_message.gsub("\"","\'").html_safe %>"));
|
|
|
|
|
$( "#dialog-confirm" ).dialog({
|
|
|
|
|
resizable: true,
|
|
|
|
|
height:200,
|
|
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
},
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
};
|
2019-09-30 00:35:34 +00:00
|
|
|
|
function updatefcn(){
|
|
|
|
|
var str="";
|
|
|
|
|
var num =1;
|
2019-09-30 11:04:37 +00:00
|
|
|
|
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
|
|
|
|
if($(".sub_checkbox").eq(i).is(":checked") == true){
|
|
|
|
|
str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>");
|
2019-09-30 00:35:34 +00:00
|
|
|
|
num += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if($( "#dialog-confirm" ).length != 0)
|
|
|
|
|
$( "#dialog-confirm" ).remove();
|
|
|
|
|
if(I18n.locale == "zh_tw"){
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='你確定要更新嗎?'>"+
|
2019-09-30 11:04:37 +00:00
|
|
|
|
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
|
|
|
|
"按下確認鍵後,你將更新你所選的檔案。"+str+"</p>"
|
2019-09-30 00:35:34 +00:00
|
|
|
|
+"</div>");
|
|
|
|
|
}else{
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='Are you sure to update?'>"+
|
2019-09-30 11:04:37 +00:00
|
|
|
|
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
|
|
|
|
"After click confirm button,you will update the selected file."+str+"</p>"
|
2019-09-30 00:35:34 +00:00
|
|
|
|
+"</div>");
|
2019-09-30 11:04:37 +00:00
|
|
|
|
};
|
2019-09-30 00:35:34 +00:00
|
|
|
|
$( "#dialog-confirm" ).dialog({
|
2019-09-30 11:04:37 +00:00
|
|
|
|
resizable: true,
|
2019-09-30 00:35:34 +00:00
|
|
|
|
height:200,
|
|
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
|
|
|
|
$( this ).dialog( "close" );
|
2019-09-30 11:04:37 +00:00
|
|
|
|
$('.edit_filefield').submit();
|
2019-09-30 00:35:34 +00:00
|
|
|
|
},
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2019-09-30 11:04:37 +00:00
|
|
|
|
return false;
|
2019-09-30 00:35:34 +00:00
|
|
|
|
};
|
|
|
|
|
function recoveryfcn(){
|
|
|
|
|
var str="";
|
|
|
|
|
var num =1;
|
2019-09-30 11:04:37 +00:00
|
|
|
|
for(var i =0;i<$(".sub_checkbox").length ; i++){
|
|
|
|
|
if($(".sub_checkbox").eq(i).is(":checked") == true){
|
|
|
|
|
str += ("</br><i style='color:red;'>"+num+". "+$(".sub_checklabel").eq(i).html()+"</i>");
|
2019-09-30 00:35:34 +00:00
|
|
|
|
num += 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if($( "#dialog-confirm" ).length != 0)
|
|
|
|
|
$( "#dialog-confirm" ).remove();
|
|
|
|
|
if(I18n.locale == "zh_tw"){
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='你確定要還原嗎?'>"+
|
2019-09-30 11:04:37 +00:00
|
|
|
|
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
|
|
|
|
"按下確認鍵後,你將還原你所選的檔案。"+str+"</p>"
|
2019-09-30 00:35:34 +00:00
|
|
|
|
+"</div>");
|
|
|
|
|
}else{
|
|
|
|
|
$('body').after("<div id='dialog-confirm' title='Are you sure to recover?'>"+
|
2019-09-30 11:04:37 +00:00
|
|
|
|
"<p><span class='ui-icon ui-icon-alert' style='float:left; margin:0 7px 0 0;'></span>"+
|
|
|
|
|
"After click confirm button,you will recover the selected file."+str+"</p>"
|
2019-09-30 00:35:34 +00:00
|
|
|
|
+"</div>");
|
|
|
|
|
}
|
|
|
|
|
$( "#dialog-confirm" ).dialog({
|
2019-09-30 11:04:37 +00:00
|
|
|
|
resizable: true,
|
2019-09-30 00:35:34 +00:00
|
|
|
|
height:200,
|
|
|
|
|
modal: true,
|
|
|
|
|
buttons: {
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "確認" : "confirm"%>: function(){
|
|
|
|
|
$('#hidden-recovery').val("true");
|
|
|
|
|
$( this ).dialog( "close" );
|
2019-09-30 11:04:37 +00:00
|
|
|
|
$('.edit_filefield').submit();
|
2019-09-30 00:35:34 +00:00
|
|
|
|
},
|
|
|
|
|
<%=(I18n.locale == "zh_tw") ? "取消" : "Cancel"%>: function() {
|
|
|
|
|
$('#hidden-recovery').val("false");
|
|
|
|
|
$( this ).dialog( "close" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
};
|
2019-09-28 11:48:59 +00:00
|
|
|
|
</script>
|