Compare commits

..
Author SHA1 Message Date
Matt K. Fu 2945e14385 use rack gridfs 2013-04-25 20:37:13 +08:00
Matt K. Fu c68c563fb0 fix qa problem 2013-04-25 20:37:13 +08:00
Spen 697944a029 user id set & user fields set & role set & member frontend list & user translation & create new member bug fix 2013-04-25 19:59:59 +08:00
Matt K. Fu 12e39b4d77 fix rescue job won't start 2013-04-25 15:46:16 +08:00
Matt K. Fu a0478f2a8f fix page name repeated error when page creating 2013-04-25 12:19:25 +08:00
Matt K. Fu b198b1a17b system preference 2013-04-24 19:21:11 +08:00
Matt K. Fu 62fa589e8a add msg when user session expired at page admin 2013-04-24 11:58:48 +08:00
Matt K. Fu 5ff7dfbac6 fronted open switch and backend openness 2013-04-23 18:48:18 +08:00
harrybomrah 11067ef34f english mandatory removed from albums 2013-04-23 11:09:43 +08:00
Spen 536f0d30af apps_translate_fix 2013-04-23 11:09:20 +08:00
Matt K. Fu 41168f4c99 fix for fronted routing failed 2013-04-23 10:01:02 +08:00
Matt K. Fu 7e9fce0c2d clean Harry's code 2013-04-17 14:31:10 +08:00
Matt K. Fu 2416030adc remove useless rake task 2013-04-17 14:31:09 +08:00
harrybomrah 38d5a193e0 tiny scrollbar trigger fixed and devin branch merged 2013-04-17 14:31:09 +08:00
Matt K. Fu fcfdd562a6 reverse harrys db setting 2013-04-17 14:29:56 +08:00
devin chen 989e5aa974 minor update 2013-04-17 14:29:56 +08:00
Matt K. Fu 4cbf2fd8b9 complete harrys code 2013-04-17 14:29:56 +08:00
Spen c94a86c3a4 web_resource rake web_link_url:web_link_url_i18n 2013-04-17 14:29:04 +08:00
devin chen aedab01ae6 minor update 2013-04-17 14:29:04 +08:00
devin chen e3782c9cf7 minor update 2013-04-17 14:29:04 +08:00
harrybomrah e2802d94d0 rake task added 2013-04-17 14:28:13 +08:00
devin chen 055d758769 Page Loading Effect
tinyscrollbar has problem
2013-04-17 14:27:18 +08:00
Spen 0734f73291 faq show fix 2013-04-17 14:25:05 +08:00
Matt K. Fu a4ebe31ada fix for widget edit js missing 2013-04-17 14:19:32 +08:00
Matt K. Fu 3098496083 widget link followed by setting 2013-04-17 14:19:32 +08:00
Matt K. Fu 28f0df5da8 fix default widget link failed 2013-04-17 14:19:32 +08:00
Matt K. Fu 3de4591413 fix frontend ajax respond 404 due to javascript overwritten after assets precompile 2013-04-17 14:19:32 +08:00
devin chen d177fe0369 minor update 2013-04-17 14:19:32 +08:00
harrybomrah d288972035 stupid commit 2013-04-17 14:19:32 +08:00
harrybomrah c6868bf2e0 small fix in select2.js 2013-04-17 14:18:49 +08:00
devin chen 95e308e046 minor update 2013-04-17 14:18:49 +08:00
Matt K. Fu 425a320c02 fix widget and fronted setting interface. checked with Spen 2013-04-17 14:16:24 +08:00
devin chen dc5f24ab22 starting new branch ( add rules in .gitignore for SASS cache folder ) 2013-04-17 14:16:24 +08:00
harrybomrah bc0477a5ed widget and gridster fixes 2013-04-17 14:16:24 +08:00
Matt K. Fu 0781779ac0 solved conflicts 2013-04-17 14:14:24 +08:00
devin e7bffe4c0f devin's new branch 2013-04-17 14:14:24 +08:00
chris dd10b3147c Fix js bug and asset url after merge 2013-04-17 14:14:24 +08:00
devin cae43e8acd recover .gitignore file
Conflicts:
	.gitignore
2013-04-17 14:14:23 +08:00
harrybomrah 793d739726 features and widgets added
Conflicts:
	app/assets/javascripts/orbitdesktop.js
2013-04-17 14:14:23 +08:00
devin c8aa50ee87 Lots of Update
1. CSS to SCSS
2. Journal Paper update

Conflicts:
	Gemfile.lock
	app/assets/javascripts/orbitdesktop.js
	app/assets/stylesheets/desktop/desktop-main.css
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_author_relations/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_co_authors/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/index.html.erb
	vendor/built_in_modules/personal_journal/app/views/panel/personal_journal/desktop/journal_pages/journal_type.html.erb
2013-04-17 14:14:23 +08:00
Matt K. Fu 0f6f5aafce fix for both part and page part settings
Conflicts:
	app/helpers/admin/page_parts_helper.rb
	app/views/admin/pages/reload_front_end_setting.js.erb
	app/views/admin/pages/reload_frontend_pages.js.erb
2013-04-17 14:12:52 +08:00
Fu Matthew f6b600df59 deliver API 2013-04-17 14:09:01 +08:00
chris 6af375efa4 Fix bug in setup_app_frontend_and_style 2013-04-17 14:09:00 +08:00
Fu Matthew 1709773b0a style for front end 2013-04-17 14:08:01 +08:00
Rueshyna 95805cfdee correct model method 2013-04-17 14:07:24 +08:00
harrybomrah 84afbfa86c section page fixed.. 2013-04-17 14:01:48 +08:00
Rueshyna 44fede2b71 fixed co author relation save button 2013-04-17 14:01:48 +08:00
harrybomrah 764f83d58c app manager changed plus some changes 2013-04-17 14:01:14 +08:00
harrybomrah 8dee211ab4 section page fixed.. 2013-04-17 14:01:14 +08:00
Rueshyna 27ad25ccca add pagination for every controller and view in personal plugin 2013-04-17 14:00:37 +08:00
harrybomrah f9e7cefc94 compatibility page added and tinyscrollbar drag event fixed.. 2013-04-17 13:59:16 +08:00
Rueshyna df220397b2 make index of list can be hightline list when click cancel button 2013-04-17 12:22:04 +08:00
Rueshyna b5fd6c7a1a fixed author sample data generation and model method 2013-04-17 12:21:21 +08:00
Rueshyna 65e306a854 have done conference author filter, journal haven't been done, yet 2013-04-17 12:13:06 +08:00
harrybomrah 41643d1f61 tinyscrollbar pagination fixed 2013-04-17 12:11:33 +08:00
Rueshyna aad4119892 fixed bug 2013-04-17 12:07:11 +08:00
harrybomrah 54af5e8bd4 insert and remove columns 2013-04-17 12:06:33 +08:00
harrybomrah 6db9e70132 Major tinyscrollbar update 2013-04-17 12:04:22 +08:00
harrybomrah dabceec3ea all none for conf done 2013-04-17 11:23:03 +08:00
harrybomrah 52789fa032 all none fixed 2013-04-17 11:23:02 +08:00
Rueshyna dc68f40cb4 correct model method 2013-04-17 11:13:32 +08:00
Rueshyna 228dd1b767 fixed co author relation save button 2013-04-17 11:13:32 +08:00
harrybomrah dae3f069ff app manager changed plus some changes 2013-04-17 11:09:56 +08:00
Rueshyna 5f2c669568 fixed checkout and start in personal plugin 2013-04-17 11:08:58 +08:00
Rueshyna 1b12412596 correct factoried girl for journal 2013-04-17 11:08:58 +08:00
harrybomrah b1d7d5345e section page fixed.. 2013-04-17 11:08:58 +08:00
Fu Matthew 6efef253a6 add conditions for making multi cates and tags more stable 2013-04-17 11:08:57 +08:00
devin 0d5ab20efa add browser compatibility page 2013-04-17 11:07:45 +08:00
Fu Matthew 9815950083 now default options can be chosen by developer at init 2013-04-17 11:07:45 +08:00
Rueshyna 50449b55e8 one abstract one column for personal plugin 2013-04-17 11:07:20 +08:00
Rueshyna 00db66b8c4 add pagination for every controller and view in personal plugin 2013-04-17 11:07:20 +08:00
harrybomrah b8ee2fd559 compatibility page added and tinyscrollbar drag event fixed.. 2013-04-17 11:07:20 +08:00
harrybomrah 401c75c0de Major tinyscrollbar update 2013-04-17 11:06:28 +08:00
Rueshyna 1ebae504dc modify translation for journal_co_author_relation button 2013-04-17 11:05:57 +08:00
harrybomrah 323fadc210 tinyscrollbar pagination fixed 2013-04-17 11:05:57 +08:00
Fu Matthew 69a49a69aa style for front end 2013-04-17 11:05:57 +08:00
Rueshyna 5178ce3bde modify nil of email string and sort 2013-04-17 11:04:52 +08:00
Rueshyna 95128a3465 remove redundant space of co_author sample data 2013-04-17 11:04:52 +08:00
Rueshyna 8783b8e5fe make index of list can be hightline list when click cancel button 2013-04-17 11:04:52 +08:00
Rueshyna a3de4cc2d4 fixed author sample data generation and model method 2013-04-17 11:04:52 +08:00
Rueshyna bdaef3af0f add author filter for journal and fix some bug 2013-04-17 11:04:52 +08:00
Rueshyna 625f2e9ad6 have done conference author filter, journal haven't been done, yet 2013-04-17 11:04:52 +08:00
harrybomrah db60a3bcfa insert and remove columns 2013-04-17 11:04:37 +08:00
harrybomrah a7667d586a Major tinyscrollbar update 2013-04-17 11:04:36 +08:00
Rueshyna e9ddb85734 add pagination for personal plugin 2013-04-17 10:56:49 +08:00
harrybomrah d840b82fa9 insert and remove columns 2013-04-17 10:56:15 +08:00
devin 84dfb44e78 tinyscrollbar css minor update 2013-04-17 10:56:15 +08:00
Fu Matthew 4a08a1992b 1.make module app forbid unearthed access except from admin
2.override sidebar link when it's object_auth or app_auth.
2013-04-17 10:56:15 +08:00
Rueshyna 15be80a35f fixed bug 2013-04-17 10:56:14 +08:00
harrybomrah 1d06bcaae7 Major tinyscrollbar update 2013-04-17 10:54:38 +08:00
Fu Matthew 8e98cb3ec9 put add admin pages using orbit back end controller 2013-04-17 10:54:38 +08:00
harrybomrah 6cd97adf21 all none for conf done 2013-04-17 10:54:38 +08:00
harrybomrah 0189d1c2c0 all none fixed 2013-04-17 10:54:38 +08:00
chris 3e96cfe514 Changes for FAQ to work with not latest but stable code 2013-03-28 15:05:52 +08:00
Spen 468555a037 faq app 2013-03-28 14:09:29 +08:00
chris da8a5123c2 Change in announcement init for query
Change in default widget query
2013-03-27 16:31:42 +08:00
chris 4ebc8cbb77 Delete NTU's i18n 2013-03-27 16:30:35 +08:00
chris ec1605358b Fix sorting for archive 2013-03-27 06:30:22 +08:00
296 changed files with 5039 additions and 1036 deletions

No files matched your search

+1
View File
@@ -26,6 +26,7 @@ gem "mongo_session_store-rails3", '3.0.6'
gem 'nokogiri'
gem 'fb_graph'
gem 'rack-gridfs'
gem 'radius'
gem 'rake'
# gem 'remotipart'
+5
View File
@@ -194,6 +194,10 @@ GEM
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-gridfs (0.4.1)
mime-types
mongo (~> 1.2)
rack
rack-oauth2 (1.0.0)
activesupport (>= 2.3)
attr_required (>= 0.0.5)
@@ -373,6 +377,7 @@ DEPENDENCIES
pry-debugger
pry-remote
pry-stack_explorer
rack-gridfs
radius
rails (~> 3.2.9)
rake
@@ -0,0 +1,34 @@
function append_id(){
if ($("#object_id").length == 1) {
return "&id="+$("#object_id").val();
}
else{
return '';
};
}
$("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '?design_id=' + $(this).val() + append_id());
});
$("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val() + append_id());
});
$("#widget_list select,#frontend_list select").live('change', function() {
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() + append_id() );
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val() + append_id() );
});
$("select.widget_field_select").live('change', function() {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val() + append_id() );
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});
@@ -2,11 +2,11 @@ function update_cates_and_tags()
{
$('.select_option,.select_all').removeAttr('disabled');
$(".select_all:checked").each(function( obj ) {
$(this).parent().siblings('label').find('.select_option').attr('disabled',true);
// $(this).parent().siblings('label').find('.select_option').attr('disabled',"disabled");
$(this).parent().siblings('label').find('.select_option').removeAttr('checked');
});
$(".select_option:checked").each(function( obj ) {
$(this).parent().siblings('label').find('.select_all').attr('disabled',true);
// $(this).parent().siblings('label').find('.select_all').attr('disabled',"disabled");
$(this).parent().siblings('label').find('.select_all').removeAttr('checked');
});
}
+188 -345
View File
@@ -108,8 +108,8 @@ var orbitDesktop = function(dom){
this.contentHolder = dom;
this.themesettings = "";
this.theme = "4f8d3f493b67fcd05f086359";
this.transitionTime = 500;
this.currenthtml = "home";
this.transitionTime = 1000;
this.currenthtml = "desktop.html";
this.currentface = "home";
this.desktopData = {};
this.tp = "";
@@ -135,7 +135,7 @@ var orbitDesktop = function(dom){
o.theme = theme;
loadTheme(desktopSettings.customtheme,desktopSettings.wallpaper);
}else{loadTheme();}
})
});
var loadTheme = function(customtheme,customwallpaper){ //This function will load the theme from database
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
o.themesettings = eval(ts);
@@ -160,8 +160,8 @@ var orbitDesktop = function(dom){
}
});
})
}
}
};
};
this.customPage = function(customload){
customload = customload.replace("#","");
if(customload.search("-") != -1){
@@ -170,7 +170,7 @@ var orbitDesktop = function(dom){
}else{
o.menu_item($(".docklist a[custom-load="+customload+"]"),true);
}
}
};
this.changeTheme = function(theme){ // this function is used for changing theme
o.theme = theme;
$.getJSON("/"+o.themefolder+"/"+theme+"/settings/"+theme+".json",function(ts){
@@ -189,9 +189,9 @@ var orbitDesktop = function(dom){
$.getJSON("http://maps.googleapis.com/maps/api/geocode/json?latlng="+o.locationdata.lat+","+o.locationdata.lng+"&sensor=true",function(data){
$.each(data.results[0].address_components,function(i,val){
o.locationdata[val.types[0]] = val.long_name;
})
});
o.locationdata.formatted_address = data.results[0].formatted_address;
})
});
}
var locationError = function(){
@@ -211,7 +211,7 @@ var orbitDesktop = function(dom){
$(".docklist a").click(function(){
o.menu_item($(this));
return false;
})
});
$('body').on({
@@ -254,7 +254,7 @@ var orbitDesktop = function(dom){
}
$(this).ajaxSubmit(options);
return false;
})
});
$("body").on("click","*[ajax-remote]",function(){
var $e = $(this);
@@ -310,11 +310,11 @@ var orbitDesktop = function(dom){
a();
}
return false;
})
});
$(window).resize(function(){
var ww = $(window).width();
$("img#thmbackground").attr({"width":ww});
// var ww = $(window).width();
// $("img#thmbackground").attr({"width":ww});
if( $('.tinycanvas').length > 0 ){ $('.tinycanvas').tinyscrollbar_update('relative'); }
if($(o.contentHolder).find("div.app_frame").length > 0){
$(o.contentHolder).find("div.app_frame").each(function(){
@@ -322,7 +322,7 @@ var orbitDesktop = function(dom){
var app_holder_width = $(this).width();
$(this).find("div.app_holder").height(app_holder_height);
$(this).find("div.app_holder iframe").attr({"height":app_holder_height,"width":app_holder_width});
})
});
}
});
@@ -372,14 +372,14 @@ var orbitDesktop = function(dom){
this.value = terms.join( ", " );
return false;
}
})
})
});
});
};
this.layout_data = function(h){
var $e;
var column_container,layout, base_width , no_of_entries = 0, pagination_link , pagination_variable, gutter, total_width;
var column_container,layout, base_width, total_width, gutter, no_of_entries = 0, pagination_link, pagination_variable;
o.paging = true;
gutter = (!isNaN(gutter)) ? gutter : 12;
this.layout_data.generate_layout_html = function(l){
@@ -393,7 +393,6 @@ var orbitDesktop = function(dom){
case "simple":
total_columns++;
temp_div.append(column_container.html());
total_width = "auto";
break;
case "datalist":
no_of_entries = (typeof column_container.attr("per-column") != "undefined"? parseInt(column_container.attr("per-column")) : 4);
@@ -412,10 +411,7 @@ var orbitDesktop = function(dom){
x = 0;
temp_div.append(column);
}
})
if(x != 0){
temp_div.append(column);
}
});
}
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
break;
@@ -428,11 +424,12 @@ var orbitDesktop = function(dom){
column.append(ul);
x++;
temp_div.append(column);
})
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
});
}
total_width = (!isNaN(base_width)) ? (base_width + gutter*2 +1) * total_columns : null;
break;
default:
break;
}
// total_width = (!isNaN(base_width) ? ( base_width + 12 ) * total_columns : null);
@@ -473,20 +470,22 @@ var orbitDesktop = function(dom){
var f = o.layout_data.generate_layout_html(html);
// console.log(f.total)
if(f.total > 0){
$("div[container=true] div.overview").append(f.markup);
$("div[container=true] .overview").append(f.markup);
if(f.width){
var w = $("div[container=true] div.overview").width();
$("div[container=true] div.overview").width(w+f.width);
var w = $("div[container=true] .overview").width();
$("div[container=true] .overview").width(w+f.width);
}
o.tinyscrollbar.tinyscrollbar_update("relative");
o.paging = true;
}else{o.paging = false;}
} else {
o.paging = false;
}
})
}
});
}
this.insert_new_column = function(index){
var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),base_width = parseInt(column_container.attr("base-width")),column;
var column_container = $("div[container=true] .overview"),layout = column_container.attr("content-layout"),base_width = parseInt(column_container.attr("base-width")),column;
var i = (index == 0? 0 : index-1);
var previous_column = column_container.find(".column").eq(i);
if(previous_column.length == 0)return false;
@@ -515,7 +514,7 @@ var orbitDesktop = function(dom){
}
this.remove_column = function(index){
var column_container = $("div[container=true] div.overview"),layout = column_container.attr("content-layout"),column = column_container.find(".column").eq(index),base_width = parseInt(column_container.attr("base-width"));
var column_container = $("div[container=true] .overview"),layout = column_container.attr("content-layout"),column = column_container.find(".column").eq(index),base_width = parseInt(column_container.attr("base-width"));
if(column.length == 0)return false;
switch(layout){
case "datalist":
@@ -542,52 +541,69 @@ var orbitDesktop = function(dom){
o.lastlink = url;
o.data_method = dom.attr("callback-method");
if(o.currenthtml!=target){
if(o.desktopData[o.currentface] == "undefined")
if(o.desktopData[o.currentface] == "undefined"){
o.desktopData[o.currentface] = "";
}
o.desktopData[o.currentface] = $(o.contentHolder).html();
if(customload){
$(o.contentHolder).html("<div id='content'></div>");
}
$("#content").hide("drop",o.transitionTime,function(){
$("#content > #holder").toggle("drop",{ easing: "easeInOutQuint" },o.transitionTime,function(){
o.currenthtml = target;
o.currentface = target;
var cache = false;
if(!o.desktopData[o.currentface]){
$(o.contentHolder).empty().load(url,function(data){
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
if(o.data_method != ""){
window.o[o.data_method](target,url,cache);
}
}
try {
if(!customload)
if(!customload){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
else{
if(submenuitem)
} else {
if(submenuitem){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
else
} else {
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
}
}
} catch(EX){}
})
header_ani();
});
}else{
$(o.contentHolder).html(o.desktopData[o.currentface]);
try{
if(!customload)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
else{
if(!customload){
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
}else{
if(submenuitem)
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[custom-load="+submenuitem+"]"));
else
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"),data);
o.sub_menu_item($(o.contentHolder).find("*[content-type=menu] a[load=true]"));
}
}catch(EX){}
cache = true;
if(typeof o.data_method != "undefined"){
if(o.data_method != "")
if(o.data_method != ""){
window.o[o.data_method](target,url,cache);
}
}
}
});
$('#header')
.delay(600)
.effect('drop',{
easing: 'easeInOutQuint',
direction: 'down'
},300);
}
var header_ani = function(){
$('#header').hide().toggle('drop',{easing: 'easeInOutQuint', direction:'down'});
$('#header > *').each(function(i){
$(this).hide().delay(i*100).fadeIn(600,'easeInOutQuint');
});
}
}
@@ -632,173 +648,56 @@ var orbitDesktop = function(dom){
}
this.initializeDesktop = function(target,url,cache){ //this is for initializing main desktops that are sections and tiles
if(!target)target = "home";
target = (!target) ? 'desktop' : target;
var bindHandlers = function(){ // this function will bind all the handlers in the desktop
// var groupWrapperWidth = 0;
// $("div#desktop .group").each(function(){groupWrapperWidth+=$(this).outerWidth(true);});
// var grps = new Array;
// $("div#desktop #group_wrapper").css("width",groupWrapperWidth);
// var first = true;
// $("div#desktop .g_col").sortable({
// connectWith: ".g_col",
// tolerance: 'pointer' ,
// revert: 300,
// containment: '#group_wrapper',
// helper: 'clone',
// stop:function(){
// first = true;
// var grpwidth = 0;
// for(i in grps){
// var grp = grps[i];
// if(grp.find(".element").length == 0){
// grp.animate({"width":"0px"},500,function(){$(this).remove();});
// grpwidth+=225;
// }
// }
// grps = [];
// $("#group_wrapper").width($("#group_wrapper").width()-grpwidth);
// },
// start:function(){
// $("#group_wrapper").find("div.group").each(function(i,par){
// var nextnumber = $(this).find("ul").length;
// $newcol = $('<ul class="g_col g_col_w2 col'+nextnumber+' ui-sortable">');
// $(this).append($newcol);
// $newcol.sortable({connectWith: '.g_col'});
// grps.push($newcol);
// $("#group_wrapper").width($("#group_wrapper").width()+225);
// });
// $("div#desktop .g_col").sortable('refresh');
// },
// update:function(){
// if(first){
// first = false;
// var newpostitions = new Array;
// var groupids = new Array;
// $.each($("div#desktop .group"),function(i,grp){
// var groupone = new Array;
// groupids.push($(grp).attr("id"));
// $ul = $(grp).find(".g_col .element");
// $.each($ul,function(){
// groupone.push($(this).attr("id"));
// })
// newpostitions.push(groupone);
// });
// $.post("/desktop/newpositions",{"sectionid":o.sectionId,"newpos":newpostitions,"groupids":groupids});
// }
// var s = $(this).find('.element').length;
// if(s!=0){
// last = $(this).find('.element').eq(s-1).position(),
// lasth = $(this).find('.element').eq(s-1).outerHeight(true);
// if ((last.top+lasth)>528){
// $(this).sortable('cancel');
// }
// }
// $("#group_wrapper ul").each(function(){
// if($(this).find('.element').length == 0)
// $(this).animate({"width":"0px"},500,function(){$(this).remove();});
// })
// },
// receive: function(event, ui){
// var s = $(this).find('.element').length,
// last = $(this).find('.element').eq(s-1).position(),
// lasth = $(this).find('.element').eq(s-1).outerHeight(true);
// if ((last.top+lasth)>528){
// $(ui.sender).sortable('cancel');
// }
// }
// });
var dragged = null,draggable,lastpos = [];
o.gridvar = $(".grid ul").find("> li ").mousedown(function(e){
o.gridvar = $(".grid ul").find("> li ")
.mousedown(function(e){
!draggable;
dragged = $(this);
lastpos = [];
$(".grid ul li").each(function(){
lastpos.push({"col":$(this).attr("data-col"),"row":$(this).attr("data-row")})
lastpos.push({"col":$(this).attr("data-col"),"row":$(this).attr("data-row")});
});
})
}).end()
.end()
.gridster({
widget_margins: [6, 6],
widget_base_dimensions: [120, 120],
// avoid_overlapped_widgets: true,
serialize_params: function($w, wgd) { return { col: wgd.col, row: wgd.row, id: $w.data("id") } },
draggable : {
start: function(event, ui){
dragged.addClass("noClick");
},
stop: function(event, ui){
// var widgetchanged_col = dragged.attr("data-col");
// var total = 0;
// // console.log(widgetchanged.col);
// // console.log(o.gridvar.serialize_changed());
// $(".grid ul li[data-col="+widgetchanged_col+"]").each(function(i,w){
// var size = parseInt($(this).attr("data-sizey"));
// if(!isNaN(size)){
// total += size;
// }
// })
// // other way to calculate the overflow is by top > height of div
// if(total>totaltiles_in_a_row){
// revertbacktiles();
// }else{
// console.log(widgetchanged_col-1);
// $(".grid ul li[data-col="+(widgetchanged_col-1)+"]").each(function(i,w){
// var sizey = parseInt($(this).attr("data-sizey"));
// var sizex = parseInt($(this).attr("data-sizex"));
// if(sizey==1){
// sizex = sizex - 1;
// }
// console.log(sizex);
// if(!isNaN(sizex)){
// total += sizex;
// }
// })
// if(total>totaltiles_in_a_row){
// revertbacktiles();
// }
// }
for (var i = 1; i <= 30; i++) {
// var celement = $(".grid ul .widget[data-col="+i+"]:last");
$(".grid ul .widget[data-col="+i+"]").each(function(){
var pos = $(this).position();
if(pos){
if((pos.top + $(this).height() + 6) > 550){
if(pos && (pos.top + $(this).height() + 6) > 550){
revertbacktiles();
}
});
}
}
}
})
}
var newpos = o.gridvar.serialize();
console.log(newpos);
$.post("/desktop/newpositions",{"newpositions":newpos});
}
}
}).data('gridster');
.data('gridster');
var revertbacktiles = function(){
lastpos.push({"col":"","row":""});
$(".grid ul li").each(function(i){
$(this).attr({"data-col":lastpos[i].col,"data-row":lastpos[i].row});
})
});
}
var remove_empty_columns = function(){
for (var i = 1; i <= 30; i++) {
// var celement = $(".grid ul .widget[data-col="+i+"]:last");
$(".grid ul .widget[data-col="+i+"]").each(function(){
})
});
break;
}
}
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas'
})
$("li.app[data-category=app]").click(function(){
$(".app[data-category=app]").click(function(){
if(!$(this).hasClass("noClick")){
var url = $(this).find("a").data("url");
var app = $(this);
@@ -810,134 +709,64 @@ var orbitDesktop = function(dom){
}
dragged.removeClass("noClick");
})
});
var element = $('.gridster li');
$.each(element, function(i){
if($(this).attr("data-category")=="app" && $(this).find('.text_wrapper').length < 1){
$(this).find('.appname').wrapInner('<span class="text_wrapper"/>');
var w = $(this).find('.text_wrapper').width();
if (w > 96){
var text = $(this).find('.text_wrapper').text();
slice = text.substr(0,12);
$(this).find('.text_wrapper').attr('title',text).text(slice+'...');
}
}
});
// $("div#group_wrapper ul li[data-category=app]").click(function(){
// o.appWindow({
// title : $(this).find("a").attr("href"),
// appid : $(this).find("a").attr("href")
// });
// });
o.simple_drop_down();
o.tinyscrollbar_ext({
main: '.tinycanvas'
});
}
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();
$("#desktop #group_wrapper").empty();
$.getJSON("/desktop/getgroups",{sectionid:id},function(tiles){
// tiles.sort(o.sortJSON("position",true,parseInt));
tiles.sort(o.sortJSON("position",true,parseInt));
var tilecolors = o.themesettings.tilecolor;
var totaltiles_in_a_row = 4;
var opacity = ["op07","op08","op09",""];
var row = 0,col = 1,x = 1,y = 1,total_x = 0,prev_y = 0;
var row = 1, col = 1, x = 1, y = 1;
var $group = $('<div class="grid gridster"></div>');
var $ul = $('<ul style="margin: -6px 0 0 -6px;"></ul>');
var $ul = $('<ul></ul>');
$.each(tiles,function(i,tile){
var shape = tile.shape.split(" ");
// if(tile.title == "Weather")console.log("Big - row : " + tile.row + ", col : "+ tile.column);
// if(tile.title == "Google Scholar")console.log("Scholar - row : " + tile.row + ", col : "+ tile.column);
// if(total_x % 2 != 0)
// row = row - y;
// if(i == 7)tile.row = null;
if(tile.row){
row = tile.row;
col = tile.column;
x = parseInt(shape[0].substr(1,1));
y = parseInt(shape[1].substr(1,1));
}else{
x = parseInt(shape[0].substr(1,1));
if(total_x % 2 == 0){
row = row + y;
}else if(x == 1){
col++;
}
y = parseInt(shape[1].substr(1,1));
total_x = total_x + ( x * y );
prev_y = y;
if(total_x > 8){
if(row >= 4){
row = 1;
total_x = 0;
col++;
}
}
var shape = tile.shape.split(" ");
x = parseInt(shape[0].substr(1,1));
y = parseInt(shape[1].substr(1,1));
var tilecolor = tilecolors[Math.floor(Math.random()*tilecolors.length)];
var op = opacity[Math.floor(Math.random()*opacity.length)];
var f = (tile.fullsize?"fullsize":null);
if(tile.data_category == "app")
if(tile.data_category == "app"){
$li = $('<li data-id="'+tile.id+'" class="app" data-row="'+row+'" data-col="'+col+'" data-sizex="'+x+'" data-sizey="'+y+'" data-title="'+tile.title+'" 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;" data-url="'+tile.link+'"><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="widget '+f+'" 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+'"><span class="tile '+tilecolor+' '+op+'"></span><div class="appholder"><div class="thmtxt o-loading"><i class="icon-spinning icon-spinner"></i> Loading</div></div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
} else {
$li = $('<li data-id="'+tile.id+'" class="widget '+f+'" 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+'"><span class="tile '+tilecolor+' '+op+'"></span><div class="appholder"></div><h1 class="appname thmtxt">'+tile.title+'</h1></li>');
}
row = row + y;
$ul.append($li);
})
});
$group.append($ul);
$("div#desktop div#group_wrapper").append($group);
$("#desktop #group_wrapper").append($group);
bindHandlers();
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
$.getJSON("/desktop/getsectionlist",{desktopid:o.desktopId},function(sectionlist){
@@ -948,39 +777,39 @@ var orbitDesktop = function(dom){
tempstyle = "style='display:none;'";
$("#desktop #section_heading").text(section.name);
}
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh1" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
})
$("#desktop #section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp hh1" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
});
bindSecondaryHandlers();
o.simple_drop_down();
})
}
var bindSecondaryHandlers = function(){ //This is the secondary bind handler function which is used to bind events which are repeatative
$("div#desktop ul#section_list li.section_name").click(function(){
$("div#desktop li.section_name").show();
$("#desktop #section_list .section_name").click(function(){
$("#desktop .section_name").show();
$(this).hide();
$("#desktop #section_heading").text($(this).text());
o.sectionId = $(this).find("a").attr("href");
loadTiles(o.sectionId);
})
});
}
if(cache){
bindHandlers();
o.initializeWidgets();
bindSecondaryHandlers();
$("div#desktop ul#section_list").empty();
$("#desktop #section_list").empty();
$.each(o.sectionList,function(i,section){
var tempstyle="";
if(section._id==o.sectionId){
tempstyle = "style='display:none;'";
$("div#desktop span#section_heading").text(section.name);
$("#desktop #section_heading").text(section.name);
}
$("div#desktop ul#section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp w2 hh1" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
})
$("#desktop #section_list").append($('<li class="section_name" '+tempstyle+'><a class="admtxt hp hh1" onclick="return false;" href="'+section._id+'" >'+section.name+'</a></li>'));
});
bindSecondaryHandlers();
}else{
loadTiles(o.sectionId);
loadSectionList();
loadTiles(o.sectionId);
}
}
};
this.tempFunc = function(th){
$.post("desktop/twitter",function(){});
@@ -996,11 +825,11 @@ var orbitDesktop = function(dom){
//for textbox search
$("#app_manager #searchbox").focus(function(){$(this).val("");}).keyup(function(e){
if($(this).val()){
$("div#app_manager .search_result").empty();
$("div#app_manager #seperator").hide();
searchArray = $("div#app_manager .element:containsi("+$(this).val()+")");
$("#app_manager .search_result").empty();
$("#app_manager #seperator").hide();
searchArray = $("#app_manager .element:containsi("+$(this).val()+")");
if(searchArray.length>0){
$("div#app_manager #seperator").show();
$("#app_manager #seperator").show();
var i = 0;
var $column;
searchArray.each(function(){
@@ -1011,19 +840,19 @@ var orbitDesktop = function(dom){
var $newelement = $('<div class="search element w1 h1 hp vp thmc2" data-category="desktop">'+$(this).html()+'</div>');
$column.append($newelement);
if(i == 4){
$("div#app_manager .search_result").append($column);
$("#app_manager .search_result").append($column);
i = 0;
}
})
if(i != 0){
$("div#app_manager .search_result").append($column);
$("#app_manager .search_result").append($column);
}
}
}else{$("div#app_manager #seperator").hide();$("div#app_manager .search_result").empty();}
}else{$("#app_manager #seperator").hide();$("#app_manager .search_result").empty();}
}).blur(function(){$(this).val("Search");});
//for Alphabet sorting
$("div#app_manager a#alphabet_sort_btn").click(function(){
$("#app_manager #alphabet_sort_btn").click(function(){
switch ($(this).attr("href")){
case "ascending":
$(this).attr("href","descending").find(".thmtxt").text("Alphabet [Z-A]");
@@ -1031,10 +860,10 @@ var orbitDesktop = function(dom){
break;
case "descending":
$(this).attr("href","ascending").find(".thmtxt").text("Alphabet [A-Z]");
allApps = $("div#app_manager .group_search .element").sort(sortDescending);
allApps = $("#app_manager .group_search .element").sort(sortDescending);
break;
}
$("div#app_manager #app_list").empty();
$("#app_manager #app_list").empty();
var count = 0, colindex = 0;
$('#app_list').append('<div class="g_col g_col_w1 col'+ colindex +'"/>');
$.each(allApps,function(i,app){
@@ -1046,9 +875,9 @@ var orbitDesktop = function(dom){
} else {
$('.g_col.col'+ colindex).append(app);
}
})
});
return false;
})
});
}
var loadApps = function(){ //this load apps for sorting and searching
$.getJSON("/desktop/getapplist",{desktopid:o.desktopId},function(appss){
@@ -1066,22 +895,23 @@ var orbitDesktop = function(dom){
} else {
$('.g_col.col'+ colindex).append($app);
}
})
})
});
});
bindHandlers();
})
});
}
if(cache)
if(cache){
bindHandlers();
else
} else {
loadApps();
}
};
this.initializeSectionsManager = function(target,url,cache){ // this is init function for section manager
var elementParent,element,slabel;
var bindHandlers = function(){ // this is bind handler for section manager page
var groupWrapperWidth = 0;
$("div#sections .group").each(function(){groupWrapperWidth+=$(this).width();})
$("#sections .group").each(function(){groupWrapperWidth+=$(this).width();})
groupWrapperWidth+=200;
groupWrapperHeight = $(".group").height() + 20;
$("#group_wrapper").width(groupWrapperWidth);
@@ -1095,9 +925,9 @@ var orbitDesktop = function(dom){
slabel.find('li:not(:nth-child(1))').stop(1,1).fadeOut(500);
}
}
$("div#sections #group_wrapper .appgroup").sortable(sortingoptions);
$("#sections #group_wrapper .appgroup").sortable(sortingoptions);
$("div#sections .section_label li:not(:nth-child(1))").droppable({
$("#sections .section_label li:not(:nth-child(1))").droppable({
drop:function(event, ui){
elementParent = ui.draggable.parents('.group');
elementParentUl = ui.draggable.parents(".appgroup");
@@ -1141,15 +971,15 @@ var orbitDesktop = function(dom){
}
if(newul){
$("div#sections #group_wrapper .appgroup").sortable(sortingoptions);
$("#sections #group_wrapper .appgroup").sortable(sortingoptions);
$list.removeClass("no_app");
}
});
$.post("/desktop/save_desktop_settings",{"save":"appnewsection","appid":ui.draggable.attr("id"),"newsectionid":$(this).data("content"),"desktopid":o.desktopId});
// if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){
if(o.sectionId == $(this).data("content") || o.sectionId == elementParent.attr("id")){
o.desktopData["home"]="";
// }
}
}
$(this).find('span.tile').addClass('op06',400);
},
@@ -1175,12 +1005,12 @@ var orbitDesktop = function(dom){
}
if(z!=x){
$lii = $('<li class="element w1 h1 hp vp thmtxt" style="display: none;" data-category="section'+(x+1)+'" data-content="'+o.sectionList[x]._id+'"><span class="tile thmc2 op06"></span><span class="thmtxt">'+o.sectionList[x].name+'</span></li>');
$group.find("ul.section_grp").append($lii);
$group.find(".section_grp").append($lii);
}
}
z++;
$("div#group_wrapper").append($group);
$("#group_wrapper").append($group);
}
var x = 0;
@@ -1194,14 +1024,14 @@ var orbitDesktop = function(dom){
$li = $('<li class="element to_drop w1 hh2 hp vp" data-category="'+app.data_category+'" data-content="'+app.data_content+'" id="'+app._id+'"><div class="appicon"><img src="'+o.iconPath+app.data_content+'.png" class="" width="30" /></div><h1 class="appname thmtxth">'+app.title+'</h1></li>');
$ul.append($li);
if(x == 7){
$("div#group_wrapper div#section"+(i+1)).append($ul);
$("div#group_wrapper div#section"+(i+1)).removeClass("no_app")
$("#group_wrapper #section"+(i+1)).append($ul);
$("#group_wrapper #section"+(i+1)).removeClass("no_app")
x = 0;
}
})
if(x != 0){
$("div#group_wrapper div#section"+(i+1)).append($ul);
$("div#group_wrapper div#section"+(i+1)).removeClass("no_app")
$("#group_wrapper #section"+(i+1)).append($ul);
$("#group_wrapper #section"+(i+1)).removeClass("no_app")
}
})
bindHandlers();
@@ -1227,7 +1057,7 @@ var orbitDesktop = function(dom){
this.initializeSettings.sections = function(){ // this load section page in setting page
var bindHandlers = function(){ // binding handlers in section page
$("a#name_save_btn").click(function(){
$("#name_save_btn").click(function(){
var desktopnm = new Array;
$("#desktop_names input").each(function(){
desktopnm.push($(this).val());
@@ -1294,7 +1124,7 @@ var orbitDesktop = function(dom){
}
});
$("a#theme_submit").click(function(){
$("#theme_submit").click(function(){
o.confirm({
message : "Are you sure that you want to save custom theme?",
highlighted : 1,
@@ -1438,7 +1268,7 @@ var orbitDesktop = function(dom){
$ul.find("input[type=password]").replaceWith("<div class='c_info pwd'>&#8226;&#8226;&#8226;&#8226;&#8226;&#8226;</div>");
$ul.find("a[for=new]").text("Edit").attr("for","edit");
$ul.find("a[for=delete]").show();
$ul.find("span.c_status").text("Connected").addClass("c_status_on");
$ul.find(".c_status").text("Connected").addClass("c_status_on");
})
bindHandlers();
})
@@ -1558,21 +1388,21 @@ var orbitDesktop = function(dom){
s_name_list_not+= "<a href='addthis' for='"+sec_link+"' style='text-decoration:underline;'>"+sec_name+"</a> ";
}
})
li.find("div.status").html("Status : Installed on "+s_name_list);
li.find(".status").html("Status : Installed on "+s_name_list);
if(s_name_list_not)
li.find("div.not_status").html("Install on "+s_name_list_not);
li.find(".not_status").html("Install on "+s_name_list_not);
}else{
li.find("div.not_status").html("Install on <a href='addthis' for='"+o.sectionList[0]._id+"' style='text-decoration:underline;'>"+o.sectionList[0].name+"</a> <a href='addthis' for='"+o.sectionList[1]._id+"' style='text-decoration:underline;'>"+o.sectionList[1].name+"</a> <a href='addthis' for='"+o.sectionList[2]._id+"' style='text-decoration:underline;'>"+o.sectionList[2].name+"</a> <a href='addthis' for='"+o.sectionList[3]._id+"' style='text-decoration:underline;'>"+o.sectionList[3].name)+"</a>";
li.find(".not_status").html("Install on <a href='addthis' for='"+o.sectionList[0]._id+"' style='text-decoration:underline;'>"+o.sectionList[0].name+"</a> <a href='addthis' for='"+o.sectionList[1]._id+"' style='text-decoration:underline;'>"+o.sectionList[1].name+"</a> <a href='addthis' for='"+o.sectionList[2]._id+"' style='text-decoration:underline;'>"+o.sectionList[2].name+"</a> <a href='addthis' for='"+o.sectionList[3]._id+"' style='text-decoration:underline;'>"+o.sectionList[3].name)+"</a>";
}
//console.log(section_names);
column.find("ul").append(li);
if(counter%4==0){
$("#apps_store div#widget_list").append(column);
$("#apps_store #widget_list").append(column);
column = $('<div class="g_col list_t" style="width:350px;"><ul></ul></div>');
}
counter++;
})
$("#apps_store div#widget_list").append(column);
$("#apps_store #widget_list").append(column);
})
@@ -1592,33 +1422,52 @@ var orbitDesktop = function(dom){
this.loadWallpaper = function(wallpaper){ // this is to load new wallpaper
wallpapernm = (!wallpaper) ? o.themesettings.background : wallpaper;
if(!wallpaper){
$("img#thmbackground").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+wallpapernm);
$("#thmbackground").attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+wallpapernm);
} else {
$("img#thmbackground").attr("src",o.wallpaperPath+wallpaper);
$("#thmbackground").attr("src",o.wallpaperPath+wallpaper);
}
};
this.loadIconCache = function(){ // this function load or refresh icon cache for the theme
var imgs = $("ul.docklist img");
var imgs = $(".docklist img");
$.each(imgs,function(){
var setting_name = $(this).attr("id").replace("_icon","");
$(this).attr("src","/"+o.themefolder+"/"+o.theme+"/images/"+o.themesettings.icons[setting_name])
})
};
this.initializeWidgets = function(){ // this function will initialize all the widgets in the desktop
var elements = $("#group_wrapper li.widget");
var elements = $("#group_wrapper .widget"),
loading = '<div class="thmtxt o-loading"><i class="icon-spin icon-spinner"></i> Loading</div>';
$.each(elements,function(){
var widget = $(this);
var widget = $(this),
widget_holder = $(this).find('.appholder'),
widget_style = (widget.find('.widget_style').length > 0) ? '' : '<link class="widget_style" rel="stylesheet" href="'+widget.attr("css-link")+'" type="text/css" />';
if(widget.attr("data-category")=="widget"){
var widgename = widget.attr("data-content");
$.getScript(widget.attr("js-link"),function(){
widget.find("div.appholder").load(widget.attr("data-content"));
var widgetname = widget.attr("data-content");
widget_holder.before(widget_style).empty();
$.getScript(widget.attr("js-link")).done(function(){
// widget.find(".appholder").load(widget.attr("data-content"));
$.ajax({
url: widgetname,
beforeSend: function(){
widget_holder.html(loading);
},
success: function(html){
widget_holder
.css('top','100%')
.html(html);
},
complete: function(){
widget_holder
.delay(300)
.animate({top:'0'},500,'easeInOutQuint');
}
});
$(this).find("div.appholder").append( '<link rel="stylesheet" id="dyn_css" href="'+widget.attr("css-link")+'" type="text/css" />')
});
// $(this).find(".appholder").append( '<link rel="stylesheet" href="'+widget.attr("css-link")+'" type="text/css" />');
}
})
});
};
this.saveWallpaper = function(wallpaper){ // this function saves wallpaper in db
$.post("/desktop/save_desktop_settings",{"save":"wallpaper","wallpapernm":wallpaper,"desktopid":o.desktopId},function(result){
@@ -1734,12 +1583,6 @@ var orbitDesktop = function(dom){
});
});
}
this.use_select2 = function(){
$('select:not(.select2-offscreen)').select2({
minimumResultsForSearch: -1
// minimumInputLength: -1
});
}
o.initialize();
}
+4 -47
View File
@@ -1,50 +1,3 @@
function get_part_id(){
return $(".edit_page_part,.edit_page").attr("action").split('/').pop();
}
$("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});
$("#page_design").live('change', function() {
$.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_themes');
});
// $("#page_module_app_id").live('change', function() {
// var app_id = $(this).val();
// if(app_id!=''){
// $.getScript($(this).attr('rel') + '/' + $(this).val() + '/reload_after_module_changed',function(data, textStatus){
// if(textStatus == 'success'){
// $(this).after(data);
// }
// });
// }
// else{
// $("#app_page_url").children().remove();
// }
// });
$("#module_app_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?module_app_id='+$(this).val()); //?part_id=' + get_part_id());
});
$("#widget_list select,#frontend_list select").live('change', function() {
$.getScript($(this).attr('rel') +'?frontend=' + $(this).val() + '&module_app_id=' + $("#module_app_list select").val() );//+ '&part_id=' + get_part_id());
});
$("#tag_list select").live('change', function() {
$.getScript($(this).attr('rel') + '?type=' + $(this).val());
});
$("select.widget_field_select").live('change', function() {
$.getScript($(this).attr('rel') + '?widget_field_value='+ $(this).val()+'&dom_id=' + $(this).attr("id") + '&field_seri=' +$(this).attr('field_seri')+ '&module_app_id=' +$("#page_module_app_id,page_part_module_app_id").val());
});
$('.part_kind').live('click', function() {
$('.part_kind_partial').hide();
$('#part_' + $(this).attr('value')).show();
});
$(document).ready(function(){
bindTreeDragHandle();
});
@@ -69,3 +22,7 @@ var bindTreeDragHandle = function(){
}
});
}
$("div.editable").live("mouseenter mouseleave", function (event) {
$(this).children('.edit_link').toggle();
});
@@ -3,12 +3,10 @@ $gray: #ddd;
@mixin font-main($font-size) {
font-family: "Source Sans Pro", sans-serif;
font-size: #{$font-size}px;
font-weight: 300;
}
@mixin font-sub($font-size) {
font-family: "Source Sans Pro", Arial, sans-serif;
font-size: #{$font-size}px;
font-weight: 300;
}
@mixin transition-type($property, $sec) {
-webkit-transition: #{$property} #{$sec}s ease;
@@ -93,9 +93,20 @@
left: 0;
top: 60px;
font-size: 15px;
width: 120px; }
width: 120px;
border: solid 2px #dddddd;
-webkit-box-sizing: border-box;
/* webkit */
-khtml-box-sizing: border-box;
/* konqueror */
-moz-box-sizing: border-box;
/* firefox */
-ms-box-sizing: border-box;
/* ie */
box-sizing: border-box;
/* css3 */ }
.sdm_o li {
border-top: solid 1px #f2f2f2; }
border-top: solid 1px #f7f7f7; }
.sdm_o li:first-child {
border: none; }
.sdm_o a {
@@ -151,7 +162,7 @@
font-size: 15px; }
.s_form label {
font-size: 13px;
font-weight: normal;
font-weight: bold;
display: inline-block;
vertical-align: middle;
width: 100px;
@@ -249,8 +260,7 @@
display: inline-block;
vertical-align: top; }
.toolbar .sdm_o {
top: 36px;
background-color: #f0f0f0; }
top: 36px; }
.toolbar button {
border: none;
outline: none;
@@ -59,9 +59,11 @@
top: 60px;
font-size: 15px;
width: 120px;
border: solid 2px $gray;
@include box-sizing;
li {
border-top: solid 1px #f2f2f2;
border-top: solid 1px lighten( $gray, 10% );
}
li:first-child {
border: none;
@@ -90,7 +92,7 @@
line-height: 36px;
li {
border-top: solid 1px #ddd;
border-top: solid 1px $gray;
}
li:first-child {
border: none;
@@ -133,7 +135,7 @@
// basic style
label {
font-size: 13px;
font-weight: normal;
font-weight: bold;
display: inline-block;
vertical-align: middle;
width: 100px;
@@ -239,7 +241,6 @@
}
.sdm_o {
top: 36px;
background-color: #f0f0f0;
}
button {
border: none;
+13 -19
View File
@@ -54,7 +54,6 @@ table {
body {
font-family: "Source Sans Pro", sans-serif;
font-size: 12px;
font-weight: 300;
background-color: #000; }
a, a:hover {
@@ -74,8 +73,7 @@ a:focus {
clear: both; }
.o-loading {
font-size: 13px;
font-weight: normal; }
font-size: 13px; }
.fullsize .o-loading {
padding: 12px; }
.o-loading i {
@@ -297,7 +295,7 @@ a:focus {
.fn_des.admtxt {
line-height: 60px;
padding: 0 6px;
padding: 0 12px;
font-size: 15px;
position: absolute;
z-index: 9;
@@ -336,8 +334,7 @@ a:focus {
.section_label li {
font-size: 15px; }
.section_label li:first-child {
font-size: 18px;
font-weight: normal; }
font-size: 18px; }
/* panel */
#panel_l {
@@ -372,8 +369,7 @@ a:focus {
#orbitnote .note_holder .note_message {
color: #333;
margin: 10px 0 0 48px;
font-size: 15px;
font-weight: normal; }
font-size: 15px; }
/* Desktop Dialogue */
#orbitdiag {
@@ -404,7 +400,6 @@ a:focus {
margin: 0 6px;
text-align: center;
font-size: 15px;
font-weight: normal;
line-height: 36px; }
#orbitdiag .diag_holder .diag_holder_inner .diag_btn:hover {
outline: solid 2px white; }
@@ -421,12 +416,12 @@ a:focus {
position: absolute;
left: 0;
bottom: 0;
z-index: 3; }
z-index: 3;
white-space: nowrap; }
[data-sizex="1"] .appname, .w1.h1 .appname {
text-align: center; }
[data-sizey="2"] .appname {
font-size: 21px;
font-weight: normal; }
font-size: 21px; }
.hh2 .appname {
position: relative;
width: auto;
@@ -469,8 +464,6 @@ a:focus {
margin: 0 12px 0 0;
position: relative;
z-index: 9; }
.dtitle .sdm_o {
width: auto; }
.tile {
display: block;
@@ -480,8 +473,12 @@ a:focus {
left: 0;
top: 0; }
.gridster ul {
margin: -6px 0 0 -6px; }
.widget.gs_w {
cursor: move; }
cursor: move;
overflow: hidden; }
/* header drop menu */
.sdm_mdr .sdm_o {
@@ -533,7 +530,6 @@ a:focus {
.s_title {
font-size: 21px;
font-weight: normal;
line-height: 60px;
text-align: left; }
.s_title.size_large {
@@ -559,7 +555,6 @@ a:focus {
display: block;
float: right;
font-size: 15px;
font-weight: normal;
line-height: 36px;
text-align: center;
border: 0; }
@@ -615,8 +610,7 @@ a:focus {
.list_t_title {
margin-bottom: 6px;
color: #333;
font-size: 15px;
font-weight: normal; }
font-size: 15px; }
.list_t_des {
line-height: 1.5em;
@@ -70,7 +70,7 @@ a:focus { outline: none; }
}
.o-loading {
font-size: 13px;
font-weight: normal;
// font-weight: normal;
.fullsize & {
padding: 12px;
@@ -231,7 +231,7 @@ a:focus { outline: none; }
}
.fn_des.admtxt {
line-height: 60px;
padding: 0 6px;
padding: 0 12px;
font-size: 15px;
position: absolute;
z-index: 9;
@@ -277,10 +277,9 @@ a:focus { outline: none; }
}
li:first-child {
font-size: 18px;
font-weight: normal;
// font-weight: normal;
}
}
/* panel */
#panel_l {
background-color: #f0f0f0;
@@ -321,7 +320,7 @@ a:focus { outline: none; }
color: #333;
margin: 10px 0 0 48px;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
}
}
}
@@ -361,7 +360,7 @@ a:focus { outline: none; }
margin: 0 6px;
text-align: center;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
line-height: 36px;
&:hover {
@@ -386,6 +385,7 @@ a:focus { outline: none; }
left: 0;
bottom: 0;
z-index: 3;
white-space: nowrap;
[data-sizex="1"] &,
.w1.h1 & {
@@ -393,7 +393,7 @@ a:focus { outline: none; }
}
[data-sizey="2"] & {
font-size: 21px;
font-weight: normal;
// font-weight: normal;
}
.hh2 & {
position: relative;
@@ -421,8 +421,6 @@ a:focus { outline: none; }
margin-right: 6px;
}
}
.appholder {
position: relative;
z-index: 2;
@@ -446,10 +444,6 @@ a:focus { outline: none; }
margin: 0 12px 0 0;
position: relative;
z-index: 9;
.sdm_o {
width: auto;
}
}
.tile {
display: block;
@@ -459,9 +453,18 @@ a:focus { outline: none; }
left: 0;
top: 0;
}
.gridster ul {
margin: -6px 0 0 -6px;
}
.widget.gs_w {
cursor: move;
overflow: hidden;
}
// .app.gs_w:active {
// -webkit-transform: scale(0.9);
// -moz-transform: scale(0.9);
// transform: scale(0.9);
// }
/* header drop menu */
.sdm_mdr .sdm_o { top: 36px; }
@@ -520,7 +523,7 @@ a:focus { outline: none; }
.s_title {
font-size: 21px;
font-weight: normal;
// font-weight: normal;
line-height: 60px;
text-align: left;
@@ -549,7 +552,7 @@ a:focus { outline: none; }
display: block;
float: right;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
line-height: 36px;
text-align: center;
border: 0;
@@ -598,7 +601,7 @@ a:focus { outline: none; }
margin-bottom: 6px;
color: #333;
font-size: 15px;
font-weight: normal;
// font-weight: normal;
}
.list_t_des {
line-height: 1.5em;
@@ -86,15 +86,12 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
position: absolute;
z-index: 9999;
top: 100%;
background-color: #dddddd;
background-color: #fff;
color: #000;
border: 1px solid #dddddd;
border-top: 0; }
border: 2px solid #dddddd; }
.select2-drop.select2-drop-above {
margin-top: 1px;
border-top: 1px solid #dddddd;
border-bottom: 0; }
margin-top: 1px; }
.select2-container .select2-choice div {
display: block;
@@ -171,8 +168,6 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 4px;
margin: 4px 4px 4px 0;
font-size: 13px;
position: relative;
overflow-x: hidden;
@@ -206,13 +201,16 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
.select2-results li {
list-style: none;
display: list-item;
background-image: none; }
background-image: none;
border-top: solid 1px #f7f7f7; }
.select2-results li :first-child {
border-top: 0; }
.select2-results li.select2-result-with-children > .select2-result-label {
font-weight: bold; }
.select2-results .select2-result-label {
padding: 4px 6px;
padding: 6px;
margin: 0;
cursor: pointer;
-webkit-touch-callout: none;
@@ -86,16 +86,16 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
position: absolute;
z-index: 9999;
top: 100%;
background-color: $gray;
background-color: #fff;
color: #000;
border: 1px solid $gray;
border-top: 0;
border: 2px solid $gray;
// border-top: 0;
}
.select2-drop.select2-drop-above {
margin-top: 1px;
border-top: 1px solid $gray;
border-bottom: 0;
// border-top: 1px solid $gray;
// border-bottom: 0;
}
.select2-container .select2-choice div {
@@ -180,8 +180,8 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
/* results */
.select2-results {
max-height: 200px;
padding: 0 0 0 4px;
margin: 4px 4px 4px 0;
// padding: 0 0 0 4px;
// margin: 4px 4px 4px 0;
font-size: 13px;
position: relative;
overflow-x: hidden;
@@ -205,6 +205,11 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
list-style: none;
display: list-item;
background-image: none;
border-top: solid 1px lighten($gray, 10%);
:first-child {
border-top: 0;
}
}
.select2-results li.select2-result-with-children > .select2-result-label {
@@ -212,7 +217,7 @@ Version: 3.3.1 Timestamp: Wed Feb 20 09:57:22 PST 2013
}
.select2-results .select2-result-label {
padding: 4px 6px;
padding: 6px;
margin: 0;
cursor: pointer;
@@ -5,6 +5,7 @@ class Admin::DashboardsController < OrbitBackendController
# before_filter :is_admin?
def index
check_backend_openness
@module_app_contents, @module_app_contents_total = get_module_app_count('bulletin', 'page_context', 'web_link')
@recent_updated = get_recently_updated('bulletin', 'page_context', 'web_link')
@most_visited = get_most_visited('bulletin', 'page_context')
+57 -72
View File
@@ -1,7 +1,6 @@
class Admin::PagePartsController < OrbitBackendController
include Admin::FrontendWidgetInterface
layout "site_editor"
before_filter :authenticate_user!
before_filter :is_admin?
before_filter :set_current_item
@@ -18,59 +17,75 @@ class Admin::PagePartsController < OrbitBackendController
end
end
def new
end
def edit
@part = PagePart.find(params[:id])
@module_apps = ModuleApp.where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc)
@module_app = @part.module_app ? @part.module_app : nil
@user_choose = @part.widget_path
@r_tag = @part.public_r_tag.blank? ? LIST[:public_r_tags][0] : @part.public_r_tag
@tag_objects = @r_tag.classify.constantize.all rescue nil
if @module_app
@widget_path = @part.widget_path ? @part.widget_path : @module_app.widgets.keys[0]
@widget_style = @module_app.get_widget_style[@widget_path][:style] unless @widget_path.nil? or @module_app.nil?
@module_apps = ModuleApp.for_widget_select
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
# @frontend_styles = nil
@selected={
:module_app=> @part.module_app ? @part.module_app : nil,
:app_frontend_url=> @part.widget_path || "default_widget", #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil,
:widget_path=> nil
}
@selected[:widget_path] = @part.widget_path ? @part.widget_path : (@selected[:module_app].widgets.keys[0] rescue nil)
get_categories_and_tags
get_frontend_data_count
@app_frontend_urls = get_app_frontend_urls
end
def reload_widgets
@part = PagePart.find params[:id]
@selected={
:module_app=> ModuleApp.find(params["module_app_id"])
}
get_categories_and_tags
get_frontend_data_count
@selected[:app_frontend_url] = @selected[:module_app].has_default_widget? ? 'default_widget' : @selected[:module_app].widget_options.first.name
end
unless @module_app.nil?
@categories = @module_app.get_categories
@tags = @module_app.get_tags
def reload_widget_styles
@part = PagePart.find(params[:id])
@selected={
:module_app=> ModuleApp.find(params["module_app_id"]),
:app_frontend_url=> params["frontend"], #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil,
:widget_path=> nil
}
get_categories_and_tags
get_frontend_data_count
end
@widget_path = @part.widget_path ? @part.widget_path : (@module_app.widgets.keys[0] rescue nil)
if @module_app && @module_app.widgets.any?{|b| b.class == Array}
@widget_style = @module_app.widgets[@widget_path] if !@widget_path.blank? && !@module_app.widgets.blank?
end
end
def create
def reload_widget_field
@index = params[:field_seri].to_i
@part = PagePart.find(params[:id])
@selected = {
:module_app=> ModuleApp.find(params["module_app_id"]),
:default_widget_field=>params[:widget_field_value]
}
end
def update
@part = PagePart.find(params[:id])
# params[:page_part][:widget_field_type] = nil
# params[:page_part][:widget_field_is_link] = nil
if params[:page_part][:module_app].blank?
params[:page_part][:module_app] = nil
end
if params[:page_part][:tag].nil? || params[:page_part][:tag].include?("nil")
params[:page_part][:tag] = []
end
if params[:page_part][:category].nil? || params[:page_part][:category].include?("nil")
params[:page_part][:category] = []
end
clean_tags_and_category_params
# params[:page_part][:widget_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page_part][:widget_field].blank?
if @part.update_attributes(params[:page_part])
@@ -101,41 +116,6 @@ class Admin::PagePartsController < OrbitBackendController
redirect_to admin_items_url( :parent_id => @item.parent_id )
end
def reload_widget_field
@index = params[:field_seri].to_i
@part = PagePart.find params[:id]
@choosen_field = params[:widget_field_value]
@module_app = @part.module_app
@module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
def reload_widgets
@part = PagePart.find params[:id]
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@categories =@module_app ? @module_app.get_categories : []
@tags =@module_app ? @module_app.get_tags : []
@widget_path = @module_app.widgets.keys[0] if (@module_app && @module_app.widgets[0].blank? )
@widget_style = @module_app.widgets[@widget_path] if ( !@widget_path.blank? )
@part.widget_path = @module_app.widgets.first if( @module_app)
respond_to do |format|
format.js {}
end
end
def reload_widget_styles
@module_app = ModuleApp.find(params[:module_app_id])
@part = PagePart.find params[:id]
@user_choose =@widget_path= params[:frontend]
@widget_style = @module_app.widgets[@widget_path]
respond_to do |format|
format.js {}
end
end
def reload_r_tag_options
@part = PagePart.find params[:id]
@r_tag = params[:type]
@@ -146,6 +126,11 @@ class Admin::PagePartsController < OrbitBackendController
end
protected
def get_app_frontend_urls
@selected[:module_app] ? @selected[:module_app].widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : []
# has_old_value = @selected[:module_app].app_pages[@selected[:app_frontend_url]]
# @frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil)
end
def set_children_sub_menu(part)
part.page.children.each do |child|
+126 -99
View File
@@ -1,5 +1,6 @@
class Admin::PagesController < Admin::ItemsController
helper Admin::PagePartsHelper
include Admin::FrontendWidgetInterface
def show
@item = Page.find(params[:id])
respond_to do |format|
@@ -13,40 +14,123 @@ helper Admin::PagePartsHelper
def new
@item = Page.new
@item.parent = Item.find(params[:parent_id]) rescue nil
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
# @apps = ModuleApp.for_frontend_select
@designs = Design.all.entries
@design = Design.first
@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
def edit
@item = Page.find(params[:id])
@user_choose = @item.app_frontend_url
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@module_apps = ModuleApp.excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
@designs = Design.all.entries
@design = @item.design ? @item.design : @designs.first
@themes = @item.design ? @item.design.themes : @designs.first.themes
@module_apps = ModuleApp.for_frontend_select
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@frontend_styles = nil
if @item.module_app
@app_frontend_urls = []
setup_app_frontend_and_style
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if @item.module_app.has_default_widget?
@module_app = @item.module_app
@frontend_path = @item.app_frontend_url
if @module_app && @module_app.widgets && @module_app.widgets.any?{|b| b.class == Array}
@frontend_style = @module_app.widgets[@frontend_path] if !@frontend_path.blank? && !@module_app.widgets.blank?
end
@selected={
:design => @item.design || @designs.first,
:theme=> @item.theme,
:module_app=>@item.module_app,#@module_apps.first
:app_frontend_url=> @item.app_frontend_url, #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil
get_categories_and_tags
else
@module_app = @module_apps[0]
get_frontend_data_count
end
def reload_themes
design = Design.find(params[:design_id])
@themes = design.themes
respond_to do |format|
format.js {}
end
end
def reload_frontend_pages
@item = Page.find(params[:id]) rescue Page.new
@selected={
:design => nil,
:theme=> nil,
:module_app=>(ModuleApp.find(params[:module_app_id]) rescue nil),
:app_frontend_url=> @item.app_frontend_url || 'default_widget', #@module_apps.first
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @selected[:module_app] ? select_array_for_app_frontend_urls(@selected[:module_app].app_pages) : nil
get_categories_and_tags
get_frontend_data_count
get_frontend_styles
respond_to do |format|
format.js {}
end
end
def reload_front_end_setting
@item = Page.find(params[:id]) rescue Page.new
@categories = nil
@tags = nil
@page_frontend_data_counts = nil
@selected={
# :design => @item.design || @designs.first,
# :theme=> @item.theme,
:module_app=>ModuleApp.find(params[:module_app_id]),
:app_frontend_url=> params[:frontend] ,
:category=>nil, #fetch by method: get_categories_and_tags
:tag=>nil, #fetch by method: get_categories_and_tags
:page_frontend_data_count=>nil,
:frontend_style => nil
}
@app_frontend_urls = @selected[:module_app].nil? ? nil : @selected[:module_app].app_pages.each{|name,data| [I18n.t(data["i18n"]),name]}
@frontend_styles = @selected[:module_app].app_pages[params["frontend"]]["style"] rescue nil
end
def reload_widget_field
@index = params[:field_seri].to_i
@item = Page.find(params[:id]) rescue Page.new
@selected = {
:module_app=> (ModuleApp.find(params[:module_app_id]) || @item.module_app ),
:default_widget_field=>params[:widget_field_value]
}
# @choosen_field = params[:widget_field_value]
# @module_app = @item.module_app
# @module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
def create
clean_tags_and_category_params
@item = Page.new(params[:page])
if @item.module_app && @item.module_app.key == 'page_content'
@@ -63,36 +147,34 @@ helper Admin::PagePartsHelper
end
else
flash.now[:error] = t('create.error.page')
@apps = ModuleApp.where(:key.in => OrbitApp::Module::FrontendUtility.all.keys)
@designs = Design.all.entries
@design = Design.first
@design = Design.find(params[:page][:design]) || Design.first
@themes = @design.themes
@module_apps = ModuleApp.for_frontend_select
@selected={
:design => params[:page][:design],
:theme=> (Theme.find(params[:page][:theme_id]) rescue nil),
:module_app=> (ModuleApp.find(params[:page][:module_app_id]) rescue nil) ,#@module_apps.first
:app_frontend_url=> params[:page][:app_frontend_url], #@module_apps.first
:category=>params[:page][:category],
:tag=>params[:page][:tag],
:page_frontend_data_count=>params[:page][:page_frontend_data_count],
:frontend_style => params[:page][:frontend_style]
}
@app_frontend_urls = @item.module_app ? select_array_for_app_frontend_urls(@item.module_app.app_pages) : nil
get_categories_and_tags
get_frontend_data_count
render :action => "new"
end
end
def update
clean_tags_and_category_params
@item = Page.find(params[:id])
if @item.module_app && @item.module_app.key == 'page_content' && @item.page_contexts.blank?
@item.page_contexts.build(:create_user_id => current_user.id, :update_user_id => current_user.id )
end
# params[:page][:frontend_field] = params[:page][:frontend_field].zip( params[:page][:frontend_field_type], params[:page][:frontend_field_is_link] ) if params[:page][:frontend_field]
# params[:page][:frontend_field_type] = nil
# params[:page][:frontend_field_is_link] = nil
if params[:page][:tag].nil? || params[:page][:tag].include?("nil")
params[:page][:tag] = []
end
if params[:page][:category].nil? || params[:page][:category].include?("nil")
params[:page][:category] = []
end
# params[:page][:frontend_field].each{|t| t[2] = (t[2]=="true" ? true : false )} if !params[:page][:frontend_field].blank?
if @item.update_attributes(params[:page])
flash[:notice] = t('update.success.page')
respond_to do |format|
@@ -126,65 +208,10 @@ helper Admin::PagePartsHelper
end
end
def reload_front_end_setting
@item = Page.find params[:id] rescue nil
@module_app = ModuleApp.find params[:module_app_id]
@user_choose = params[:frontend] #choosen frontend
protected
@app_frontend_urls = @module_app.nil? ? nil : @module_app.app_pages.each{|name,data| [I18n.t(data["i18n"]),name]}
@frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil
# =======
# @chosen_frontend = @user_choose = params[:frontend]
# >>>>>>> Stashed changes
end
def get_categories_and_tags
unless @module_app.nil?
@categories = @module_app.get_categories
@tags = @module_app.get_tags
def get_frontend_styles
has_old_value = @selected[:module_app].app_pages[@selected[:app_frontend_url]]
@frontend_styles = has_old_value ? has_old_value["style"] : (@selected[:module_app].app_pages.first[1]["style"] rescue nil)
end
end
def setup_app_frontend_and_style
if @module_app.nil?
@item.module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]}
@frontend_styles = @item.module_app.app_pages[@item.frontend_style]["style"] if @frontend_styles.nil? && @item && @item.module_app.app_pages[@item.frontend_style]
@frontend_styles = @item.module_app.app_pages.first[1]["style"] if @frontend_styles.nil? && @item
else
@module_app.app_pages.each{|name,data| @app_frontend_urls << [I18n.t(data["i18n"]),name]}
@frontend_styles = @module_app.app_pages[params["frontend"]]["style"] rescue nil
@frontend_styles = @module_app.app_pages.first[1]["style"] if @frontend_styles.nil?
end
end
def reload_frontend_pages
@item = Page.find params[:id] rescue nil
@module_app = ModuleApp.find(params[:module_app_id]) rescue nil
@app_frontend_urls = []
setup_app_frontend_and_style
@app_frontend_urls << [I18n.t('default_widget.name'),'default_widget'] if(@module_app && @module_app.has_default_widget?)
get_categories_and_tags
respond_to do |format|
format.js {}
end
end
def reload_themes
@design = Design.find(params[:id])
@themes = @design.themes
respond_to do |format|
format.js {}
end
end
def reload_widget_field
@index = params[:field_seri].to_i
@item = params.has_key?(:id) ? Page.find(params[:id] ) : Page.new
@choosen_field = params[:widget_field_value]
@module_app = @page.module_app
@module_app = ModuleApp.find params[:module_app_id] if @module_app.nil?
end
end
@@ -0,0 +1,9 @@
class Admin::RoleCategorysController < Admin::RoleFiltersController
def initialize
super
@app_type = 'role_category'
@app_type_name = 'category'
end
end
@@ -0,0 +1,144 @@
class Admin::RoleFiltersController < OrbitBackendController
include OrbitControllerLib::DivisionForDisable
layout "new_admin"
before_filter :authenticate_user!
before_filter :is_admin?
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
helper Admin::AttributeValuesViewHelper
def index
get_types
@role = Role.find(params[:role_id])
@role_filters = @types.where(:role_id=>params[:role_id])
@role_filter = @types.new(:display => 'List')
# @url = admin_role_filter_role_filters_path
if @app_type == 'role_statuses'
@url = eval("admin_#{@app_type}_path")
else
@url = eval("admin_#{@app_type}s_path")
end
respond_to do |format|
format.html # index.html.erb
format.js
end
end
def show
get_types
@role_filter = @types.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js
end
end
def new
get_types
@role_filter = @types.new(:display => 'List')
@verb = :post
respond_to do |format|
format.html # new.html.erb
format.js
end
end
def edit
get_types
@role_filter = @types.find(params[:id])
@url = polymorphic_path([:admin, @role_filter])
@verb = :put
respond_to do |format|
format.html
format.js
end
end
def create
get_types
@role_filter = @types.new(params[:role_filter])
respond_to do |format|
if @role_filter.save
format.html { redirect_to(admin_role_filter_url(params[:role_filter][:role_id])) }
format.js
end
end
end
def update
get_types
@role_filter = @types.find(params[:id])
# debugger
# @url = admin_role_filter_role_filter_path(@role_filter)
# @url = eval("admin_role_filter_#{@app_type}_path(#{@role_filter})")
@url = polymorphic_path([:admin, @role_filter])
respond_to do |format|
if @role_filter.update_attributes(params[:role_filter])
format.html { redirect_to(admin_role_filter_role_filters_url(params[:role_id]), :notice => t('role_filter.update_role_filter_success')) }
# format.xml { head :ok }
format.js
else
format.html { render :action => "edit" }
format.js { render :action => "edit" }
end
end
end
def destroy
get_types
@role_filter = @types.find(params[:id])
@role_filter.disable = @role_filter.disable ? false : true
if @role_filter.save!
respond_to do |format|
format.html { redirect_to(admin_role_filter_role_filters_url) }
# format.xml { head :ok }
format.js
end
else
flash[:error] = t("role_filter.update_failed")
format.html { render :action => "index" }
end
end
protected
def get_types
@types = @app_type.classify.constantize
end
end
@@ -0,0 +1,9 @@
class Admin::RoleStatusesController < Admin::RoleFiltersController
def initialize
super
@app_type = 'role_statuses'
@app_type_name = 'status'
end
end
@@ -28,7 +28,6 @@ class Admin::RolesController < OrbitBackendController
@attribute = Role.find(params[:role_id])
@attribute_fields_upper_object = @attribute.sub_roles
end
def add_sub_role
@@ -95,7 +94,6 @@ class Admin::RolesController < OrbitBackendController
format.js { render 'add_attribute_field' }
end
end
def new
@@ -14,8 +14,16 @@ class Admin::SitesController < OrbitBackendController
# @site = Site.new
# end
def show_system_preference
@git_commit_list_file = File.new(OrbitSystemPreference::GitCommitListPath, "r") rescue nil
@db_backup_list_file = File.new(OrbitSystemPreference::ArchiveDbListPath, "r") rescue nil
@resque_logs_file = File.new(OrbitSystemPreference::ResqueLogFile, "r") rescue nil
@site = Site.first
end
def update
@site.update_attributes(params[:site])
site_restart
redirect_to :back
end
@@ -1,5 +1,7 @@
class Admin::UsersNewInterfaceController < OrbitBackendController
helper MemberHelper
layout "new_admin"
# before_filter :authenticate_user!
# before_filter :set_attribute, :only => [:index, :show, :new, :edit]
@@ -23,13 +25,13 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
render case params[:at]
when 'summary'
@users=User.not_guest_user.page(page_num).per(12).includes('avatar')
@users=User.not_guest_user.page(page_num).per(12).asc("_id").includes('avatar')
"index_summary"
when 'thumbnail'
@users=User.not_guest_user.page(page_num).per(36).includes('avatar')
@users=User.not_guest_user.page(page_num).per(36).asc("_id").includes('avatar')
"index_thumbnail"
else
@users=User.not_guest_user.page(page_num).per(10).includes('avatar')
@users=User.not_guest_user.page(page_num).per(10).asc("_id").includes('avatar')
"index"
end
end
@@ -43,7 +45,7 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
@student_data = []
@staff_data = []
attribute_values = @user.attribute_values
attribute_values = @user.attribute_values.asc("_id")
attribute_values.each{|att_val|
@profile_data.push({:name => att_val.attribute_field.title,:value =>att_val.get_value_by_locale(I18n.locale.to_s)}) if att_val.attribute_field.attribute.key=="profile" rescue false
}
@@ -80,21 +82,29 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
end
def create
puts params.to_yaml
# puts params.to_yaml
# attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
# attribute_values = params[:user].delete(attribute_values_key)
@user = User.new(params["user"])
@checkuser = User.where(:user_id => params[:user][:user_id]).first
if !@checkuser.blank?
flash.now[:error] = t("users.user_id_error")
end
# attribute_values.to_hash.each{|key,value|
# @user.attribute_values.build(value)
# }
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
# binding.pry
if @user.save
if !flash.now[:error] && @user.save
flash[:notice] = t('create.success.user')
redirect_to :action => :index
else
@user.attribute_values = nil
@form_index = 0
render :action => :new
render :action => :new , :notice => flash.now[:error]
end
end
@@ -111,15 +121,45 @@ class Admin::UsersNewInterfaceController < OrbitBackendController
get_info_and_roles
end
def edit_passwd
# @disable_all_field = false
@user = User.find(params[:users_new_interface_id])
end
def update
@user = User.find(params[:id])
if params[:edit_type] == 'edit_passwd'
@checkuser = User.where(:user_id => params[:user][:user_id]).first
if !@checkuser.blank? && @checkuser.id != @user.id
flash.now[:error] = t("users.user_id_error")
elsif @user.admin && current_user.id == @user.id
flash.now[:error] = t("users.admin_change_password")
end
if !flash.now[:error] && @user.update_attributes(params[:user])
redirect_to :action => :show
else
render :action => :edit_passwd, :notice => flash.now[:error]
end
else
@user.update_attributes(params[:user])
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
attribute_values = params[:user].delete(attribute_values_key)
# @user.rebuild_sub_roles_from_attribute_values!(attribute_values)
@user.save
redirect_to :action => :show
end
# # Update changes to the avatar
# @user.remove_avatar! if params[:file]
# @user.avatar = params[:file] if params[:file]
+10 -2
View File
@@ -17,7 +17,15 @@ class ApplicationController < ActionController::Base
helper_attr :site_valid_locales
def check_backend_openness
if !Me.backend_openness_on
redirect_to '/users/sign_in' if not (authenticate_user! and is_member? )
end
end
def site_restart
Resque.enqueue(RestartServer)
end
def set_current_user
User.current = current_or_guest_user
@@ -101,10 +109,10 @@ class ApplicationController < ActionController::Base
end
# Render the page
def render_page
def render_page(args=nil)
if @item
respond_to do |format|
format.html { render :text => parse_page_content(@item), :layout => 'page_layout' }
format.html { render :text => parse_page_content(@item,args), :layout => 'page_layout' }
format.rss { render_main_rss }
format.mobile { redirect_to mobile_path(:app => params[:app]) }
end
+11 -3
View File
@@ -36,23 +36,31 @@ class DefaultWidgetController< OrbitWidgetController
result = eval("#{ori_class_name}.where(:#{get_category_field_name(ori_class_name)}.in=>params['category_id'])")
end
date_now = Time.now
result.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, :postdate)
result.available_for_lang(I18n.locale).can_display.desc(:is_top, :postdate)
end
def default_widget
if !params[:id].blank?
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[:title][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
clicked_field_name = params["clicked_field_name"].to_sym
redirect_to eval("#{@page_part.module_app.widget_fields_link_method[clicked_field_name][:method]}('#{params[:id]}', {inner: #{params[:inner] || true}})")
else
@tag_class = nil
@default_widget = @page_part.module_app.get_default_widget
@widget_image_field = @default_widget["image"] || @default_widget[:image]
case @page_part
when Page
@fields = @page_part.frontend_field
@frontend_field_names = @page_part.frontend_field_name
@frontend_classes = @page_part.frontend_class
@frontend_sat_to_links = @page_part.frontend_sat_to_link
@data_limit = @page_part.frontend_data_count.is_a?(Fixnum) ? @page_part.frontend_data_count : (@page_part.frontend_data_count.to_i rescue 3)
@paginate = true
@page_id = @page_part.id
when PagePart
@frontend_field_names = @page_part.widget_field_name
@frontend_classes = @page_part.widget_class
@frontend_sat_to_links = @page_part.widget_sat_to_link
@fields = @page_part.widget_field
@data_limit = @page_part.widget_data_count.is_a?(Fixnum) ? @page_part.widget_data_count : (@page_part.widget_data_count.to_i rescue 3)
end
@@ -15,6 +15,7 @@ class OrbitBackendController < ApplicationController
private
def force_order_for_visitor
check_backend_openness
setup_vars
set_current_user
end
+12
View File
@@ -1,8 +1,15 @@
class PagesController < ApplicationController
include ApplicationHelper
before_filter :get_item, :only => [:index_from_link, :show_from_link]
before_filter :check_frontend_open, :only => [:index,:show]
# caches_page :index
def check_frontend_open
if Me.frontend_closed
redirect_to '/admin/dashboards'
end
end
def index
@item = Page.find_by_name('home')
@@ -21,7 +28,11 @@ class PagesController < ApplicationController
impressionist(@item)
case @item.class.to_s
when 'Page'
if params[:clicked_field_name]
render_page({"clicked_field_name"=>params["clicked_field_name"]}) unless save_from_no_lang_for_page
else
render_page unless save_from_no_lang_for_page
end
when 'Link'
redirect_to(@item[:url]) unless save_from_no_lang_for_page
end
@@ -54,6 +65,7 @@ class PagesController < ApplicationController
options << "#{options.blank? ? '?' : '&'}tag_id=#{params[:tag_id]}" unless params[:tag_id].blank?
options << "#{options.blank? ? '?' : '&'}preview=#{params[:preview]}" unless params[:preview].blank?
options << "#{options.blank? ? '?' : '&'}controller_action=#{params[:controller_action]}" unless params[:controller_action].blank?
options << "#{options.blank? ? '?' : '&'}clicked_field_name=#{params[:clicked_field_name]}" unless params[:clicked_field_name].blank?
redirect_to(url + options) unless save_from_no_lang_for_page
end
@@ -0,0 +1,58 @@
module Admin::FrontendWidgetInterface
protected
def get_categories_and_tags
unless @selected[:module_app].nil?
@categories = @selected[:module_app].get_categories
@tags = @selected[:module_app].get_tags
end
end
def get_frontend_data_count
local_item = set_local_item
@page_frontend_data_counts = @selected[:module_app].get_registration.get_data_count rescue []
@selected[:page_frontend_data_count] = case local_item
when PagePart
local_item.widget_data_count
when Page
local_item.frontend_data_count
end
end
def clean_tags_and_category_params
field_name = set_field_name
if self.class==Admin::PagePartsController and params[field_name][:module_app].blank?
params[field_name][:module_app] = nil
end
if params[field_name][:tag].nil? || params[field_name][:tag].include?("nil")
params[field_name][:tag] = []
end
if params[field_name][:category].nil? || params[field_name][:category].include?("nil")
params[field_name][:category] = []
end
end #of clean_tags_and_category_params
def set_local_item
local_item = @part
local_item = @item if local_item.nil? && @item
local_item
end
def set_field_name
case self.class.to_s
when "Admin::PagesController"
return "page"
when "Admin::PagePartsController"
return "page_part"
end # of case
end
def select_array_for_app_frontend_urls(hash)
ary = hash.collect{|name,data| [I18n.t(data["i18n"]),name]}
ary << [I18n.t('default_widget.name'),'default_widget'] if @selected[:module_app] and @selected[:module_app].has_default_widget?
ary
end
end
+15 -28
View File
@@ -1,7 +1,8 @@
module Admin::PagePartsHelper
include Admin::FrontendWidgetInterface
def support_link
url_method = @module_app.get_default_widget[:url_method]
url_method = @selected[:module_app].get_default_widget[:url_method]
unless url_method.nil?
res = "Link:"
res << select_tag( "page_part[widget_field_is_link][]", options_for_select([["NotLink",false],["Link1",url_method]]))
@@ -9,10 +10,8 @@ module Admin::PagePartsHelper
end
end
def get_widget_field_rel(local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
case local_item
def get_widget_field_rel
case set_local_item
when Page
reload_after_list_changed_admin_pages_path
when PagePart
@@ -34,8 +33,7 @@ module Admin::PagePartsHelper
unless field_is_checked.nil? and assign_field_name_value.nil?
origin_field = nil
origin_field = @module_app.widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first
origin_field = @selected[:module_app].widget_fields.select{|t| t.first.to_s==(assign_field_name_value || local_item.default_widget_field_name[i])}.first
if origin_field and origin_field[2]==:link #choosen_field_is_link
@@ -51,11 +49,10 @@ module Admin::PagePartsHelper
end
def widget_field_options(i,local_item=nil)
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
local_item = set_local_item
options = @module_app.widget_fields.collect do |widget_field|
label = I18n.t("#{@module_app.key}.default_widget.#{widget_field[0]}")
options = @selected[:module_app].widget_fields.collect do |widget_field|
label = I18n.t("#{@selected[:module_app].key}.default_widget.#{widget_field[0]}")
[label, widget_field[0]]
end
case local_item
@@ -66,11 +63,9 @@ module Admin::PagePartsHelper
end
end
def widget_fiield_class_options(i,local_item=nil)
def widget_field_class_options(i,local_item=nil)
options = LIST[:widget_field_type].collect{|widget_field| [widget_field.humanize, widget_field]}
local_item = @part if local_item.nil? && @part
local_item = @item if local_item.nil? && @item
local_item = set_local_item
case local_item
when Page
options_for_select(options, (local_item.frontend_class[i] if (local_item) ))
@@ -115,12 +110,8 @@ module Admin::PagePartsHelper
end
def nil_checkbox_button(part,tag_or_cate)
field_name = case part
when PagePart
'page_part'
when Page
'page'
end
field_name = set_field_name
content_tag :label,:class=>"radio inline" do
op = check_box_tag("#{field_name}[#{tag_or_cate}][]", 'nil' , eval("#{tag_or_cate}_checked_value(part,'')"),:class=>'select_all')
op << I18n.t("default_widget.no_value")
@@ -128,12 +119,8 @@ module Admin::PagePartsHelper
end
def nil_radio_button(part,tag_or_cate)
field_name = case part
when PagePart
'page_part'
when Page
'page'
end
field_name = set_field_name
content_tag :label,:class=>"radio inline" do
op = radio_button(field_name, tag_or_cate, '' , :checked => eval("#{tag_or_cate}_checked_value(part,'')"))
op << I18n.t("default_widget.no_value")
@@ -141,7 +128,7 @@ module Admin::PagePartsHelper
end
def show_default_widget_setting_panel
@module_app && @module_app.has_default_widget? && (!@user_choose.nil? && @user_choose== 'default_widget') #&& @part.widget_path == 'default_widget'
@selected[:module_app] && @selected[:module_app].has_default_widget? && (@selected[:app_frontend_url]== 'default_widget')
end
def show_custom_widget_setting_panel
+3 -1
View File
@@ -6,7 +6,9 @@ module DefaultWidgetHelper
def link_to_field(row_data,field, switch, options=nil)
method_ary = @page_part.module_app.widget_fields_link_method
field = field.to_sym
if(method_ary.has_key?(field) and (switch == true))
options = options || {}
options[:clicked_field_name] = field
if(method_ary.has_key?(field) and (switch.to_s == "true"))
url = case method_ary[field][:args]
when nil # no args
get_data_link(method_ary[field][:method], options)
+5
View File
@@ -0,0 +1,5 @@
module MemberHelper
def nl2br(val)
val.gsub(/\r\n/, '<br />').html_safe
end
end
+5 -1
View File
@@ -5,9 +5,13 @@ class BackupServer
#CronMail.time_check("Going to backup Orbit").deliver
dbhost = Mongoid.config.database.connection.primary.join ':'
dbname = Mongoid.config.database.name
archive_db_list_path = OrbitSystemPreference::ArchiveDbListPath
dbdirectory = "#{Rails.root}/tmp/#{dbname}-"+Time.now.strftime("%Y-%m-%d-%H-%M")
%x[mongodump -h #{dbhost} -d #{dbname} -o #{dbdirectory} ]
# %x[touch #{Rails.root}/tmp/restart]
%x[rm #{archive_db_list_path}]
%x[ls #{Rails.root}/tmp/#{dbname}* | du -h --max-depth=1 --block-size=1M |sort -h >> #{archive_db_list_path}]
OrbitJobLogger.info "DB backup done Path:#{dbdirectory}"
end
end
+36
View File
@@ -0,0 +1,36 @@
class DashboardCounter < Resque::Plugins::RestrictionJob
@queue = :high
def self.perform(*args)
site = Site.first
obj = new(*args)
site.dashboard_counter[:visitors_this_week] = obj.display_visitors_this_week
site.dashboard_counter[:visitors_this_month] = obj.display_visitors_this_month
site.dashboard_counter[:visitors_this_year] = obj.display_visitors_this_year
site.save
OrbitJobLogger.info "DashboardCounter done #{site.dashboard_counter.to_s}"
end
def display_visitors(options={})
impressions = Impression.where(options).and(:referrer.ne => nil)
impressions.map{|i| i[:session_hash]}.uniq.count
end
def display_visitors_today
display_visitors(created_at: {'$gte' => Date.today.beginning_of_day, '$lte' => Date.today.end_of_day})
end
def display_visitors_this_week
display_visitors(created_at: {'$gte' => Date.today.beginning_of_week, '$lte' => Date.today.end_of_week})
end
def display_visitors_this_month
display_visitors(created_at: {'$gte' => Date.today.beginning_of_month, '$lte' => Date.today.end_of_month})
end
def display_visitors_this_year
display_visitors(created_at: {'$gte' => Date.today.beginning_of_year, '$lte' => Date.today.end_of_year})
end
end
+46
View File
@@ -0,0 +1,46 @@
class GenerateSystemSummary
@queue = :high
def self.perform()
@site = Site.first
get_disk_free
get_git_log_list
get_package_info
@site.save
end
def self.get_package_info
@info = {}
get_nginx_version
get_MongoDB_version
get_Linux_version
@site.system_package_info = @info
end
def self.get_git_log_list
git_commit_list_path = OrbitSystemPreference::GitCommitListPath
%x[rm #{git_commit_list_path}]
%x[cd #{Rails.root};#{OrbitSystemPreference::GitLogCommend} >>#{git_commit_list_path} ]
end
def self.get_disk_free
@site.disk_space= %x[#{OrbitSystemPreference::DiskFree}]
end
def self.get_nginx_version
@info[:nginx] = %x[#{OrbitSystemPreference::SystemPackage::NginxVersion} ]
end
def self.get_MongoDB_version
@info[:mongodb] = %x[#{OrbitSystemPreference::SystemPackage::MongodbVersion} ]
end
def self.get_Linux_version
@info[:linux] = %x[#{OrbitSystemPreference::SystemPackage::SystemVersion} ]
end
def self.check_system_has_enough_space( limit =OrbitSystemPreference::DefaultDiskSpaceLimit )
binding.pry
end
end
-21
View File
@@ -1,21 +0,0 @@
class NccuCalendar
require 'open-uri'
require 'tempfile'
@queue = :high
def self.perform()
# temp_file = Tempfile.new('new_cal')
# open('http://events.nccu.edu.tw/Month').read{|data|
# temp_file << data
# }
open(File.join(Rails.root, 'public/static', 'nccu_calendar.xml'), 'wb') do |fo|
fo.print open('http://events.nccu.edu.tw/Month').read
end
# FileUtils.mv(temp_file, File.join(Rails.root, 'public/static', 'nccu_calendar.xml'))
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]NccuCalendar Synced #{File.join(Rails.root, 'public/static', 'nccu_calendar.xml')}"
end
end
+8
View File
@@ -0,0 +1,8 @@
class RestartServer
@queue = :high
def self.perform()
temp_directory = "#{Rails.root}/tmp/"
%x[touch #{temp_directory}restart.txt ]
end
end
-25
View File
@@ -1,25 +0,0 @@
class SyncDb
@queue = :high
def self.perform()
puts "[ #{DateTime.now.strftime("%Y %D %H:%M") }]\t SyncDb Starting"
self.start_sync
self.set_admin
end
def self.start_sync
task = 'mid_site:sync'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
User.all.each{|ur| ur.create_dept_cache}
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tSyncDb Synced"
end
def self.set_admin
task = 'mid_site:install_admin'
args = []
%x[rake #{task} --trace >> #{Rails.root}/log/rake.log]
puts "[#{ DateTime.now.strftime("%Y %D %H:%M")}]\tAdmin done"
end
end
+1
View File
@@ -5,5 +5,6 @@ class UpdateTagCloud
Tag.all.each do |tag|
tag.update_attribute(:cloud_view_count, tag.impressionist_count(:created_at.gte => 14.days.ago, :created_at.lte => Time.now))
end
OrbitJobLogger.info "UpdateTagCloud Done"
end
end
+1 -1
View File
@@ -17,7 +17,7 @@ class Item
validates_format_of :name, :with => /^[0-9a-zA-Z\-_]+$/
# validates :name, :exclusion => { :in => LIST[:forbidden_item_names] }
validates_uniqueness_of :name, :scope => :parent_id
validates_uniqueness_of :name #, :scope => :parent_id
validates_presence_of :name
validates_associated :parent, :children
+9 -3
View File
@@ -20,10 +20,16 @@ class ModuleApp
end
# def app_pages
# get_registration.get_app_pages
# end
# scope :for_frontend_select,
scope :standard_sorting ,order_by(:title, :asc)
def self.for_widget_select
where(:key.in=>OrbitApp::Module::WidgetUtility.all.keys).order_by(:title, :asc)
end
def self.for_frontend_select
where(:key.in => OrbitApp::Module::FrontendUtility.all.keys).excludes(widgets: nil).where(enable_frontend: true).order_by(:title, :asc)
end
def enable_frontend?
self[:enable_frontend]
+2 -1
View File
@@ -7,7 +7,7 @@ class Page < Item
field :content, localize: true
field :app_frontend_url
field :theme_id, :type => BSON::ObjectId, :default => nil
# field :theme_id, :type => BSON::ObjectId, :default => nil
field :category,type: Array, :default => []
field :tag, type: Array,:default => []
field :view_count, :type => Integer, :default => 0
@@ -22,6 +22,7 @@ class Page < Item
field :frontend_data_count
belongs_to :theme
belongs_to :design
belongs_to :module_app
has_many :page_parts, :dependent => :destroy
+7
View File
@@ -11,10 +11,17 @@ class Site
field :roaming_id
field :private_key, :type => Binary
field :public_key, :type => Binary
field :frontend_closed, :type => Boolean, :default => false
field :backend_openness_on, :type => Boolean, :default => false
field :title_always_on, :type => Boolean, :default => false
field :dashbroad_allow_visitor, :type => Boolean, :default => false
field :mail_settings, :type => Hash
field :disk_space, :type => String
field :system_package_info, :type => Hash,:default=>{}
field :school
field :department
+6 -1
View File
@@ -11,9 +11,14 @@ class Role < Attribute
has_many :sub_roles, :autosave => true, :dependent => :destroy
has_many :users
has_many :statuses, :autosave => true, :dependent => :destroy
# has_many :statuses, :autosave => true, :dependent => :destroy
# has_many :attribute_fields, :autosave => true, :dependent => :destroy
has_many :role_statuses, :autosave => true, :dependent => :destroy
has_many :role_categorys, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :sub_roles, :allow_destroy => true
accepts_nested_attributes_for :role_statuses, :allow_destroy => true
accepts_nested_attributes_for :role_categorys, :allow_destroy => true
def is_built_in?
self.built_in
+14
View File
@@ -0,0 +1,14 @@
class RoleCategory < RoleFilter
has_and_belongs_to_many :users
belongs_to :role
def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first
return @role.id
end
end
+26
View File
@@ -0,0 +1,26 @@
class RoleFilter
include Mongoid::Document
include Mongoid::Timestamps
# include OrbitCoreLib::ObjectAuthable
include OrbitCoreLib::ObjectDisable
field :key
field :title, localize: true
# belongs_to :role
def pp_object
title
end
def self.from_id(id)
RoleFilter.find(id) rescue nil
end
def self.is_localized?(field_name)
self.fields[field_name.to_s].localized?
end
end
+16
View File
@@ -0,0 +1,16 @@
class RoleStatus < RoleFilter
has_and_belongs_to_many :users
belongs_to :role
scope :can_display,where(disable: false)
def self.get_role_data(role_key)
@role = Role.where(:key =>role_key).first
return @role.id
end
end
+62 -5
View File
@@ -9,7 +9,13 @@ class User
field :admin, :type => Boolean, :default => true
field :active_role
field :user_id
field :sid
field :first_name, localize: true
field :last_name, localize: true
field :email
field :sex, :default => 'unknown'
field :office_tel
field :cache_dept,type: Hash
field :status_record,type: Hash
@@ -25,9 +31,11 @@ class User
# has_many :papers, :autosave => true, :dependent => :destroy
has_and_belongs_to_many :sub_role_tags
has_and_belongs_to_many :statuses
# has_and_belongs_to_many :statuses
has_and_belongs_to_many :roles
has_and_belongs_to_many :sub_roles
has_and_belongs_to_many :role_statuses
has_and_belongs_to_many :role_categorys
accepts_nested_attributes_for :attribute_values, :allow_destroy => true
before_create :initialize_desktop
@@ -36,6 +44,9 @@ class User
scope :remote_account, where(:nccu_id.ne => nil)
scope :not_guest_user, all_of(:name.ne => "guest")
validates :user_id,
:presence => { :message => I18n.t("users.user_id_not_null") } ,
:length => {:minimum => 3, :maximum => 50, :message => I18n.t("users.user_id_length") }
# validates_uniqueness_of :email,:message=> I18n.t("devise.registrations.email_not_unique")
# def new_attribute_values=(vars)
@@ -101,6 +112,24 @@ class User
end
end
def role_status=(var)
self.role_statuses = []
var[:id].each do |id,val|
if (val=="true")
self.role_statuses << RoleStatus.find(id)
end
end
end
def role_category=(var)
self.role_categorys = []
var[:id].each do |id,val|
if (val=="true")
self.role_categorys << RoleCategory.find(id)
end
end
end
def set_sub_role(sub_role_id,status_id)
@@ -144,6 +173,17 @@ class User
}.uniq!
end
def self.get_member_list_attribute_field_name(role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
return ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first.title
end
def self.get_member_list_attribute_value(user_id,role_type,field_key)
@attribute = ::Attribute.where(:key => role_type).first
@AttributeField = ::AttributeField.where(:key => field_key, :attribute_id => @attribute.id).first
return ::AttributeValue.where(attribute_field_id: @AttributeField.id, :user_id => user_id).first[I18n.locale.to_s]
end
def create_dept_cache
dept_hash = {}
@@ -170,12 +210,30 @@ class User
(query1 + query2).uniq
end
# def name
# info = Class::Info.first(:conditions => {:key => 'profile'})
# if info
# first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
# last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
# full_name = "#{last_name} #{first_name}"
# if full_name.strip.empty?
# full_name = email
# end
# return full_name
# else
# return nil
# end
# end
def name
info = Class::Info.first(:conditions => {:key => 'profile'})
if info
first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
full_name = "#{last_name} #{first_name}"
# first_name = get_attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
# last_name = get_attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
# full_name = (I18n.locale != 'zh_tw') ? "#{self.last_name} #{self.first_name}" : "#{self.first_name} #{self.last_name}"
full_name = (I18n.locale.to_s == 'zh_tw') ? "#{self.last_name} #{self.first_name}" : "#{self.first_name} #{self.last_name}"
if full_name.strip.empty?
full_name = email
@@ -211,7 +269,6 @@ class User
self.roles = self.roles.uniq
end
def rebuild_status_record
self.status_record = {}
self.attribute_values.reject{|t| t.key!='status'}.each do |status|
@@ -37,6 +37,8 @@
<% if @attribute_type == 'role' %>
<li><%= link_to t(:role_field), eval("admin_#{@attribute_type}_role_field_path(attribute)") %></li>
<li><%= link_to t(:sub_role), eval("admin_#{@attribute_type}_sub_role_path(attribute)") %></li>
<li><%= link_to t(:status), eval("admin_role_statuses_path(:role_id=>attribute)") %></li>
<li><%= link_to t(:category), eval("admin_role_categorys_path(:role_id=>attribute)") %></li>
<% end %>
<li><%= link_to t(:enable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => true})"), :remote => true, :method => :put, :id => "disable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? 'none' : ''}", :class => 'switch' %></li>
<li><%= link_to t(:disable), eval("admin_#{@attribute_type}_path(attribute, :authenticity_token => form_authenticity_token, :#{@attribute_type} => {:disabled => false})"), :remote => true, :method => :put, :id => "enable_#{attribute.id}", :style => "display:#{attribute.is_disabled? ? '' : 'none'}", :class => 'switch' %></li>
@@ -2,5 +2,14 @@
<%= render_node_and_children(Item.first(:conditions => {:parent_id => nil})) %>
</ol>
<script type="text/javascript">
$.ajaxSetup({
error: function(xhr, status, err) {
if (xhr.status == 401){
alert("<%= I18n.t('access.denied.ajax_401_error') %>");
window.location.href = '/';
}
}
});
bindTreeDragHandle();
</script>
@@ -1 +1 @@
<%= f.select :module_app_id, @apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
<%= f.select :module_app_id, @module_apps.collect { |t| [t.module_name, t.id] }, {:include_blank => true} ,{:rel => admin_module_apps_path } %>
@@ -3,14 +3,14 @@
<%= t("default_widget.select_widget_style") %>
</label>
<div class="controls well">
<% if @module_app.nil? || @module_app.widgets.nil? || (@module_app.widgets[@widget_path].blank? rescue true) %>
<% if @selected[:module_app].nil? || @selected[:module_app].widgets.nil? || (@selected[:module_app].widgets[@selected[:app_frontend_url]].blank? rescue true) || @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"].nil? %>
<%= t("default_widget.no_support_setting")%>
<%else%>
<%= select('page_part', 'widget_style', @module_app.widgets[@widget_path]["style"]) %>
<%= select('page_part', 'widget_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]["style"]) %>
<% end %>
</div>
</div>
<% if(@module_app && @module_app.widget_options(@widget_path)) %>
<% if(@selected[:module_app] && @selected[:module_app].widget_options(@selected[:app_frontend_url])) %>
<div class="style_switch control-group">
<label class="control-label"><%= t("default_widget.select_widget_ext_option") %></label>
<div class="controls well" >
@@ -27,14 +27,14 @@
<span class="span5"></span>
</div>
<% @module_app.widget_fields.each_with_index do |widget_field, i| %>
<% @selected[:module_app].widget_fields.each_with_index do |widget_field, i| %>
<div class="rows clear">
<span class="span4">
<%= i+1 %>
<%= select_tag "#{object_name}[#{field_name}][][field_name]", widget_field_options(i), :include_blank => true ,:class=>'widget_field_select',:field_seri => i ,:id=>"#{object_name}_#{field_name}_#{i}",:rel=>reload_rel%>
</span>
<span class="span3">
<%= select_tag "#{object_name}[#{field_name}][][class]", widget_fiield_class_options(i), :include_blank => true %> <br />
<%= select_tag "#{object_name}[#{field_name}][][class]", widget_field_class_options(i), :include_blank => true %> <br />
</span>
<span class="span5 link_switch_holder">
<%= link_to_field_switch(i,object_name,field_name) %>
@@ -5,14 +5,13 @@
<% when PagePart %>
<% field_name = "page_part[widget_style]" %>
<% end %>
<div class="style_switch control-group">
<label class="control-label">
<%= t("default_widget.select_widget_style") %>
</label>
<div class="controls well">
<ul class="clear">
<% if @module_app.get_default_widget["enabled_styles"].include?("typeA") %>
<% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeA") %>
<li>
<label class="radio style_radio">
<%= radio_button_tag field_name,"typeA",style_checked_value(object,"typeA") %>
@@ -23,7 +22,7 @@
</li>
<% end %>
<% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style2") %>
<% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style2") %>
<li>
<label class="radio style_radio">
<%= radio_button_tag field_name,"typeB_style2",style_checked_value(object,"typeB_style2") %>
@@ -33,7 +32,7 @@
</label>
</li>
<% end %>
<% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style3") %>
<% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style3") %>
<li>
<label class="radio style_radio">
<%= radio_button_tag field_name,"typeB_style3",style_checked_value(object,"typeB_style3") %>
@@ -43,7 +42,7 @@
</label>
</li>
<% end %>
<% if @module_app.get_default_widget["enabled_styles"].include?("typeB_style4") %>
<% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeB_style4") %>
<li>
<label class="radio style_radio">
<%= radio_button_tag field_name,"typeB_style4",style_checked_value(object,"typeB_style4") %>
@@ -53,7 +52,7 @@
</label>
</li>
<% end %>
<% if @module_app.get_default_widget["enabled_styles"].include?("typeC") %>
<% if @selected[:module_app].get_default_widget["enabled_styles"].include?("typeC") %>
<li>
<label class="radio style_radio">
<%= radio_button_tag field_name,"typeC",style_checked_value(object,"typeC") %>
@@ -21,3 +21,4 @@
<% end %>
<%=javascript_include_tag "inc/update_cates_and_tags.js" %>
<%= javascript_include_tag "inc/page_widget_edit_interface.js" %>
@@ -17,7 +17,7 @@
<%= t "default_widget.select_module_app" %>
</label>
<div class="controls">
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel => reload_after_module_changed_admin_page_part_path,:id=>"page_module_app_id"} %>
<%= f.select :module_app, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@selected[:module_app].id rescue nil)), {:include_blank => true }, {:rel => reload_after_module_changed_admin_page_part_path,:id=>"page_module_app_id"} %>
</div>
</div>
@@ -26,7 +26,8 @@
<%= t "default_widget.select_widget_path" %>
</label>
<div class="controls">
<%= f.select :widget_path, @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} : [], {}, { :selected => @part.widget_path, :rel => get_widget_field_rel } %>
<%#= @module_app ? @module_app.widgets.collect{|k,v| [I18n.t(v["i18n"]),k]} %>
<%= f.select :widget_path, @app_frontend_urls , {}, { :selected => @selected[:app_frontend_url], :rel => get_widget_field_rel } %>
</div>
</div>
@@ -1,4 +1,7 @@
<% @module_app.widget_options(@widget_path).get_options.each do |key,settings| %>
<% if (not(@selected[:module_app].widget_options(@selected[:app_frontend_url]).blank?) and @selected[:app_frontend_url]!='default_widget')%>
<% @selected[:module_app].widget_options(@selected[:app_frontend_url]).get_options.each do |key,settings| %>
<% options = settings[:opts] %>
<%= label_tag(t(settings[:label_i18n]))%>
<% case options%>
@@ -12,3 +15,4 @@
<% end %>
<% end %>
-4
View File
@@ -2,8 +2,4 @@
<%= render 'admin/items/site_map_left_bar' %>
<% end -%>
<%= render 'edit' %>
@@ -1 +1 @@
$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page_part','widget_field',nil,@choosen_field) %>");
$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page_part','widget_field',nil,@selected[:default_widget_field]) %>");
@@ -1,11 +1,11 @@
<% if @module_app%>
$('#widget_list select').html("<%= j options_for_select(@module_app.widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@part.widget_path) %>");
<% if @selected[:module_app]%>
$('#widget_list select').html("<%= j options_for_select(@selected[:module_app].widgets.collect{|k,v| [I18n.t(v['i18n']),k]},@selected[:app_frontend_url]) %>");
$("#widget_data_source_category").html("<%= j render :partial => 'widget_data_source_category',:locals=>{:object=>@part} %>");
$("#widget_data_source_tag").html("<%= j render :partial => 'widget_data_source_tag',:locals=>{:object=>@part} %>");
$("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page_part[widget_data_count]',:field_value=>@part.widget_data_count } %>");
<% if @part %>
<% if show_default_widget_setting_panel %>
$('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel' %>");
$('#widget_setting').html("<%= j render :partial => 'default_widget_style_panel',:locals=>{:object=>@part} %>");
$('#widget_setting').append("<%= j render :partial => 'default_widget_setting',:locals=>{:object=>@part} %>");
<% elsif show_custom_widget_setting_panel %>
$('#widget_setting').html("<%= j render :partial => 'custom_widget_setting' %>");
@@ -4,7 +4,7 @@
</label>
<div class="controls well">
<% if @frontend_styles%>
<%= select('page', 'frontend_style', @frontend_styles) %>
<%= select('page', 'frontend_style', @frontend_styles,{:selected => @selected[:frontend_style]}) %>
<% else %>
<%= t("default_widget.no_support_setting")%>
<% end %>
@@ -2,5 +2,5 @@
<%= t("default_widget.widget_data_count") %>
</label>
<div class="controls">
<%= select_tag(field_name,options_for_select((@module_app.get_registration.get_data_count rescue []),field_value )) %>
<%= select_tag(field_name,options_for_select(@page_frontend_data_counts||[],field_value )) %>
</div>
+8 -7
View File
@@ -1,13 +1,13 @@
<%= f.error_messages %>
<%= f.hidden_field :parent, :value => (@item.parent.id rescue nil) %>
<%= f.hidden_field :id, :value => (@item.id),:id=>"object_id" %>
<div class="control-group">
<%= f.label :name, '*'+t(:name), :class => 'control-label' %>
<div class="controls">
<%= f.text_field :name, :class => 'text input-xlarge' %>
<span class="help-inline">請輸入數字或英文,不可使用空白</span>
<span class="help-inline"><%= I18n.t("front_page.name_field_helper") %></span>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
@@ -27,14 +27,14 @@
<div class="control-group">
<%= f.label :name, t(:template_name), :class => 'control-label' %>
<div class="controls">
<%= f.collection_select :design, @designs, :id, :title, {:selected => @design.id}, {:rel => reload_themes_admin_pages_path} %>
<%= f.collection_select :design, @designs, :id, :title, {:selected => (@selected[:design].id rescue nil) }, {:rel => reload_themes_admin_pages_path} %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
<div class="control-group">
<%= f.label :name, t(:theme), :class => 'control-label' %>
<div class="controls">
<%= f.select :theme_id, @design.themes.collect { |t| [t.name.capitalize, t.id] }, :include_blank => true %>
<%= f.select :theme_id, @themes.collect { |t| [t.name.capitalize, t.id] }, {:include_blank => true, :selected=>(@selected[:theme].id rescue nil) } %>
<!-- <p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p> -->
</div>
</div>
@@ -42,14 +42,14 @@
<div class="control-group" id="module_app_list">
<%= f.label '',t("default_widget.select_module_app"), :class => 'control-label' %>
<div class="controls">
<%= f.select :module_app_id, options_from_collection_for_select(@module_apps, :id, :module_name, :selected => (@module_app.id rescue nil)), {:include_blank => true }, {:rel => reload_after_module_changed_admin_pages_path,:id=>"page_module_app_id"} %>
<%= f.select :module_app_id, options_from_collection_for_select(@module_apps, :id, :module_name, :selected =>(@selected[:module_app].id rescue nil)), {:include_blank => true }, {:rel => reload_after_module_changed_admin_pages_path,:id=>"page_module_app_id"} %>
</div>
</div>
<div class="control-group" id="frontend_list">
<%= f.label '', t("front_page.select_app_url"), :class => 'control-label' %>
<div class="controls" id="app_page_url">
<%= select('page','app_frontend_url', @app_frontend_urls || [],{}, {:selected => (@item.app_frontend_url || 'default_widget'),:rel => reload_after_list_changed_admin_pages_path}) rescue ''%>
<%= select('page','app_frontend_url', @app_frontend_urls || [], {:selected => @selected[:app_frontend_url],:rel => reload_after_list_changed_admin_pages_path}) rescue ''%>
</div>
</div>
@@ -67,7 +67,7 @@
</div>
<div class="control-group" id='data_count'>
<%= render :partial=>'data_count_field',:locals=>{:field_name=>"page[frontend_data_count]",:field_value=>@item.frontend_data_count} %>
<%= render :partial=>'data_count_field',:locals=>{:field_name=>"page[frontend_data_count]",:field_value=>@selected[:page_frontend_data_count]} %>
</div>
<div class="control-group">
@@ -113,3 +113,4 @@
</div>
<%=javascript_include_tag "inc/update_cates_and_tags.js" %>
<%= javascript_include_tag "inc/page_widget_edit_interface.js" %>
@@ -4,7 +4,7 @@
<% @module_app.widget_fields.each_with_index do |frontend_field, i| %>
<%= i+1 %>
<%= select_tag "page[frontend_field][]",widget_field_options(i,@item) , :include_blank => true %>
<%= select_tag "page[frontend_field_type][]", widget_fiield_class_options(i,@item), :include_blank => true %> <br />
<%= select_tag "page[frontend_field_type][]", widget_field_class_options(i,@item), :include_blank => true %> <br />
<% end %>
<% end %>
@@ -1,25 +1,25 @@
<% if @module_app %>
<% if @selected[:module_app] %>
$('#app_page_category').html("<%= j render :partial => 'admin/page_parts/widget_data_source_category' ,:locals=>{:object=>@item}%>");
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@item} %>");
$("#data_count").html("<%= j render :partial => 'admin/pages/data_count_field',:locals=>{:field_name=>'page[frontend_data_count]',:field_value=>(@item.frontend_data_count rescue nil)} %>");
<% if !@module_app.app_pages.blank? or @module_app.has_default_widget? %>
$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, (@item.app_frontend_url || 'default_widget')),{},{:rel => reload_after_list_changed_admin_pages_path}) %>");
<% if !@selected[:module_app].app_pages.blank? or @selected[:module_app].has_default_widget? %>
$('#app_page_url').html("<%= escape_javascript(select 'page', 'app_frontend_url', options_for_select(@app_frontend_urls, @selected[:app_frontend_url]),{},{:rel => reload_after_list_changed_admin_pages_path}) %>");
<% else %>
$('#app_page_url').html("<div class='well'><%= t('default_widget.no_support_setting')%></div>");
<% end %>
<% if @app_frontend_urls.first =='default_widget' %>
$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @module_app.widgets[@frontend_path]) if !@frontend_path.blank? %>");
$('#app_page_frontend_style').html("<%= escape_javascript(select 'page', 'frontend_style', @selected[:module_app].widgets[@selected[:app_frontend_url]]) %>");
<% else %>
$('#app_page_frontend_style').html("<%= t('default_widget.no_support_setting')%>");
<% end %>
<% if show_default_widget_setting_panel %>
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@page} %>");
$('#app_page_tag').html("<%= j render :partial => 'admin/page_parts/widget_data_source_tag',:locals=>{:object=>@item} %>");
$('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@page} %>");
$('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@page} %>");
$('#frontend_setting').html("<%= j render :partial => 'admin/page_parts/default_widget_style_panel',:locals=>{:object=>@item} %>");
$('#frontend_setting').append("<%= j render :partial => 'admin/page_parts/default_widget_setting',:locals=>{:object=>@item} %>");
<% else %>
$('#frontend_setting').html("<%= j render :partial => 'custom_frontend_setting' %>");
<% end %>
@@ -1 +1 @@
$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@choosen_field) %>");
$("#<%= params[:dom_id] %>").parents(".rows").find(".link_switch_holder").html("<%= j link_to_field_switch(@index,'page','frontend_field',nil,@selected[:default_widget_field]) %>");
@@ -0,0 +1,31 @@
<% # encoding: utf-8 %>
<%= form_for(:role_filter, :remote => true, :url => @url, :method => @verb, :html => { :id => 'form_role_filter' } ) do |f| %>
<h2><%= (@role_filter.new_record? ? 'Add' : 'Edit') %></h2>
<div id="widget-title">
<%= f.label :key %>
<%= f.text_field :key %>
</div>
<div id="widget-title">
<%= f.fields_for :title_translations do |f| %>
<% @site_valid_locales.each do |locale| %>
<div class="control-group">
<%= label_tag "name-#{locale}", "Name-#{I18nVariable.from_locale(locale)}", :class => 'control-label' %>
<div class="controls">
<%= f.text_field locale, :class =>' input-xxlarge', :value => (@role_filter.title_translations[locale] rescue nil) %>
</div>
</div>
<% end %>
<% end %>
</div>
<div class="form-actions">
<%= f.hidden_field :role_id, :value => params[:role_id] if !params[:role_id].blank? %>
<%= f.submit 'Submit/送出', :class=>'btn btn-primary' %>
</div>
<% end %>
@@ -0,0 +1,23 @@
<tr id="<%= dom_id role_filter %>" class="with_action">
<td>
<%= role_filter.key %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<% if is_admin?%>
<li><%= link_to t('role_filter.edit'),
polymorphic_path([:admin, role_filter], {:action => :edit}), :remote => true %></li>
<li><%= link_to show_toggle_archive_btn(role_filter),
polymorphic_path([:admin, role_filter]), :confirm => t('sure?'), :method => :delete, :remote => true,:class=>"archive_toggle" %></li>
<% end %>
</ul>
</div>
</td>
<% if @types.is_localized?(:title) %>
<% @site_valid_locales.each do |locale| %>
<td><%= role_filter.title_translations[locale] rescue nil %></td>
<% end %>
<% else %>
<td><%= role_filter.title %></td>
<% end %>
</tr>
@@ -0,0 +1,2 @@
$('<%= j render :partial => 'role_filter', :collection => [@role_filter] %>').appendTo('#role_filters').hide().fadeIn();
$("#form_role_filter")[0].reset();
@@ -0,0 +1 @@
$("#<%= dom_id @role_filter %>").find(".archive_toggle").text("<%= show_toggle_archive_btn(@role_filter) %> ");
+1
View File
@@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");
@@ -0,0 +1,49 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<div class="subnav">
<ul class="breadcrumb">
<li><%= link_to( t("role"), admin_roles_path ) %> <span class="divider">/</span></li>
<li class="active">( <%= @role.title %> ) <%= t(@app_type_name) %></li>
</ul>
<div id="accordion">
<div class="accordion-group filters">
<div class="table-label">
<table class="table main-list">
<thead>
<tr class="sort-header">
<th id="sort-name" class="sort span1-2 select"><span><a href="#"><%= t('role_filters.key') %><b class="web-symbol"></b></a></span></th>
<% @site_valid_locales.each do |locale| %>
<th id="sort-name" class="sort span1-2 select"><span><a href="#"><%= I18nVariable.first(:conditions => {:key => locale})[I18n.locale] %><b class="web-symbol"></b></a></span></th>
<% end %>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
<table id="role_filters" class="table main-list">
<thead>
<tr>
<th class="span1-2"></th>
<% @site_valid_locales.each do |locale| %>
<th class="span1-2"></th>
<% end %>
</tr>
</thead>
<tbody>
<%= render :partial => 'role_filter', :collection => @role_filters %>
</tbody>
</table>
<div id="form"><%= render :partial => "form" %></div>
+1
View File
@@ -0,0 +1 @@
$("#form > form").replaceWith("<%= j render "form" %>");
@@ -0,0 +1,4 @@
$("#<%= dom_id @role_filter %>").replaceWith("<%= j render :partial => 'role_filter', :collection => [@role_filter] %>");
<% @role_filter = @types.new(:display => 'List') # reset for new form %>
$("#form_role_filter").replaceWith("<%= j render "form" %>")
$("#form_role_filter")[0].reset();
@@ -1,3 +1,9 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<%= form_for @sub_attribute,:url => eval("admin_#{@attribute_type}s_path") ,:class=> "form-horizontal" do |f| %>
<div class="site-map role-block">
<div class="map-block back">
@@ -1,3 +1,9 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-group', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<%= form_for @sub_attribute,:url => eval("admin_#{@attribute_type}_path(@attribute)") ,:class=> "form-horizontal" do |f| %>
<div class="site-map role-block">
<div class="map-block back">
@@ -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 %>
<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/>").html_safe %>
<% 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/>").html_safe %>
<% 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/>").html_safe %>
<% end if @resque_logs_file%>
<%else %>
<div class="well"><%= I18n.t("site.system_preference_.summary.no_data") %></div>
<% end %>
</div>
</div>
+8
View File
@@ -35,6 +35,14 @@
</div>
<% end %>
<% end %>
<div class="control-group">
<label class="control-label"><%= t 'site.openness' %></label>
<div class="controls">
<%= f.check_box :frontend_closed %><%= I18n.t('site.frontend_closed') %><br/>
<%= f.check_box :backend_openness_on %><%= I18n.t('site.backend_openness_on') %>
<p class="help-block"><%= (t 'site.search_help').html_safe %></p>
</div>
</div>
<div class="control-group">
<label class="control-label"><%= t 'site.search' %></label>
<div class="controls">
@@ -4,12 +4,34 @@
<div class="groups map-block back <%= role_disable ? 'disabled' : '' %>">
<h4>
<button for=<%=@form_index%> class="onoff pull-right"><%= role_disable ? 'OFF' : 'ON' %></button><span><%= role.title %></span>
<button for=<%=@form_index%> class="onoff pull-right"><%= role_disable ? 'OFF' : 'ON' %></button><span><%= role.title %><%= t(:role_info)%></span>
<%= hidden_field_tag("user[disable_role][id][#{role.id}]",role_disable,:for=>@form_index,:class=>"subrole_disable_field",:value=>role_disable)%>
</h4>
<div class="form-horizontal <%= role_disable ? 'hide' : '' %>">
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:status), nil, {:func=>"field_label", :for=>"1", :class=>"control-label"} %>
<% role.role_statuses.where(:disable => false).each_with_index do |rrs, i|%>
<%= hidden_field_tag("user[role_status][id][#{rrs.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_status][id][#{rrs.id}]", true, @user.role_statuses.include?(rrs))+rrs.title,:class=>"control-label") %>
<% end %>
</div>
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:category), nil, {:func=>"field_label", :for=>"1", :class=>"control-label"} %>
<% role.role_categorys.where(:disable => false).each_with_index do |rrcg, i|%>
<%= hidden_field_tag("user[role_category][id][#{rrcg.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_category][id][#{rrcg.id}]", true, @user.role_categorys.include?(rrcg))+rrcg.title,:class=>"control-label") %>
<% end %>
</div>
<% role.attribute_fields.each do |rf|%>
<%= rf.block_helper(@user,@form_index)%>
@@ -1,14 +1,22 @@
<div class="roles <%= show_roles.key %>">
<%= show_roles.title %>
<%= show_roles.title %><%= t(:role_info)%>
<div class="label-line">
<hr />
</div>
<table class="table">
<tbody>
<tr>
<td class="span1"><%= t('status') %></td>
<td><%= show_attribute_value(@user.role_statuses.where(:role_id=>show_roles.id).map{|t|t.title.to_s}.join(',')) rescue '' %></td>
</tr>
<tr>
<td class="span1"><%= t('category') %></td>
<td><%= show_attribute_value(@user.role_categorys.where(:role_id=>show_roles.id).map{|t|t.title.to_s}.join(',')) rescue '' %></td>
</tr>
<% show_roles.attribute_fields.where(:disabled=>false).each do |rf| %>
<tr>
<td class="span1"><%= rf.title %></td>
<td><%= show_attribute_value(@user.get_attribute_value(rf).get_value_by_locale(I18n.locale)) rescue '' %></td>
<td><%= nl2br(show_attribute_value(@user.get_attribute_value(rf).get_value_by_locale(I18n.locale))) rescue '' %></td>
</tr>
<% end -%>
<%= render :partial => 'show_sub_role',:collection=> @user.get_sub_roles_by_role(show_roles)%>
@@ -2,6 +2,6 @@
<% show_sub_role.attribute_fields.each do |item|%>
<tr>
<td class="span1"><%= item.title %></td>
<td><%= show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale)) rescue '' %></td>
<td><%= nl2br(show_attribute_value(@user.get_attribute_value(item).get_value_by_locale(I18n.locale))) rescue '' %></td>
</tr>
<% end %>
@@ -3,9 +3,63 @@
<div class="map-block back">
<h4><span><%=t(:sys_basic_form)%></span></h4>
<div class="form-horizontal">
<div class="controls-block" >
<div class="control-group language-swich">
<%= f.label t("users.first_name"),{:class=>"control-label", :func=>"field_label"} %>
<div class="controls">
<div class="tabbable">
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= locale %> user-attribute_values-first_name <%= ( i == 0 ) ? "in active" : '' %>">
<%= f.fields_for :first_name_translations do |f| %>
<%= f.text_field locale, :func=>'input_unit', :value => (@user.first_name_translations[locale] rescue nil) %>
<% end %>
</div>
<% end %>
</div>
<ul class="nav nav-pills">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %> for="<%= locale %>">
<a data-toggle="tab" href=".user-attribute_values-first_name.<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="controls-block" >
<div class="control-group language-swich">
<%= f.label t("users.last_name"),{:class=>"control-label", :func=>"field_label"} %>
<div class="controls">
<div class="tabbable">
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= locale %> user-attribute_values-last_name <%= ( i == 0 ) ? "in active" : '' %>">
<%= f.fields_for :last_name_translations do |f| %>
<%= f.text_field locale, :func=>'input_unit', :value => (@user.last_name_translations[locale] rescue nil) %>
<% end %>
</div>
<% end %>
</div>
<ul class="nav nav-pills">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %> for="<%= locale %>">
<a data-toggle="tab" href=".user-attribute_values-last_name.<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t(:email),:class=>"control-label" %><br />
<%= f.label t("users.email"),:class=>"control-label" %>
<div class="controls">
<%= f.email_field :email %>
</div>
@@ -14,19 +68,53 @@
<div class="form-horizontal">
<div class="control-group">
<%= f.label t(:password),:class=>"control-label" %>
<%= f.label t("users.sid"),:class=>"control-label" %>
<div class="controls">
<%= f.password_field :password %>
<%= f.text_field :sid %>
<span>( <%= t("users.sid_note")%> )</span>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t("users.office_tel"),:class=>"control-label" %>
<div class="controls">
<%= f.text_field :office_tel %>
<span>( <%= t("users.office_tel_note")%> )</span>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t(:password_confirmation),:class=>"control-label" %>
<%= f.label t("users.avatar"),:class=>"control-label" %>
<div class="controls">
<%= f.password_field :password_confirmation %>
<%= f.file_field :avatar %>
<% if @user.avatar.file %>
<%= f.check_box :remove_avatar %>
<%= t('delete.file') %>
<% end %>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t("users.sex"),:class=>"control-label" %>
<div class="controls">
<label func="input_unit" for="0" class=" radio inline">
<%= f.radio_button :sex, "male" %><%= t('users.male')%>
</label>
<label func="input_unit" for="1" class=" radio inline">
<%= f.radio_button :sex, "female" %><%= t('users.female')%>
</label>
<label func="input_unit" for="2" class=" radio inline">
<%= f.radio_button :sex, "unknown" %><%= t('users.unknown')%>
</label>
</div>
</div>
</div>
</div>
@@ -0,0 +1,36 @@
<%#= devise_error_messages! %>
<%= flash_messages %>
<div class="map-block back">
<h4><span><%=t(:sys_basic_id_form)%></span></h4>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t("users.user_id"),:class=>"control-label" %>
<%#= f.label t(:user_id),:class=>"control-label" %>
<div class="controls">
<%= f.text_field :user_id %>
<span>( <%= t("users.user_id_note")%> )</span>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t("users.new_password"),:class=>"control-label" %>
<div class="controls">
<%= f.password_field :password %>
<span>( <%= t("users.new_password_note")%> )</span>
</div>
</div>
</div>
<div class="form-horizontal">
<div class="control-group">
<%= f.label t("users.new_password_confirmation"),:class=>"control-label" %>
<div class="controls">
<%= f.password_field :password_confirmation %>
</div>
</div>
</div>
</div>
@@ -18,7 +18,10 @@
<%= link_to user_for_summary.name,admin_users_new_interface_path(user_for_summary)%>
</p>
<div class="user-title">
<span>#TODO 教授兼系主任</span><span>#TODO 大學部校友</span>
<% user_for_summary.roles.each do |rf| %>
<% @roledata = Role.find(rf.id) %>
<span><%= @roledata.title %></span>
<% end %>
</div>
<ul class="user-itemborder clear">
<li class="pull-left"><span>#TODO 258</span>Publications</li>
@@ -5,6 +5,32 @@
</div>
<table class="table">
<tbody>
<tr>
<td class="span1"><%= t('users.first_name')%></td>
<td><%= @user.first_name %></td>
</tr>
<tr>
<td class="span1"><%= t('users.last_name')%></td>
<td><%= @user.last_name %></td>
</tr>
<tr>
<td class="span1"><%= t('users.email')%></td>
<td><%= @user.email %></td>
</tr>
<% if !@user.sid.blank? %>
<tr>
<td class="span1"><%= t('users.sid')%></td>
<td><%= @user.sid %></td>
</tr>
<tr>
<td class="span1"><%= t('users.office_tel')%></td>
<td><%= @user.office_tel %></td>
</tr>
<% end %>
<tr>
<td class="span1"><%= t('users.sex')%></td>
<td><%= t("users.#{@user.sex}") %></td>
</tr>
<% items.each do |item| %>
<tr>
<td class="span1"><%= item[:name] %></td>
@@ -0,0 +1,32 @@
<% content_for :side_bar do %>
<%= render :partial => 'layouts/side_bar', :locals => {:link_name => t(:member), :link_url => admin_site_site_info_path(@site), :icon => 'icons-users', :side_bar_content => 'admin/users_new_interface/side_bar'} %>
<% end %>
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "member" %>
<%= stylesheet_link_tag "site-map" %>
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "/static/jquery.cycle.all.latest.js" %>
<%= javascript_include_tag "inc/modal-preview" %>
<%= javascript_include_tag "lib/contenteditable" %>
<%= javascript_include_tag "inc/ploy_input_field" %>
<%= javascript_include_tag "inc/input_module" %>
<%= javascript_include_tag "inc/attribute_panel_select" %>
<%= javascript_include_tag "inc/attribute_onoff" %>
<% end -%>
<%= content_tag :div,:class=>"user-role site-map role-block" do%>
<%= form_for @user, :url => admin_users_new_interface_path(@user), :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
<%= render :partial => 'user_basic_passwd', :locals => {:f => f}%>
<div class="button_bar">
<%= link_back %>
<%= hidden_field_tag 'edit_type', 'edit_passwd' %>
<%= link_to t(:update_), "#", :onclick=>"$('#edit_user_#{@user.id}').submit()" %>
</div>
<% end -%>
<% end -%>
@@ -21,6 +21,7 @@
<%= form_for @user, :url => admin_users_new_interface_index_path, :html => { :multipart => true },:method => :post do |f| %>
<%= f.error_messages %>
<%= render :partial => 'user_basic_passwd', :locals => {:f => f}%>
<%= render :partial => 'user_basic', :locals => {:f => f}%>
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="button_bar">
@@ -39,6 +39,7 @@
<%= @user.email %>
</p>
<%= link_to("<i class='icon-pencil'></i>#{t(:edit)}".html_safe,edit_admin_users_new_interface_path(@user),:class=>"btn btn-small" ) if is_admin?%>
<%= link_to("<i class='icon-pencil'></i>#{t("users.change_passwd")}".html_safe,admin_users_new_interface_edit_passwd_path(@user),:class=>"btn btn-small" ) if is_admin?%>
</div>
<div class="user-roles my_scroll">
<div class="scrollbar">
+4 -4
View File
@@ -3,15 +3,15 @@
<table class="default_widget_tb" border="0" cellpadding="0" cellspacing="0" >
<thead>
<tr>
<% @fields.each do |field|%>
<th><%= content_tag(:span,get_field_header(field[0]),:class=>field[1])%></th>
<% @frontend_field_names.each_with_index do |field,index|%>
<%= content_tag(:th,content_tag(:span,get_field_header(field),:class=>@frontend_classes[index]))unless field.blank?%>
<% end %>
</tr>
</thead>
<% @data.each do |row_data| %>
<tr>
<% @fields.each do |field|%>
<td><%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%></td>
<% @frontend_field_names.each_with_index do |field,index|%>
<%= content_tag(:td,content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]))unless field.blank?%>
<% end %>
</tr>
<% end %>
+2 -2
View File
@@ -6,8 +6,8 @@
<%= image_tag row_data.send(@widget_image_field)%>
</div>
<div class="wrap">
<% @fields.each do |field|%>
<%= content_tag(:span,link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% @frontend_field_names.each_with_index do |field,index|%>
<%= content_tag(:span,link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%>
<% end %>
</div>
<% end %>
+2 -2
View File
@@ -5,8 +5,8 @@
<ul class="default_widget_list">
<% @data.each do |row_data| %>
<%= content_tag(:li) do %>
<% @fields.each do |field|%>
<%= content_tag(:span, link_to_field(row_data,field[0], field[2], {orig_page: @page_id.to_s}),:class=>field[1])%>
<% @frontend_field_names.each_with_index do |field,index|%>
<%= content_tag(:span, link_to_field(row_data,field, @frontend_sat_to_links[index], {orig_page: @page_id.to_s}),:class=>@frontend_classes[index]) unless field.blank?%>
<% end %>
<% end %>
<% end %>
+2 -6
View File
@@ -2,13 +2,9 @@
<div id="content">
<div id="header" class="hh2">
<div class="dtitle w2 hh2 hp sdm">
<div class="thmtxth sdm_t" id="section_heading">Loading...</div>
<div class="admbg sdm_o">
<div class="thmtxth sdm_t" id="section_heading"></div>
<div class="admbg sdm_o w2">
<ul id="section_list">
<!-- <li><a class="admtxt hp w2 hh2" href="">Campus</a></li>
<li><a class="admtxt hp w2 hh2" href="">Research</a></li>
<li><a class="admtxt hp w2 hh2" href="">Social</a></li>
<li><a class="admtxt hp w2 hh2" href="">Private</a></li> -->
</ul>
</div>
</div>
+2 -2
View File
@@ -11,8 +11,8 @@
<p class="alert hide">You need to sign in or sign up before continuing.</p>
<div class="main">
<div class="control-group clear">
<%= f.label :email ,t(:email)%>
<%= f.text_field :email, :placeholder => t(:email), :style => "width: 330px;" %>
<%= f.label :user_id ,t(:user_id)%>
<%= f.text_field :user_id, :placeholder => t(:email), :style => "width: 330px;" %>
<span class="help-inline">Please correct the error</span>
</div>
<div class="control-group clear">
+3
View File
@@ -1,5 +1,8 @@
<a class="brand dropdown-toggle" data-toggle="dropdown" href="#">Orbit</a>
<% if Me.backend_openness_on %>
<ul class="dropdown-menu">
<li><%= link_to content_tag(:i, nil, :class => 'icons-gauge') + t(:dashboard_), admin_dashboards_path %></li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-users') + t(:member), admin_users_new_interface_index_path %></li>
</ul>
<% end %>
+2 -2
View File
@@ -38,7 +38,7 @@
<li class="dropdown language">
<a class="dropdown-toggle orbit-bar-language" href="#" data-toggle="dropdown" data-icons="&#xe054;"></a>
<ul class="dropdown-menu language-menu">
<% @site_in_use_locales.each do |locale| %>
<% @site_in_use_locales.compact.each do |locale| %>
<%= content_tag :li, (link_to t(:_locale, :locale => locale), add_locale(remove_locale((referer rescue request.fullpath)), locale)), :class => (I18n.locale.eql?(locale.to_sym) ? 'active' : nil) %>
<% end %>
</ul>
@@ -74,7 +74,7 @@
<li>
<div class="input-prepend">
<span class="add-on"><i class="icon-user"></i></span>
<%= f.text_field :email, :class => 'span2', :placeholder => t(:email), :size => 16 %>
<%= f.text_field :user_id, :class => 'span2', :placeholder => t(:email), :size => 16 %>
</div>
</li>
<li>
-2
View File
@@ -77,5 +77,3 @@ module Orbit
end
Orbit_Apps = []
VALID_LOCALES = ["en", "zh_tw"]
+2
View File
@@ -5,3 +5,5 @@ YAML::ENGINE.yamler = 'syck'
# Initialize the rails application
Orbit::Application.initialize!
Me = Site.first
OrbitJobLogger = OrbitJobLog.new
+1 -1
View File
@@ -21,7 +21,7 @@ Devise.setup do |config|
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# config.authentication_keys = [ :email ]
config.authentication_keys = [ :email ]
config.authentication_keys = [ :user_id ]
# Tell if authentication through request.params is enabled. True by default.
@@ -0,0 +1,13 @@
module OrbitSystemPreference
ArchiveDbListPath = "#{Rails.root}/log/archive_db.list.log"
GitCommitListPath = "#{Rails.root}/log/git_commit.list.log"
ResqueLogFile ="#{Rails.root}/log/orbit_job.log"
GitLogCommend = 'git log --pretty=format:"%x09%ad%x09%s" --date=short'
DiskFree= 'df -h /'
DefaultDiskSpaceLimit = 3 #in GB
module SystemPackage
MongodbVersion = "mongod --version"
NginxVersion = "nginx -V"
SystemVersion = "uname -a"
end
end
+45 -2
View File
@@ -4,6 +4,7 @@ en:
access:
denied:
ajax_401_error: "User session has been expired,please login again."
app:
not_authed_user: Access Denied for you are not User for this app
not_manager: Access Denied for you are not Manager for this app
@@ -52,7 +53,7 @@ en:
zip: ZIP
addthis_tools:
add_to_bookmark: Add this to bookmark
admin: Admin
admin: Super Admin
all: All
all_content: All Content
all_file: All File
@@ -209,6 +210,7 @@ en:
forgot_password: Forgot your password?
frequency: Frequency
front_page:
name_field_helper: Can not be blank
select_app_url:
is_published:
menu_enable_lang:
@@ -345,6 +347,7 @@ en:
related_links: Related Links
role: Role
role_field: Role Field
role_info: " Role Info."
roles: Roles
ruling_site: Ruling Site
rulingcom:
@@ -369,21 +372,36 @@ en:
summary: Summary
thumbnail: Thumbnail
site:
backend_openness_on: Backend Openness
default_image: Site default image
description: Site description
description_help: Description Guide
footer: Site footer
footer_help: Footer Guide
frontend_closed: Frontend Closed
header: Site header
info: Site information
keywords: Site keywords
keywords_help: Keyword Guide
language: Site language
mobile_version: Mobile version
openness: Openness
search: Site Search
search_help: Please Enter the search argument for Google search.
settings: Site setting
sub_menu: Site sub-menu
system_preference: System Preference
system_preference_:
tab_backups: Backups
tab_commits: Commits
tab_summary: Summary
tab_logs: Logs
summary:
code_update_at: Code Update histroy
disk_space: Disk Free
no_data: No Data
version: Version
weekness_report: Weekness Report
title: Site Title
title_help: Site Title Guide
site_: Site
@@ -410,7 +428,8 @@ en:
module_page_lang_not_support: "We are sorry, this page is not available for English"
not_previewable: "Preview not support"
preview_only_for_img: "Preview only supprt with file type: jpg, png, gif, bmp"
sys_basic_form: User system info
sys_basic_form: System Default Basic Field
sys_basic_id_form: System Account Info.
system_info: System information
tag_cloud: Tag cloud
tags: Tags
@@ -445,6 +464,30 @@ en:
url: URL
use_status: Use Statue
user: User
users:
admin_change_password: You cannot change your own password here!
avatar: Profile Picture
change_passwd: Change password
email: Email
first_name: First Name
last_name: Last Name
male: Male
name: Name
new_password: New password
new_password_note: At least 6 characters
new_password_confirmation: Confirm new password
female: Female
unknown: Information Not Available
office_tel: Office Tel No.
office_tel_note: Public available
sid: ID No.
sid_note: Faculty ID No. or Student ID No.
sex: Gender
user_id: User Account
user_id_note: Should be more than 3 characters and less than 50 characters
user_id_not_null: User account cannot be null
user_id_length: User account should be more than 3 characters
user_id_error: Someone already use that user account
version: Version
vertical: Vertical
view: View
-15
View File
@@ -1,15 +0,0 @@
en:
ntu:
site_names:
"00": "Dean of General Affairs"
"01": "Documentation Division"
"02": "Cashier Division"
"03": "General Service Division"
"04": "General Affairs Division, College of Social Science"
"05": "Property Management Division"
"06": "Procurement Division"
"07": "Facilities Service Division"
"08": "General Service Division"
"09": "Campus Security"
"10": "Construction and Maintenance Division"
-15
View File
@@ -1,15 +0,0 @@
zh_tw:
ntu:
site_names:
"00": "總務處"
"01": "文書組"
"02": "出納組"
"03": "事務組"
"04": "社科院總務分處"
"05": "保管組"
"06": "採購組"
"07": "經營管理組"
"08": "事務組"
"09": "駐警隊"
"10": "營繕組"
Loaded 100 of 296 files, more files were not shown because too many files have changed in this diff. Show more