[CLEAN] Button open and create in push dialog

bzr revid: mva@openerp.com-20111222151753-2qwkoywvvdh8wvtc
This commit is contained in:
MVA
2011-12-22 16:17:53 +01:00
parent cfea271197
commit fb306bd2bb
7 changed files with 29 additions and 8 deletions
Binary file not shown.
@@ -2,3 +2,19 @@ function load_contact_dialog() {
log_message("load contact dialog")
}
function load_document(){
log_message("ceci est un test");
log_message(getPreference('statutdoc'));
log_message("fin de test");
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;
}
}
@@ -160,14 +160,17 @@ 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) {
alert("Document is not available.");
window.open('chrome://openerp_plugin/content/push_dialog.xul', '', 'chrome', resizable='yes');
document.getElementById('message_label').setAttribute('value', 'No document was found');
//alert("Document is not available.");
//document.getElementById('message_label').setAttribute('value', 'No document was found');
setPreference('statutdoc','create');
}
else {
open_url(res[URL])
}
setPreference('statutdoc', 'open');
//open_url(res[URL]);
}
},
onFault: function (client, ctxt, fault) {
@@ -20,7 +20,7 @@
/>
<menuitem id="tiny-opendocument" label="document"
oncommand="window.open('chrome://openerp_plugin/content/push_dialog.xul', '', 'chrome', 'resizable=yes');"
oncommand="check(open_document);"
image="&menuicon.value;"
class="menuitem-iconic"
tooltiptext="&opendocumenttooltip.value;"
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<!-- Extremely recommended to keep this css include!! -->
<window id="rootWnd" title="push box" onload="load_contact_dialog();"
<window id="rootWnd" title="push box" onload="load_contact_dialog();load_document();"
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>
<label value="Message" id="message_label"/>
@@ -14,7 +15,7 @@
<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="opendocument" label="Open Document" accesskey="d" oncommand="check(open_document);"/>
<button id="open_document" label="Open Document" accesskey="d" oncommand="check_document();"/>
<!-- link open document and show create or open but not both-->
</hbox>
</vbox>
@@ -9,6 +9,7 @@ pref("extensions.tiny.username","admin");
pref("extensions.tiny.password","admin");
pref("extensions.tiny.senderemail","");
pref("extensions.tiny.sendername","");
pref("extensions.tiny.statutdoc","");// add to have a statut to hidde or not the button
pref("extensions.tiny.receiveremail","");
pref("extensions.tiny.subject","");
pref("extensions.tiny.receiveddate","");