[CLEAN+FIX] FIX create document
bzr revid: tfr@openerp.com-20111226145054-lvkmje8sd0f694by
This commit is contained in:
parent
e1a44c3cc7
commit
f32c9e2356
Binary file not shown.
Binary file not shown.
|
@ -4,10 +4,21 @@
|
|||
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/create.dtd">
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
title="&title.label;" onload="load_createContact();" >
|
||||
title="&title.label;" onload="load_createContact();" id="create_partner_window">
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tiny_xmlrpc.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tools.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/create.js"></script>
|
||||
<groupbox id="contact" >
|
||||
<hbox>
|
||||
<label align="right" value="Partner not found. create a new one ? "/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label align="right" id="partner" value="&selectpartner.value;" width="90" class="text-prompt"/>
|
||||
<textbox id="txtselectpartner" readonly="true" value="" width="170"/>
|
||||
<button label="Link to partner" oncommand="open_window('chrome://openerp_plugin/content/selectpartner.xul', 400, 400);" image="&imagesearch.value;"/>
|
||||
<button label="Clear" oncommand="clear();"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<groupbox id="information" >
|
||||
<caption label="Address Detail" />
|
||||
<grid flex="1">
|
||||
|
@ -31,6 +42,5 @@
|
|||
<hbox align="right">
|
||||
<button label="cancel" image="&imagecancel.value;" oncommand="close();" />
|
||||
<button label="create partner" image="&imageok.value;" oncommand="createContact();"/>
|
||||
<button label="link to a partner" image="&imageok.value;" oncommand="window.open('chrome://openerp_plugin/content/selectpartner.xul', '', 'chrome', resizable='yes');"/>
|
||||
</hbox>
|
||||
</window>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -44,31 +44,6 @@ function getDocumentType(){
|
|||
xmlRpcClient.asyncCall(DocumentTypeHandler,null,'execute',[strDbName,struid,strpass,strobj,strmethod], 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -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 !")
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
</listbox>
|
||||
</vbox>
|
||||
<hbox align="right" width="480">
|
||||
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="push();"/>
|
||||
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="push('add');"/>
|
||||
</hbox>
|
||||
<separator class="groove-thin" orient="horizontal" width="480"/>
|
||||
</vbox>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="style.css" type="text/css"?>
|
||||
<!-- Extremely recommended to keep this css include!! -->
|
||||
<window id="rootWnd" title="push box" onload="load_contact_dialog();load_document();message_setlabel();"
|
||||
<window id="rootWnd" title="push box" onload="load_contact_dialog();"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tiny_xmlrpc.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tools.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/dialog.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/overlay.js"></script>
|
||||
<vbox>
|
||||
<hbox height="50px">
|
||||
<caption label="Subject:" />
|
||||
<label value="Message" id="message_label"/>
|
||||
<hbox height="50">
|
||||
<label value="Message" id="message_label" class="text-border"/>
|
||||
</hbox>
|
||||
<hbox align="right">
|
||||
<button label="Cancel" accesskey="c" oncommand="window.close();"/>
|
||||
<button id="push_new" label="Push Email" accesskey="a" oncommand=" window.close();window.open('chrome://openerp_plugin/content/push.xul', '', 'chrome', resizable='yes');"/>
|
||||
<button id="open" label="Create Document" accesskey="c" oncommand="window.close();window.open('chrome://openerp_plugin/content/create_new.xul', '', 'chrome', resizable='yes');"/>
|
||||
<button id="push" label="Push Email" accesskey="a" oncommand=" window.close();window.open('chrome://openerp_plugin/content/push.xul', '', 'chrome', resizable='yes');"/>
|
||||
<button id="new" label="Create Document" accesskey="c" oncommand="window.close();window.open('chrome://openerp_plugin/content/push_new.xul', '', 'chrome', resizable='yes');"/>
|
||||
<button id="open_document" label="Open Document" accesskey="d" oncommand="open_url(getPreference('urldoc'));window.close();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xml-stylesheet href="style.css" type="text/css"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/plugin.dtd">
|
||||
<window id="pluginwindows" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
title="&title.label;" onload="getDocumentType()" >
|
||||
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tiny_xmlrpc.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/tools.js"></script>
|
||||
<script type="text/javascript" src="chrome://openerp_plugin/content/js/push.js"></script>
|
||||
<description></description>
|
||||
<vbox>
|
||||
<separator class="groove-thin" orient="horizontal" width="400"/>
|
||||
<grid flex="1">
|
||||
<columns>
|
||||
<column />
|
||||
<column />
|
||||
<column flex="1"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label id="lblex3" align="right" width="135" control="section" value="&object.label;" class="text-prompt" />
|
||||
<menulist id="menu_model_list" width="150">
|
||||
<menupopup id="model_list">
|
||||
<menuitem id="first_model_list" value="" label=""/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<hbox align="right" width="480">
|
||||
<button label="&attach.label;" accesskey="u" image="&imagearchive.value;" oncommand="push();"/>
|
||||
</hbox>
|
||||
<separator class="groove-thin" orient="horizontal" width="480"/>
|
||||
</vbox>
|
||||
|
||||
</window>
|
|
@ -25,7 +25,7 @@
|
|||
<hbox>
|
||||
<spacer width="45"/>
|
||||
<button label="cancel" image="&imagecancel.value;" oncommand="close();" />
|
||||
<button label="link" image="&imageok.value;" oncommand="createContact();window.close();"/>
|
||||
<button label="link" image="&imageok.value;" oncommand="selectPartner();window.close();"/>
|
||||
</hbox>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
.text-prompt {
|
||||
padding-top: .25em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-border {
|
||||
padding: 1em;
|
||||
font-size : 1.2em;
|
||||
font-weight: bold;
|
||||
}
|
Loading…
Reference in New Issue