bzr revid: uco@tinyerp.com-20110202044527-m61qnov3aspijdrn
This commit is contained in:
Ujjvala Collins (OpenERP)
2011-02-02 10:15:27 +05:30
17 changed files with 314 additions and 251 deletions
+7
View File
@@ -742,6 +742,13 @@ class users(osv.osv):
_columns = {
'context_section_id': fields.many2one('crm.case.section', 'Sales Team'),
}
def write(self, cr, uid, ids, vals, context=None):
res = super(users, self).write(cr, uid, ids, vals, context=context)
section_obj=self.pool.get('crm.case.section')
for user in self.browse(cr, uid, ids, context):
if user.context_section_id:
section_obj.write(cr, uid, [user.context_section_id.id], {'member_ids':[(4, user.id)]},context)
return res
users()
@@ -167,10 +167,6 @@ global name
name=''
global email
email=''
global web_server
web_server = 'localhost'
global web_server_port
web_server_port = '8080'
global country_ref
country_ref = ""
global state_ref
@@ -198,7 +194,7 @@ def resetConnAttribs(window):
config = window.manager.LoadConfig()
NewConn.setitem('_server', config['server'])
NewConn.setitem('_port', config['port'])
# NewConn.setitem('protocol', config['protocol'])
NewConn.setitem('protocol', config['protocol'])
NewConn.setitem('_uri', "http://" + config['server'] + ":" + str(config['port']))
NewConn.setitem('_obj_list', config['objects'])
NewConn.setitem('_dbname', config['database'])
@@ -207,6 +203,7 @@ def resetConnAttribs(window):
NewConn.setitem('_login', str(config['login']))
NewConn.setitem('_webserver',manager.config['webserver'])
NewConn.setitem('_webport',manager.config['webport'])
NewConn.setitem('_webportocol',manager.config['webportocol'])
return
def setConnAttribs(server, port, manager):
@@ -228,6 +225,7 @@ def setConnAttribs(server, port, manager):
NewConn.setitem('_obj_list', manager.config['objects'])
NewConn.setitem('_webserver',manager.config['webserver'])
NewConn.setitem('_webport',manager.config['webport'])
NewConn.setitem('_webprotocol',manager.config['webprotocol'])
return
def getConnAttributes(manager):
@@ -241,7 +239,9 @@ def getConnAttributes(manager):
manager.config['login'] = NewConn.getitem('_login')
manager.config['webserver'] = NewConn.getitem('_webserver')
manager.config['webport'] = NewConn.getitem('_webport')
manager.config['webprotocol'] = NewConn.getitem('_webprotocol')
return
def setWebConnAttribs(server, port, manager):
manager.config = manager.LoadConfig()
NewConn.setitem('_webserver',server)
@@ -272,6 +272,11 @@ class OKButtonProcessor(ButtonProcessor):
def OnClicked(self, id):
server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
protocol = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[3])
if not protocol:
win32ui.MessageBox("Invalid Protocol !\nPlease select Protocol from Connection Protocol List.", "OpenERP Connection", flag_excl)
return
NewConn.setitem('protocol', protocol)
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError, e:
@@ -306,9 +311,16 @@ class WEBOKButtonProcessor(ButtonProcessor):
ControlProcessor.__init__(self, window, control_ids)
def OnClicked(self, id):
global web_server
global web_server_port
# global web_server
# global web_server_port
server = win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[0])
web_protocol = 'http:\\\\'
hwnd = win32gui.GetDlgItem(self.window.hwnd, self.other_ids[2])
chk = win32gui.SendMessage(hwnd, win32con.BM_GETCHECK)
if chk:
web_protocol = 'https:\\\\'
NewConn.setitem('_webprotocol', web_protocol)
try:
port = int(win32gui.GetDlgItemText(self.window.hwnd, self.other_ids[1]))
except ValueError:
@@ -318,10 +330,23 @@ class WEBOKButtonProcessor(ButtonProcessor):
win32ui.MessageBox("Invalid web Server address.", "OpenERP Connection", flag_excl)
return
setWebConnAttribs(server, port, self.mngr)
web_server = server
web_server_port = port
# web_server = server
# web_server_port = port
win32gui.EndDialog(self.window.hwnd, id)
class WEBCHKProcessor(ButtonProcessor):
def __init__(self, window, control_ids):
self.mngr = window.manager
ControlProcessor.__init__(self, window, control_ids)
def OnClicked(self, id):
web_protocol = 'http:\\\\'
hwnd = self.GetControl()
chk = win32gui.SendMessage(hwnd, win32con.BM_GETCHECK)
if chk:
web_protocol = 'https:\\\\'
NewConn.setitem('_webprotocol', web_protocol)
class MessageProcessor(ControlProcessor):
def Init(self):
text = " This Outlook Plugin for OpenERP has been developed by OpenERP s.a.\n\n \
@@ -851,9 +876,6 @@ def CreateContact(btnProcessor,*args):
win32gui.EndDialog(btnProcessor.window.hwnd, btnProcessor.id)
def SetAllText(txtProcessor,*args):
# Set values for url, uname, pwd from config file
global web_server
global web_server_port
url = NewConn.getitem('_uri')
tbox = txtProcessor.GetControl()
win32gui.SendMessage(tbox, win32con.WM_SETTEXT, 0, str(url))
@@ -866,9 +888,7 @@ def SetAllText(txtProcessor,*args):
pwd = NewConn.getitem('_pwd')
win32gui.SendMessage(passbox, win32con.WM_SETTEXT, 0, str(pwd))
serverBox = txtProcessor.GetControl(txtProcessor.other_ids[2])
web_server = NewConn.getitem('_webserver')
web_server_port = NewConn.getitem('_webport')
webstr = "http:\\\\"+str(web_server)+":"+str(web_server_port)
webstr = NewConn.getitem('_webprotocol')+NewConn.getitem('_webserver')+":"+str(NewConn.getitem('_webport'))
win32gui.SendMessage(serverBox, win32con.WM_SETTEXT, 0, str(webstr))
def SetDefaultList(listProcessor,*args):
@@ -1378,29 +1398,24 @@ def OpenPartnerForm(txtProcessor,*args):
partner_text = ""
try:
partner_text = ustr(mail.SenderName).encode('iso-8859-1')
sender_mail = ustr(mail.SenderEmailAddress).encode('iso-8859-1')
sender_mail = ustr(mail.SenderEmailAddress).strip()
except Exception:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< Error in reading email.>")
pass
vals = NewConn.SearchPartner(sender_mail)
if vals:
if not vals:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< Their is contact related to "+str(partner_text)+" email address, but no partner is linked to contact>")
txtProcessor.init_done=True
return
if vals == None:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, "< No Partner found linked to "+str(partner_text)+" email address.>")
txtProcessor.init_done=True
return
global web_server
global web_server_port
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
if NewConn.getitem('_webserver') == "" or NewConn.getitem('_webserver') in ["http:\\\\","https:\\\\"]:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
try:
import urllib
next = urllib.urlencode({'next' : '/openerp/form/view?model=res.partner&id=' +str(vals) })
weburl = 'http://'+web_server+':'+str(web_server_port)+'/'
weburl = NewConn.getitem('_webprotocol')+NewConn.getitem('_webserver')+":"+str(NewConn.getitem('_webport'))
linktopartner = weburl + '?' + next
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, str(linktopartner))
except Exception,e:
@@ -1416,8 +1431,8 @@ def SerachOpenDocuemnt(txtProcessor,*args):
b = check()
if not b:
return
global web_server
global web_server_port
# global web_server
# global web_server_port
#Reading Current Selected Email.
ex = txtProcessor.window.manager.outlook.ActiveExplorer()
assert ex.Selection.Count == 1
@@ -1425,8 +1440,8 @@ def SerachOpenDocuemnt(txtProcessor,*args):
#Acquiring control of the text box
link_box = txtProcessor.GetControl()
#Checking for the web server Parameters
if web_server.strip() == "" or web_server.strip() == "http:\\\\":
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
if NewConn.getitem('_webserver') == "" or NewConn.getitem('_webserver') in ["http:\\\\","https:\\\\"]:
win32gui.SendMessage(partner_link, win32con.WM_SETTEXT, 0, " <Invalid Server Address>")
txtProcessor.init_done=True
return
linktodoc = ""
@@ -1460,7 +1475,7 @@ def SerachOpenDocuemnt(txtProcessor,*args):
try:
import urllib
next = urllib.urlencode({'next' : '/openerp/form/view?model='+vals[0][1]+'&id='+str(vals[1][1])})
weburl = 'http://'+web_server+':'+str(web_server_port)+'/'
weburl = NewConn.getitem('_webprotocol')+NewConn.getitem('_webserver')+":"+str(NewConn.getitem('_webport'))
linktodoc = weburl + '?' + next
win32gui.SendMessage(link_box, win32con.WM_SETTEXT, 0, str(linktodoc))
except Exception,e:
@@ -1679,8 +1694,13 @@ dialog_map = {
),
"IDD_SERVER_PORT_DIALOG" : (
(ProtocolComboProcessor, "ID_DROPDOWNLIST_PROTOCOL", GetConn, ()),
(CloseButtonProcessor, "IDCANCEL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL"),
(OKButtonProcessor, "IDOK ID_SERVER ID_PORT IDR_XML_PROTOCOL ID_DROPDOWNLIST_PROTOCOL"),
#
# (RadioButtonProcessor, "IDR_XML_PROTOCOL", GetConn, ()),
# (RadioButtonProcessor, "IDR_XMLS_PROTOCOL", GetConn, ()),
# (RadioButtonProcessor, "IDR_NETRPC_PROTOCOL", GetConn, ()),
),
"IDD_SYNC" : (
@@ -1739,7 +1759,9 @@ dialog_map = {
),
"IDD_WEB_SERVER_PORT_DIALOG" :(
(CloseButtonProcessor, "IDCANCEL"),
(WEBOKButtonProcessor, "ID_WEB_OK IDET_WEB_SERVER IDET_WEB_PORT")
(WEBOKButtonProcessor, "ID_WEB_OK IDET_WEB_SERVER IDET_WEB_PORT IDCB_WEB_SECURE"),
(WEBCHKProcessor, "IDCB_WEB_SECURE"),
),
"IDD_SELECT_COUNTRY" : (
(CommandButtonProcessor, "IDPB_SEARCH_COUNTRY IDET_COUNTRY_SEARCH_NAME IDC_LIST_COUNTRY" , SearchCountry, ()),
@@ -305,4 +305,20 @@ class GroupProcessor(OptionControlProcessor):
def UpdateControl_FromValue(self):
pass
def UpdateValue_FromControl(self):
pass
pass
class ProtocolComboProcessor(ComboProcessor):
def Init(self):
self.UpdateControl_FromValue()
def UpdateControl_FromValue(self):
combo = self.GetControl()
list = ['XML-RPC', 'XML-RPCS']
win32gui.ShowWindow(combo, True)
win32gui.SendMessage(combo, win32con.CB_RESETCONTENT, 0, 0);
for item in list:
win32gui.SendMessage(combo, win32con.CB_ADDSTRING, 0, str(item))
if sel == -1:
win32gui.SendMessage(combo, win32con.CB_SETCURSEL, 1, 0)
self.active_control_id = self.control_id
@@ -208,6 +208,8 @@
#define IDPB_NC_SEARCH_STATE1 2107
#define IDET_NC_PARTNER_COUNTRY 2108
#define IDPB_NC_SEARCH_COUNTRY1 2109
#define ID_DROPDOWNLIST_PROTOCOL 2110
#define IDCB_WEB_SECURE 2111
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
File diff suppressed because one or more lines are too long
@@ -97,18 +97,26 @@ BEGIN
LTEXT "",IDC_ABOUT,80,90,300,100
END
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
IDD_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 90
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "OpenERP Connection"
FONT 8, "Tahoma", 400, 0, 0x0
BEGIN
LTEXT "Server : ",IDC_STATIC,5,3,150,17
EDITTEXT ID_SERVER,40,3,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Port : ",IDC_STATIC,5,18,100,17
EDITTEXT ID_PORT,40,18,100,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,110,35,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,60,35,45,14,WS_TABSTOP
EDITTEXT ID_SERVER, 45, 3, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
LTEXT " Port : ",IDC_STATIC,5,18,100,17
EDITTEXT ID_PORT, 45, 18, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
GROUPBOX "", IDC_STATIC_GROUP, 5, 35, 150, 5
// PUSHBUTTON "XML-RPC",IDR_XML_PROTOCOL,8,45,50,14,BS_AUTORADIOBUTTON | BST_CHECKED |WS_TABSTOP
// PUSHBUTTON "XML-RPCS",IDR_XMLS_PROTOCOL,55,45,50,14,BS_AUTORADIOBUTTON | WS_TABSTOP
// PUSHBUTTON "NET-RPC",IDR_NETRPC_PROTOCOL,105,45,45,14,BS_AUTORADIOBUTTON | WS_TABSTOP
LTEXT "Protocol Connection :", IDC_STATIC, 5, 45, 80, 17
COMBOBOX ID_DROPDOWNLIST_PROTOCOL, 75, 43, 75, 50, CBS_DROPDOWNLIST |WS_VSCROLL | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,60,70,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",IDOK,110,70,45,14,WS_TABSTOP
END
IDD_SYNC DIALOGEX 0, 0, 470, 320
@@ -287,7 +295,7 @@ BEGIN
PUSHBUTTON "Ok",IDCANCEL,150,45,45,14,WS_TABSTOP
END
IDD_WEB_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 55
IDD_WEB_SERVER_PORT_DIALOG DIALOGEX 0, 0, 160, 80
STYLE DS_SETFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_CONTEXTHELP
CAPTION "OpenERP Connection"
@@ -297,8 +305,9 @@ BEGIN
EDITTEXT IDET_WEB_SERVER,40,3,100,12,ES_AUTOHSCROLL | WS_TABSTOP
LTEXT "Port : ",IDC_STATIC,5,18,100,17
EDITTEXT IDET_WEB_PORT,40,18,100,12,ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,110,35,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",ID_WEB_OK,60,35,45,14,WS_TABSTOP
PUSHBUTTON "Close",IDCANCEL,110,50,45,14,WS_TABSTOP
DEFPUSHBUTTON "OK",ID_WEB_OK,50,50,50,14,WS_TABSTOP
PUSHBUTTON "SSL (https)",IDCB_WEB_SECURE,20,35,100,14,BS_AUTOCHECKBOX | BST_CHECKED |WS_TABSTOP
END
IDD_SELECT_COUNTRY DIALOGEX 0, 0, 220, 250
@@ -311,7 +320,6 @@ BEGIN
LTEXT "Enter Name : ",IDC_STATIC,8,12,80,17
EDITTEXT IDET_COUNTRY_SEARCH_NAME, 55, 10, 100, 12, ES_AUTOHSCROLL | WS_TABSTOP
PUSHBUTTON "Search", IDPB_SEARCH_COUNTRY, 160, 10, 50, 14, WS_TABSTOP
CONTROL "List1",IDC_LIST_COUNTRY,"SysListView32",WS_CHILD | WS_VISIBLE | WS_BORDER | WS_HSCROLL | WS_VSCROLL |
LVS_SHOWSELALWAYS | LVS_EX_GRIDLINES | LVS_REPORT | LVS_EX_FULLROWSELECT, 8,40,200,185
PUSHBUTTON "Select", IDPB_SELECT_COUNTRY, 170, 230, 40, 14, WS_TABSTOP
@@ -140,7 +140,7 @@ class OpenERPManager:
def LoadConfig(self):
import win32ui
path = os.path.join(self.data_directory, 'tiny.ini')
data = {'server' : 'localhost', 'port' : '8069', 'protocol' : 'http://', 'database' : '', 'objects' : self.default_objects, 'uname':'admin', 'pwd':'a', 'login':False,'webserver':'localhost','webport':'8080'}
data = {'server' : 'localhost', 'port' : '8069', 'protocol' : 'http://', 'database' : '', 'objects' : self.default_objects, 'uname':'admin', 'pwd':'a', 'login':False,'webserver':'localhost','webport':'8080', 'webprotocol' : 'http:\\'}
if os.path.exists(path):
fp = open(path, 'r')
data = fp.readlines()
@@ -50,7 +50,7 @@ Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Files]
Source: "C:\openerp-outlook-plugin\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\workspace\openerp-outlook-plugin\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Messages]
@@ -80,7 +80,8 @@ class XMLRpcConn(object):
self._iscrm=True
self.partner_id_list=None
self.protocol=None
self._webprotocol=None
self._weburi=None
def getitem(self, attrib):
v=self.__getattribute__(attrib)
@@ -442,16 +443,14 @@ class XMLRpcConn(object):
return country_list
def SearchPartner(self, mail_id = ""):
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(mail_id))])
if not address:
return None
else:
add_rec = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'read', address[0])
partner = add_rec.get('partner_id',False)
if partner:
return partner[0]
return True
conn = xmlrpclib.ServerProxy(self._uri+ '/xmlrpc/object')
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'search', [('email','=',ustr(mail_id))])
if not address:
return False
add_rec = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'res.partner.address', 'read', address[0])
partner = add_rec.get('partner_id',False)
if partner: return partner[0]
else: return partner
def SearchEmailResources(self, message_id):
import win32ui
@@ -462,9 +461,7 @@ class XMLRpcConn(object):
if not mail_id:
ref_mail_id = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message', 'search', [('references','=',message_id)])
if ref_mail_id:
win32ui.MessageBox(str(ref_mail_id),"ref_mail_id")
address = execute( conn, 'execute', self._dbname, int(self._uid), self._pwd, 'mailgate.message','read',ref_mail_id[0],['model','res_id'])
win32ui.MessageBox(str(address),"address")
for key, vals in address.items():
res_vals.append([key,vals])
return res_vals
@@ -7,8 +7,8 @@
<record id="project_plannning_1" model="report_account_analytic.planning">
<field name="name">Project_Planning</field>
<field name="business_days">20</field>
<field name="date_from" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="date_to" eval="time.strftime('%Y-%m-30 15:23:00')"/>
<field name="date_from" eval="time.strftime('%Y-%m-01')"/>
<field name="date_to" eval="time.strftime('%Y-%m-30')"/>
<field name="state">open</field>
<field name="user_id" ref="project.res_users_project_manager"/>
</record>
Binary file not shown.
@@ -2,126 +2,134 @@
function config_close()
{
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
//set the value of the configuration fields
function config_change_load()
{
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
var s = getServer();
var a =s.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcurl').value = "localhost"
document.getElementById('txtcport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcurl').value = "localhost"
}
else
{
document.getElementById('txtcurl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcport').value = "8069"
setPort("8069");
}
else
{
document.getElementById('txtcport').value = a[2]
setPort(a[2]);
}
}
}
}
function config_change_load_web()
{
//var s = getServer();
//var s = getServer();
weburl = getWebServerURL();
webport = getwebPort();
var urlport = weburl+':'+webport;
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
var a =urlport.split(':');
if (String(a)=="" || String(a)=="undefined"){
document.getElementById('txtcweburl').value = "localhost"
document.getElementById('txtcwebport').value = "8069"
}
else
{
len = a[1];
var url = "";
for (i=0;i<len.length;i++)
{ if (len[i] == "/")
{
continue
}
url += len[i]
}
if (String(url) == "" || String(url) == "undefined"){
document.getElementById('txtcweburl').value = "localhost"
}
else
{
document.getElementById('txtcweburl').value = url
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
if (String(a[2]) == "" || String(a[2]) == "undefined"){
document.getElementById('txtcwebport').value = "8069"
setwebPort("8069");
}
else
{
document.getElementById('txtcwebport').value = a[2]
setwebPort(a[2]);
}
}
}
}
function config_ok()
{
if (document.getElementById('txtcurl').value == '')
{
if (document.getElementById('txtcurl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
}
if (document.getElementById('txtcport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setServer("http://"+document.getElementById('txtcurl').value +":" + document.getElementById('txtcport').value);
window.close("chrome://openerp_plugin/content/config_change.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
function config_ok_web()
{
if (document.getElementById('txtcweburl').value == '')
{
if (document.getElementById('txtcweburl').value == '')
{
alert("You Must Enter Server Name!")
return false;
return false;
}
if (document.getElementById('txtcwebport').value == '')
{
alert("You Must Enter Port!")
return false;
}
setWebServerURL("http://"+document.getElementById('txtcweburl').value +":" + document.getElementById('txtcwebport').value);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
}
if (document.getElementById('txtcwebport').value == '' && !document.getElementById('lblssl').checked)
{
alert("You Must Enter Port!")
return false;
}
var protocol = "http://";
var port = document.getElementById('txtcwebport').value
if(document.getElementById('lblssl').checked) {
protocol = "https://";
if(port == '') {
port = 443
}
}
setWebServerURL(protocol + document.getElementById('txtcweburl').value +":" + port);
window.close("chrome://openerp_plugin/content/config_change_web.xul", "", "chrome");
window.open("chrome://openerp_plugin/content/config.xul", "", "chrome");
}
@@ -139,89 +147,89 @@ function openConfigChangeweb()
function appendDbList()
{
setServerService('xmlrpc/db');
getDbList('DBlist');
setServerService('xmlrpc/db');
getDbList('DBlist');
}
//set the database list in the listbox in configuration window
function setDb()
{
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
var cmbDbList = document.getElementById('listDBListBox');
document.getElementById('DBlist').value = cmbDbList.getItemAtIndex(cmbDbList.selectedIndex).value;
}
//stores the value of configuration fields in preferences
function okClick()
{
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
if (getDBList()=="false")
{
if (document.getElementById('DBlist_text').value =='')
{
alert("You Must Enter Database Name");
return false;
}
setDbName(document.getElementById('DBlist_text').value);
}
else if(document.getElementById('DBlist') != null)
{
setDbName(document.getElementById('DBlist').value);
}
setServer(document.getElementById('txturl').value);
var s = document.getElementById('txturl').value;
var a =s.split(':');
setPort(a[a.length-1]);
setUsername(document.getElementById('txtusername').value);
setPassword(document.getElementById('txtpassword').value);
window.close();
}
//deletes the value of the selected value in the listbox in configuraton menu
function deleteDocument(){
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
if(document.getElementById("listObjectListBox").selectedItem){
var objectlist = getPref().getCharPref("object").split(',');
var imagelist = getPref().getCharPref("imagename").split(',');
var objlist = getPref().getCharPref("listobject").split(',');
if(objectlist.length>0){
var objectcharpref = '';
var imagecharpref = '';
var objcharpref = '';
var nodelist = document.getElementById("listObjectListBox").selectedItem.childNodes
var childnode = document.getElementById("listObjectListBox").childNodes
for(i=2;i<childnode.length;i++){
if(childnode[i].hasChildNodes){
var secondchild = childnode[i].childNodes;
if (secondchild[1].getAttribute("label") != nodelist[1].getAttribute("label")){
objcharpref += secondchild[0].getAttribute("label")+',';
objectcharpref += secondchild[1].getAttribute("label")+',';
imagecharpref += secondchild[2].getAttribute("image")+',';
}
}
}
var demo3 = objectcharpref.substring(0,objectcharpref.length-1);
var demo4 = imagecharpref.substring(0,imagecharpref.length-1);
var demo5 = objcharpref.substring(0,objcharpref.length-1);
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
getPref().setCharPref("listobject",demo5);
getPref().setCharPref("object",demo3);
getPref().setCharPref("imagename",demo4);
}
document.getElementById("listObjectListBox").removeItemAt(document.getElementById("listObjectListBox").selectedIndex)
}
else{
alert("Please Select Any One Document ");
}
}
//function to add the image file for the checkbox
function addFile(){
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(this, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
var res = fp.show();
if (res == nsIFilePicker.returnOK){
var thefile = fp.file;
document.getElementById("txtimagename").value = thefile.path
}
}
@@ -2,25 +2,29 @@
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://openerp_plugin/locale/config_change.dtd">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
xmlns:html="http://www.w3.org/1999/xhtml" onload="config_change_load_web()"
title="Openerp Connection" height="140" width="240">
<script type="text/javascript" src="chrome://openerp_plugin/content/tiny_xmlrpc.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/config.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/loaddata.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/static.js"></script>
<script type="text/javascript" src="chrome://openerp_plugin/content/overlay.js"></script>
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
<hbox>
<label align="center" id="heading" value="&lblheading.label;" style="padding-left:38px" />
</hbox>
<groupbox id="gpData" width="200">
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox >
<label id="lblurl" control="txtcurl" value="&lblurl.label;" width="50"/>
<textbox id="txtcweburl" width="140" />
</hbox>
<hbox>
<label id="lblport" control="txtcport" value="&lblport.label;" width="50"/>
<textbox id="txtcwebport" width="140" />
</hbox>
<hbox>
<checkbox id="lblssl" label="SSL (https)" checked="false"/>
</hbox>
</groupbox>
<hbox align="right">
@@ -196,11 +196,12 @@ function getPredefinedFolder(type) {
var fname = msgDate8601string+"-"+subj+"-"+hdr.messageKey;
}
var rand1=Math.floor(Math.random()*100000)
var rand2=Math.floor(Math.random()*100000)
fname = rand1+'openerp-eml'+rand2
setFileName(fname)
fname = fname.replace(/[\x00-\x19]/g,"_");
if (mustcorrectname)
fname = nametoascii(fname);
else
fname = fname.replace(/[\/\\:,<>*\?\"\|]/g,"_");
return fname;
}
@@ -612,7 +612,6 @@ function createMenuItem_db(aLabel) {
//xmlrpc request handler for getting the list of database
var listDbHandler = {
onResult: function(client, context, result) {
setconnect_server("true")
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
var arrMethodList = result.QueryInterface(Components.interfaces.nsISupportsArray);
// Set the number of results
@@ -625,7 +624,7 @@ var listDbHandler = {
var database = ""
if (count > 0)
{
setDBList("true")
setDBList("true");
var label = document.getElementById("database_option");
var vbox = document.createElement("vbox");
var hbox = document.createElement("hbox");
@@ -658,7 +657,7 @@ var listDbHandler = {
}
else
{
setDBList("false")
setDBList("false");
}
// Loop through the results, adding items to the list
if (count)
@@ -682,22 +681,18 @@ var listDbHandler = {
onFault: function (client, ctxt, fault) {
setDBList("false");
},
onError: function (client, ctxt, status, errorMsg) {
if(status == 0) {
setconnect_server("true");
setDBList("false");
}
setDBList("false");
}
};
//function to get the database list
function getDbList(argControl)
{
setDBList("false")
setconnect_server("false")
setDBList("false");
setconnect_server("true");
// Enable correct security
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
// Get the instance of the XML-RPC client
@@ -1389,6 +1384,7 @@ function getPartnerList(){
xmlRpcClient.asyncCall(listPartnerHandler,cmdPartnerList,'execute',[ strDbName,struid,strpass,strobj,strmethod,strvalue ],6);
}
//function to create the xmlrpc supported variables for xmlrpc request
function dictcontact(a,b){
var temp = xmlRpcClient.createType(xmlRpcClient.ARRAY,{});
@@ -1844,7 +1840,6 @@ function testConnection(){
function testConnection_web(){
var branchobj = getPref();
weburl = getWebServerURL();
// window.open(weburl, "", "chrome","resizable=yes,scrollbars=yes,status=yes");
var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
messenger.launchExternalURL(weburl);
@@ -1876,6 +1871,7 @@ var listcreateLoginHandler = {
//function to check the login information
function createConnection(){
setconnect_server("true");
var branchobj = getPref();
setServerService('xmlrpc/common');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserAccess');
@@ -1,5 +1,7 @@
<!ENTITY lblurl.label "Server: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblport.label "Port: ">
<!ENTITY lblssl.label "Use SLL ? ">
<!ENTITY lblheading.label "Openerp Connection">
<!ENTITY imagecancel.value "chrome://openerp_plugin/skin/Error.gif">
<!ENTITY imageok.value "chrome://openerp_plugin/skin/Success.gif">