orbitDesktop.prototype.initializePersonalBook = function(target,url,cache){ // this init journal papers this.initializePersonalBook.formCallback = function(data){ if(data.success){ o.notify(data.msg,"success"); o.sub_menu_item($("div[content-type=menu] a").eq(0)); }else{ o.notify(data.msg,"alert"); } } this.initializePersonalBook.list = function(){ // to open list part in journal papers page var journalData; var bindHandlers = function(){ // to bind handlers for list page } bindHandlers(); var bindSecondaryHandlers = function(){ $("#journal_p div#paper_list a.icon-check-empty").click(function(){ if($(this).hasClass("icon-check-empty")){ $(this).switchClass("icon-check-empty","icon-check",0); } else if($(this) .hasClass("icon-check")) { $(this).switchClass("icon-check","icon-check-empty",0); } else if($(this).hasClass("icon-star")){ $(this).removeClass("icon-star").addClass("icon-star-empty"); } else if($(this).hasClass("icon-star-empty")){ $(this).removeClass("icon-star-empty").addClass("icon-star"); } return false; }) } o.enableSharing("div.share_mode"); } this.initializePersonalBook.bookDelete = function(data,dom){ var parent = dom.parent().parent().parent(); if(data.success){ parent.hide("slide",function(){parent.remove();}); o.notify(data.msg,"success"); } } this.initializePersonalBook.cancelbook = function(){ o.highlight_sub_menu_item(0); } var uploadFiles = function(){ $('#add_plugin_file a.add').click(function(){ var new_id = $(this).prev().attr('value'); var old_id = new RegExp("new_writing_journal_files", "g"); $(this).prev().attr('value', parseInt(new_id) + 1); var x = get_html(old_id,new_id); var newfield = $(x); $(this).parents('table').append(newfield); newfield.find('.action a.delete').click(function(){ newfield.remove(); }); return false; }); $('.action a.remove_existing_record').click(function(){ $(this).toggleClass("color-red",function(){ if($(this).hasClass('color-red')){ $(this).next('.should_destroy').attr('value', 1); }else{ $(this).next('.should_destroy').removeAttr('value'); } }) }); } var languageSelect = function(){ $(".language_select a").click(function(event) { $("*[data-language]").hide(); $("*[data-language="+$(this).data("lang")+"]").show(); return false; }); } this.initializePersonalBook.editbook = function(){ o.highlight_sub_menu_item(1); uploadFiles(); languageSelect(); } this.initializePersonalBook.addbook = function(){ // to open add pages in journal papers page uploadFiles(); languageSelect(); } this.initializePersonalBook.brief = function(){ o.enablelanguageSelect(); $("textarea.editor").ckeditor({ height: 300, width: $(".overview").width() - 20 }); } this.initializePersonalBook.syncComplete = function(){ o.notify("Sync Complete","success"); o.sub_menu_item($("div[content-type=menu] a").eq(0)); } 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"); o.sub_menu_item($("div[content-type=menu] a").eq(3)); }else{ o.notify(data.msg,"alert"); } } this.initializePersonalBook.coauthor = function(){ // to open add pages in coauthor page var bindHandlers = function(){ // to bind handlers for add page } bindHandlers(); } this.initializePersonalBook.coauthorRelationForm = function(data){ if(data.success){ o.notify(data.msg,"success"); $("#co_author_relation_table").html(data.newvalue); }else{ o.notify(data.msg,"alert"); } } this.initializePersonalBook.coauthorRelationEditForm = function(data){ if(data.success){ o.notify(data.msg,"success"); var x = o.layout_data.generate_layout_html(data.newvalue); $("div[container=true] div.overview").html(x.markup); }else{ o.notify(data.msg,"alert"); } } this.initializePersonalBook.allnone = function(d,o){ switch(o.attr("href")){ case "all": $("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check"); break; case "none": $("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty"); break; } } this.initializePersonalBook.allnone = function(d,o){ switch(o.attr("href")){ case "all": $("div.overview a.icon-check-empty").removeClass("icon-check-empty").addClass("icon-check"); break; case "none": $("div.overview a.icon-check").removeClass("icon-check").addClass("icon-check-empty"); break; } } };