From: tfr@openerp.com <>
Date: Mon, 26 Dec 2011 14:50:54 +0000 (+0100)
Subject: [CLEAN+FIX] FIX create document
X-Git-Tag: 6.1.0-rc1-addons~320^2~1
X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;ds=inline;h=f32c9e2356374d8b49e7e1d9e609fdf334718f96;p=odoo%2Fodoo.git
[CLEAN+FIX] FIX create document
bzr revid: tfr@openerp.com-20111226145054-lvkmje8sd0f694by
---
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin.xpi b/addons/plugin_thunderbird/plugin/openerp_plugin.xpi
index c52d0dc..2bb6a61 100644
Binary files a/addons/plugin_thunderbird/plugin/openerp_plugin.xpi and b/addons/plugin_thunderbird/plugin/openerp_plugin.xpi differ
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar
index a284303..14af127 100644
Binary files a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar and b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin.jar differ
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
index 843f3c5..963cddf 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/create.xul
@@ -4,10 +4,21 @@
+ title="&title.label;" onload="load_createContact();" id="create_partner_window">
+
+
+
+
+
+
+
+
+
+
+
@@ -31,6 +42,5 @@
-
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/create.js b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/create.js
index 6670002..7665c9c 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/create.js
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/create.js
@@ -29,11 +29,12 @@ function selectPartner(){
document.getElementById('txtselectpartner').setAttribute('value', label);
window.opener.document.getElementById('txtselectpartner').setAttribute('value', label);
}
- else {
- window.opener.document.getElementById('txtselectpartner').setAttribute('value','');
- }
}
+function clear() {
+ setPartnerId(0);
+ document.getElementById('txtselectpartner').setAttribute('value', '');
+}
//xmlrpc request handler for getting the list of partners
@@ -91,25 +92,25 @@ function getPartnerList(){
//xmlrpc request handler for creating a new contact
var listCreateContactHandler = {
onResult: function(client, context, result) {
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
- var createId = result.QueryInterface(Components.interfaces.nsISupportsPRInt32);
- setPreference('partner_id', createId);
- alert("Contact Created Successfully.");
+ res = extract_data(result)
+ open_url(res[URL])
window.close();
},
onFault: function (client, ctxt, fault) {
-
+ log_message('fail')
+ log_message(fault)
},
onError: function (client, ctxt, status, errorMsg) {
-
+ log_message('fail 2')
+ log_message(errorMsg)
}
}
//function to create a new contact
function createContact(){
- window.close();
+ log_message("create partner call")
setServerService('xmlrpc/object');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var xmlRpcClient = getXmlRpc();
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/dialog.js b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/dialog.js
index 2995a48..3a40295 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/dialog.js
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/dialog.js
@@ -1,20 +1,13 @@
function load_contact_dialog() {
log_message("load contact dialog")
-
-}
-function load_document(){
- if (getPreference('statutdoc')=='open'){
- document.getElementById('open_document').hidden=false;
- document.getElementById('open').hidden=true;
- }
- else{
- document.getElementById('open_document').hidden=true;
- document.getElementById('open').hidden=false;
- }
-
-}
-
-function message_setlabel(){
- log_message(getPreference('subject'));
- document.getElementById('message_label').value=getPreference('subject');
+ if (getPreference('statutdoc')=='open') {
+ document.getElementById('open_document').hidden=false;
+ document.getElementById('new').hidden=false;
+ document.getElementById('message_label').value="Document found"
}
+ else {
+ document.getElementById('open_document').hidden=true;
+ document.getElementById('new').hidden=false;
+ document.getElementById('message_label').value="Document not found"
+ }
+}
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/overlay.js b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/overlay.js
index c85e735..0660cf7 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/overlay.js
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/overlay.js
@@ -79,18 +79,9 @@ function searchmail()
var openPartnerHandler = {
onResult: function(client, context, result) {
- log_message('get partner')
- log_message(1)
res = extract_data(result)
- log_message(2)
- log_message(res[RES_ID])
- log_message(3)
- log_message(res[URL])
- log_message(4)
- if(res[RES_ID]==0)
- {
- alert("Partner is not Available.");
- window.open("chrome://openerp_plugin/content/create.xul", "", "chrome, resizable=yes");
+ if(res[RES_ID]==0) {
+ open_window("chrome://openerp_plugin/content/create.xul", 550, 230);
return;
}
open_url(res[URL])
@@ -159,8 +150,7 @@ function open_partner()
var listDocumentHandler = {
onResult: function(client, context, result) {
res = extract_data(result)
- log_message("open document")
- window.open('chrome://openerp_plugin/content/push_dialog.xul', '', 'chrome', resizable='yes');
+
if(res[RES_ID]==0) {
setPreference('statutdoc','create');
}
@@ -168,7 +158,7 @@ var listDocumentHandler = {
setPreference('statutdoc', 'open');
setPreference('urldoc', res[URL]);
}
- setPreference('message_label',setPreference('subject'));// to have the subject to print on the push dialog
+ open_window("chrome://openerp_plugin/content/push_dialog.xul", 480, 110);
},
onFault: function (client, ctxt, fault) {
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/push.js b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/push.js
index a20ea17..706753a 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/push.js
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/push.js
@@ -45,31 +45,6 @@ function getDocumentType(){
}
/**
- * Return the current operation :
- * add or create
- */
-function getOperation() {
- var operation = document.getElementById('operation').selectedItem;
- return operation.value
-}
-
-function changeForm() {
-
- var hidden = false
-
- if(getOperation() == "create") {
- hidden = true
- }
- document.getElementById('label_box').hidden = hidden
- document.getElementById('listSearchBox').hidden = hidden
- document.getElementById('lblsearch').hidden = hidden
- document.getElementById('txtvalueobj').hidden = hidden
- document.getElementById('search_button').hidden = hidden
-}
-
-
-
-/**
* Search Handler : Fill the result of list_document_get in the listbox
*/
//xmlrpc request handler for getting the search results for the particular selected check box object
@@ -137,10 +112,9 @@ function searchCheckbox()
var pushHandler = {
onResult: function(client, context, result) {
log_message("push finished")
- netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
- var message = result.QueryInterface(Components.interfaces.nsISupportsCString);
- log_message(message)
- alert(message)
+ res = extract_data(result)
+ alert(res[ADDITIONAL_INFORMATION])
+ open_url(res[URL]);
window.close();
},
@@ -154,11 +128,10 @@ var pushHandler = {
}
-function push() {
- window.close();
+function push(op) {
var model_name = document.getElementById('menu_model_list').selectedItem.value;
var res_id = 0;
- if(getOperation() == "add") {
+ if(op == "add") {
var item = document.getElementById('listSearchBox').selectedItem
if (String(item) == "null") {
alert("select at least one Document !")
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/tools.js b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/tools.js
index c0dad69..07f6c83 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/tools.js
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/js/tools.js
@@ -42,7 +42,7 @@ function clear_search_box(element) {
function open_url(url) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
- messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
+ var messenger = Components.classes['@mozilla.org/messenger;1'].createInstance(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(url);
}
@@ -65,6 +65,7 @@ function extract_data(result) {
var MODEL = 0;
var RES_ID = 1;
var URL = 2;
+var ADDITIONAL_INFORMATION = 3
function check_connection(callback) {
return function () {
@@ -79,3 +80,13 @@ function check_connection(callback) {
return callback()
}
}
+
+function open_window(url,width,height) {
+ var win = window.open(url, '', 'chrome,width='+width+',height='+height+',resizable=yes');
+ var w = ((window.screen.availWidth/2)-(width/2));
+ var h=((window.screen.availHeight/2)-(height/2));
+ win.moveTo(w,h);
+}
+
+
+
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push.xul b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push.xul
index e3d2150..d4fdb26 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push.xul
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push.xul
@@ -55,7 +55,7 @@
-
+
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_dialog.xul b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_dialog.xul
index dcbcc84..a35e8d2 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_dialog.xul
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_dialog.xul
@@ -1,21 +1,21 @@
+
-
-
-
-
+
+
-
-
+
+
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_new.xul b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_new.xul
new file mode 100644
index 0000000..897fdb8
--- /dev/null
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/push_new.xul
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
index 97d636e..db1839b 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/selectpartner.xul
@@ -25,7 +25,7 @@
-
+
diff --git a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/style.css b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/style.css
index 8e490b7..5997230 100644
--- a/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/style.css
+++ b/addons/plugin_thunderbird/plugin/openerp_plugin/chrome/openerp_plugin/content/style.css
@@ -1,4 +1,10 @@
.text-prompt {
padding-top: .25em;
text-align: right;
+}
+
+.text-border {
+ padding: 1em;
+ font-size : 1.2em;
+ font-weight: bold;
}
\ No newline at end of file