*
* {tag: 'div', style: 'display:block;position:absolute;top:2;left:300;width:100%;height:25px'});
*
+ *
+ * CHANGES
+ * - gtranslate moved to Pman.GoogleTranslate
+ *
+ *
*/
if (typeof(_T) == 'undefined') { _T={};}
+
Pman = new Roo.Document(
}
// remove loader..
- if (Ext.get('loading')) {
- Ext.get('loading').remove();
+ if (Roo.get('loading')) {
+ Roo.get('loading').remove();
}
- Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
+ Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
// link errors...
if (AppLinkError.length) {
- Ext.MessageBox.alert("Error", AppLinkError, function() {
+ Roo.MessageBox.alert("Error", AppLinkError, function() {
Pman.Login.onLoad();
});
return;
if (this.layout) {
return; // already loaded
}
- if (Ext.get('loading')) {
- Ext.get('loading').remove();
+ if (Roo.get('loading')) {
+ Roo.get('loading').remove();
}
- if (Ext.get('loading-mask')) {
- Ext.get('loading-mask').show();
+ if (Roo.get('loading-mask')) {
+ Roo.get('loading-mask').show();
}
/*
- Ext.MessageBox.show({
+ Roo.MessageBox.show({
title: "Please wait...",
msg: "Building Interface...",
width:340,
});
*/
//Pman.onLoadBuild();
- //Ext.get(document.body).mask("Building Interface");
+ //Roo.get(document.body).mask("Building Interface");
//Pman.onLoadBuild.defer(100, Pman);
//Pman.onLoadBuild();
var _this = this;
this.stime = new Date();
- this.layout = new Ext.BorderLayout(document.body, {
+ this.layout = new Roo.BorderLayout(document.body, {
north: {
split:false,
initialSize: 25,
//resizeTabs: true,
alwaysShowTabs: true,
minTabWidth: 140
- } /*,
+ } ,
south: {
+ collapsible : true,
+ collapsed : true,
split:false,
- initialSize: 25,
+ height: 120,
titlebar: false
}
- */
+
});
this.fireEvent('beforeload',this);
this.layout.beginUpdate();
- this.layout.add('north', new Ext.ContentPanel('title', 'North'));
+ this.layout.add('north', new Roo.ContentPanel('title', 'North'));
var au = Pman.Login.authUser;
- if (au.id > 0 && au.company_id_background_color.length) {
- Ext.get('title').dom.style.backgroundColor = '#' + au.company_id_background_color;
- Ext.get('headerInformation').dom.style.color = this.invertColor('#' + au.company_id_background_color);
+ if (au.id > 0 && au.company_id_background_color && au.company_id_background_color.length) {
+ Roo.get('title').dom.style.backgroundColor = '#' + au.company_id_background_color;
+ Roo.get('headerInformation').dom.style.color = this.invertColor('#' + au.company_id_background_color);
}
if (au.id > 0 && au.company_id_logo_id * 1 > 0) {
- Ext.get('headerInformation-company-logo').dom.src = baseURL +
+ Roo.get('headerInformation-company-logo').dom.src = baseURL +
'/Images/' + au.company_id_logo_id + '/' + au.company_id_logo_id_filename;
} else {
- Ext.get('headerInformation-company-logo').dom.src = Roo.BLANK_IMAGE_URL;
+ Roo.get('headerInformation-company-logo').dom.src = Roo.BLANK_IMAGE_URL;
}
- Ext.get('headerInformation').dom.innerHTML = String.format(
+ Roo.get('headerInformation').dom.innerHTML = String.format(
"You are Logged in as <b>{0} ({1})</b>", // to {4} v{3}", // for <b>{2}</b>",
au.name, au.email, au.company_id_name,
AppVersion , appNameShort
document.title = appName + ' v' + AppVersion + ' - ' + au.company_id_name;
- Ext.QuickTips.init();
- if (Ext.isGecko) {
- Ext.useShims = true;
+ Roo.QuickTips.init();
+ if (Roo.isGecko) {
+ Roo.useShims = true;
}
//this.mainLayout.beginUpdate();
- //var maskDom = Ext.get(document.body)._maskMsg.dom
+ //var maskDom = Roo.get(document.body)._maskMsg.dom
this.layout.beginUpdate();
Pman.building = true;
var tbh = se.createChild(
{ tag: 'td', style: 'width:100%;' });
- var lotb = new Ext.Toolbar(tbh);
+ var lotb = new Roo.Toolbar(tbh);
if (Roo.isSafari) {
var tbl = se.child('table', true);
tbl.setAttribute('width', '100%');
}
lotb.add(
- new Ext.Toolbar.Fill(),
+ new Roo.Toolbar.Fill(),
{
text: "Change Password",
text: "Add New Item",
cls: 'x-btn-text-icon',
- icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
+ icon: Roo.rootURL + 'images/default/dd/drop-add.gif',
menu : {
items : this.subMenuItems
}
};
- Ext.MessageBox.hide();
- if (Ext.get('loading-mask')) {
- Ext.get('loading-mask').remove();
+ Roo.MessageBox.hide();
+ if (Roo.get('loading-mask')) {
+ Roo.get('loading-mask').remove();
}
var forceAdmin = function(data)
{
if (!data || !data.id) {
+ //Roo.log("Force Admin");
Pman.Dialog.PersonStaff.show(
{
id : 0,
- company_id : Pman.Login.authUser.company_id * 1,
+ company_id : Pman.Login.authUser.company_id_id * 1,
company_id_name : Pman.Login.authUser.company_id_name
}, function(data) {
forceAdmin(data);
);
return;
}
- Ext.state.Manager.set('Pman.Login.username', data.email),
+ Roo.state.Manager.set('Pman.Login.username', data.email),
window.onbeforeunload = false;
document.location = baseURL + '?ts=' + Math.random();
}
});
return;
}
+ Pman.Login.authUser.company_id_id = data.id;
Pman.Login.authUser.company_id = data.id;
Pman.Login.authUser.company_id_name = data.name;
forceAdmin();
}
if (Pman.Login.authUser.id < 0) {
+ // admin company has been created - create the user..
+ if (Pman.Login.authUser.company_id_id* 1 > 0) {
+ forceAdmin();
+ return;
+ }
+
forceCompany();
/// create account..
onLoadTrackCall : function(id,cb, cls) {
- Ext.get(document.body).mask("Loading Document details");
+ Roo.get(document.body).mask("Loading Document details");
Pman.request({
url: baseURL + '/Roo/Documents.html',
},
method: 'GET',
success : function(data) {
- Ext.get(document.body).unmask();
+ Roo.get(document.body).unmask();
switch(data.in_out) {
case 'OUT' : cls+='Out';break;
case 'WIP' : cls+='Wip';break;
default:
- Ext.MessageBox.alert("Error", "invalid in_out");
+ Roo.MessageBox.alert("Error", "invalid in_out");
return;
}
Pman.Dialog[cls].show(data, cb ? cb : Pman.refreshActivePanel);
},
failure: function() {
- Ext.get(document.body).unmask();
+ Roo.get(document.body).unmask();
//if (cb) {
// cb.call(false);
//}
{
var res = '';
try {
- res = Ext.decode(response.responseText);
+ res = Roo.decode(response.responseText);
// oops...
if (typeof(res) != 'object') {
res = { success : false, errorMsg : res, errors : true };
var s = tab.grid.getSelectionModel().getSelections();
if (!s.length) {
- Ext.MessageBox.alert("Error", "Select at least one Row to delete" );
+ Roo.MessageBox.alert("Error", "Select at least one Row to delete" );
return '';
}
r.push(s[i].data.id);
}
- Ext.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
+ Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
function(btn) {
if (btn != 'yes') {
return;
},
failure: function(act) {
tab.grid.getView().mainWrap.unmask();
- Ext.MessageBox.alert("Error", "Error Deleting");
+ Roo.MessageBox.alert("Error", "Error Deleting");
}
});
standardActionFailed : function(f, act, cb) {
if (act.failureType == 'client') {
- Ext.MessageBox.alert("Error", "Please Correct all the errors in red", cb);
+ Roo.MessageBox.alert("Error", "Please Correct all the errors in red", cb);
return;
}
if (act.failureType == 'connect') {
- Ext.MessageBox.alert("Error", "Problem Connecting to Server - please try again.", cb);
+ Roo.MessageBox.alert("Error", "Problem Connecting to Server - please try again.", cb);
return;
}
if (act.type == 'submit') {
- Ext.MessageBox.alert("Error", typeof(act.result.errorMsg) == 'string' ?
+ Roo.MessageBox.alert("Error", typeof(act.result.errorMsg) == 'string' ?
String.format('{0}', act.result.errorMsg) :
"Saving failed = fix errors and try again", cb);
return;
}
// what about load failing..
- Ext.MessageBox.alert("Error", "Error loading details",cb);
+ Roo.MessageBox.alert("Error", "Error loading details",cb);
},
/**
*
- * similar to Ext.Ajax, but handles our responses better...
+ * similar to Roo.Ajax, but handles our responses better...
* c.url
* c.method
* c.params
*
*/
request : function(c) {
-
- Ext.Ajax.request({
- timeout : c.timeout || 30000,
+ var r= new Roo.data.Connection({
+ timeout : typeof(c.timeout) == 'undefined' ? 30000 : c.timeout
+ });
+ r.request({
url: c.url,
method : c.method,
params: c.params,
}
}
Roo.MessageBox.hide();
- Ext.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : "Error Sending");
+ Roo.MessageBox.alert("Error", res.errorMsg ? res.errorMsg : "Error Sending");
return;
}
}
Roo.MessageBox.hide();
Roo.MessageBox.alert("Error", "Connection timed out sending");
- console.log(response);
+ Roo.log(response);
},
scope: this
});
},
- csvFrame : false,
- createCsvFrame: function()
- {
-
- if (this.csvFrame) {
- document.body.removeChild(this.csvFrame);
- }
-
- var id = Ext.id();
- this.csvFrame = document.createElement('iframe');
- this.csvFrame.id = id;
- this.csvFrame.name = id;
- this.csvFrame.className = 'x-hidden';
- if(Ext.isIE){
- this.csvFrame.src = Ext.SSL_SECURE_URL;
- }
- document.body.appendChild(this.csvFrame);
-
- if(Ext.isIE){
- document.frames[id].name = id;
- }
-
- },
- /**
- * download({
- url:
- })
- *
- *
- */
+ // depreciated - use Pman.Download()
download : function(c) {
- if (c.newWindow) {
- // as ie seems buggy...
- window.open( c.url + '?' + Roo.urlEncode(c.params || {}), '_blank');
- return;
-
- }
-
- this.createCsvFrame();
- function cb(){
- var r = { responseText : "", responseXML : null };
-
- var frame = this.csvFrame;
-
- try {
- var doc = Ext.isIE ?
- frame.contentWindow.document :
- (frame.contentDocument || window.frames[this.csvFrame.id].document);
-
- if(doc && doc.body && doc.body.innerHTML.length){
- // alert(doc.body.innerHTML);
- Ext.MessageBox.alert("Error download",doc.body.innerHTML);
- }
-
- }
- catch(e) {
- }
-
- Ext.EventManager.removeListener(frame, 'load', cb, this);
-
- }
- Ext.EventManager.on( this.csvFrame, 'load', cb, this);
- this.csvFrame.src = c.url;
+ return new Pman.Download(c);
},
+
+ // fixme - move to document manager...
downloadRevision : function(doc, rev)
{
this.download({
});
},
+
+
exportCSV : function(c) {
- //this.createCsvFrame();
+
for(var i=0;i < c.csvFormat.length;i++) {
c.params['csvCols['+i+']'] = c.csvFormat[i][0];
c.params['csvTitles['+i+']'] = c.csvFormat[i][1];
}
-
-
- c.url += '?' + Ext.urlEncode(c.params);
+ c.url += '?' + Roo.urlEncode(c.params);
this.download(c);
},
+
+
prettyDate : function (value)
{
if (typeof(value) == 'string') {
return;
}
// flash it up as modal - so we store the mask!?
- Ext.MessageBox.show({ title: 'loading' });
- Ext.MessageBox.show({
+ Roo.MessageBox.show({ title: 'loading' });
+ Roo.MessageBox.show({
title: "Please wait...",
msg: "Building Interface...",
width:450,
var n = 0;
var progressRun = function() {
- var m = mods[n];
+ var mod = mods[n];
- Ext.MessageBox.updateProgress(
+ Roo.MessageBox.updateProgress(
(n+1)/mods.length, "Building Interface " + (n+1) +
" of " + mods.length +
- (m.name ? (' - ' + m.name) : '')
+ (mod.name ? (' - ' + mod.name) : '')
);
- if (typeof(m) == 'function') {
- m();
+ if (typeof(mod) == 'function') {
+ mod();
- } else {
- if (m.parent.layout && !m.module.disabled) {
- m.module.add(m.parent.layout, m.region);
+ } else if (mod.parent.layout && !mod.module.disabled) {
+ // honour permname setings..
+ if (mod.permname && mod.permname.length) {
+ if (Pman.hasPerm(mod.permname, 'S')) {
+ mod.module.add(mod.parent.layout, mod.region);
+ }
+ } else {
+ mod.module.add(mod.parent.layout, mod.region);
}
-
+
+
}
},
- gtranslate : function(str, src, dest, cb) {
- // load script:
-
-
- var x = new Roo.data.ScriptTagProxy({
- url: 'http://ajax.googleapis.com/ajax/services/language/translate',
- callbackParam : 'callback'
- });
- x.load(
- {
- v: '1.0',
- q : str,
- langpair : src + '|' +dest
- }, // end params.
- { // reader
- readRecords : function (o) {
- if (!o.responseData) {
- return o;
- }
- return o.responseData.translatedText;
- }
- },
- function (result) {
- cb(result);
- },
- this,
- []
- );
-
-
-
- } ,
invertColor : function(c)
{
// read..