added sync for journal paper books and conference.. and also disabled the icons

This commit is contained in:
Harry Bomrah 2013-09-26 22:26:19 +08:00 committed by saurabhbhatia
parent 096aec3406
commit 9a03e7a6b2
12 changed files with 131 additions and 81 deletions

View File

@ -226,6 +226,7 @@ var orbitDesktop = function(dom){
this.bindDesktopEvents = function(){ //this function will bind the global handlers to thd desktop, for example doc
$(".docklist a").click(function(){
if( !$( this ).hasClass( 'disable' ) )
o.menu_item($(this));
return false;
});
@ -274,10 +275,11 @@ var orbitDesktop = function(dom){
});
$("body").on("click","*[ajax-remote]",function(){
var $e = $(this);
var t = $e.attr("ajax-remote");
var classes_to_toggle = $e.attr("toggle-onclick");
var exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : "");
var $e = $(this),
t = $e.attr("ajax-remote"),
classes_to_toggle = $e.attr("toggle-onclick"),
responsetype = $e.attr('response-type') ? $e.attr('response-type') : "html",
exe = $e.attr("callback-method"); // (typeof $e.attr("callback-method") == "function"? $e.attr("callback-method") : "");
if(classes_to_toggle){
$e.toggleClass(classes_to_toggle);
}
@ -289,9 +291,9 @@ var orbitDesktop = function(dom){
}
var ca = $e.attr("content-holder");
var a = function(){
$.ajax({
type : t,
dataType : responsetype,
url : $e.attr("href"),
success : function(data){
if(typeof data == "string"){
@ -302,6 +304,7 @@ var orbitDesktop = function(dom){
// $("div[container=true]").html(data);
}
}
if(exe)
window.o[o.data_method][exe](data,$e);
if(t == "delete"){

View File

@ -322,6 +322,12 @@ class Admin::ImportDataController < OrbitBackendController
puts "No conference by Teacher"
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end
@ -356,26 +362,31 @@ class Admin::ImportDataController < OrbitBackendController
@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?
@ -385,11 +396,22 @@ class Admin::ImportDataController < OrbitBackendController
@journal_paper.create_user_id = @user.id
@journal_paper.save!
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
else
puts "No journal paper by Teacher"
end
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end
def sync_book_data
@ -431,10 +453,14 @@ def sync_book_data
@book.create_user_id = @user.id
@book.save
end
else
puts "No books by Teacher"
end
end
respond_to do |format|
format.html
format.json { render json: {"success"=>true}.to_json}
end
end

View File

@ -32,32 +32,32 @@
<li class="dock_item"><a callback-method='initializePersonalExperience' href="<%= panel_personal_experience_desktop_experience_window_path %>" class="widget_fn wh2 hh2" id='d_working' onclick="return false;"><span class="widget_icon"><img src="" alt="Working" id="working_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializePersonalDiploma' href="<%= panel_personal_diploma_desktop_diploma_window_path %>" class="widget_fn wh2 hh2" id='d_education' onclick="return false;"><span class="widget_icon"><img src="" alt="Education" id="education_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='initializePersonalHonor' href="<%= panel_personal_honor_desktop_honor_window_path %>" class="widget_fn wh2 hh2" id='d_honors' onclick="return false;"><span class="widget_icon"><img src="" alt="Honors" id="honors_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="activities" class="widget_fn wh2 hh2" id='d_activities' onclick="return false;"><span class="widget_icon"><img src="" alt="Activities" id="activities_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="clubs" class="widget_fn wh2 hh2" id='d_clubs' onclick="return false;"><span class="widget_icon"><img src="" alt="Clubs" id="clubs_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="activities" class="widget_fn wh2 hh2" id='d_activities' onclick="return false;"><span class="widget_icon disable"><img src="" alt="Activities" id="activities_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="clubs" class="widget_fn wh2 hh2" id='d_clubs' onclick="return false;"><span class="widget_icon"><img src="" alt="Clubs" id="clubs_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='' href="" class="widget_fn wh2 hh2" id='d_landt' onclick="return false;"><span class="widget_icon"><img src="" alt="Learning & Teaching" id="landt_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh2 thmc4" style="width: 180px;">
<li class="dock_item"><a callback-method='' href="courses" class="widget_fn wh2 hh2" id='d_courses' onclick="return false;"><span class="widget_icon"><img src="" alt="Courses" id="courses_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="homework" class="widget_fn wh2 hh2" id='d_homework' onclick="return false;"><span class="widget_icon"><img src="" alt="Homework" id="homework_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="certification" class="widget_fn wh2 hh2" id='d_certification' onclick="return false;"><span class="widget_icon"><img src="" alt="Certification" id="certification_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="courses" class="widget_fn wh2 hh2" id='d_courses' onclick="return false;"><span class="widget_icon"><img src="" alt="Courses" id="courses_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="homework" class="widget_fn wh2 hh2" id='d_homework' onclick="return false;"><span class="widget_icon"><img src="" alt="Homework" id="homework_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="certification" class="widget_fn wh2 hh2" id='d_certification' onclick="return false;"><span class="widget_icon"><img src="" alt="Certification" id="certification_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='' href="" class="widget_fn wh2 hh2" id='d_personal' onclick="return false;"><span class="widget_icon"><img src="" alt="Personal" id="personal_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh2 thmc4" style="width: 300px;">
<li class="dock_item"><a callback-method='' href="mypage" class="widget_fn wh2 hh2" id='d_mypage' onclick="return false;"><span class="widget_icon"><img src="" alt="myPage" id="mypage_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="blog" class="widget_fn wh2 hh2" id='d_blog' onclick="return false;"><span class="widget_icon"><img src="" alt="Blog" id="blog_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="album" class="widget_fn wh2 hh2" id='d_album' onclick="return false;"><span class="widget_icon"><img src="" alt="Album" id="album_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="calendar" class="widget_fn wh2 hh2" id='d_calendar' onclick="return false;"><span class="widget_icon"><img src="" alt="Calendar" id="calendar_icon" width="30" height="30"/></span></a></li>
<li class="dock_item"><a callback-method='' href="files" class="widget_fn wh2 hh2" id='d_files' onclick="return false;"><span class="widget_icon"><img src="" alt="Files" id="files_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="mypage" class="widget_fn wh2 hh2" id='d_mypage' onclick="return false;"><span class="widget_icon"><img src="" alt="myPage" id="mypage_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="blog" class="widget_fn wh2 hh2" id='d_blog' onclick="return false;"><span class="widget_icon"><img src="" alt="Blog" id="blog_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="album" class="widget_fn wh2 hh2" id='d_album' onclick="return false;"><span class="widget_icon"><img src="" alt="Album" id="album_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="calendar" class="widget_fn wh2 hh2" id='d_calendar' onclick="return false;"><span class="widget_icon"><img src="" alt="Calendar" id="calendar_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="files" class="widget_fn wh2 hh2" id='d_files' onclick="return false;"><span class="widget_icon"><img src="" alt="Files" id="files_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='initializeOrbitTimeline' href="<%= desktop_orbit_orbit_path %>" class="widget_fn wh2 hh2" id='d_orbit' onclick="return false;"><span class="widget_icon"><img src="" alt="Orbit" id="orbit_icon" width="30" height="30"/></span></a>
<ul class="dock_child hh2 thmc4" style="width: 60px;">
<li class="dock_item"><a callback-method='' href="" class="widget_fn wh2 hh2" id='d_connection' onclick="return false;"><span class="widget_icon"><img src="" alt="Academia Connection" id="connection_icon" width="30" height="30"/></span></a></li>
<li class="dock_item disable"><a callback-method='' href="" class="widget_fn wh2 hh2" id='d_connection' onclick="return false;"><span class="widget_icon"><img src="" alt="Academia Connection" id="connection_icon" width="30" height="30"/></span></a></li>
</ul>
</li>
<li class="d_cate"><a callback-method='initializeAppstore' href="<%= desktop_appstore_appstore_path %>" class="widget_fn wh2 hh2" id='d_appstore' onclick="return false;"><span class="widget_icon"><img src="" alt="AppStore" id="appstore_icon" width="30" height="30"/></span></a></li>
<li class="d_cate disable"><a callback-method='initializeAppstore' href="<%= desktop_appstore_appstore_path %>" class="widget_fn wh2 hh2" id='d_appstore' onclick="return false;"><span class="widget_icon"><img src="" alt="AppStore" id="appstore_icon" width="30" height="30"/></span></a></li>
</ul>
<div class="fn_des hh2 admbg admtxt"></div>
</div>

View File

@ -93,6 +93,11 @@ orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // t
});
}
this.initializePersonalBook.syncComplete = function(){
o.notify("Sync Complete","success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}
this.initializePersonalBook.coAuthorformCallback = function(data){
if(data.success){
o.notify(data.msg,"success");

View File

@ -7,7 +7,7 @@ class Panel::PersonalBook::Desktop::PersonalBooksController < ApplicationControl
page ||= 1
@per_column = 5
@userid = current_user.id
case @view_by
when "abstract"
@per_column = 1

View File

@ -57,6 +57,9 @@
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_book_data_path(:user_id=>@userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Books</a></div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>

View File

@ -42,7 +42,10 @@ orbitDesktop.prototype.initializeConferencePapers = function(target,url,cache){
this.initializeConferencePapers.cancelpaper = function(){
o.highlight_sub_menu_item(0);
}
this.initializeConferencePapers.syncComplete = function(){
o.notify("Sync Complete","success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}
var uploadFiles = function(){
$('#add_plugin_file a.add').click(function(){
var new_id = $(this).prev().attr('value');

View File

@ -4,7 +4,7 @@ class Panel::PersonalConference::Desktop::ConferencePagesController < Applicatio
@writing_conferences = WritingConference.where(create_user_id: current_user.id)
page = params[:page]
page ||= 1
@userid = current_user.id
if @view_by.nil?
@writing_conferences = @writing_conferences.asc(:paper_title)
else

View File

@ -58,6 +58,9 @@
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_conference_data_path(:user_id => @userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Conference Papers</a></div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>

View File

@ -42,6 +42,10 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
this.initializeJournalPapers.cancelpaper = function(){
o.highlight_sub_menu_item(0);
}
this.initializeJournalPapers.syncComplete = function(){
o.notify("Sync Complete","success");
o.sub_menu_item($("div[content-type=menu] a").eq(0));
}
var uploadFiles = function(){
$('#add_plugin_file a.add').click(function(){

View File

@ -7,7 +7,7 @@ class Panel::PersonalJournal::Desktop::JournalPagesController < ApplicationContr
page ||= 1
@per_column = 5
@userid = current_user.id
case @view_by
when "abstract"
@per_column = 1

View File

@ -58,6 +58,9 @@
</ul>
</div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><a href="<%= admin_import_data_sync_journal_paper_data_path(:user_id => @userid) %>" class="icons-cycle" ajax-remote="get" response-type="json" callback-method="syncComplete" > Sync Books</a></div>
</div>
<div class="hh1 hp sdm">
<div class="sdm_t hh1"><span class="icon-question-sign"></span></div>
</div>