gridster, url code fixed, views removed.

This commit is contained in:
Harry Bomrah 2013-02-23 15:23:24 +08:00
parent 680d7908b9
commit 5f9dd984b1
9 changed files with 3629 additions and 282 deletions

View File

@ -24,7 +24,7 @@ gem 'mongoid-tree', :require => 'mongoid/tree'
gem "mongo_session_store-rails3", '3.0.6' gem "mongo_session_store-rails3", '3.0.6'
gem 'nokogiri' gem 'nokogiri'
gem 'fb_graph'
gem 'radius' gem 'radius'
gem 'rake' gem 'rake'
# gem 'remotipart' # gem 'remotipart'

View File

@ -45,6 +45,7 @@ GEM
i18n (~> 0.6) i18n (~> 0.6)
multi_json (~> 1.0) multi_json (~> 1.0)
arel (3.0.2) arel (3.0.2)
attr_required (0.0.5)
bcrypt-ruby (3.0.0) bcrypt-ruby (3.0.0)
binding_of_caller (0.7.1) binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
@ -121,6 +122,11 @@ GEM
i18n (~> 0.5) i18n (~> 0.5)
fastercsv (1.5.5) fastercsv (1.5.5)
fattr (2.2.1) fattr (2.2.1)
fb_graph (2.6.4)
httpclient (>= 2.2.0.2)
multi_json (>= 1.3)
rack-oauth2 (>= 0.14.4)
tzinfo
ffi (1.4.0) ffi (1.4.0)
haml (3.1.8) haml (3.1.8)
highline (1.6.15) highline (1.6.15)
@ -188,6 +194,13 @@ GEM
rack (1.4.5) rack (1.4.5)
rack-cache (1.2) rack-cache (1.2)
rack (>= 0.4) rack (>= 0.4)
rack-oauth2 (1.0.0)
activesupport (>= 2.3)
attr_required (>= 0.0.5)
httpclient (>= 2.2.0.2)
i18n
multi_json (>= 1.3.6)
rack (>= 1.1)
rack-protection (1.3.2) rack-protection (1.3.2)
rack rack
rack-ssl (1.3.3) rack-ssl (1.3.3)
@ -339,6 +352,7 @@ DEPENDENCIES
execjs execjs
factory_girl_rails factory_girl_rails
faker faker
fb_graph
impressionist! impressionist!
jquery-rails (= 2.1.4) jquery-rails (= 2.1.4)
jquery-ui-rails jquery-ui-rails

View File

@ -14,4 +14,5 @@
//= require orbitdesktopAPI //= require orbitdesktopAPI
//= require orbitTimeline //= require orbitTimeline
//= require orbitdesktop //= require orbitdesktop
//= require jquery.gridster
//= require desktop/books_pages //= require desktop/books_pages

File diff suppressed because it is too large Load Diff

View File

@ -328,156 +328,191 @@ var orbitDesktop = function(dom){
this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles
if(!target)target = "desktop"; if(!target)target = "desktop";
var bindHandlers = function(){ // this function will bind all the handlers in the desktop var bindHandlers = function(){ // this function will bind all the handlers in the desktop
var groupWrapperWidth = 0; // var groupWrapperWidth = 0;
$("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);}); // $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
var grps = new Array; // var grps = new Array;
$("div#desktop #group_wrapper").css("width",groupWrapperWidth); // $("div#desktop #group_wrapper").css("width",groupWrapperWidth);
var first = true; // var first = true;
$("div#desktop .g_col").sortable({ // $("div#desktop .g_col").sortable({
connectWith: ".g_col", // connectWith: ".g_col",
tolerance: 'pointer' , // tolerance: 'pointer' ,
revert: 300, // revert: 300,
containment: '#group_wrapper', // containment: '#group_wrapper',
helper: 'clone', // helper: 'clone',
stop:function(){ // stop:function(){
first = true; // first = true;
var grpwidth = 0; // var grpwidth = 0;
for(i in grps){ // for(i in grps){
var grp = grps[i]; // var grp = grps[i];
if(grp.find(".element").length == 0){ // if(grp.find(".element").length == 0){
grp.animate({"width":"0px"},500,function(){$(this).remove();}); // grp.animate({"width":"0px"},500,function(){$(this).remove();});
grpwidth+=225; // grpwidth+=225;
} // }
} // }
grps = []; // grps = [];
$("#group_wrapper").width($("#group_wrapper").width()-grpwidth); // $("#group_wrapper").width($("#group_wrapper").width()-grpwidth);
}, // },
start:function(){ // start:function(){
$("#group_wrapper").find("div.group").each(function(i,par){ // $("#group_wrapper").find("div.group").each(function(i,par){
var nextnumber = $(this).find("ul").length; // var nextnumber = $(this).find("ul").length;
$newcol = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">'); // $newcol = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">');
$(this).append($newcol); // $(this).append($newcol);
$newcol.sortable({connectWith: '.g_col'}); // $newcol.sortable({connectWith: '.g_col'});
grps.push($newcol); // grps.push($newcol);
$("#group_wrapper").width($("#group_wrapper").width()+225); // $("#group_wrapper").width($("#group_wrapper").width()+225);
}); // });
$("div#desktop .g_col").sortable('refresh'); // $("div#desktop .g_col").sortable('refresh');
}, // },
update:function(){ // update:function(){
if(first){ // if(first){
first = false; // first = false;
var newpostitions = new Array; // var newpostitions = new Array;
var groupids = new Array; // var groupids = new Array;
$.each($("div#desktop .group"),function(i,grp){ // $.each($("div#desktop .group"),function(i,grp){
var groupone = new Array; // var groupone = new Array;
groupids.push($(grp).attr("id")); // groupids.push($(grp).attr("id"));
$ul = $(grp).find(".g_col .element"); // $ul = $(grp).find(".g_col .element");
$.each($ul,function(){ // $.each($ul,function(){
groupone.push($(this).attr("id")); // groupone.push($(this).attr("id"));
}) // })
newpostitions.push(groupone); // newpostitions.push(groupone);
}); // });
$.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids}); // $.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
} // }
var s = $(this).find('.element').length; // var s = $(this).find('.element').length;
if(s!=0){ // if(s!=0){
last = $(this).find('.element').eq(s-1).position(), // last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true); // lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){ // if ((last.top+lasth)>528){
$(this).sortable('cancel'); // $(this).sortable('cancel');
} // }
} // }
$("#group_wrapper ul").each(function(){ // $("#group_wrapper ul").each(function(){
if($(this).find('.element').length == 0) // if($(this).find('.element').length == 0)
$(this).animate({"width":"0px"},500,function(){$(this).remove();}); // $(this).animate({"width":"0px"},500,function(){$(this).remove();});
}) // })
}, // },
receive: function(event, ui){ // receive: function(event, ui){
var s = $(this).find('.element').length, // var s = $(this).find('.element').length,
last = $(this).find('.element').eq(s-1).position(), // last = $(this).find('.element').eq(s-1).position(),
lasth = $(this).find('.element').eq(s-1).outerHeight(true); // lasth = $(this).find('.element').eq(s-1).outerHeight(true);
if ((last.top+lasth)>528){ // if ((last.top+lasth)>528){
$(ui.sender).sortable('cancel'); // $(ui.sender).sortable('cancel');
} // }
} // }
}); // });
o.tinyscrollbar_ext({ o.tinyscrollbar_ext({
main: '.tinycanvas' main: '.tinycanvas'
}) })
o.simple_drop_down(); o.simple_drop_down();
$("div#group_wrapper ul li[data-category=app]").click(function(){ // $("div#group_wrapper ul li[data-category=app]").click(function(){
o.appWindow({ // o.appWindow({
title : $(this).find("a").attr("href"), // title : $(this).find("a").attr("href"),
appid : $(this).find("a").attr("href") // appid : $(this).find("a").attr("href")
}); // });
}); // });
} }
var loadTiles = function(id){ //This will load tiles for a specific desktop .. id of section has to be passed here to load tiles var loadTiles = function(id){ //This will load tiles for a specific desktop .. id of section has to be passed here to load tiles
$("div#desktop div#group_wrapper").empty(); $("div#desktop div#group_wrapper").empty();
$.getJSON("/desktop/getgroups",{sectionid:id},function(groups){ $.getJSON("/desktop/getgroups",{sectionid:id},function(tiles){
tiles.sort(o.sortJSON("position",true,parseInt));
var tilecolors = o.themesettings.tilecolor; var tilecolors = o.themesettings.tilecolor;
var opacity = ["op05","op06","op07","op08","op09"]; var opacity = ["op05","op06","op07","op08","op09"];
$.each(groups,function(i,group){ var row = 1,col = 1,x = 1,y = 1;
group.sort(o.sortJSON("position",true,parseInt)); var $group = $('<div class="grid"></div>');
// var $group = $('<div class="group"><ul class="grp ui-sortable"></ul></div>'), var $ul = $('<ul style="margin: -6px 0 0 -6px;"></ul>');
var colindex = 0, $.each(tiles,function(i,tile){
$group = $('<div class="group"></div>'), if(row >= 4){
$col = $('<ul class="g_col g_col_w2 col'+ colindex +'"/>'), row = 1;
$li, col++;
bdsum = 0,
bwsum = 0,
bhsum = 0,
small = 0,
single = false;
$group.append($col);
for(j=0;j<group.length;j++){
var tile = group[j];
var brick = tile.shape.replace(' holder_f','').split(' '),
bw = parseInt(brick[0].substr(1)),
bh = parseInt(brick[1].substr(1)),
bd = bw * bh;
if(bh==1 && bw==1){
small++;
}else if(bh!=1 && bw!=1){
single = true;
} }
if(small==2){ var shape = tile.shape.split(" ");
small=0; x = parseInt(shape[0].substr(1,1));
single=false; y = parseInt(shape[1].substr(1,1));
}else if(small==1 && single==true){
bh++;
small=0;
single=false;
}else{small=0;single=false;}
bdsum+=bd;
bwsum+=bw;
bhsum+=bh;
if(bdsum > 8 || bhsum > 6){
bdsum = 0, bhsum = 0, colindex++,j--;
$group.append('<ul class="g_col g_col_w2 col'+ colindex +'"/>');
}else{
var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)]; var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
var op = opacity[Math.floor(Math.random()*opacity.length)]; var op = opacity[Math.floor(Math.random()*opacity.length)];
if(j==0)$group.attr("id",tile.group_id);
if(tile.data_category == "app") if(tile.data_category == "app")
$li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" ><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile.data_content+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>'); $li = $('<li data-id="'+tile.id+'" class="tile '+tilecolor+' '+op+'" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'"><a href="'+tile.data_content+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
else else
$li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>'); $li = $('<li data-id="'+tile.id+'" class="tile '+tilecolor+' '+op+'" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><div class="appholder">Loading...</div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
$group.find('.col'+colindex).append($li); row = row + y;
}
} $ul.append($li);
$("div#desktop div#group_wrapper").append($group);
}) })
$group.append($ul);
console.log($group);
$("div#desktop div#group_wrapper").append($group);
$(".grid ul").gridster({
widget_margins: [6, 6],
widget_base_dimensions: [120, 120]
});
bindHandlers(); bindHandlers();
o.initializeWidgets(); o.initializeWidgets();
}) })
// var tilecolors = o.themesettings.tilecolor;
// var opacity = ["op05","op06","op07","op08","op09"];
// $.each(groups,function(i,group){
// group.sort(o.sortJSON("position",true,parseInt));
// // var $group = $('<div class="group"><ul class="grp ui-sortable"></ul></div>'),
// var colindex = 0,
// $group = $('<div class="group"></div>'),
// $col = $('<ul class="g_col g_col_w2 col'+ colindex +'"/>'),
// $li,
// bdsum = 0,
// bwsum = 0,
// bhsum = 0,
// small = 0,
// single = false;
// $group.append($col);
// for(j=0;j<group.length;j++){
// var tile = group[j];
// var brick = tile.shape.replace(' holder_f','').split(' '),
// bw = parseInt(brick[0].substr(1)),
// bh = parseInt(brick[1].substr(1)),
// bd = bw * bh;
// if(bh==1 && bw==1){
// small++;
// }else if(bh!=1 && bw!=1){
// single = true;
// }
// if(small==2){
// small=0;
// single=false;
// }else if(small==1 && single==true){
// bh++;
// small=0;
// single=false;
// }else{small=0;single=false;}
// bdsum+=bd;
// bwsum+=bw;
// bhsum+=bh;
// if(bdsum > 8 || bhsum > 6){
// bdsum = 0, bhsum = 0, colindex++,j--;
// $group.append('<ul class="g_col g_col_w2 col'+ colindex +'"/>');
// }else{
// var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
// var op = opacity[Math.floor(Math.random()*opacity.length)];
// if(j==0)$group.attr("id",tile.group_id);
// if(tile.data_category == "app")
// $li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" ><span class="tile '+tilecolor+' '+op+'"></span><a href="'+tile.data_content+'" class="appicon" onclick="return false;"><img src="'+o.iconPath+tile.data_content+'.png" alt="" ></a><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
// else
// $li = $('<li data-id="'+tile.id+'" class="element '+tile.shape+' hp vp" data-category="'+tile.data_category+'" data-content="'+tile.data_content+'" js-link="'+tile.js[0].url+'" css-link="'+tile.css.url+'"><span class="tile '+tilecolor+' '+op+'"></span><h1 class="appname thmtxt">'+tile.title+'</h1><div class="appholder">Loading...</div></li>');
// $group.find('.col'+colindex).append($li);
// }
// }
// $("div#desktop div#group_wrapper").append($group);
// })
// })
} }
var loadSectionList = function(){ //This will load the section list from the db var loadSectionList = function(){ //This will load the section list from the db
$.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){ $.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){
@ -1183,7 +1218,7 @@ var orbitDesktop = function(dom){
}) })
}; };
this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop
var elements = $("#group_wrapper li.element"); var elements = $("#group_wrapper li.tile");
$.each(elements,function(){ $.each(elements,function(){
var widget = $(this); var widget = $(this);
if(widget.attr("data-category")=="widget"){ if(widget.attr("data-category")=="widget"){

View File

@ -12,5 +12,6 @@
*= require desktopmedia *= require desktopmedia
*= require orbitTimeline *= require orbitTimeline
*= require orbit-bar *= require orbit-bar
*= require jquery.gridster
*= require icons *= require icons
*/ */

View File

@ -0,0 +1,64 @@
/*! gridster.js - v0.1.0 - 2012-10-20
* http://gridster.net/
* Copyright (c) 2012 ducksboard; Licensed MIT */
.gridster {
position:relative;
}
.gridster > * {
margin: 0 auto;
-webkit-transition: height .4s;
-moz-transition: height .4s;
-o-transition: height .4s;
-ms-transition: height .4s;
transition: height .4s;
}
.gridster .gs_w{
z-index: 2;
position: absolute;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s;
-moz-transition: opacity .3s, left .3s, top .3s;
-o-transition: opacity .3s, left .3s, top .3s;
transition: opacity .3s, left .3s, top .3s;
}
.ready .gs_w:not(.preview-holder) {
-webkit-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-moz-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
-o-transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
transition: opacity .3s, left .3s, top .3s, width .3s, height .3s;
}
.gridster .preview-holder {
z-index: 1;
position: absolute;
background-color: #fff;
border-color: #fff;
opacity: 0.3;
}
.gridster .player-revert {
z-index: 10!important;
-webkit-transition: left .3s, top .3s!important;
-moz-transition: left .3s, top .3s!important;
-o-transition: left .3s, top .3s!important;
transition: left .3s, top .3s!important;
}
.gridster .dragging {
z-index: 10!important;
-webkit-transition: all 0s !important;
-moz-transition: all 0s !important;
-o-transition: all 0s !important;
transition: all 0s !important;
}
/* Uncomment this if you set helper : "clone" in draggable options */
/*.gridster .player {
opacity:0;
}*/

View File

@ -125,9 +125,9 @@ class DesktopController< ApplicationController
data_content = tile.data_content data_content = tile.data_content
title = tile.title title = tile.title
end end
a << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title} gr << {"id"=>tile.id,"data_category"=>tile.data_category,"data_content"=>data_content,"js"=>jsfile,"css"=>cssfile,"shape"=>shape,"position"=>tile.position,"title"=>title}
end end
gr << a # gr << a
end end
render :json =>gr.to_json render :json =>gr.to_json
end end

View File

@ -18,37 +18,37 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
fill: '.list_t' fill: '.list_t'
}) })
$("#journal_selection_options a").click(function(){ // $("#journal_selection_options a").click(function(){
switch($(this).attr("href")){ // switch($(this).attr("href")){
case "all": // case "all":
$(".list_item_action > .icon-check-empty").switchClass("icon-check-empty","icon-check",0); // $(".list_item_action > .icon-check-empty").switchClass("icon-check-empty","icon-check",0);
break; // break;
case "none": // case "none":
$(".list_item_action > .icon-check").switchClass("icon-check","icon-check-empty",0); // $(".list_item_action > .icon-check").switchClass("icon-check","icon-check-empty",0);
break; // break;
} // }
return false; // return false;
}) // })
$("#journal_view_selection a").click(function(){ // $("#journal_view_selection a").click(function(){
switch($(this).attr("href")){ // switch($(this).attr("href")){
case "journal": // case "journal":
journalview(); // journalview();
break; // break;
case "keywords": // case "keywords":
keywordsview(); // keywordsview();
break; // break;
case "title": // case "title":
titleview(); // titleview();
break; // break;
case "abstract": // case "abstract":
abstractview(); // abstractview();
break; // break;
case "file": // case "file":
fileview(); // fileview();
break; // break;
} // }
return false; // return false;
}) // })
} }
var bindSecondaryHandlers = function(){ var bindSecondaryHandlers = function(){
@ -67,123 +67,123 @@ orbitDesktop.prototype.initializeJournalPapers = function(target,url,cache){ //
} }
var journalview = function(){ // var journalview = function(){
$("#journal_p div#paper_list div.overview").empty(); // $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), // var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1, // counter = 1,
li; // li;
$.each(journalData,function(i,journal){ // $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ // $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>'); // li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li); // column.find("ul").append(li);
if(counter%5==0){ // if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); // column = $('<div class="g_col list_t"><ul></ul></div>');
} // }
counter++; // counter++;
}) // })
}) // })
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers(); // bindSecondaryHandlers();
} // }
var fileview = function(){ // var fileview = function(){
$("#journal_p div#paper_list div.overview").empty(); // $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), // var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1, // counter = 1,
li = null; // li = null;
$.each(journalData,function(i,journal){ // $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ // $.each(journal.papers,function(j,paper){
li = null; // li = null;
li = $('<li class="list_t_item file_view"></li>'); // li = $('<li class="list_t_item file_view"></li>');
li.append('<div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des"></div>'); // li.append('<div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+journal.title+'</div><div class="list_t_des"></div>');
var file_list = li.find('.list_t_des'); // var file_list = li.find('.list_t_des');
$.each(paper.files,function(k,file){ // $.each(paper.files,function(k,file){
var thistitle = file.title; // var thistitle = file.title;
if(!thistitle) // if(!thistitle)
thistitle = ""; // thistitle = "";
thistitle = ( thistitle.length > 8 )? thistitle.substring(0,8)+'...' : thistitle; // thistitle = ( thistitle.length > 8 )? thistitle.substring(0,8)+'...' : thistitle;
if(!file.title){ // if(!file.title){
thistitle = "Untitled File"; // thistitle = "Untitled File";
} // }
var img = $('<a class="file" href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" /><span class="filetitle">'+thistitle+'</span></a>'); // var img = $('<a class="file" href="'+file.url+'" target="_blank" ><img src="'+file.icon+'" /><span class="filetitle">'+thistitle+'</span></a>');
file_list.append(img); // file_list.append(img);
}) // })
li.append('<div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div>'); // li.append('<div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div>');
column.find("ul").append(li); // column.find("ul").append(li);
if(counter%3==0){ // if(counter%3==0){
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); // column = $('<div class="g_col list_t"><ul></ul></div>');
} // }
counter++; // counter++;
}) // })
}) // })
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers(); // bindSecondaryHandlers();
} // }
var keywordsview = function(){ // var keywordsview = function(){
$("#journal_p div#paper_list div.overview").empty(); // $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), // var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1, // counter = 1,
li; // li;
$.each(journalData,function(i,journal){ // $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ // $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>'); // li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.keywords+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li); // column.find("ul").append(li);
if(counter%5==0){ // if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); // column = $('<div class="g_col list_t"><ul></ul></div>');
} // }
counter++; // counter++;
}) // })
}) // })
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers(); // bindSecondaryHandlers();
} // }
var titleview = function(){ // var titleview = function(){
$("#journal_p div#paper_list div.overview").empty(); // $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), // var column = $('<div class="g_col list_t"><ul></ul></div>'),
counter = 1, // counter = 1,
li; // li;
$.each(journalData,function(i,journal){ // $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ // $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>'); // li = $('<li class="list_t_item"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li); // column.find("ul").append(li);
if(counter%5==0){ // if(counter%5==0){
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); // column = $('<div class="g_col list_t"><ul></ul></div>');
} // }
counter++; // counter++;
}) // })
}) // })
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers(); // bindSecondaryHandlers();
} // }
var abstractview = function(){ // var abstractview = function(){
$("#journal_p div#paper_list div.overview").empty(); // $("#journal_p div#paper_list div.overview").empty();
var column = $('<div class="g_col list_t"><ul></ul></div>'), // var column = $('<div class="g_col list_t"><ul></ul></div>'),
li; // li;
$.each(journalData,function(i,journal){ // $.each(journalData,function(i,journal){
$.each(journal.papers,function(j,paper){ // $.each(journal.papers,function(j,paper){
li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>'); // li = $('<li class="list_t_item" style="height:auto;"><div class="list_item_action"><a href="" class="icon-check-empty"></a><a href="" class="icon-star-empty"></a></div><div class="list_t_title">'+paper.title+'</div><div class="list_t_des">'+paper.abstract+'</div><div class="list_item_function"><a class="journal_paper_edit admbg2 admtxt" href="'+paper.url_edit+'" ajax-remote="get" >Edit</a> <a ajax-remote="delete" confirm-message="Are you sure?" callback-method="paperDelete" class="journal_paper_delete admbg2 admtxt" href="'+paper.url_delete+'">Delete</a></div></li>');
column.find("ul").append(li); // column.find("ul").append(li);
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
column = $('<div class="g_col list_t"><ul></ul></div>'); // column = $('<div class="g_col list_t"><ul></ul></div>');
}) // })
}) // })
$("#journal_p div#paper_list div.overview").append(column); // $("#journal_p div#paper_list div.overview").append(column);
bindSecondaryHandlers(); // bindSecondaryHandlers();
} // }
var getData = function(){ // var getData = function(){
$.getJSON("/panel/personal_journal/desktop/get_journals_json",function(journals){ // $.getJSON("/panel/personal_journal/desktop/get_journals_json",function(journals){
journalData = eval(journals); // journalData = eval(journals);
journalview(); // journalview();
bindHandlers(); // bindHandlers();
}) // })
} // }
getData(); // getData();
} }
this.initializeJournalPapers.paperDelete = function(data,dom){ this.initializeJournalPapers.paperDelete = function(data,dom){
var parent = dom.parent().parent(); var parent = dom.parent().parent();