Compare commits
11 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
0028a21307 | |
|
|
58051caac1 | |
|
|
5e9c6924e2 | |
|
|
a845a9d41b | |
|
|
72bd04099e | |
|
|
2258fd30e6 | |
|
|
b7142c884b | |
|
|
f4e88616c7 | |
|
|
9d45df1c5a | |
|
|
f59452ffc4 | |
|
|
69d588b9ef |
1
Gemfile
1
Gemfile
|
|
@ -20,6 +20,7 @@ gem "acts_as_unvlogable"
|
|||
gem 'youtube_it'
|
||||
gem 'gotcha'
|
||||
gem "geocoder"
|
||||
gem 'whenever', :require => false
|
||||
|
||||
# gem "memcached", "~> 1.4.3"
|
||||
# gem "memcache-client"
|
||||
|
|
|
|||
|
|
@ -1,108 +1,98 @@
|
|||
$(function() {
|
||||
var ListCheckData = {},
|
||||
ListCheck = function(element) {
|
||||
this.element = $(element);
|
||||
this.element.data('exists', true);
|
||||
if(this.element.context.parentNode.tagName == "TD") {
|
||||
this.elementWrap = $(this.element.context.parentNode);
|
||||
this.elementWrap.addClass('listCheck');
|
||||
} else if(this.element.context.parentNode.tagName == "TH") {
|
||||
this.elementWrap = $(this.element.context.parentNode);
|
||||
this.elementWrap.addClass('listCheckHead');
|
||||
}
|
||||
this.element.before('<i class="icon-check-empty" />');
|
||||
};
|
||||
|
||||
$.fn.listCheck = function () {
|
||||
$(this).each(function() {
|
||||
var $this = $(this),
|
||||
$el = $this.find('input[type="checkbox"]');
|
||||
$el.each(function (i) {
|
||||
if(!$(this).data('exists')) {
|
||||
new ListCheck(this);
|
||||
};
|
||||
});
|
||||
$this.on(clickEvent, $el, function(e) {
|
||||
if($(e.target).prop('checked')) {
|
||||
$(e.target).siblings('i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
|
||||
} else {
|
||||
$(e.target).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
|
||||
};
|
||||
if($(e.target).closest('th').hasClass('listCheckHead')) {
|
||||
$this.find('.listCheck input[type="checkbox"]').prop('checked', $(e.target).prop('checked'));
|
||||
if($(e.target).prop('checked')) {
|
||||
$this.find('.listCheck i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
|
||||
} else {
|
||||
$this.find('.listCheck i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
|
||||
}
|
||||
};
|
||||
|
||||
var _isCheck = $this.find('tbody').find($el).filter(':checked').length,
|
||||
_defaultLength = $this.find('tbody').find($el).length;
|
||||
|
||||
if(_isCheck > 0 && _isCheck < _defaultLength) {
|
||||
$this.find('.listCheckHead i').removeClass('icon-check-empty icon-check').addClass('icon-minus');
|
||||
} else if(!_isCheck) {
|
||||
$this.find('.listCheckHead i').removeClass('icon-minus icon-check').addClass('icon-check-empty');
|
||||
} else {
|
||||
$this.find('.listCheckHead i').removeClass('icon-check-empty icon-minus').addClass('icon-check');
|
||||
}
|
||||
_isCheck ? $this.find('.list-active-btn').removeClass('disabled').data('actionable', true) : $this.find('.list-active-btn').addClass('disabled').data('actionable', false);
|
||||
});
|
||||
$this.on(clickEvent, '.list-active-btn', function(e) {
|
||||
if(!$(this).hasClass('disabled')) {
|
||||
ListCheckData.url = $(this).attr('rel');
|
||||
ListCheckData.name = $this.find('tbody').find('input[type="checkbox"]').attr('name');
|
||||
ListCheckData.action = $(this).data('checkAction');
|
||||
ListCheckData.values = [];
|
||||
ListCheckData.element = $this
|
||||
$this.find('tbody').find('input[type="checkbox"]').each(function (i) {
|
||||
this.checked && ListCheckData.values.push("ids[]=" + this.value);
|
||||
});
|
||||
console.log(ListCheckData.values.join("&"));
|
||||
$('#dialog').modal('show');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
clearCheck($(this));
|
||||
};
|
||||
|
||||
function clearCheck(element) {
|
||||
element.find('input[type="checkbox"]').each(function() {
|
||||
$(this).prop('checked', false).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
|
||||
});
|
||||
element.find('.list-active-btn').addClass('disabled');
|
||||
};
|
||||
|
||||
function actionSuccess(e) {
|
||||
ListCheckData.element.find('tbody').find('input[type="checkbox"]').each(function() {
|
||||
switch(e) {
|
||||
case 'list-be-hide':
|
||||
$(this).filter(':checked').closest('tr').addClass('checkHide');
|
||||
break;
|
||||
case 'list-be-show':
|
||||
$(this).filter(':checked').closest('tr').removeClass('checkHide');
|
||||
break;
|
||||
case 'list-be-remove':
|
||||
$(this).filter(':checked').closest('tr').fadeOut(300, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
break;
|
||||
};
|
||||
$('.list-check').siblings('i').removeAttr('class').addClass('icon-check-empty').closest('tr').removeClass('checkHit');
|
||||
});
|
||||
clearCheck(ListCheckData.element);
|
||||
var ListCheck = function(element) {
|
||||
this.element = $(element);
|
||||
this.element.data('exists', true);
|
||||
if(this.element.context.parentNode.tagName == "TD") {
|
||||
this.elementWrap = $(this.element.context.parentNode);
|
||||
this.elementWrap.addClass('listCheck');
|
||||
} else if(this.element.context.parentNode.tagName == "TH") {
|
||||
this.elementWrap = $(this.element.context.parentNode);
|
||||
this.elementWrap.addClass('listCheckHead');
|
||||
}
|
||||
this.element.before('<i class="icon-check-empty" />');
|
||||
};
|
||||
|
||||
$.fn.listCheck = function (callback) {
|
||||
this.each(function (i) {
|
||||
if(!$(this).data('exists')) {
|
||||
new ListCheck(this);
|
||||
};
|
||||
});
|
||||
this.on(clickEvent, function(e) {
|
||||
if($(this).prop('checked')) {
|
||||
$(this).siblings('i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
|
||||
} else {
|
||||
$(this).siblings('i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
|
||||
};
|
||||
if ($(this).closest('.listCheckHead').length) {
|
||||
$('.listCheck .list-check').prop('checked', $(this).prop('checked'));
|
||||
if($(this).prop('checked')) {
|
||||
$('.listCheck i').addClass('icon-check').removeClass('icon-check-empty').closest('tr').addClass('checkHit');
|
||||
} else {
|
||||
$('.listCheck i').addClass('icon-check-empty').removeClass('icon-check').closest('tr').removeClass('checkHit');
|
||||
}
|
||||
};
|
||||
|
||||
var _isCheck = $('tbody .list-check').filter(':checked').length,
|
||||
_defaultLength = $('tbody .list-check').length;
|
||||
|
||||
if(_isCheck > 0 && _isCheck < _defaultLength) {
|
||||
$('.listCheckHead i').removeClass('icon-check-empty icon-check').addClass('icon-minus');
|
||||
} else if(!_isCheck) {
|
||||
$('.listCheckHead i').removeClass('icon-minus icon-check').addClass('icon-check-empty');
|
||||
} else {
|
||||
$('.listCheckHead i').removeClass('icon-check-empty icon-minus').addClass('icon-check');
|
||||
}
|
||||
_isCheck ? $('.list-active-btn').removeClass('disabled').data('actionable', true) : $('.list-active-btn').addClass('disabled').data('actionable', false);
|
||||
});
|
||||
};
|
||||
function clearCheck() {
|
||||
$('.list-check').each(function() {
|
||||
$(this).prop('checked', false);
|
||||
})
|
||||
}
|
||||
function actionSuccess(e) {
|
||||
$("tbody .list-check").each(function() {
|
||||
switch(e) {
|
||||
case 'list-be-hide':
|
||||
$(this).filter(':checked').closest('tr').addClass('checkHide');
|
||||
break;
|
||||
case 'list-be-show':
|
||||
$(this).filter(':checked').closest('tr').removeClass('checkHide');
|
||||
break;
|
||||
case 'list-be-remove':
|
||||
$(this).filter(':checked').closest('tr').fadeOut(300, function() {
|
||||
$(this).remove();
|
||||
});
|
||||
break;
|
||||
};
|
||||
$('.list-check').siblings('i').removeAttr('class').addClass('icon-check-empty').closest('tr').removeClass('checkHit');
|
||||
});
|
||||
clearCheck();
|
||||
}
|
||||
$(function() {
|
||||
var $t = null,
|
||||
_data = null;
|
||||
clearCheck();
|
||||
$('.list-check').listCheck();
|
||||
$('.list-active-btn').data('actionable', false).on(clickEvent, function(e) {
|
||||
$t = $(this)
|
||||
_data = $(this).data()
|
||||
_data.actionable ? $('#dialog').modal('show') : "";
|
||||
e.preventDefault();
|
||||
});
|
||||
$('.delete-item').on(clickEvent, function() {
|
||||
if(ListCheckData.url.indexOf("?") > -1) {
|
||||
$.ajax(ListCheckData.url + "&" + ListCheckData.values.join("&")).done(function() {
|
||||
actionSuccess(ListCheckData.action);
|
||||
var _v = [];
|
||||
$("tbody .list-check").each(function() {
|
||||
this.checked && _v.push("ids[]="+this.value)
|
||||
});
|
||||
var _t = $t.attr("rel");
|
||||
if(_t.indexOf("?") > -1) {
|
||||
$.ajax(_t + "&" + _v.join("&")).done(function() {
|
||||
actionSuccess(_data.checkAction)
|
||||
});
|
||||
} else {
|
||||
$.ajax(ListCheckData.url + "?" + ListCheckData.values.join("&")).done(function() {
|
||||
actionSuccess(ListCheckData.action);
|
||||
$.ajax(_t + "?" + _v.join("&")).done(function() {
|
||||
actionSuccess(_data.checkAction)
|
||||
});
|
||||
}
|
||||
$('#dialog').modal('hide');
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
$(function() {
|
||||
$(".post_preview").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
|
||||
var preview_url = $(this).attr('url');
|
||||
|
||||
$("form.previewable").ajaxSubmit({
|
||||
beforeSubmit: function(a,f,o){
|
||||
o.dataType = 'script';
|
||||
o.url = preview_url;
|
||||
o.type = 'post';
|
||||
},success: function(msg) {
|
||||
$('#show_preview .modal').modal()
|
||||
$.post($(this).attr('url'), $(".previewable").serialize() ,function(data){
|
||||
$('#show_preview .modal').modal();
|
||||
$('#show_preview .modal').height(function() {
|
||||
return $(window).height() * 0.7;
|
||||
});
|
||||
}});
|
||||
},'script');
|
||||
});
|
||||
$(".preview_trigger").click(function(){
|
||||
$("#main-wrap").after("<span id='show_preview'></span>");
|
||||
|
|
@ -45,10 +38,10 @@ $(function() {
|
|||
// o.url = url.nodeValue;
|
||||
// o.type = 'post';
|
||||
// },success: function(msg) {
|
||||
// $('#show_preview .modal').modal()
|
||||
// $('#show_preview .modal').height(function() {
|
||||
// return $(window).height() * 0.7;
|
||||
// });
|
||||
// $('#show_preview .modal').modal()
|
||||
// $('#show_preview .modal').height(function() {
|
||||
// return $(window).height() * 0.7;
|
||||
// });
|
||||
// }
|
||||
|
||||
// });
|
||||
|
|
|
|||
|
|
@ -682,8 +682,8 @@ legend {
|
|||
margin-bottom: 25px;
|
||||
}
|
||||
.sign-in .btn {
|
||||
padding: 4px 0;
|
||||
display: block;
|
||||
padding: 4px 0;
|
||||
width: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
@ -711,7 +711,7 @@ legend {
|
|||
.sign-in .checkbox {
|
||||
position: absolute;
|
||||
text-align: left;
|
||||
bottom: 37px;
|
||||
bottom: 47px;
|
||||
}
|
||||
.sign-in .switchboard {
|
||||
color: #08C;
|
||||
|
|
@ -766,4 +766,4 @@ legend {
|
|||
#main-wrap .wrap-inner {
|
||||
padding: 20px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
top: 0px;
|
||||
left: -10px;
|
||||
right: -10px;
|
||||
height: 40px;
|
||||
z-index: 1041;
|
||||
position: fixed;
|
||||
margin-bottom: 0;
|
||||
height: 40px;
|
||||
}
|
||||
#orbit-bar .orbitlogo {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
width: 50px;
|
||||
height: 40px;
|
||||
padding: 0!important;
|
||||
background-size: 70%;
|
||||
display: inline-block;
|
||||
display: block;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
background-image: url(<%= asset_path 'orbit-logo.svg' %>);
|
||||
|
|
@ -19,8 +20,23 @@
|
|||
/* For Suck IE */
|
||||
background-image: url(<%= asset_path 'orbit-logo.png' %>)\9;
|
||||
}
|
||||
#orbit-bar .dropdown-menu li > a {
|
||||
padding: 0 20px;
|
||||
display: block;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
#orbit-bar .dropdown-menu li i {
|
||||
float: left;
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
line-height: 30px;
|
||||
height: 100%;
|
||||
}
|
||||
#orbit-bar.navbar .nav > li > a {
|
||||
color: #EEE;
|
||||
padding: 0 15px;
|
||||
display: block;
|
||||
text-shadow: 0 -1px 0 #000;
|
||||
border-right: 1px solid #363636;
|
||||
box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.3);
|
||||
|
|
@ -34,6 +50,11 @@
|
|||
background-color: #0095CF;
|
||||
text-shadow: 0 -1px 0 #014380;
|
||||
}
|
||||
#orbit-bar.navbar .nav > li > a > [class^="icon"],
|
||||
#orbit-bar.navbar .nav > li > a > [class*=" icon"] {
|
||||
line-height: 40px;
|
||||
display: block;
|
||||
}
|
||||
#orbit-bar.navbar .nav li.dropdown.open > .dropdown-toggle,
|
||||
#orbit-bar.navbar .nav li.dropdown.active > .dropdown-toggle,
|
||||
#orbit-bar.navbar .nav li.dropdown.open.active > .dropdown-toggle {
|
||||
|
|
@ -41,9 +62,7 @@
|
|||
text-shadow: 0 -1px 0 #014380;
|
||||
}
|
||||
#orbit-bar .navbar-inner {
|
||||
height: 40px;
|
||||
border-width: 0;
|
||||
min-height: 40px;
|
||||
background-color: #333333;
|
||||
-webkit-border-radius: 0px;
|
||||
-moz-border-radius: 0px;
|
||||
|
|
@ -66,6 +85,10 @@
|
|||
right: auto;
|
||||
bottom: auto;
|
||||
}
|
||||
#orbit-bar .nav > li {
|
||||
display: block;
|
||||
line-height: 40px;
|
||||
}
|
||||
#orbit-bar .nav [class^="icon"],
|
||||
#orbit-bar .nav [class*=" icon"] {
|
||||
font-size: 1.5em;
|
||||
|
|
@ -92,17 +115,45 @@
|
|||
#orbit-bar .modal .input-prepend {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
#orbit-bar .modal .other-sign-in {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 30px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid #EDEDED;
|
||||
}
|
||||
#orbit-bar .modal .other-sign-in .btn {
|
||||
padding: 4px 0;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
width: 100%;
|
||||
}
|
||||
#orbit-bar .modal .other-sign-in p {
|
||||
position: absolute;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background-color: #FFF;
|
||||
padding: 0 10px;
|
||||
margin-bottom: 0;
|
||||
margin-left: -25px;
|
||||
line-height: 30px;
|
||||
left: 50%;
|
||||
bottom: -15px;
|
||||
font-size: 1.3em;
|
||||
color: #B1B1B1;
|
||||
}
|
||||
|
||||
/*Search*/
|
||||
#orbit-bar #search {
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
padding: 8px 10px 0;
|
||||
padding: 0 10px;
|
||||
border-right: 1px solid #363636;
|
||||
box-shadow: 1px 0px 0px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
#orbit-bar #search form {
|
||||
margin-bottom: 8px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
#orbit-bar #search input[type="text"] {
|
||||
height: 14px;
|
||||
|
|
@ -110,6 +161,7 @@
|
|||
font-size: 13px;
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
display: block;
|
||||
-webkit-border-radius: 12px;
|
||||
-moz-border-radius: 12px;
|
||||
-o-border-radius: 12px;
|
||||
|
|
@ -122,15 +174,16 @@
|
|||
#orbit-bar #search .search-clear {
|
||||
position: absolute;
|
||||
color: #A3A3A3;
|
||||
top: 14px;
|
||||
top: 16px;
|
||||
}
|
||||
#orbit-bar #search .icon-search {
|
||||
left: 13px;
|
||||
top: 15px;
|
||||
left: 15px;
|
||||
font-size: 1.2em;
|
||||
width: 1.25em;
|
||||
margin-top: 0;
|
||||
}
|
||||
#orbit-bar #search .search-clear {
|
||||
right: 14px;
|
||||
right: 13px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
#orbit-bar #search .search-clear:hover {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
vertical-align: middle;
|
||||
padding: 0 0 0 10px!important;
|
||||
}
|
||||
.listCheckHead input[type="checkbox"],
|
||||
.listCheck input[type="checkbox"] {
|
||||
.listCheckHead .list-check,
|
||||
.listCheck .list-check {
|
||||
position: absolute;
|
||||
margin: -12px 0 0 -1px;
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,752 @@
|
|||
# encoding: utf-8
|
||||
|
||||
require 'net/http'
|
||||
require 'open-uri'
|
||||
|
||||
class Admin::ImportDataController < OrbitBackendController
|
||||
# helper Admin::PagePartsHelper
|
||||
# include Admin::FrontendWidgetInterface
|
||||
open_for_user
|
||||
open_for_admin
|
||||
|
||||
def get_teacher_data
|
||||
uri = URI("https://localhost:8000/teachers.xml")
|
||||
|
||||
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
#uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
@teacher_data = Hash.from_xml(res.body)
|
||||
@teachers = @teacher_data["objects"]
|
||||
@i = 5000
|
||||
@teachers.each do |hash|
|
||||
# @roles = Role.skip(1).first
|
||||
@roles = Role.all
|
||||
@teacher = User.new
|
||||
I18n.locale = :zh_tw
|
||||
if !hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_zh_tw'].blank? && !hash['teacher_en'].blank?
|
||||
@teacher.first_name = hash['teacher_en']
|
||||
elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
|
||||
@teacher.first_name = "Please Fill the Name"
|
||||
end
|
||||
|
||||
I18n.locale = :en
|
||||
if !hash['teacher_en'].blank?
|
||||
@teacher.first_name = hash['teacher_en']
|
||||
elsif hash['teacher_en'].blank? && !hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_en'].blank? && hash['teacher_zh_tw'].blank?
|
||||
@teacher.first_name = "Please Fill the Name"
|
||||
end
|
||||
|
||||
#@teacher.first_name = hash['teacher_en']
|
||||
@teacher.ntu_seq = hash['ntu_seq']
|
||||
@teacher.sid = hash['ntu_seq']
|
||||
@teacher.role_ids = ["#{@roles.skip(1).first.id}"]
|
||||
@teacher.password = "testpass"
|
||||
@i += 10
|
||||
if !hash['email'].blank?
|
||||
@user = User.where(email: "#{hash['email']}")
|
||||
if @user.length == 0
|
||||
@teacher.email = hash['email']
|
||||
elsif @user.length > 0
|
||||
@teacher.email = "#{@i}duplicate@ntu.edu.tw"
|
||||
end
|
||||
else
|
||||
@teacher.email = "#{@i}@ntu.edu.tw"
|
||||
end
|
||||
|
||||
if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank?
|
||||
@teacher.user_id = "defaultuser"
|
||||
elsif hash['teacher_en'].blank?
|
||||
@teacher.user_id = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_zh_tw']
|
||||
@teacher.user_id = hash['teacher_en']
|
||||
end
|
||||
@teacher.save!
|
||||
end
|
||||
end
|
||||
|
||||
def get_book_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.ntu_seq.present?
|
||||
ntu_seq = hash.ntu_seq
|
||||
books_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
year: (book_node>"PublishYear").text,
|
||||
title: (book_node>"DocTitle").text,
|
||||
remarks: (book_node>"Remarks").text,
|
||||
publisher: (book_node>"Publisher").text,
|
||||
book_title: (book_node>"BookTitle").text
|
||||
}
|
||||
end
|
||||
if @books.present?
|
||||
@books.each do |b|
|
||||
@book = WritingBook.new
|
||||
I18n.locale = :zh_tw
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
I18n.locale = :en
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
@book.year = b[:year]
|
||||
@book.create_user_id = hash.id
|
||||
@book.save
|
||||
end
|
||||
else
|
||||
puts "No books by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def get_conference_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.ntu_seq.present?
|
||||
ntu_seq = hash.ntu_seq
|
||||
conference_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
|
||||
{
|
||||
author: (cp_node>"Authors").text,
|
||||
year: (cp_node>"PublishYear").text,
|
||||
title: (cp_node>"PaperTitle").text,
|
||||
conference: (cp_node>"PublishOn").text,
|
||||
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
|
||||
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
|
||||
conference_title: (cp_node>"PublishOn").text,
|
||||
remarks: (cp_node>"Remarks").text
|
||||
}
|
||||
end
|
||||
if @conference_papers.present?
|
||||
@conference_papers.each do |b|
|
||||
@conference_paper = WritingConference.new
|
||||
I18n.locale = :zh_tw
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
|
||||
@conference_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
@conference_paper.note = b[:remarks]
|
||||
|
||||
@conference_paper.location = b[:location]
|
||||
@conference_paper.year = b[:year]
|
||||
@conference_paper.create_user_id = hash.id
|
||||
|
||||
@conference_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No conference by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_journal_paper_data
|
||||
uri = URI("http://ann.cc.ntu.edu.tw/Achv/xmlTeacherData.asp")
|
||||
params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
teachers = User.all
|
||||
|
||||
teachers.each do |hash|
|
||||
if hash.ntu_seq.present?
|
||||
ntu_seq = hash.ntu_seq
|
||||
paper_xml = Nokogiri::XML( \
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
|
||||
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
|
||||
{
|
||||
author: (paper_node>"Authors").text,
|
||||
year: (paper_node>"PublishYear").text,
|
||||
title: (paper_node>"PaperTitle").text,
|
||||
journal: (paper_node>"PublishOn").text,
|
||||
volume:(paper_node>"Volume").text,
|
||||
volumeno:(paper_node>"VolumeNo").text,
|
||||
beginpage:(paper_node>"BeginPage").text,
|
||||
endpage:(paper_node>"EndPage").text,
|
||||
subgroup:(paper_node>"subgroup").text,
|
||||
remarks: (paper_node>"Remarks").text,
|
||||
cate: ((paper_node>"subgroup")>"Group").text
|
||||
}
|
||||
end
|
||||
if @journal_papers.present?
|
||||
@journal_papers.each do |b|
|
||||
@journal_paper = WritingJournal.new
|
||||
I18n.locale = :zh_tw
|
||||
@journal_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@journal_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
@journal_paper.year = b[:year]
|
||||
@journal_paper.vol_no = b[:volumeno]
|
||||
@journal_paper.form_to_start = b[:beginpage]
|
||||
@journal_paper.form_to_end = b[:endpage]
|
||||
if !b[:cate].blank?
|
||||
@level_type = JournalLevelType.where(:key => b[:cate])
|
||||
if @level_type.present?
|
||||
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
|
||||
end
|
||||
end
|
||||
|
||||
@journal_paper.create_user_id = hash.id
|
||||
@journal_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No journal paper by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sync_conference_data
|
||||
@conference_data = WritingConference.where(create_user_id: "#{params[:user_id]}")
|
||||
@conference_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
conference_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
|
||||
{
|
||||
author: (cp_node>"Authors").text,
|
||||
year: (cp_node>"PublishYear").text,
|
||||
title: (cp_node>"PaperTitle").text,
|
||||
conference: (cp_node>"PublishOn").text,
|
||||
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
|
||||
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
|
||||
conference_title: (cp_node>"PublishOn").text,
|
||||
remarks: (cp_node>"Remarks").text
|
||||
}
|
||||
end
|
||||
if @conference_papers.present?
|
||||
@conference_papers.each do |b|
|
||||
@conference_paper = WritingConference.new
|
||||
I18n.locale = :zh_tw
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
|
||||
@conference_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
@conference_paper.note = b[:remarks]
|
||||
|
||||
@conference_paper.location = b[:location]
|
||||
@conference_paper.year = b[:year]
|
||||
@conference_paper.create_user_id = @user.id
|
||||
|
||||
@conference_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No conference by Teacher"
|
||||
end
|
||||
end
|
||||
|
||||
redirect_to request.referer
|
||||
end
|
||||
|
||||
|
||||
def sync_journal_paper_data
|
||||
@journal_data = WritingJournal.where(create_user_id: "#{params[:user_id]}")
|
||||
@journal_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
paper_xml = Nokogiri::XML( \
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
|
||||
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
|
||||
{
|
||||
author: (paper_node>"Authors").text,
|
||||
year: (paper_node>"PublishYear").text,
|
||||
title: (paper_node>"PaperTitle").text,
|
||||
journal: (paper_node>"PublishOn").text,
|
||||
volume:(paper_node>"Volume").text,
|
||||
volumeno:(paper_node>"VolumeNo").text,
|
||||
beginpage:(paper_node>"BeginPage").text,
|
||||
endpage:(paper_node>"EndPage").text,
|
||||
subgroup:(paper_node>"subgroup").text,
|
||||
remarks: (paper_node>"Remarks").text,
|
||||
cate: ((paper_node>"subgroup")>"Group").text
|
||||
}
|
||||
end
|
||||
if @journal_papers.present?
|
||||
@journal_papers.each do |b|
|
||||
@journal_paper = WritingJournal.new
|
||||
I18n.locale = :zh_tw
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
@journal_paper.year = b[:year]
|
||||
@journal_paper.vol_no = b[:volumeno]
|
||||
@journal_paper.form_to_start = b[:beginpage]
|
||||
@journal_paper.form_to_end = b[:endpage]
|
||||
|
||||
if !b[:cate].blank?
|
||||
@level_type = JournalLevelType.where(:key => b[:cate])
|
||||
if @level_type.present?
|
||||
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
|
||||
end
|
||||
end
|
||||
|
||||
@journal_paper.create_user_id = @user.id
|
||||
@journal_paper.save!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
redirect_to request.referer
|
||||
end
|
||||
|
||||
def sync_book_data
|
||||
@books_data = WritingBook.where(create_user_id: "#{params[:user_id]}")
|
||||
@books_data.delete_all
|
||||
@user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if @user.sid.present?
|
||||
ntu_seq = @user.sid
|
||||
books_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
year: (book_node>"PublishYear").text,
|
||||
title: (book_node>"DocTitle").text,
|
||||
remarks: (book_node>"Remarks").text,
|
||||
publisher: (book_node>"Publisher").text,
|
||||
book_title: (book_node>"BookTitle").text
|
||||
}
|
||||
end
|
||||
if @books.present?
|
||||
@books.each do |b|
|
||||
@book = WritingBook.new
|
||||
I18n.locale = :zh_tw
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
I18n.locale = :en
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
@book.year = b[:year]
|
||||
@book.create_user_id = @user.id
|
||||
@book.save
|
||||
end
|
||||
end
|
||||
end
|
||||
redirect_to request.referer
|
||||
end
|
||||
|
||||
|
||||
def sync_conference_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@conference_data = WritingConference.where(create_user_id: "#{user.id}")
|
||||
@conference_data.delete_all
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if user.sid.present?
|
||||
ntu_seq = user.sid
|
||||
conference_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=C"))
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
@conference_papers = conference_xml.xpath("//Paper").map do |cp_node|
|
||||
{
|
||||
author: (cp_node>"Authors").text,
|
||||
year: (cp_node>"PublishYear").text,
|
||||
title: (cp_node>"PaperTitle").text,
|
||||
conference: (cp_node>"PublishOn").text,
|
||||
date: Date::MONTHNAMES[(cp_node>"PublishMonth").text.to_i],
|
||||
location: "#{(cp_node>"Country").text} #{(cp_node>"location").text}",
|
||||
conference_title: (cp_node>"PublishOn").text,
|
||||
remarks: (cp_node>"Remarks").text
|
||||
}
|
||||
end
|
||||
if @conference_papers.present?
|
||||
@conference_papers.each do |b|
|
||||
@conference_paper = WritingConference.new
|
||||
I18n.locale = :zh_tw
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
|
||||
@conference_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@conference_paper.authors = b[:author]
|
||||
if b[:title].blank?
|
||||
@conference_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.paper_title = b[:title]
|
||||
end
|
||||
if b[:conference_title].blank?
|
||||
@conference_paper.conference_title = "No Title Present"
|
||||
else
|
||||
@conference_paper.conference_title = b[:conference_title]
|
||||
end
|
||||
@conference_paper.note = b[:remarks]
|
||||
|
||||
@conference_paper.location = b[:location]
|
||||
@conference_paper.year = b[:year]
|
||||
@conference_paper.create_user_id = user.id
|
||||
|
||||
@conference_paper.save!
|
||||
end
|
||||
else
|
||||
puts "No conference by Teacher"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def sync_journal_paper_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@journal_data = WritingJournal.where(create_user_id: "#{user_id}")
|
||||
@journal_data.delete_all
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if user.sid.present?
|
||||
ntu_seq = user.sid
|
||||
paper_xml = Nokogiri::XML( \
|
||||
#open("http://versatile.management.ntu.edu.tw/publication1/journal/#{ntuseq}.xml"))
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlPaper.asp?Seq=#{ntu_seq}&type=J"))
|
||||
@journal_papers = paper_xml.xpath("//Paper").map do |paper_node|
|
||||
{
|
||||
author: (paper_node>"Authors").text,
|
||||
year: (paper_node>"PublishYear").text,
|
||||
title: (paper_node>"PaperTitle").text,
|
||||
journal: (paper_node>"PublishOn").text,
|
||||
volume:(paper_node>"Volume").text,
|
||||
volumeno:(paper_node>"VolumeNo").text,
|
||||
beginpage:(paper_node>"BeginPage").text,
|
||||
endpage:(paper_node>"EndPage").text,
|
||||
subgroup:(paper_node>"subgroup").text,
|
||||
remarks: (paper_node>"Remarks").text,
|
||||
cate: ((paper_node>"subgroup")>"Group").text
|
||||
}
|
||||
end
|
||||
if @journal_papers.present?
|
||||
@journal_papers.each do |b|
|
||||
@journal_paper = WritingJournal.new
|
||||
I18n.locale = :zh_tw
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
I18n.locale = :en
|
||||
@journal_paper.authors = b[:author]
|
||||
|
||||
if b[:title].blank?
|
||||
@journal_paper.paper_title = "No Title Present"
|
||||
else
|
||||
@journal_paper.paper_title = b[:title]
|
||||
end
|
||||
|
||||
@journal_paper.journal_title = b[:journal]
|
||||
@journal_paper.note = b[:remarks]
|
||||
@journal_paper.year = b[:year]
|
||||
@journal_paper.vol_no = b[:volumeno]
|
||||
@journal_paper.form_to_start = b[:beginpage]
|
||||
@journal_paper.form_to_end = b[:endpage]
|
||||
|
||||
if !b[:cate].blank?
|
||||
@level_type = JournalLevelType.where(:key => b[:cate])
|
||||
if @level_type.present?
|
||||
@journal_paper.journal_level_type_ids = ["#{@level_type.first.id}"]
|
||||
end
|
||||
end
|
||||
|
||||
@journal_paper.create_user_id = user.id
|
||||
@journal_paper.save!
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sync_book_data_auto
|
||||
@user = User.all
|
||||
@user.each do |user|
|
||||
@books_data = WritingBook.where(create_user_id: "#{user_id}")
|
||||
@books_data.delete_all
|
||||
# @user = User.find("#{params[:user_id]}")
|
||||
|
||||
# teachers.each do |hash|
|
||||
if user.sid.present?
|
||||
ntu_seq = user.sid
|
||||
books_xml = Nokogiri::XML( \
|
||||
open("http://ann.cc.ntu.edu.tw/Achv/xmlBook.asp?Seq=#{ntu_seq}"))
|
||||
@books = books_xml.xpath("//Book").map do |book_node|
|
||||
{
|
||||
author: (book_node>"Authors").text,
|
||||
year: (book_node>"PublishYear").text,
|
||||
title: (book_node>"DocTitle").text,
|
||||
remarks: (book_node>"Remarks").text,
|
||||
publisher: (book_node>"Publisher").text,
|
||||
book_title: (book_node>"BookTitle").text
|
||||
}
|
||||
end
|
||||
if @books.present?
|
||||
@books.each do |b|
|
||||
@book = WritingBook.new
|
||||
I18n.locale = :zh_tw
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
I18n.locale = :en
|
||||
@book.authors = b[:author]
|
||||
@book.paper_title = b[:title]
|
||||
@book.book_title = b[:book_title]
|
||||
@book.note = b[:remarks]
|
||||
@book.publisher = b[:publisher]
|
||||
@book.year = b[:year]
|
||||
@book.create_user_id = user.id
|
||||
@book.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def get_announcement_data
|
||||
uri = URI("https://localhost:8000/announcements.xml")
|
||||
|
||||
#params = {"UnitName" => "管理學院".encode('big5-uao'), "account" => "manage"}
|
||||
#uri.query = URI.encode_www_form(params)
|
||||
res = Net::HTTP.get_response(uri)
|
||||
|
||||
@announcement_data = Hash.from_xml(res.body)
|
||||
@announcements = @announcement_data["objects"]
|
||||
@announcements.each do |hash|
|
||||
@bulletin = Bulletin.new
|
||||
|
||||
I18n.locale = :zh_tw
|
||||
if hash['announcement_title_zh_tw'].blank?
|
||||
@bulletin.title = hash['announcement_title_en']
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
elsif hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
|
||||
@bulletin.title = "Please Fill the Name"
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
else
|
||||
@bulletin.title = hash['announcement_title_zh_tw']
|
||||
@bulletin.text = hash['announcement_content_zh_tw']
|
||||
end
|
||||
|
||||
I18n.locale = :en
|
||||
if hash['announcement_title_zh_tw'].blank? && hash['announcement_title_en'].blank?
|
||||
@bulletin.title = "Please Fill the Name"
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
|
||||
elsif hash['announcement_title_en'].blank?
|
||||
@bulletin.title = hash['announcement_zh_tw']
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
|
||||
elsif hash['announcement_title_zh_tw'].blank?
|
||||
@bulletin.title = hash['announcement_title_en']
|
||||
@bulletin.text = hash['announcement_content_en']
|
||||
end
|
||||
@bulletin.category_id = "51d2a16438178423c2000001"
|
||||
@bulletin.is_pending = true
|
||||
|
||||
@bulletin.save!
|
||||
end
|
||||
end
|
||||
|
||||
# def get_page_data
|
||||
# f = File.open("/home/rwub/orbit-db/ntu_mb/pages/management_pages.xml")
|
||||
# page_xml = Nokogiri::XML(f)
|
||||
# #open("http://versatile.management.ntu.edu.tw/publication1/conference/#{ntuseq}.xml"))
|
||||
# @pages = page_xml.xpath("//management-page").map do |cp_node|
|
||||
# {
|
||||
# menu_title: (cp_node>"menu-title").text,
|
||||
# content: (cp_node>"content").text
|
||||
# }
|
||||
# end
|
||||
|
||||
# if @pages.present?
|
||||
# @i=0
|
||||
# @pages.each do |b|
|
||||
|
||||
# get_variables_for_new
|
||||
# @page = Page.new
|
||||
|
||||
# @page.parent = "4f45f3b9e9d02c5db900005d"
|
||||
# @page.design = "50ac424983e75219d2000021"
|
||||
# @page.theme_id = "50ac424a83e75219d2000025"
|
||||
# @page.menu_enabled_for= ["en", "zh_tw", ""]
|
||||
# @page.enabled_for= ["en", "zh_tw", ""]
|
||||
# @page.is_published = false
|
||||
# if b[:menu_title].blank?
|
||||
# @page.title = 'No Title Present'
|
||||
# @i += 1
|
||||
# @page.name = "#{@i}Page"
|
||||
# else
|
||||
# @i += 1
|
||||
# @page.title = b[:menu_title]
|
||||
# @page.name = "#{@i}Page"
|
||||
# end
|
||||
# if b[:content].blank?
|
||||
# @page.content = "No Content Present"
|
||||
# else
|
||||
# @page.content = b[:content]
|
||||
# end
|
||||
# @page.save!
|
||||
# end
|
||||
# else
|
||||
# puts "No Page Data"
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
# def get_variables_for_new
|
||||
# @designs = Design.all.entries
|
||||
# @themes = Design.first.themes
|
||||
# @module_apps = ModuleApp.for_frontend_select
|
||||
# @app_frontend_urls = nil
|
||||
# @categories = nil
|
||||
# @tags = nil
|
||||
# @page_frontend_data_counts = nil
|
||||
# @frontend_styles = nil
|
||||
# @selected={
|
||||
# :design => @designs.first,
|
||||
# :theme=> @themes.first,
|
||||
# :module_app=>nil,#@module_apps.first
|
||||
# :app_frontend_url=> nil, #@module_apps.first
|
||||
# :category=>nil,
|
||||
# :tag=>nil,
|
||||
# :page_frontend_data_count=>nil,
|
||||
# :frontend_style => nil
|
||||
# }
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -36,26 +36,6 @@ class Admin::PagesController < Admin::ItemsController
|
|||
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
|
||||
end
|
||||
if @item.update_attributes(params[:page])
|
||||
unless params[:page]['frontend_field'].nil?
|
||||
frontend_class = []
|
||||
frontend_field_name = []
|
||||
frontend_sat_to_link = []
|
||||
|
||||
params[:page]['frontend_field'].each do |field|
|
||||
frontend_class << field['class']
|
||||
frontend_field_name << field['field_name']
|
||||
frontend_sat_to_link << field['sat_to_link']
|
||||
end
|
||||
|
||||
@item['frontend_class'] = frontend_class
|
||||
@item['frontend_field_name'] = frontend_field_name
|
||||
@item['frontend_sat_to_link'] = frontend_sat_to_link
|
||||
end
|
||||
|
||||
@item['tag'] = params[:page]['tag'] == nil ? [] : params[:page]['tag']
|
||||
|
||||
@item.save
|
||||
|
||||
render 'admin/items/reload_items'
|
||||
else
|
||||
@error = error_messages_for(@item)
|
||||
|
|
|
|||
|
|
@ -72,10 +72,7 @@ class Admin::SitesController < OrbitBackendController
|
|||
end
|
||||
|
||||
def system_info
|
||||
@disk_free = `df -h /`.gsub("\n","<br/>").html_safe
|
||||
@nginx_version = %x[/opt/nginx/sbin/nginx -v 2>&1].gsub("\n","<br/> ").html_safe
|
||||
@mongo_version = `mongod --version`.split("\n")[0].html_safe
|
||||
@linux_version = `lsb_release -d`.split(":")[1].html_safe
|
||||
|
||||
end
|
||||
|
||||
def search_engine
|
||||
|
|
|
|||
|
|
@ -1,95 +1,22 @@
|
|||
require 'net/http'
|
||||
require 'uri'
|
||||
require 'fileutils'
|
||||
require 'zip/zip'
|
||||
class Admin::TemplateStoreController < OrbitBackendController
|
||||
|
||||
|
||||
@@store_domain = STORE_CONFIG[:store_settings]["url"]
|
||||
def index
|
||||
@store = @@store_domain
|
||||
@design_ids = Design.all.map{|d| d.template_store_id}
|
||||
@templates = JSON.parse(get_templates)
|
||||
end
|
||||
|
||||
def show
|
||||
@store = @@store_domain
|
||||
@design_ids = Design.all.map{|d| d.template_store_id}
|
||||
@template = JSON.parse(get_template(params[:id])) rescue nil
|
||||
end
|
||||
|
||||
def download_theme
|
||||
url = @@store_domain + params["url"]
|
||||
url_base = url.split('/')[2]
|
||||
url_path = '/'+url.split('/')[3..-1].join('/')
|
||||
Net::HTTP.start(url_base) do |http|
|
||||
open("public/#{params['slug']}.zip", "wb") do |file|
|
||||
http.get(url_path) do |str|
|
||||
file.write(str)
|
||||
end
|
||||
end
|
||||
end
|
||||
upload_package("#{params['slug']}.zip", params["id"])
|
||||
File.delete("public/#{params['slug']}.zip")
|
||||
render :json => {"success"=>true,"url"=>@@store_domain + params["url"]}.to_json
|
||||
render :json => {"success"=>true}.to_json
|
||||
end
|
||||
protected
|
||||
|
||||
def upload_package(package_name,template_store_id)
|
||||
|
||||
temp_file = Tempfile.new("temp_file")
|
||||
original_file = File.open("#{Rails.root}/public/#{package_name}")
|
||||
temp_file.write(original_file.read.force_encoding('UTF-8'))
|
||||
temp_file.rewind
|
||||
filename = File.basename(original_file,".zip")
|
||||
unzip_design(temp_file, filename, template_store_id)
|
||||
temp_file.close
|
||||
|
||||
end
|
||||
|
||||
def unzip_design(file, zip_name, template_store_id)
|
||||
Zip::ZipFile.open(file) { |zip_file|
|
||||
design = Design.new.from_json(zip_file.read("#{zip_name}/info.json"))
|
||||
design.template_store_id = template_store_id
|
||||
Dir.mktmpdir('f_path') { |dir|
|
||||
themes_entries = []
|
||||
javascripts_entries = []
|
||||
images_entries = []
|
||||
|
||||
zip_file.entries.each do |entry|
|
||||
case (path = entry.to_s)
|
||||
when /\A(#{zip_name})\/(default\.css)\z/ #for default css
|
||||
design.build_css_default(:file => get_temp_file(zip_file, dir, entry))
|
||||
when /\A(#{zip_name})\/(reset\.css)\z/ #for reset css
|
||||
design.build_css_reset(:file => get_temp_file(zip_file, dir, entry))
|
||||
when /\A(#{zip_name})\/(layout\.html)\z/ #for layout html
|
||||
design.build_layout(:file => get_temp_file(zip_file, dir, entry))
|
||||
when /\A(#{zip_name})\/(themes)\/.*(\.css)\z/ #for themes css
|
||||
themes_entries << entry
|
||||
when /\A(#{zip_name})\/(javascripts)\/.*(\.js)\z/ #for js
|
||||
javascripts_entries << entry
|
||||
when /\A(#{zip_name})\/(images)\/.*((\.jpg)|(\.png)|(\.gif))\z/ #for img
|
||||
images_entries << entry
|
||||
end
|
||||
end
|
||||
|
||||
['themes', 'javascripts', 'images'].each do |type|
|
||||
eval("#{type}_entries").each do |entry|
|
||||
eval("design.#{type}").build(:file => get_temp_file(zip_file, dir, entry))
|
||||
end
|
||||
end
|
||||
}
|
||||
design.save
|
||||
}
|
||||
end
|
||||
|
||||
def get_temp_file(zip_file, dir, entry)
|
||||
filename = File.basename(entry.to_s)
|
||||
temp_file = File.new(dir + '/' + filename, 'w+')
|
||||
temp_file.write (zip_file.read entry ).force_encoding('UTF-8')
|
||||
temp_file
|
||||
end
|
||||
|
||||
def get_template(id)
|
||||
uri = URI.parse("#{@@store_domain}/api/templates/#{id}")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
class OrbitBackendController < ApplicationController
|
||||
include OrbitCategory::Categorizing
|
||||
include OrbitCoreLib::Authorization
|
||||
include OrbitCoreLib::PermissionUtility
|
||||
include OrbitTag::Tagging
|
||||
include AdminHelper
|
||||
include ApplicationHelper
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
# encoding: utf-8
|
||||
|
||||
class SessionsController < Devise::SessionsController
|
||||
prepend_before_filter :require_no_authentication, :only => [ :new, :create ]
|
||||
|
||||
|
||||
def create
|
||||
@site = Site.first
|
||||
|
||||
private_key = OpenSSL::PKey::RSA.new(@site.private_key)
|
||||
wresult = private_key.private_decrypt(request.params['wresult'])
|
||||
|
||||
@ids = wresult.split("@")
|
||||
|
||||
login_uid = @ids[0]
|
||||
|
||||
resource = User.first(conditions:{user_id: login_uid})
|
||||
|
||||
if !resource.blank?
|
||||
resource_name = resource.class.to_s.downcase
|
||||
sign_in(resource_name, resource)
|
||||
session[:user_id_type] = "myntumb"
|
||||
redirect_to after_sign_in_path_for(resource)
|
||||
else
|
||||
flash[:error] = "很抱歉,您無此權限或帳號登入本站,請洽本站管理員<br />Sorry, you don't have the account or authority to login. Please contact the website administrator."
|
||||
redirect_to :root
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_id_type = session[:user_id_type]
|
||||
sign_out
|
||||
if @user_id_type == "myntumb"
|
||||
redirect_to "https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignout1.0&wreply=https://management.ntu.edu.tw"
|
||||
else
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -12,13 +12,13 @@ module OrbitBackendHelper
|
|||
|
||||
def show_form_status_field(object)
|
||||
#by_object = (!object.is_expired? and object.is_pending?)
|
||||
by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
|
||||
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?)
|
||||
by_user
|
||||
end
|
||||
|
||||
def show_approval_link(object)
|
||||
by_object = (!object.is_expired? and object.is_pending?)
|
||||
by_user = ((object.category.user_is_authorized_by_title?(current_user,"category_approval_#{@module_app.key}") rescue nil) or is_manager? or is_admin?)
|
||||
by_user = ((object.category.authed_users("approval_#{@module_app.key}").include?(current_user) rescue nil) or is_manager? or is_admin? or is_sub_manager?)
|
||||
by_object and by_user
|
||||
end
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ module OrbitBackendHelper
|
|||
content_tag :li, link_to(t(quick[:translation] || :authorization_), eval("#{quick[:link]}"), class: "preview_trigger #{quick[:class]}")
|
||||
end
|
||||
when 'edit'
|
||||
if authorization && approvable || is_manager?
|
||||
if authorization && approvable
|
||||
content_tag :li, link_to(t(quick[:translation] || :edit), quick[:link].nil? ? '#' : eval("#{quick[:link]}('#{object.id}'#{link_option})"), class: quick[:class], data: eval("#{quick[:data]}"))
|
||||
end
|
||||
when 'delete'
|
||||
|
|
@ -321,17 +321,7 @@ module OrbitBackendHelper
|
|||
content_tag :li, link_to(t(quick[:translation] || :rejected_reason) + ' ' + truncate(object.not_checked_reason, :length => 10), '#', rel: "tooltip", 'data-original-title' => (wrap_string_with(object.not_checked_reason, :line_width => 24)), class: "reject_info #{quick[:class]}")
|
||||
end
|
||||
else
|
||||
if quick[:define_link]
|
||||
if quick[:condition_option]
|
||||
if eval("#{quick[:condition_option]}")
|
||||
content_tag :li, link_to(t(quick[:translation]), eval("#{quick[:define_link]}"), class: quick[:class])
|
||||
end
|
||||
else
|
||||
content_tag :li, link_to(t(quick[:translation]), eval("#{quick[:define_link]}"), class: quick[:class])
|
||||
end
|
||||
else
|
||||
content_tag :li, link_to(t(quick[:translation]), eval("#{quick[:link]}('#{object.id}')"), class: quick[:class])
|
||||
end
|
||||
content_tag :li, link_to(t(quick[:translation]), eval("#{quick[:link]}('#{object.id}')"), class: quick[:class])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -443,10 +433,6 @@ module OrbitBackendHelper
|
|||
res << "<li class='active'>#{t(:search_engine)}</li>"
|
||||
when 'site_info'
|
||||
res << "<li class='active'>#{t(:site_info)}</li>"
|
||||
when 'update_manager'
|
||||
res << "<li class='active'>#{t(:update_manager)}</li>"
|
||||
when 'system_info'
|
||||
res << "<li class='active'>#{t("site.system_preference")}</li>"
|
||||
end
|
||||
when 'items'
|
||||
res << "<li class='active'>#{t(:structure)}</li>"
|
||||
|
|
|
|||
|
|
@ -2,30 +2,28 @@ class CronMail < ActionMailer::Base
|
|||
default :from => "orbit_test@rulingcom.com"
|
||||
|
||||
def get_settings
|
||||
@site = Site.first
|
||||
@@smtp_settings = {
|
||||
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto'],
|
||||
:address => @site['site_settings']['address'],
|
||||
:port => @site['site_settings']['port'],
|
||||
:domain => @site['site_settings']['domain'],
|
||||
:authentication => @site['site_settings']['authentication'],
|
||||
:user_name => @site['site_settings']['user_name'],
|
||||
:password => @site['site_settings']['password']
|
||||
# @@smtp_settings = {
|
||||
# :address => "smtp.gmail.com",
|
||||
# :port => '587',
|
||||
# :domain => "smtp.gmail.com",
|
||||
# :authentication => "plain",
|
||||
# :user_name => "redmine@rulingcom.com",
|
||||
# :password => "rulingredmine",
|
||||
# :tls => true,
|
||||
# :enable_starttls_auto => true
|
||||
# }
|
||||
@@smtp_settings = {
|
||||
:address => @site['mail_settings']['address'],
|
||||
:port => @site['mail_settings']['port'],
|
||||
:domain => @site['mail_settings']['domain'],
|
||||
:authentication => @site['mail_settings']['authentication'],
|
||||
:user_name => @site['mail_settings']['user_name'],
|
||||
:password => @site['mail_settings']['password'],
|
||||
:tls => @site['mail_settings']['tls'],
|
||||
:enable_starttls_auto => @site['mail_settings']['enable_starttls_auto']
|
||||
}
|
||||
end
|
||||
|
||||
def self.smtp_settings
|
||||
@site = Site.first
|
||||
@@smtp_settings = {
|
||||
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto'],
|
||||
:address => @site['site_settings']['address'],
|
||||
:port => @site['site_settings']['port'],
|
||||
:domain => @site['site_settings']['domain'],
|
||||
:authentication => @site['site_settings']['authentication'],
|
||||
:user_name => @site['site_settings']['user_name'],
|
||||
:password => @site['site_settings']['password']
|
||||
}
|
||||
end
|
||||
|
||||
def time_check(msg)
|
||||
get_settings
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ class Design
|
|||
field :intro, :type => String
|
||||
field :title, :type => String
|
||||
field :version, :type => String
|
||||
field :template_store_id, :type => String
|
||||
|
||||
mount_uploader :zip_file, AssetUploader
|
||||
|
||||
|
|
|
|||
|
|
@ -194,7 +194,6 @@ class ModuleApp
|
|||
# authorization
|
||||
def update_auth_approval_users
|
||||
user_ids = self.auth_approvals.inject([]) do |users, auth|
|
||||
auth = auth.class.find(auth.id)
|
||||
users += auth.authorized_users.map{|user| user.id}
|
||||
end
|
||||
self.update_attribute(:auth_approval_users, user_ids.uniq)
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
<li title="<%= t('update_manager') %>"><%= link_to admin_site_update_manager_path(@site), :class => active_for_action('sites', 'update_manager') do %><span><i class="icon-refresh"></i></span><%end%></li>
|
||||
|
||||
<li title="<%= t("site.system_preference") %>"><%= link_to admin_site_system_info_path(@site), :class => active_for_action('sites', 'system_info') do %><span><i class="icons-info-2"></i></span><%end%></li>
|
||||
</ul>
|
||||
<!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li>
|
||||
--> </ul>
|
||||
</div>
|
||||
<div class="sub-nav-arrow"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
<li title="<%= t('update_manager') %>"><%= link_to admin_site_update_manager_path(@site), :class => active_for_action('sites', 'update_manager') do %><span><i class="icon-refresh"></i></span><%end%></li>
|
||||
|
||||
<li title="<%= t("site.system_preference") %>"><%= link_to admin_site_system_info_path(@site), :class => active_for_action('sites', 'system_info') do %><span><i class="icons-info-2"></i></span><%end%></li>
|
||||
</ul>
|
||||
<!-- <li title="System Info"><a href="/orbit_4.0.1/admin/system_info/index.shtml?sidebarNavList=8&subNavBlockList=0"><span><i class="icons-info-2"></i></span></a></li>
|
||||
--> </ul>
|
||||
</div>
|
||||
<div class="sub-nav-arrow"></div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.domain' %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :domain, :value => (@site['site_settings']['domain'] rescue nil), :class=>"input-large", :placeholder=>"Domain" %>
|
||||
<%= f.text_field :port, :value => (@site['site_settings']['port'] rescue nil), :class=>"input-large", :placeholder=>"Domain" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
<div class="control-group">
|
||||
<label class="control-label muted"><%= t 'mail.password' %></label>
|
||||
<div class="controls">
|
||||
<%= f.password_field :password, :value => (@site['site_settings']['password'] rescue nil), :class=>"input-large", :placeholder=>"Password" %>
|
||||
<%= f.text_field :password, :value => (@site['site_settings']['password'] rescue nil), :class=>"input-large", :placeholder=>"Password" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<h1><%= I18n.t("site.system_preference") %></h1>
|
||||
<ul class="nav nav-tabs" id="myTab">
|
||||
<li class="active"><a href="#summary" data-toggle="tab"><%= I18n.t("site.system_preference_.tab_summary") %></a></li>
|
||||
<li><a href="#commits" data-toggle="tab"><%= I18n.t("site.system_preference_.tab_commits") %></a></li>
|
||||
<li><a href="#backups" data-toggle="tab"><%= I18n.t("site.system_preference_.tab_backups") %></a></li>
|
||||
<li><a href="#resque_logs" data-toggle="tab"><%= I18n.t("site.system_preference_.tab_logs") %></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active in" id="summary">
|
||||
<h2><%= I18n.t("site.system_preference_.summary.disk_space") %>:</h2>
|
||||
<%= content_tag :p,@site.disk_space.gsub(/\n/,"<br />").html_safe if @site.disk_space %>
|
||||
<h2><%= I18n.t("site.system_preference_.summary.code_update_at") %>: </h2>
|
||||
<% @site.system_package_info.each do |index,value| %>
|
||||
<h2><%= index.titleize %> <%= I18n.t("site.system_preference_.summary.version") %>:</h2>
|
||||
<%= content_tag :p,value %>
|
||||
<% end %>
|
||||
<h2><%= I18n.t("site.system_preference_.summary.weekness_report") %>:<%= '' %></h2>
|
||||
</div>
|
||||
<div class="tab-pane" id="commits">
|
||||
<% if @git_commit_list_file %>
|
||||
<% @git_commit_list_file.lines do |line|%>
|
||||
<%= line %><br/>
|
||||
<% end%>
|
||||
<% else %>
|
||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="tab-pane" id="backups">
|
||||
<%if @db_backup_list_file %>
|
||||
<% @db_backup_list_file.lines do |line|%>
|
||||
<%=line %><br/>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="tab-pane" id="resque_logs">
|
||||
<%if @db_backup_list_file %>
|
||||
<% @resque_logs_file.lines do |line|%>
|
||||
<%=line %><br/>
|
||||
<% end if @resque_logs_file%>
|
||||
<%else %>
|
||||
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,126 +1,5 @@
|
|||
<%= stylesheet_link_tag "lib/wrap-nav" %>
|
||||
<%= stylesheet_link_tag "lib/main-list" %>
|
||||
<%= stylesheet_link_tag "lib/main-forms" %>
|
||||
<%= stylesheet_link_tag "lib/fileupload.css" %>
|
||||
<%= stylesheet_link_tag "lib/togglebox.css" %>
|
||||
<%= stylesheet_link_tag "lib/list-check.css" %>
|
||||
|
||||
<%= javascript_include_tag "lib/site_set" %>
|
||||
<%= javascript_include_tag "lib/list-check" %>
|
||||
|
||||
<% content_for :side_bar do %>
|
||||
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :icon => 'icons-cog', :side_bar_content => 'admin/sites/side_bar'} %>
|
||||
<% end %>
|
||||
|
||||
<form class="form-horizontal main-forms">
|
||||
<fieldset>
|
||||
<div class="input-area">
|
||||
<div class="nav-name"><strong><%= t("preferences.classification") %></strong></div>
|
||||
<ul class="nav nav-pills language-nav">
|
||||
<li class="active"><a href="#overview" data-toggle="tab"><%= t("site.system_preference_.tab_summary") %></a></li>
|
||||
<li><a href="#mail-cron-logs" data-toggle="tab"><%= t("site.system_preference_.tab_send_reminders_log") %></a></li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
<!-- Overview -->
|
||||
<div id="overview" class="tab-pane fade in active">
|
||||
<h3 class="muted"><%= t("site.system_preference_.summary.disk_space") %></h3>
|
||||
<blockquote>
|
||||
<p>
|
||||
<%= @disk_free %>
|
||||
</p>
|
||||
</blockquote>
|
||||
<h3 class="muted">Nginx <%= t("site.system_preference_.summary.version") %></h3>
|
||||
<blockquote>
|
||||
<p>
|
||||
<%= @nginx_version %>
|
||||
</p>
|
||||
</blockquote>
|
||||
</span>
|
||||
<h3 class="muted">MongoDB <%= t("site.system_preference_.summary.version") %></h3>
|
||||
<blockquote>
|
||||
<p>
|
||||
<%= @mongo_version %>
|
||||
</p>
|
||||
</blockquote>
|
||||
<h3 class="muted">Linux <%= t("site.system_preference_.summary.version") %></h3>
|
||||
<blockquote>
|
||||
<p>
|
||||
<%= @linux_version %>
|
||||
</p>
|
||||
</blockquote>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Email Log -->
|
||||
<div id="mail-cron-logs" class="tab-pane fade">
|
||||
<ul class="nav nav-pills">
|
||||
<li class="active">
|
||||
<a href="#send-log" data-toggle="tab"><%= t(:email_log) %></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#waiting-sent" data-toggle="tab"><%= t(:email_queue) %></a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane fade in active list-check" id="send-log">
|
||||
<p class="">
|
||||
<a href="#" class="btn list-active-btn disabled" data-check-action="list-be-remove" rel="/panel/announcement/back_end/bulletins/delete"><i class="icons-trash"></i></a>
|
||||
</p>
|
||||
<table class="table main-list table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" name="to_delete[]" value="b" />
|
||||
</th>
|
||||
<th><%= t(:sent_date) %></th>
|
||||
<th><%= t(:subject) %></th>
|
||||
<th><%= t(:mail_to) %></th>
|
||||
<th><%= t(:mail_user) %></th>
|
||||
<th><%= t(:mail_from_app) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade in list-check" id="waiting-sent">
|
||||
<p class="">
|
||||
<a href="#" class="btn list-active-btn disabled" data-check-action="list-be-remove" rel="/panel/announcement/back_end/bulletins/delete"><i class="icons-trash"></i></a>
|
||||
</p>
|
||||
<table class="table main-list table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" name="to_delete[]" value="b" />
|
||||
</th>
|
||||
<th><%= t(:sent_date) %></th>
|
||||
<th><%= t(:subject) %></th>
|
||||
<th><%= t(:mail_to) %></th>
|
||||
<th><%= t(:mail_from_app) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
<a class="close" data-dismiss="modal">×</a>
|
||||
<h3><%= t(:sure?) %></h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<span class="text-warning text-center"><%= t(:this_action_can_not_be_restore) %></span>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn" data-dismiss="modal" aria-hidden="true"><%= t(:close) %></button>
|
||||
<button class="delete-item btn btn-danger"><%= t(:delete_) %></button>
|
||||
</div>
|
||||
</div>
|
||||
system_info.html.erb
|
||||
|
|
@ -60,11 +60,7 @@
|
|||
<span class="item-price">Free</span>
|
||||
</span>
|
||||
</a>
|
||||
<% if @design_ids.include?(template["_id"]["$oid"]) %>
|
||||
<%= link_to "Installed", "javascript:void(0);", "data-url" => template['template']['template']['url'], :class=> 'btn btn-success download-link', "disabled"=>"disabled", "data-name"=>template['title'], "data-slug"=>template["_slugs"][0], "data-id"=>template["_id"]["$oid"] %>
|
||||
<% else %>
|
||||
<%= link_to "Download", "javascript:void(0);", "data-url" => template['template']['template']['url'], :class=> 'btn btn-primary download-link', "data-name"=>template['title'], "data-slug"=>template["_slugs"][0], "data-id"=>template["_id"]["$oid"] %>
|
||||
<% end %>
|
||||
<%= link_to "Download", "javascript:void(0);", "data-url" => template['template']['template']['url'], :class=> 'btn btn-primary download-link' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
|
|
@ -75,20 +71,20 @@
|
|||
<script type="text/javascript">
|
||||
(function(){
|
||||
$("a.download-link").on(clickEvent,function(){
|
||||
if($(this).attr("disabled") == "disabled")return false;
|
||||
var el = $(this);
|
||||
var el = $(this),
|
||||
downloadurl = $(this).data("url");
|
||||
|
||||
el.removeClass("btn-primary").addClass("btn-info").text("Installing").attr('disabled',"disabled");
|
||||
$.ajax({
|
||||
url : "<%= admin_template_store_download_theme_path %>",
|
||||
data : el.data(),
|
||||
data : {"url" : downloadurl},
|
||||
dataType : "json",
|
||||
type : "post"
|
||||
}).done(function(data){
|
||||
if(data.success){
|
||||
type : "post",
|
||||
success : function(data){
|
||||
if(data.success){
|
||||
el.removeClass('btn-info').addClass('btn-success').text("Installed");
|
||||
}
|
||||
}).fail(function(){
|
||||
el.removeClass('btn-info').addClass('btn-danger').text("Error, please try again.").removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
})
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@
|
|||
<div id="item-info">
|
||||
<%= image_tag "#{@store}#{@template['preview']['preview']['thumb']['url']}", :class => "item-thumb" %>
|
||||
<h2 class="item-name"><%= @template['title'] %></h2>
|
||||
<% if @design_ids.include?(@template["_id"]["$oid"]) %>
|
||||
<%= link_to "Installed", "javascript:void(0);", "data-url" => @template['template']['template']['url'], :class=> 'btn btn-success download-link', "disabled"=>"disabled", "data-name"=>@template['title'], "data-slug"=>@template["_slugs"][0], "data-id"=>@template["_id"]["$oid"] %>
|
||||
<% else %>
|
||||
<%= link_to "Download", "javascript:void(0);", "data-url" => @template['template']['template']['url'], :class=> 'btn btn-primary download-link', "data-name"=>@template['title'], "data-slug"=>@template["_slugs"][0], "data-id"=>@template["_id"]["$oid"] %>
|
||||
<% end %>
|
||||
<%= link_to "Download", "javascript:void(0);", "data-url" => @template['template']['template']['url'], :class=> 'btn btn-primary download-link' %>
|
||||
<ul class="item-extra-info">
|
||||
<li><span class="title">views</span><span class="count"><%= Random.new.rand(10..100) %></span></li>
|
||||
<!-- <li><span class="title">color</span><span class="color-tag green"></span></li> -->
|
||||
|
|
@ -68,22 +64,21 @@
|
|||
<script type="text/javascript">
|
||||
(function(){
|
||||
$("a.download-link").on(clickEvent,function(){
|
||||
if($(this).attr("disabled") == "disabled")return false;
|
||||
var el = $(this);
|
||||
var el = $(this),
|
||||
downloadurl = $(this).data("url");
|
||||
|
||||
el.removeClass("btn-primary").addClass("btn-info").text("Installing").attr('disabled',"disabled");
|
||||
$.ajax({
|
||||
url : "<%= admin_template_store_download_theme_path %>",
|
||||
data : el.data(),
|
||||
data : {"url" : downloadurl},
|
||||
dataType : "json",
|
||||
type : "post"
|
||||
}).done(function(data){
|
||||
if(data.success){
|
||||
type : "post",
|
||||
success : function(data){
|
||||
if(data.success){
|
||||
el.removeClass('btn-info').addClass('btn-success').text("Installed");
|
||||
}
|
||||
}).fail(function(){
|
||||
el.removeClass('btn-info').addClass('btn-danger').text("Error, please try again.").removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
})
|
||||
})()
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
<div id="module-content">
|
||||
<div class="nano">
|
||||
<div class="content list-check">
|
||||
<div class="content">
|
||||
<%=render :partial => @right_partial %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,59 +1,62 @@
|
|||
<section id="main-wrap">
|
||||
|
||||
|
||||
<div class="sign-in have-other-sign-in">
|
||||
<!-- <p class="alert alert-error in fade">You need to sign in.</p>
|
||||
-->
|
||||
<% flash.each do |key, msg| %>
|
||||
<%= content_tag :p, msg, :class => [key, "alert alert-error in fade"] %>
|
||||
|
||||
<% flash.each do |key, msg| %>
|
||||
<%= content_tag :p, msg, :class => [key, "alert alert-error"] %>
|
||||
<% end %>
|
||||
|
||||
<div class="form">
|
||||
<h3 class="login-logo">Log In to Orbit</h3>
|
||||
<div>
|
||||
<input name="utf8" type="hidden" value="" />
|
||||
<input name="authenticity_token" type="hidden" value="" />
|
||||
</div>
|
||||
<!-- <div class="other-sign-in">
|
||||
<a class="btn btn-primary" type="submit">Other Sign In</a>
|
||||
|
||||
<div class="form">
|
||||
<h3 class="login-logo"><%= t(:login) %></h3>
|
||||
<div class="other-sign-in">
|
||||
<% @request_hosts = request.host_with_port.split(".") %>
|
||||
<a class="btn btn-primary" type="submit" href="https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignin1.0&wtrealm=https://management.ntu.edu.tw/saml_login&wctx=<%= @request_hosts[0] %>">使用計中帳號登入</a>
|
||||
<p>or</p>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-block">
|
||||
<div class="form-list clearfix">
|
||||
<form class="content" accept-charset="UTF-8" action="/users/sign_in" method="post">
|
||||
<%= form_for resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'content'} do |f| %>
|
||||
|
||||
<%= form_for resource, :as => resource_name, :url => session_path(resource_name), :html => {:class => 'content'} do |f| %>
|
||||
<div class="control-group clear">
|
||||
<label for="user_email">
|
||||
<i class="icon-user"></i>
|
||||
</label>
|
||||
<%= f.text_field :user_id, :placeholder => t("users.user_id"), :id=>"user_email" %>
|
||||
<%= f.text_field :user_id, :placeholder => t("users.user_id") %>
|
||||
</div>
|
||||
<div class="control-group clear">
|
||||
<label for="user_password">
|
||||
<i class="icon-lock"></i>
|
||||
</label>
|
||||
<%= f.password_field :password, :placeholder => t(:dots), :id=>"user_password" %>
|
||||
<%= f.password_field :password, :placeholder => t(:dots) %>
|
||||
</div>
|
||||
<br/>
|
||||
<label class="checkbox">
|
||||
<% if devise_mapping.rememberable? -%>
|
||||
<%= f.check_box :remember_me %> <small><%= f.label :remember_me %></small>
|
||||
<% end -%>
|
||||
</label>
|
||||
|
||||
<!-- <label class="checkbox">
|
||||
<input type="checkbox" value="">
|
||||
<small>Remember me</small>
|
||||
</label> -->
|
||||
<%= content_tag :button, t(:login), :type => :submit, :class => 'btn btn-primary' %>
|
||||
</form>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- <form class="content" accept-charset="UTF-8" action="/users/sign_in" method="post">
|
||||
<div class="control-group clear">
|
||||
<label for="user_email">
|
||||
<i class="icon-user"></i>
|
||||
</label>
|
||||
<input type="text" id="user_id" name="user[id]" placeholder="帳號" />
|
||||
</div>
|
||||
<div class="control-group clear">
|
||||
<label for="user_password">
|
||||
<i class="icons-mail"></i>
|
||||
</label>
|
||||
<input type="text" id="user_email" name="user[email]" placeholder="電子郵件" />
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Submit</button>
|
||||
</form> -->
|
||||
</div>
|
||||
<!-- <div class="switchboard"><span>Forgot Password ?</span> <i class="icons-arrow-left-2"></i></div> -->
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<%= link_to content_tag(:small, t(:forgot_password)), new_user_password_path %>
|
||||
</div>
|
||||
<br/>
|
||||
<!-- <div class="register">
|
||||
<!-- <div class="register">
|
||||
<button class="btn btn-inverse" type="submit">Register</button>
|
||||
</div> -->
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -56,6 +56,11 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<%= form_for :user, url: user_session_path, html: {class: 'container'} do |f| %>
|
||||
<div class="other-sign-in">
|
||||
<% @request_hosts = request.host_with_port.split(".") %>
|
||||
<a class="btn btn-primary" type="submit" href="https://adfs.ntu.edu.tw/adfs/ls/?wa=wsignin1.0&wtrealm=https://management.ntu.edu.tw/saml_login&wctx=<%= @request_hosts[0] %>">使用計中帳號登入</a>
|
||||
<p>or</p>
|
||||
</div>
|
||||
<div class="input-prepend">
|
||||
<span class="add-on">
|
||||
<i class="icon-user"></i>
|
||||
|
|
@ -84,4 +89,4 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -24,5 +24,9 @@
|
|||
<body>
|
||||
<%= render 'layouts/orbit_bar' %>
|
||||
<%= yield %>
|
||||
<!--<div id="sign-footer">
|
||||
<p>Rulingcom</p>
|
||||
</div>
|
||||
-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
function InsertPreviewImage(){
|
||||
if($("iframe").contents().find('.news_image').length){
|
||||
$("iframe").contents().find('.news_image').append("<a href='' target='_blank'><img src='"+preview_img+"' width='320' /></a>");
|
||||
$("iframe").contents().find('.news_image').append("<a href='' target='_blank'><img src='"+preview_img+"' width='320' height='240' /></a>");
|
||||
}else{
|
||||
setTimeout(InsertPreviewImage,1000);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,5 +63,15 @@ Orbit::Application.configure do
|
|||
config.action_mailer.delivery_method = :smtp
|
||||
config.action_mailer.perform_deliveries = true
|
||||
config.action_mailer.raise_delivery_errors = true
|
||||
config.action_mailer.smtp_settings = {
|
||||
:enable_starttls_auto => true,
|
||||
:openssl_verify_mode => 'none',
|
||||
:address => 'smtp.sendgrid.net',
|
||||
:port => '587',
|
||||
:domain => "new.tp.rulingcom.com",
|
||||
:authentication => "plain",
|
||||
:user_name => "rulingcom",
|
||||
:password => "bjo4xjp6"
|
||||
}
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
if defined?(PhusionPassenger)
|
||||
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
||||
if forked
|
||||
Resque.redis.client.disconnect
|
||||
Resque.redis = Redis.new(:host => 'localhost', :port => 6379)
|
||||
Resque.redis.namespace = Site.first.resque_namespace rescue APP_CONFIG['orbit']
|
||||
else
|
||||
# We're in conservative spawning mode. We don't need to do anything.
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -192,8 +192,6 @@ en:
|
|||
link: Editing link
|
||||
page: Editing page
|
||||
email: Email
|
||||
email_log: Email Log
|
||||
email_queue: Waiting to be sent
|
||||
enable: Enable
|
||||
enabled_for: Enabled for
|
||||
end: End
|
||||
|
|
@ -225,13 +223,11 @@ en:
|
|||
groups: Groups
|
||||
help: Help
|
||||
hidden: Hidden
|
||||
is_hidden: Hidden
|
||||
hide: Hide
|
||||
hits: Hits
|
||||
homepage: Homepage
|
||||
horizontal: Horizontal
|
||||
hot: Hot
|
||||
is_hot: Hot
|
||||
image: Image
|
||||
images: Images
|
||||
info: Information
|
||||
|
|
@ -278,9 +274,6 @@ en:
|
|||
setting: Mail settings
|
||||
tls: TLS
|
||||
user_name: User Name
|
||||
mail_from_app: Mail From App
|
||||
mail_to: Mail To
|
||||
mail_user: Mail User
|
||||
manager: Manager
|
||||
markup: Markup
|
||||
markup_options: Markup options
|
||||
|
|
@ -347,19 +340,18 @@ en:
|
|||
public_r_tag: System Widget
|
||||
text: Text Area
|
||||
passed: Approved
|
||||
is_checked: Approved
|
||||
password: Password
|
||||
password_change: Change password
|
||||
password_confirmation: Password confirmation
|
||||
password_current: Current password
|
||||
pending: Pending
|
||||
is_pending: Pending
|
||||
personal_plugins:
|
||||
author : "Author"
|
||||
edit_brief_intro : "Edit Brief Intro."
|
||||
brief_intro : "Brief Intro."
|
||||
complete_list : "Complete List"
|
||||
frontend_page : "Frontend Page"
|
||||
sync_data: "Synchronize"
|
||||
phone_number: "Phone Number"
|
||||
picture: Picture
|
||||
placeholder: Field Hint
|
||||
|
|
@ -396,7 +388,6 @@ en:
|
|||
register: Register
|
||||
registered: Registered
|
||||
rejected: Rejected
|
||||
is_rejected: Rejected
|
||||
rejected_reason: 'Reason:'
|
||||
rejected_reason_empty: "Approval rejected, no referencable information"
|
||||
related_links: Related Links
|
||||
|
|
@ -434,7 +425,6 @@ en:
|
|||
index: Index
|
||||
summary: Summary
|
||||
thumbnail: Thumbnail
|
||||
sent_date: Sent Date
|
||||
settings: Site Setting
|
||||
site:
|
||||
backend_openness_on: Backend Openness
|
||||
|
|
@ -465,7 +455,6 @@ en:
|
|||
tab_commits: Commits
|
||||
tab_summary: Summary
|
||||
tab_logs: Logs
|
||||
tab_send_reminders_log: Send reminders log
|
||||
summary:
|
||||
code_update_at: Code Update histroy
|
||||
disk_space: Disk Free
|
||||
|
|
@ -495,7 +484,6 @@ en:
|
|||
sub_role: Sub Role
|
||||
sub_role_field: Sub Role Field
|
||||
sub_role_info: " Sub Role Info."
|
||||
subject: Subject
|
||||
subtitle: Subtitle
|
||||
submit: Submit
|
||||
submit_approval: Submit approval
|
||||
|
|
@ -519,12 +507,10 @@ en:
|
|||
text: Text
|
||||
theme: Theme
|
||||
themes: Themes
|
||||
this_action_can_not_be_restore: This action can not be restored, are you sure you want to delete?
|
||||
title: Title
|
||||
to_search: Set as Search Key
|
||||
to_show: Display in frontend
|
||||
top: Top
|
||||
is_top: Top
|
||||
total_visitors: Total Visitors
|
||||
traffic: Traffic
|
||||
type: Field Type
|
||||
|
|
|
|||
|
|
@ -192,8 +192,6 @@ zh_tw:
|
|||
link: 編輯連結
|
||||
page: 編輯頁面
|
||||
email: 電子郵件
|
||||
email_log: 寄送紀錄
|
||||
email_queue: 待寄送郵件
|
||||
enable: 開啟
|
||||
enabled_for: 啟用
|
||||
end: 結束
|
||||
|
|
@ -278,9 +276,6 @@ zh_tw:
|
|||
setting: 電子郵件設定
|
||||
tls: 電子郵件TLS
|
||||
user_name: 電子郵件帳號
|
||||
mail_from_app: 寄送模組
|
||||
mail_to: 收件者
|
||||
mail_user: 寄件者
|
||||
manager: 管理者
|
||||
markup: 輸入模式
|
||||
markup_options: 標註選項
|
||||
|
|
@ -348,19 +343,18 @@ zh_tw:
|
|||
public_r_tag: 系統模塊
|
||||
text: 文字區域
|
||||
passed: 通過審核
|
||||
is_checked: 通過審核
|
||||
password: 密碼
|
||||
password_change: 更改密碼
|
||||
password_confirmation: 確認密碼
|
||||
password_current: 目前的密碼
|
||||
pending: 待審核
|
||||
is_pending: 待審核
|
||||
personal_plugins:
|
||||
author : "著作人"
|
||||
edit_brief_intro : "編輯摘要"
|
||||
brief_intro : "摘要"
|
||||
complete_list : "完整列表"
|
||||
frontend_page : "前台呈現"
|
||||
sync_data: "同步資料"
|
||||
phone_number: "電話"
|
||||
picture: 圖片
|
||||
placeholder: 欄位提示文字
|
||||
|
|
@ -396,7 +390,6 @@ zh_tw:
|
|||
register: 註冊
|
||||
registered: 已註冊
|
||||
rejected: 拒絕
|
||||
is_rejected: 拒絕
|
||||
rejected_reason: 拒絕原因:'
|
||||
rejected_reason_empty: "拒絕核准, 沒有參考資訊"
|
||||
related_links: 相關連結
|
||||
|
|
@ -434,7 +427,6 @@ zh_tw:
|
|||
index: 檢索
|
||||
summary: 摘要
|
||||
thumbnail: 縮圖
|
||||
sent_date: 寄送日期
|
||||
settings: 基本設定
|
||||
site:
|
||||
frontend_closed: 前台關閉?
|
||||
|
|
@ -465,7 +457,6 @@ zh_tw:
|
|||
tab_commits: 程式版本
|
||||
tab_summary: 總覽
|
||||
tab_logs: 排程工作日誌
|
||||
tab_send_reminders_log: 寄送提醒紀錄
|
||||
summary:
|
||||
code_update_at: 程式更新紀錄
|
||||
disk_space: 硬碟空間
|
||||
|
|
@ -495,7 +486,6 @@ zh_tw:
|
|||
sub_role: 子身份
|
||||
sub_role_field: 子身份欄位
|
||||
sub_role_info: 子身份資料
|
||||
subject: 主題
|
||||
subtitle: 副標題
|
||||
submit: 送出
|
||||
submit_approval: 送出已核准
|
||||
|
|
@ -519,7 +509,6 @@ zh_tw:
|
|||
text: 內文
|
||||
theme: 套用頁面樣式
|
||||
themes: 主題
|
||||
this_action_can_not_be_restore: 刪除後將無法還原,您確定要刪除嗎?
|
||||
title: 標題
|
||||
to_search: 加入搜尋條件
|
||||
to_show: 是否顯示於前台
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ defaults: &defaults
|
|||
|
||||
development:
|
||||
<<: *defaults
|
||||
database: orbit_site_new
|
||||
database: ntu_mb_orbit_2_new
|
||||
|
||||
|
||||
|
||||
test:
|
||||
<<: *defaults
|
||||
database: orbit_site_new
|
||||
database: ntu_mb_orbit_2_new
|
||||
|
||||
# set these environment variables on your prod server
|
||||
production:
|
||||
|
|
@ -24,4 +24,4 @@ production:
|
|||
# password: <%= ENV['MONGOID_PASSWORD'] %>
|
||||
# database: <%= ENV['MONGOID_DATABASE'] %>
|
||||
<<: *defaults
|
||||
database: orbit_site_new
|
||||
database: ntu_mb_orbit_2_new
|
||||
|
|
|
|||
|
|
@ -8,6 +8,14 @@ Orbit::Application.routes.draw do
|
|||
match "/users_passwd" => "desktop/registrations#update", :as => :users_passwd, :via => :put
|
||||
end
|
||||
|
||||
devise_scope :user do
|
||||
get 'user_login' => 'sessions#create'
|
||||
match 'user_logout' => 'sessions#destroy'
|
||||
end
|
||||
|
||||
match "saml_login" => 'saml_logins#index'
|
||||
|
||||
|
||||
mount Resque::Server, :at => "/admin/resque"
|
||||
mount Rack::GridFS::Endpoint.new(:db => Mongoid.database,:lookup=>:path), :at => "gridfs"
|
||||
|
||||
|
|
@ -218,6 +226,19 @@ Orbit::Application.routes.draw do
|
|||
get 'update_orbit'
|
||||
get 'restart_server'
|
||||
end
|
||||
|
||||
get "import_data/get_teacher_data"
|
||||
get "import_data/get_book_data"
|
||||
get "import_data/get_conference_data"
|
||||
get "import_data/get_journal_paper_data"
|
||||
get "import_data/get_announcement_data"
|
||||
get "import_data/get_page_data"
|
||||
get "import_data/sync_book_data"
|
||||
get "import_data/sync_journal_paper_data"
|
||||
get "import_data/sync_conference_data"
|
||||
get "import_data/sync_book_data_auto"
|
||||
get "import_data/sync_journal_paper_data_auto"
|
||||
get "import_data/sync_conference_data_auto"
|
||||
|
||||
resources :tags do
|
||||
collection do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
# Use this file to easily define all of your cron jobs.
|
||||
#
|
||||
# It's helpful, but not entirely necessary to understand cron before proceeding.
|
||||
# http://en.wikipedia.org/wiki/Cron
|
||||
|
||||
# Example:
|
||||
#
|
||||
# set :output, "/path/to/my/cron_log.log"
|
||||
#
|
||||
every 1.day, :at => '11:00 pm' do
|
||||
# command "/usr/bin/some_great_command"
|
||||
# runner "MyModel.some_method"
|
||||
rake "rake synchronize:data"
|
||||
end
|
||||
#
|
||||
# every 4.days do
|
||||
# runner "AnotherModel.prune_old_records"
|
||||
# end
|
||||
|
||||
# Learn more: http://github.com/javan/whenever
|
||||
|
|
@ -234,7 +234,7 @@ module OrbitCoreLib
|
|||
when :sub_manager
|
||||
@open ||= check_sub_manager
|
||||
when :approver
|
||||
@open ||= check_approver
|
||||
@open ||= check_sub_manager
|
||||
when :user
|
||||
@open ||= true
|
||||
when :visitor
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
# encoding: utf-8
|
||||
namespace :synchronize do
|
||||
desc "synchronize tasks"
|
||||
task :data => :environment do
|
||||
p Admin::ImportDataController.new.sync_book_data_auto
|
||||
puts "Book Data Synchronization Complete"
|
||||
p Admin::ImportDataController.new.sync_journal_paper_data_auto
|
||||
puts "Journal Paper Data Synchronization Complete"
|
||||
p Admin::ImportDataController.new.sync_conference_data_auto
|
||||
puts "Conference Data Synchronization Complete"
|
||||
end
|
||||
end
|
||||
Binary file not shown.
|
|
@ -10,7 +10,6 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
|
|||
end
|
||||
|
||||
def preview
|
||||
params['bulletin']['image'] = nil
|
||||
bulletin = Bulletin.new params
|
||||
@preview_obj = bulletin.to_preview
|
||||
@preview_obj.save
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
<% show_office_field.attribute_fields.where(:disabled=>false).asc(:_id).each do |rf| %>
|
||||
|
||||
<%
|
||||
if !@member.get_attribute_value(rf).blank?
|
||||
if !@member.get_attribute_value(rf)['val'].blank?
|
||||
@rodata = @member.get_attribute_value(rf)['val']
|
||||
elsif !@member.get_attribute_value(rf)[I18n.locale].blank?
|
||||
@rodata = @member.get_attribute_value(rf)[I18n.locale]
|
||||
else
|
||||
@rodata = nil
|
||||
end
|
||||
|
||||
if !@rodata.blank? and !@member.get_attribute_value(rf).get_value_by_locale(I18n.locale).blank?
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<% if (rf.title == "Office" || rf.title == "研究室")%>
|
||||
<td><%= rf.title %></td>
|
||||
<td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
||||
</tr>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<% show_research_field.attribute_fields.where(:disabled=>false).asc(:_id).each do |rf| %>
|
||||
|
||||
<%
|
||||
if !@member.get_attribute_value(rf).blank?
|
||||
if !@member.get_attribute_value(rf)['val'].blank?
|
||||
@rodata = @member.get_attribute_value(rf)['val']
|
||||
elsif !@member.get_attribute_value(rf)[I18n.locale].blank?
|
||||
@rodata = @member.get_attribute_value(rf)[I18n.locale]
|
||||
else
|
||||
@rodata = nil
|
||||
end
|
||||
|
||||
if !@rodata.blank? and !@member.get_attribute_value(rf).get_value_by_locale(I18n.locale).blank?
|
||||
%>
|
||||
|
||||
<tr>
|
||||
<% if (rf.title == "Research Field"|| rf.title == "研究領域")%>
|
||||
<td><%= rf.title %></td>
|
||||
<td><%= nl2br(show_attribute_value(@member.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
|
||||
</tr>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
||||
<% end -%>
|
||||
|
||||
|
|
@ -94,6 +94,8 @@ class WritingBook
|
|||
if !self.publish_date.nil?
|
||||
pd = self.publish_date.strftime("%Y-%m-%d").split('-')
|
||||
title << pd[0]+"/"+pd[1]
|
||||
elsif !self.year.blank?
|
||||
title << self.year
|
||||
end
|
||||
|
||||
# title << "(#{self.journal_level_types.collect{|x| x.title}.join(', ')})"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_book.year') %></th>
|
||||
<th><%= t('personal_book.book_title') %></th>
|
||||
|
|
@ -75,8 +75,9 @@
|
|||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_book_back_end_personal_book_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'), admin_import_data_sync_book_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_book_back_end_personal_book_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_book_back_end_writing_book_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @writing_books, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ class WritingConference
|
|||
if !self.publication_date.nil?
|
||||
pd = self.publication_date.strftime("%Y-%m-%d").split('-')
|
||||
title << pd[0]
|
||||
elsif !self.year.blank?
|
||||
title << self.year
|
||||
end
|
||||
|
||||
title << self.paper_title if self.paper_title.present?
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_conference.year') %></th>
|
||||
<th><%= t('module_name.personal_conference') %></th>
|
||||
|
|
@ -75,8 +75,9 @@
|
|||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_conference_back_end_personal_conference_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_conference_back_end_writing_conference_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'), admin_import_data_sync_conference_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_conference_back_end_personal_conference_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_conference_back_end_writing_conference_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @writing_conferences, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('date_') %></th>
|
||||
<th><%= t('personal_diploma.school_name') %></th>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('date_') %></th>
|
||||
<th><%= t('personal_experience.organizationt_title') %></th>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_honor.year') %></th>
|
||||
<th><%= t('personal_honor.award_name') %></th>
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ class WritingJournal
|
|||
if !self.publication_date.nil?
|
||||
pd = self.publication_date.strftime("%Y-%m-%d").split('-')
|
||||
title << pd[0]
|
||||
elsif !self.year.blank?
|
||||
title << self.year
|
||||
end
|
||||
title << self.paper_title if self.paper_title.present?
|
||||
title << self.journal_title if self.journal_title.present?
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_journal.year') %></th>
|
||||
<th><%= t('module_name.personal_journal') %></th>
|
||||
|
|
@ -77,17 +77,16 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<% if is_admin? %>
|
||||
<div class="bottomnav clearfix">
|
||||
<div class="action pull-right">
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_journal_back_end_personal_journal_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.sync_data'), admin_import_data_sync_journal_paper_data_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('personal_plugins.edit_brief_intro'), panel_personal_journal_back_end_personal_journal_intros_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
<%= link_to content_tag(:i, nil, :class => 'icon-plus') + t('announcement.add_new'), new_panel_personal_journal_back_end_writing_journal_path(:user_id => @user.id), :class => 'btn btn-primary' %>
|
||||
</div>
|
||||
<div class="pagination pagination-centered">
|
||||
<%= paginate @writing_journals, :params => {:direction => params[:direction], :sort => params[:sort], :filter => @filter, :new_filter => nil} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div id="dialog" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="Delete item" aria-hidden="true">
|
||||
<div class="modal-header">
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span1"><%= t('personal_lab.year') %></th>
|
||||
<th><%= t('personal_lab.lab_title') %></th>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('personal_patent.publication_date') %></th>
|
||||
<th><%= t('personal_patent.patent_title') %></th>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('personal_project.period') %></th>
|
||||
<th><%= t('personal_project.project_title') %></th>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<% if is_admin? %>
|
||||
<th><input type="checkbox" /></th>
|
||||
<th><input type="checkbox" class="list-check" /></th>
|
||||
<% end -%>
|
||||
<th class="span2"><%= t('personal_research.publication_date') %></th>
|
||||
<th><%= t('personal_research.research_title') %></th>
|
||||
|
|
|
|||
Reference in New Issue