Commit 150a2ece authored by Lingnan Wu's avatar Lingnan Wu

delete some useless file and change add and edit frame background to suits OfficeJS

parent 3ae99833
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
href="lib/presentation/erp5.css" /> href="lib/presentation/erp5.css" />
<script type="text/javascript" <script type="text/javascript"
src="lib/presentation/erp5.js"></script> src="lib/presentation/erp5.js"></script>
<script type="text/javascript"
src="lib/presentation/erp5_knowledge_box.js"></script>
<script type="text/javascript" <script type="text/javascript"
src="lib/presentation/erp5_xhtml_appearance.js"></script> src="lib/presentation/erp5_xhtml_appearance.js"></script>
</head> </head>
......
...@@ -7,13 +7,10 @@ ...@@ -7,13 +7,10 @@
<meta content="index, follow" name="robots"> <meta content="index, follow" name="robots">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Add a new Slide</title> <title>Add a new Slide</title>
<link href="erp5_knowledge_box.css" rel="stylesheet" type="text/css">
<link href="erp5.css" rel="stylesheet" type="text/css"> <link href="erp5.css" rel="stylesheet" type="text/css">
<link href="erp5_listbox.css" rel="stylesheet" type="text/css">
<script src="jquery.js" type="text/javascript"></script> <script src="jquery.js" type="text/javascript"></script>
<script src="jquery-ui.js" type="text/javascript"></script> <script src="jquery-ui.js" type="text/javascript"></script>
<script src="erp5.js" type="text/javascript"></script> <script src="erp5.js" type="text/javascript"></script>
<script src="erp5_knowledge_box.js" type="text/javascript"></script>
<script src="erp5_xhtml_appearance.js" type="text/javascript"></script> <script src="erp5_xhtml_appearance.js" type="text/javascript"></script>
<!-- this is a placeholder for different extensions to head which could be required by web themes --> <!-- this is a placeholder for different extensions to head which could be required by web themes -->
</head> </head>
......
...@@ -7,13 +7,10 @@ ...@@ -7,13 +7,10 @@
<meta content="index, follow" name="robots"> <meta content="index, follow" name="robots">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Add a new Slide</title> <title>Add a new Slide</title>
<link href="erp5_knowledge_box.css" rel="stylesheet" type="text/css">
<link href="erp5.css" rel="stylesheet" type="text/css"> <link href="erp5.css" rel="stylesheet" type="text/css">
<link href="erp5_listbox.css" rel="stylesheet" type="text/css">
<script src="jquery.js" type="text/javascript"></script> <script src="jquery.js" type="text/javascript"></script>
<script src="jquery-ui.js" type="text/javascript"></script> <script src="jquery-ui.js" type="text/javascript"></script>
<script src="erp5.js" type="text/javascript"></script> <script src="erp5.js" type="text/javascript"></script>
<script src="erp5_knowledge_box.js" type="text/javascript"></script>
<script src="erp5_xhtml_appearance.js" type="text/javascript"></script> <script src="erp5_xhtml_appearance.js" type="text/javascript"></script>
<!-- this is a placeholder for different extensions to head which could be required by web themes --> <!-- this is a placeholder for different extensions to head which could be required by web themes -->
</head> </head>
......
...@@ -551,7 +551,6 @@ span.search { ...@@ -551,7 +551,6 @@ span.search {
.dialog_box { .dialog_box {
color: inherit; color: inherit;
background-color: #BDD0F0;
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
border-color: #3D5474; border-color: #3D5474;
......
#gadget_area_wrapper {
margin-top: 0.5em;
}
#page_wrapper {
text-align: left;
margin: 0em;
padding: 0em;
padding-top: 0em;
background-color: inherit;
min-height: 500px;
width: 100%;
float:left;
margin-top: 0.5em;
}
#loading-wrapper{
position:absolute;
width:250px;
top:80px;
left:50%;
margin-left:-150px;
text-align:center;
padding:7px 0 0 0;
background-color: #FFF;
z-index:1000;
}
#loading-wrapper p{
font-weight: bold;
font-size: 90%;
}
.invisible-gadget{
display:none;
}
/* 3 columng gadget layout */
div.portal-column {
float: left;
width:32.9%;
margin-right:3px;
min-height: 200px;
}
/* Boxes */
div.block {
margin:1px 1px 3px;
padding: 0px;
width: 100%;
}
div.pad-actions{
float:left;
}
h3.handle {
margin: 0;
padding: 0 0 0 10px;
font-size: 14px;
color: #fff;
background: transparent url(images/tab_left_selected.png) no-repeat scroll left top;
border-bottom: 1px solid #3D6474;
}
h3.handle span.handle {
display: block;
min-height:20px;
padding: 5px 5px 0 0;
background: transparent url(images/tab_right_selected.png) no-repeat scroll right top;
}
div.block h3 span.gadget_title{
min-width: 100px;
}
/* Minimize, Edit, Remove images */
span.clickable_image{
cursor: pointer;
margin-top: 5px;
display: block;
float: left;
}
#tabs li span.rename_tab_dialog_image{
background: url("icon_edit.gif") no-repeat;
padding-right: 6px;
}
#tabs li span.remove_tab_dialog_image{
background: url("icon_remove.gif") no-repeat;
padding-right: 6px;
}
a.clickable-block{
display: block;
float: right;
width: 15px;
height: 15px;
background-repeat: no-repeat;
background-position: center;
cursor: pointer;
padding: 0em;
margin: 0;
}
a.block-remove {
background-image: url(icon_remove.gif);
}
a.block-minimize {
background-image: url(icon_minimize.gif);
}
a.block-edit-form {
background-image: url(icon_edit.gif);
}
.block-hover {
border: 2px dashed #f00;
}
span.handle,
h3.handle {
cursor: move;
}
/* In edit form disable border */
div.edit-form fieldset{
border: 0px solid black;
}
div.edit-form button{
margin-top: 0.5em;
}
div.edit-form {
padding-top: 0.5em;
padding-left: 1em;
padding-bottom: 0.5em;
border: solid black;
border-width: 0 1px 1px 1px;
background-color: #BDD0F0;
overflow: auto;
width:auto;
}
/* Tabs for Knowledge Pads */
#pad-navigation-wrapper{
margin-top:10px;
border-bottom:1px solid #3D6474;
height:25px;
width:100%;
}
#tabs {
padding-left: 0em;
float: left;
width:78%;
}
#tabs ul {
margin : 0em;
padding: 0em;
width: 100%;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
}
li.tab {
display: block;
font-size: 12px;
float: left;
height: 24px;
padding-right: 5px;
background-color: #BDD0F0;
cursor: pointer;
border: 1px solid #3D6474;
margin-right: 1px;
}
#tabs li span{
padding: 0px 10px;
display: block;
float: left;
height: 19px;
padding-top: 5px;
}
/* Selected tabs should be 1px higher in order to hide border at bottom */
li.tab_selected {
font-weight: bold;
background-color: #DAE6F6;
border-bottom: 1px solid #DAE6F6;
}
/* without this declaration IE will hide draggable elements!*/
.content .field{
position: static;
clear:both;
}
/* Dialogs */
div.toggable_dialog{
display: none;
left: 400px;
position: absolute;
top: 75px;
z-index: 10000;
border: 5px solid #BDD0F0;
background-color: #97B0D1;
padding: 0em 1em 0.5em 1em;
}
#add-gadgets{
cursor: pointer;
}
#add_new_tab_dialog_link{
cursor: pointer;
font-weight: bold;
background: transparent;
display: block;
float: left;
font-weight: bold;
height: 19px;
padding-top: 5px;
padding-left: 5px;
margin-left: 5px;
border-style: none;
}
#create_own_pad_dialog_link{
cursor: pointer;
background: url("images/configure.png") no-repeat !important;
display: block;
float: left;
height: 22px!important;
width:22px!important;
padding-top: 5px;
padding-left: 5px;
margin-left: 5px;
border-style: none;
}
#tabs_switcher{
cursor: pointer;
font-weight: bold;
background: transparent;
padding-top: 5px;
border-style: none;
margin: 0em;
width: 10%;
float:left
}
#add_new_gadget_link{
font-weight: bold;
height: 20px;
text-align:right;
padding-top:5px;
float:right;
width:12%;
}
/* Draggable Area */
div.draggable_wrapper{
background-color: #FFFFFF;
}
div.wait_block {
text-align: center;
padding: 2em;
}
div.box_inner_content {
background-color:#FFFFFF;
padding: 0.1em;
clear:left;
overflow: visible;
}
div.box_inner_content ol{
margin-top: 0em;
}
/* seperate gadget tables from rest of ERP5*/
div.block div.content{
padding: 0px;
}
div.block table,
div.block table tr,
div.block table tr td{
border: none;
}
/* lisbox style should be square for gadgets */
div.block ul{
list-style-type: square;
}
/*
Gadget listbox CSS
*/
div.block table.listbox .right{
float:right;
}
div.block table.listbox .left{
float:left;
}
div.block .listbox-head{
margin-left:0;
}
div.block div.listbox-head-spacer{
display:none;
}
div.block div.listbox-head-content {
/* background: none;*/
background-color: #E3EAFA;
border: none;
margin-left:0;
padding-left: 10px;
}
div.block table.listbox tr{
margin-top:2px;
}
div.block table.listbox tr.DataB {
background-color:#FFF;
}
div.block div.input{
margin-left:0em;
}
#add-stick-gadget-tool-section{
margin-bottom: 1.5em;
}
/* labels in forms inserted into a gadget should be visible
indedepndantly from fact that master form may use hiddenLabel */
div.block div.hidden_label label,
div.block div.hiddenLabel label{
display: none;
}
/*
Gadgets CSS - use to define gadget specific CSS.
*/
div.block .right{
float:right;
margin-left:5px;
}
div.block div.box_inner_content div.worklist_list ul {
list-style-image:url(bullet.png);
margin:0;
padding-bottom:0.5em;
padding-left:2em;
padding-top:0.5em;
}
div.block div.worklist_list ul li{
overflow: visible;
margin-bottom:5px;
background-color:white;
}
div.block div.worklist_list a{
color:black;
text-decoration:none;
cursor:pointer;
}
div.block div.worklist_list ul li a:hover{
text-decoration:none;
}
/* Some gadgets share same Document_getSummaryAsHTML or RssFeed_getSummaryAsHTML */
div.document-gadget-quick-preview div.teaser{
cursor: pointer;
margin-bottom: 3px;
}
div.document-gadget-quick-preview div.teaser img{
vertical-align:top;
}
div.document-gadget-quick-preview span.document-title,
div.document-gadget-quick-preview span.modification-date{
font-size:1em;
color: #000;
}
/* Some items can be marked as read and we need a way to visualize it */
div.document-gadget-quick-preview div.read span.document-title,
div.document-gadget-quick-preview div.read span.modification-date{
color: #969696;
}
div.document-gadget-quick-preview a.document-link{
color:#000;
font-weight:bold;
}
/* Rss Feed reader gadget needs no listbox headers or
show number of records or show 'No results' as listbox title is used for this */
div.gadget-rss-reader table.listbox thead,
div.gadget-rss-reader div.listbox-number-of-records,
div.gadget-rss-reader table.listbox td.listbox-table-no-result-row,
div.gadget-rss-reader div.listbox-title{
display: none;
}
div.gadget-rss-reader-message{
font-weight:bold;
}
div.gadget-rss-reader .listbox-head-content{
height:auto;
}
div.gadget-rss-reader .listbox-body,
div.gadget-rss-reader .listbox-head{
margin-left:4px;
width:auto;
}
div.gadget-rss-reader div.read{
background-color:#ececec;
}
div.gadget-rss-reader span.modification-date{
color: #969696;
}
div.gadget-rss-reader a.document-link {
color:#000;
}
div.gadget-rss-reader a.listbox_title {
text-decoration: underline;
font-weight:bold;
}
div.rss-description{
margin-top:4px;
}
div.teaser .thumbnail-image{
margin-top:0px;
margin-right:4px;
margin-bottom:4px;
float:left;
}
div.teaser .icon {
vertical-align:middle;
}
/* RSS logo */
div.gadget-rss-reader-logo img{
float:right;
margin:4px;
width:auto;
}
div.gadget-rss-reader div.listbox-head-content {
background-color: transparent;
padding-left:0px;
}
div.gadget-rss-reader .body {
float:left;
}
// global layout is saved here
var last_layout = '';
// current active pad relative url
var active_knowledge_pad_relative_url = '';
var active_knowledge_pad_title_dom_id = '';
// enable or disable integration with server
var is_knowledge_template_used = 0;
// dictionary of invisible gadgets
var invisible_gadgets={};
var create_default_knowledge_pad_script_id = "ERP5Site_createDefaultKnowledgePadListForUser";
var check_for_activities_on_server_script_id = "ERP5Site_hasUserActivity";
var knowledge_box_edit_script_id = "KnowledgeBox_baseEdit";
var knowledge_pad_save_layout_script_id = "KnowledgePad_saveBoxColumnLayout";
var knowledge_pad_delete_box_script_id = "KnowledgePad_deleteBox";
var knowledge_box_toggle_script_id = "KnowledgeBox_toggleVisibility";
var knowledge_pad_rename_script_id = "ERP5Site_renameKnowledgePad";
var knowledge_pad_delete_script_id = "ERP5Site_deleteKnowledgePad";
var add_new_knowledge_pad_script_id = "ERP5Site_addNewKnowledgePad";
var knowledge_pad_as_json_script_id = "KnowledgePad_getPadAsJSON";
var add_new_gadget_form_id = "Base_viewGadgetListDialog";
function createCustomKnowledgePadOnServer(){
$.ajax({url:create_default_knowledge_pad_script_id,
data:{mode: mode,
default_pad_group: default_pad_group},
dataType: "json",
success:function(data){window.location=cancel_url + "/view?active_pad_url=" + data.knowledge_pad_relative_url;}});
}
function showCreateDefaultKnowledgePadWarningMessage(){
user_choice = confirm("In order to complete operation you must have your own tab on server instead of the default one which you are currently using and which you can not change.Is it OK to create new one for you now?");
if (user_choice==true){
createCustomKnowledgePadOnServer();}
}
function createCookie(name, value, days, path) {
if (days){
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();}
else var expires = "";
if (!path){var path='/';}
document.cookie = name+"="+value+expires+"; path="+path;
}
function updater(url, box_relative_url, dom_id,
editable_mode, additionnal_request_params, field_prefix){
/* Get content from server */
request_params = {};
additionnal_request_params = typeof(additionnal_request_params) != 'undefined' ? additionnal_request_params : [];
// getting parameters for the request in the form's hidden inputs
input_list = $("#" + dom_id).find("input");
function extractHiddenInputs(index){
element = $(this);
type = element.attr("type");
name = element.attr("name");
value = element.val();
is_list = name.substring(name.length, name.length - 5) == ":list";
if(type == "hidden"){
if(name == "gadget_form_id"){
// turn 'gadget_form_id' into 'form_id'
request_params["form_id"] = value;}
else if(is_list){
if(typeof(request_params[name]) == "undefined"){
request_params[name] = new Array()}
request_params[name].push(value);}
else{
// not list input
request_params[name] = value;}
}}
input_list.each(extractHiddenInputs);
// we can have a field_prefix which allows multiple gadgets within same HTML form
if (field_prefix){
$.each(request_params,
function (key, value){
if (key.match("^"+field_prefix)){
delete request_params[key];
request_params[key.replace(field_prefix,'')] = value;
}});
}
// getting parameters for request from the parameter additionnal_request_params
$.each(additionnal_request_params,
function (key, value){request_params[key] = additionnal_request_params[key];});
request_params["box_relative_url"] = box_relative_url;
request_params["is_gadget_mode:int"] = 1;
request_params["editable_mode:int"] = editable_mode;
// set transperancy to show an activity is going on
$("#" + dom_id).css("opacity", 0.5);
$.ajax({url:url,
data: request_params,
success: handleServerSuccess,
error: handleServerError,
// it's important for Zope to have traditional way of encoding an URL
traditional: 1});
function handleServerSuccess(data, text_status, xhr){
content_type = xhr.getResponseHeader('Content-Type');
if(content_type.search("application/json")!=-1){
// server returned JSON which may contain HTML & JavaScript
html = data['body'];
eval(data['javascript']);}
else{
/* server returned HTML */
html = data;}
$("#" + dom_id).html(html);
$("#" + dom_id).css("opacity", 1.0);
}
function handleServerError(res){
$("#" + dom_id).html("Server side error.");
$("#" + dom_id).css("opacity", 1.0);
}
}
function checkForActivitiesOnServer(timeout, return_url, mode, default_pad_group){
/* check if activities are over and refresh current page */
window.setInterval(
function () {
$.ajax({url:check_for_activities_on_server_script_id,
data: {js_call: 1,
mode: mode,
default_pad_group: default_pad_group},
dataType: "json",
success: function (data){if(data.result=="False"){window.location=return_url;}}
})},
timeout);
};
function createDefaultPadOnServer(timeout, default_pad_group, return_url, mode){
/* create default tab on server and then check if
activities are over and refresh current page */
$.ajax({url: create_default_knowledge_pad_script_id,
data: {default_pad_group: default_pad_group,
mode: mode},
success: function(data){checkForActivitiesOnServer(timeout, return_url, mode, default_pad_group);}});
}
function submitGadgetPreferenceFormOnEnter(event,
form_fields_main_prefix,
box_relative_url,
edit_form_id){
/* This function can be used to submit gadget preferences form whenever
an enter is pressed in form */
if(event.keyCode == 13){submitSynchronousGadgetPreferenceForm(form_fields_main_prefix,
box_relative_url,
edit_form_id);}
}
function submitSynchronousGadgetPreferenceForm(
form_fields_main_prefix,
box_relative_url,
edit_form_id){
/* this will add respective gadget knowledge box relative url and
gadget ERP5 preference form field_prefix (so multiple gadgets can
safely coexist in one HTML page with one HTML form */
redirect_url = window.location.protocol + "//" + window.location.host + window.location.pathname
$("form").append('<input type="hidden" name="box_relative_url" value="' +box_relative_url + '">')
$("form").append('<input type="hidden" name="form_fields_main_prefix" value="' +form_fields_main_prefix + '">')
$("form").append('<input type="hidden" name="gadget_redirect_url" value="' +redirect_url + '">')
$("form").append('<input type="hidden" name="form_id" value="' +edit_form_id + '">')
clickSaveButton(knowledge_box_edit_script_id)
}
function submitAsynchronousGadgetPreferenceForm(
form_dom_id,
view_form_url,
box_relative_url,
visual_block_dom_id,
form_fields_main_prefix,
edit_form_id){
/* Iterate over all possible form elements within edit form,
collect them and send to server*/
var request_str = "synchronous_mode:int=0&" + "box_relative_url=" + box_relative_url+ "&form_fields_main_prefix=" + form_fields_main_prefix + "&form_id="+edit_form_id + "&";
//input tags
$("#" + form_dom_id).find("input").each(
function (index) {
element = $(this);
type = element.attr("type");
name = element.attr("name");
is_checked = element.attr("checked");
value = element.val()
if (type == "checkbox"){
if (is_checked){request_str+=name + ":boolean=True&";}
else {request_str+=name + ":boolean=False&";}}
if (type == "radio" && is_checked){request_str+=name + "="+value+"&";}
if (type == "text" || type == "password"){request_str+=name + "=" + value + "&";}
} );
// select tags
$("#" + form_dom_id).find("select").each(
function (index) {
element = $(this);
name = element.attr("name");
is_multiple = element.attr("multiple");
value = element.val()
if (is_multiple){
//support multifield selects in gadget edit form
element.children("option").each(
function (index) {
option = $(this);
if(option.attr("selected")){request_str+=element.attr("name") + '=' + option.val() + '&';}
}); }
else{request_str+=name + '=' + value + '&';} });
// save form preferences to remote server
$.ajax({url: knowledge_box_edit_script_id + "?" + request_str,
dataType: "json",
success: function (data){
if (data.validation_status){
// server side validation passed
updater(view_form_url, box_relative_url, visual_block_dom_id)
$("#" + form_dom_id).toggle()
// clean error messages
$("#" + form_dom_id + " span.error").remove()
}
else{
// server side validation failed show error message
$("#" + form_dom_id + " div.edit-form-content").html(data.content)
}
} });
}
function updateServerBoxColumnLayout(event, ui){
/* read columns structure from DOM and save it to server */
var columns_arr = new Array;
var columns = $("div.portal-column");
// sort alphabetically as it's required to get proper layout from DOM
columns.sort(function(a, b) {
var compA = $(a).attr("id").toUpperCase();
var compB = $(b).attr("id").toUpperCase();
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;})
columns.each(function(column_index, column){
column = $(this);
var items_arr = new Array;
column_items = column.find("div.block");
column_items.each(function(box_index, box){
items_arr[box_index] = column_items[box_index].id;});
columns_arr[column_index] = items_arr.join('|') });
var layout = columns_arr.join("##");
// .. and send it to server only if it's different
if (layout!=last_layout){
last_layout = layout;
$.ajax({url: knowledge_pad_save_layout_script_id,
data: {user_layout: layout}});}
}
function showAddNewPadPopup(){
$("#add_new_tab_dialog").toggle();
// set focus on new Pad title after toggle effect is over
setTimeout("$('#new_pad_title').focus()", 500 );
}
function showRenamePadPopup(knowledge_pad_relative_url, knowledge_pad_title_dom_id){
// set current active pad' url & title dom element id
active_knowledge_pad_relative_url = knowledge_pad_relative_url;
active_knowledge_pad_title_dom_id = knowledge_pad_title_dom_id;
// init rename dialog input field to current active pad
$("#new_knowledge_pad_title")[0].value = $("#"+knowledge_pad_title_dom_id)[0].innerHTML;
// show rename dialog
$("#rename_tab_dialog").toggle();
// set focus on new Pad title after toggle effect is over
setTimeout("$('#new_knowledge_pad_title').focus()", 500);
}
function loadPadFromServer(pad_relative_url, selected_pad_dom_id, mode){
/* Load Pad from server */
// show some animation
$("#loading-wrapper").first().show()
$.ajax({url: knowledge_pad_as_json_script_id,
data: {pad_relative_url: pad_relative_url,
mode: mode},
dataType: "json",
success: handleServerSuccess});
// set old pad to not selected
old_selected_pad = $("#tabs ul").children("li.tab_selected").first()
old_selected_pad.removeClass("tab_selected");
old_selected_pad.addClass("tab");
pad_actions = old_selected_pad.children("div.pad-actions").first();
pad_actions.hide();
// set new selected pad class
new_selected_pad = $("#" + selected_pad_dom_id).first();
new_selected_pad.addClass("tab_selected");
// enable "settings" for this pad and hide instant switch
pad_actions = new_selected_pad.children("div.pad-actions").first()
pad_actions.show()
// set new active pad
active_knowledge_pad_relative_url = pad_relative_url;
// update "Add Gadget" link
current_url = $("#add-gadgets").attr("href");
new_url = current_url.substring(0, current_url.indexOf("active_pad_relative_url=")+24)+active_knowledge_pad_relative_url
$("#add-gadgets").attr("href", new_url);
//function metadataFetchFailed(meta){}
function handleServerSuccess(data){
body = data.body
javascript = data.javascript
body_element = $("#pad-body-wrapper")[0]
body_element.innerHTML = body;
// init new Pad
initialize();
// execute JS code provided by server
eval(javascript);
// give some timeout as we can be sometimes two fast loading a tab
setTimeout("$('#loading-wrapper').first().hide();", 250 );};
}
function addPadOnServerOnEnter(event, mode, cancel_url){
/* Catch and submit form when ENTER is pressed */
if(event.keyCode == 13){
addPadOnServer(mode, cancel_url);
return false;}
}
function addPadOnServer(mode,
cancel_url){
/* add pad on server */
pad_title_value = $("#new_pad_title").first().val();
window.location = add_new_knowledge_pad_script_id + "?redirect_url=" + cancel_url + "&mode=" + mode + "&pad_title=" + pad_title_value;
};
function removeKnowledgePadFromServer(knowledge_pad_relative_url, mode){
/* remove pad from server*/
if (is_knowledge_template_used){
showCreateDefaultKnowledgePadWarningMessage();}
else{
var user_choice = true;
user_choice = confirm("Are you sure you want to remove this pad from your home?");
if (user_choice==true){
location.href=knowledge_pad_delete_script_id + "?knowledge_pad_relative_url=" + knowledge_pad_relative_url+"&mode="+mode;} }
}
function renameKnowledgePadToServerOnEnter(event){
if(event.keyCode == 13){
renameKnowledgePadToServer();
return false;}
return true;
}
function renameKnowledgePadToServer(){
if (is_knowledge_template_used){
showCreateDefaultKnowledgePadWarningMessage();}
else{
// rename it locally and update server asynchonously
title_element = $("#"+active_knowledge_pad_title_dom_id).first()
input_element = $("#new_knowledge_pad_title")
var knowledge_pad_title = input_element.val();
title_element.html(knowledge_pad_title);
$.ajax({url: knowledge_pad_rename_script_id,
data: {knowledge_pad_relative_url: active_knowledge_pad_relative_url,
knowledge_pad_title: knowledge_pad_title}});
}
$("#rename_tab_dialog").toggle();
}
function initialize(){
// initialize sortable columns
if (is_knowledge_template_used==0){
// allow drag and drop only if we are dealing with a pad we can modify
sortable_list = $("div.portal-column");
function makeSortables(index){
element = $(this);
if (element.attr("class") == "portal-column"){
// eliminate undraggable columns by checking exact match
element.sortable({handle: "h3.handle",
connectWith: sortable_list,
placeholder: "block-hover",
forcePlaceholderSize: 1,
opacity: 0.8,
containment: "document",
delay: 100,
stop: updateServerBoxColumnLayout});} }
if (sortable_list!=null) sortable_list.each(makeSortables);
}
// enable show/hide tabs
gadgets_tabs = $("#tabs");
gadgets_tabs_switcher = $("#tabs_switcher");
add_gadget = $("#add_new_gadget_link");
function toggleTabNavigation(){
/* Toggle tabs navigation */
var is_tabs_visible=0;
if($("#tabs").css("display")!="block"){
is_tabs_visible=1;
$("#tab_switcher_visible").show();
$("#tab_switcher_hidden").hide();}
else{
$("#tab_switcher_visible").hide();
$("#tab_switcher_hidden").show();}
$("#tabs").toggle();
createCookie("is_tabs_visible", is_tabs_visible, 365); }
function bindGadgetHandlers(index, box){
/* Bind all gadgets handlers */
box = $(this)
var edit = box.find("a.block-edit-form").first();
var edit_form = box.find("div.edit-form").first();
var remove = box.find("a.block-remove").first();
var minimize = box.find("a.block-minimize").first();
var minimize_wrapper = box.find("div.minimize_wrapper").first();
if(minimize){
minimize.unbind("click");
minimize.bind("click", function (){
if (is_knowledge_template_used){showCreateDefaultKnowledgePadWarningMessage();}
else{
minimize_wrapper.toggle();
box_id = box.attr("id")
js_dom_id = box_id + "_content";
js_code = invisible_gadgets[js_dom_id];
if (js_code!=undefined){
eval(js_code);
// gadget is now visible, i.e. no need to query server just toggle locally dom
delete invisible_gadgets[js_dom_id];}
$.ajax({url: knowledge_box_toggle_script_id,
data: {box_relative_url: box_id}});
}
});}
if(edit){
edit.unbind("click");
edit.bind("click", function (){
if (is_knowledge_template_used){showCreateDefaultKnowledgePadWarningMessage();}
else{edit_form.toggle()}});}
if(remove){
remove.unbind("click");
remove.bind("click", function (){
if (is_knowledge_template_used){showCreateDefaultKnowledgePadWarningMessage();}
else{
user_choice = confirm("Are you sure you want to remove this gadget from your personalized page?");
if (user_choice==true){
box_id = box.attr("id");
box.toggle();
$.ajax({url: knowledge_pad_delete_box_script_id,
data: {box_relative_url: box_id}});}
}});}
}
// tabs navigation
if(gadgets_tabs_switcher){
gadgets_tabs_switcher.unbind("click");
gadgets_tabs_switcher.bind("click", toggleTabNavigation);}
// for each box (gadget) add respective event handlers
gadget_list = $("div.block");
if (gadget_list!=null){
gadget_list.each(bindGadgetHandlers);
// when dom is loaded we need to remove all gadget's scripts otherwise currently when a gadget is moved
// its HTML is getting executed again, thus making unecessary calls to server, etc ...
gadget_list.each(
function (index, box){ $(this).find("script").remove();});
}
}
// call function after load of document
$(document).ready(initialize);
/*
Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved.
Ivan Tyagov <ivan@nexedi.com>
This program is Free Software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* Search popup fix*/
div.search_popup{
left:200px;
position:absolute;
top:-120px;
width:250px;
}
div.listbox-container{
width: 100%;
height: auto;
float:left;
margin-bottom:5px;
}
div.listbox-body{
float:left;
width: 100%;
}
div.listbox-tree{
margin-right: 0.1%;
max-width: 10%;
float: left;
}
div.listbox-content{
float:left;
width:100%;
}
div.maximal-width{
width:100%;
}
div.float-right{
float:right;
}
div.listbox-content-fixed-width{
width:89%;
}
table.listbox td.listbox-table-no-result-row{
border: 1px solid #3D6474;
text-align:center;
}
table.listbox tr.listbox-stat-line{
border-top: 1px solid #3D6474;
}
table.listbox tr.listbox-search-line {
background-color: #DAE6F6;
}
div.listbox-head{
color:#9D968D;
margin-left:-1px;
}
div.listbox-head-spacer{
background:transparent url("images/tab_left_selected.png") no-repeat scroll left top;
height:36px;
width:10px;
float:left;
}
div.listbox-head-content{
border-right:1px solid #3D6474;
border-top:1px solid #3D6474;
height:25px;
margin-left:10px;
padding-top:10px;
padding-right: 5px;
width:auto;
background-color: #e3eafa;
}
div.listbox-head div.listbox-head-title{
float:left;
width:auto;
}
div.listbox-head div.listbox-head-navigation{
float:right;
width:auto;
}
div.listbox-head div.listbox-head-results{
float: right;
width: auto;
clear: right;
text-align:right;
}
div.listbox-tree-mode-selection{
height: 22px;
width: auto;
float: left;
}
div.listbox-tree-mode-selection input{
width: auto;
}
th.listbox-table-report-tree-selection-cell{
width: 50px;
}
/* Listbox header */
div.listbox-header-box{
width: auto;
float:left;
padding-right: 5px;
}
/* Listbox Footer */
div.listbox-footer{
float:left;
width:100%;
text-align: center;
background-color: #BDD0F0;
margin-left:-1px;
}
div.listbox-footer-box{
margin-top:3px;
margin-bottom:3px;
}
/* Listbox Footer in gadget mode */
div.block div.listbox-footer{
background-color: transparent;
}
div.block div.listbox-head-content{
font-size: 90%;
}
div.listbox-title,
div.listbox-number-of-records{
padding-top: 5px;
}
/* List style selection */
div.listbox-list-style-selection {
padding-top:1px;
padding-left: 5px;
}
div.listbox-list-style-selection span{
vertical-align:-4px;
}
div.block div.listbox-list-style-selection span{
padding-left: 0px;
}
div.listbox-list-style-selection ul{
display:inline;
padding-left:0;
margin: 0;
vertical-align: -4px;
}
div.listbox-list-style-selection li{
display: inline;
margin-left: 0.1em;
}
div.listbox-list-style-selection li a{
cursor: pointer;
}
div.listbox-list-style-selection li a.selected,
.listbox-table-report-tree-selection-cell a.selected,
.listbox-table-domain-tree-cell a.selected,
.listbox-page-navigation-text a.selected{
font-weight: bold;
}
/* Domain / Report tree buttons */
button.tree-open,
button.tree-closed{
background: none;
border: none;
cursor: pointer;
padding-left: 15px;
text-align: left;
}
button.tree-open{
background: url("./images/tree_open.png") no-repeat scroll left 4px transparent;
font-weight: bold;
}
button.tree-closed{
background: url("./images/tree_closed.png") no-repeat scroll left 4px transparent;
}
/* Listbox full text search bar */
div.listbox-full-text-search {
}
div.listbox-full-text-search input{
width: 250px;
}
div.listbox-full-text-search input.button{
background-color: #97B0D1;
border: 0 none;
color:#000;
width: auto;
padding-left: 10px;
padding-right: 10px;
cursor: pointer;
}
/* Listbox Navigation */
div.listbox-page-navigation input.listbox_set_page,
div.listbox-page-navigation button.listbox_next_page,
div.listbox-page-navigation button.listbox_last_page,
div.listbox-page-navigation button.listbox_first_page,
div.listbox-page-navigation button.listbox_previous_page{
margin: 0em;
padding: 0em;
}
div.listbox-page-navigation button{
background-color:transparent;
border: none;
cursor: pointer;
}
div.listbox-page-navigation button span.image{
display:block;
height:22px;
width:22px;
background-repeat:no-repeat;
}
div.listbox-page-navigation button.listbox_first_page span.image {
background-image:url("images/2leftarrowv.png");
}
div.listbox-page-navigation button.listbox_previous_page span.image {
background-image:url("images/1leftarrowv.png");
}
div.listbox-page-navigation button.listbox_next_page span.image {
background-image:url("images/1rightarrowv.png");
}
div.listbox-page-navigation button.listbox_last_page span.image {
background-image:url("images/2rightarrowv.png");
}
div.listbox-page-navigation-slider{
width:100%;
margin:auto;
padding-right: 0.5em;
float:right;
}
div.listbox-page-navigation-slider input{
max-width: 30px;
}
div.listbox-page-navigation-text{
width:100%;
float:left;
text-align:center;
}
div.listbox-page-navigation-text a{
padding-right: 1px;
color: #000;
cursor: pointer;
}
/* Report tree */
a.tree-closed {
background:transparent url('./images/tree_closed.png') no-repeat scroll left center;
padding-left:15px;
}
a.tree-open {
background:transparent url('./images/tree_open.png') no-repeat scroll left center;
padding-left:15px;
font-weight: bold;
}
div.listbox-tree select{
/* max-width:120px; */
}
/* Table Listbox elements */
table.listbox{
border-collapse:collapse;
width:100%;
border-color:#3D6474;
border-style:solid;
border-width:0 1px 1px;
margin-bottom: 0em;
}
table.listbox th,
table.listbox td {
text-align:left;
vertical-align: top;
border-color:#3D6474;
border-style:solid;
border-width:0 1px;
padding: 0em;
padding-left:1px;
padding-right:1px;
font-weight: normal;
}
table.listbox tr.listbox-label-line{
background-color:#C1DAEB;
color:#001730;
border-top: 1px solid #3D6474;
}
table.listbox tr.listbox-search-line th{
margin: 0em;
padding: 0em;
padding-right:5px;
padding-left:1px;
}
/* Select columns */
table.listbox tr.listbox-label-line th.listbox-table-select-cell,
table.listbox tr.listbox-search-line th.listbox-table-select-cell,
table.listbox tr td.listbox-table-select-cell{
width: 50px;
text-align: center;
vertical-align: middle;
padding:0;
margin:0;
}
table.listbox tr.DataA {
color: inherit;
background-color: #FFF;
}
table.listbox tr.DataB {
color: inherit;
background-color: #DAE6F6;
}
table.listbox tr.DataA:hover,
table.listbox tr.DataB:hover,
table.listbox.table tr.tbody:hover{
color: inherit;
background-color: #BDD0F0;
}
table.listbox tr.listbox-search-line th.listbox-table-filter-cell input{
width: 100%;
vertical-align:middle;
}
table.listbox input{
float:none;
}
table.listbox input.listbox-check-all,
table.listbox input.listbox-uncheck-all,
table.listbox input.listbox-select-action{
width:auto;
}
.listbox-table-data-cell > .figure{
float:right;
display:block;
}
.listbox-table-data-cell > a > .figure{
float:right;
display:block;
}
table.listbox th button{
border-width:0;
cursor:pointer;
float:left;
padding:0 6px 0 0;
background: transparent;
}
table.listbox th button.sort-button {
text-decoration: underline;
padding: 0px;
}
table.listbox th button.sort-button:hover{
color: #FFF;
}
/* in ERP5 mode no need to have a switch for not clicked sort button */
table.listbox th button.sort-button-asc,
table.listbox th button.sort-button-desc{
background: none;
}
table.listbox th img.sort-button-desc,
table.listbox th img.sort-button-asc{
width: 13px;
height: 13px;
margin:0;
padding:0;
}
table.listbox th img.sort-button-desc{
background: url('images/1toparrow.png') no-repeat scroll 100% 100%;
}
table.listbox th img.sort-button-asc{
background: url('images/1bottomarrow.png') no-repeat scroll 100% 100%;
}
/* listbox table in thumbnail style
In thumbnail style we usually have only one thumbnail colum which through CSS
we show as floating box table row.
*/
table.listbox-thumbnail tbody tr{
display:block;
width: 128px; /* nano image width. XXX: dynamically generate. */
height:128px; /* nano image height. XXX: dynamically generate. */
float:left;
margin: 10px;
}
table.listbox-thumbnail tr.DataA, table.listbox-thumbnail tr.DataB,
table.listbox-thumbnail tr.DataA:hover, table.listbox-thumbnail tr.DataB:hover{
background-color: transparent; /* in thumbnail mode we don't care for hoover */
}
table.listbox-thumbnail td{
border:none;
}
/* in search mode listbox may contain top/bottom quick search inputs */
div.search-text-listbox{
text-align: center;
float:left;
height:auto;
margin-bottom:0.5em;
margin-top:0.5em;
}
div.search-text-listbox input{
width: auto;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment