function WorkspaceQuery() {
if (isNaN(WorkspaceQuery.count)) {WorkspaceQuery.count = 0;}
this.index = WorkspaceQuery.count;
this.name = "WorkspaceQuery" + (WorkspaceQuery.count++);
this.obj = this.name + "Object";
eval(this.obj + " = this")
this.Loader = new jsAJAXLoader();
this.ChangeWorkspaceChecker = null;
this.CurrentAccountPage = 0;
this.CurrentWorkspacePage = 0;
this.ChangeWorkspaceDiv = null;
this.ChangeWorkspace = WorkspaceQueryChangeWorkspace;
this.ShowChangeWorkspaceDiv = WorkspaceQueryShowChangeWorkspaceDiv;
this.HideChangeWorkspaceDiv = WorkspaceQueryHideChangeWorkspaceDiv;
this.ClearChangeWorkspaceDivValues = WorkspaceQueryClearChangeWorkspaceDivValues;
this.OnChangeWorkspaceOkClicked = WorkspaceQueryOnChangeWorkspaceOkClicked;
this.OnChangeWorkspaceCancelClicked = WorkspaceQueryOnChangeWorkspaceCancelClicked;
this.LoadAccounts = WorkspaceQueryLoadAccounts;
this.FillAccountList = WorkspaceQueryFillAccountList;
this.SetAccountPageInfo = WorkspaceQuerySetAccountPageInfo;
this.CheckAccountPageIcons = WorkspaceQueryCheckAccountPageIcons;
this.AccountListFirstPageIconClicked = WorkspaceQueryAccountListFirstPageIconClicked;
this.AccountListPrevPageIconClicked = WorkspaceQueryAccountListPrevPageIconClicked;
this.AccountListNextPageIconClicked = WorkspaceQueryAccountListNextPageIconClicked;
this.AccountListLastPageIconClicked = WorkspaceQueryAccountListLastPageIconClicked;
this.AccountListPageSizeChanged = WorkspaceQueryAccountListPageSizeChanged;
this.AccountListSelectionChanged = WorkspaceQueryAccountListSelectionChanged;
this.LoadWorkspaces = WorkspaceQueryLoadWorkspaces;
this.FillWorkspaceList = WorkspaceQueryFillWorkspaceList;
this.SetWorkspacePageInfo = WorkspaceQuerySetWorkspacePageInfo;
this.CheckWorkspacePageIcons = WorkspaceQueryCheckWorkspacePageIcons;
this.WorkspaceListFirstPageIconClicked = WorkspaceQueryWorkspaceListFirstPageIconClicked;
this.WorkspaceListPrevPageIconClicked = WorkspaceQueryWorkspaceListPrevPageIconClicked;
this.WorkspaceListNextPageIconClicked = WorkspaceQueryWorkspaceListNextPageIconClicked;
this.WorkspaceListLastPageIconClicked = WorkspaceQueryWorkspaceListLastPageIconClicked;
this.WorkspaceListPageSizeChanged = WorkspaceQueryWorkspaceListPageSizeChanged;
this.WorkspaceListSelectionChanged = WorkspaceQueryWorkspaceListSelectionChanged;
this.CheckWorkspaceIsSelected = WorkspaceQueryCheckWorkspaceIsSelected;
this.OnWorkspaceChanged = WorkspaceQueryOnWorkspaceChanged;
this.OnAccountListLoaded = WorkspaceQueryOnAccountListLoaded;
this.OnWorkspaceListLoaded = WorkspaceQueryOnWorkspaceListLoaded;
}
function WorkspaceQueryChangeWorkspace(afterchange) {
this.OnAfterWorkspaceChanged = afterchange;
this.ShowChangeWorkspaceDiv();
}
function WorkspaceQueryShowChangeWorkspaceDiv() {
if (!this.ChangeWorkspaceDiv) {
var html = '
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'

' +
'

' +
'
' +
'
' +
'Pág. 1 / 1
' +
'
' +
'

' +
'

' +
'
' +
'
' +
'
' +
'' +
'
' +
'
' +
'
' +
'
' +
'
' +
'

' +
'

' +
'
' +
'
' +
'Pág. 1 / 1
' +
'
' +
'

' +
'

' +
'
' +
'
' +
'
' +
'' +
'
' +
'
' +
'
' +
'
';
var floating = new Floating(
new FloatingHeader(null,'Cambiar espacio de trabajo'),
new FloatingBody(null,html),
new FloatingFooter(
null,
[
new FormButton('fltwcokimg','../img/icon-ok.gif','../img/icon-ok-dis.gif','Aceptar',true,
this.obj + '.OnChangeWorkspaceOkClicked();'),
new FormButton('fltwccancelimg','../img/icon-cancel.gif','../img/icon-cancel-dis.gif','Cancelar',false,
this.obj + '.OnChangeWorkspaceCancelClicked();')
],
'fltwcerrordiv'
)
);
this.ChangeWorkspaceDiv = floating.BuildDiv('fltwcdiv','floatingworkspacec');
this.ChangeWorkspaceDiv.style.display = 'none';
var obj = this;
var accountdiv = document.getElementById('fltwcaccountdiv');
if (accountdiv) {
this.AccountList = new jsListView();
this.AccountList.Mode = jsListViewModeDetails;
this.AccountList.MultipleSelect = false;
this.AccountList.AllowDrag = false;
this.AccountList.DetailsHeight = 20;
this.AccountList.DetailsShowHeaders = false;
this.AccountList.AddColumn('Nombre','210px','left');
this.AccountList.AddColumn('Estado','80px','left');
this.AccountList.AddSmallIcons('../img/icon-account.gif');
this.AccountList.OnItemSelected = function(item) {obj.AccountListSelectionChanged(item.Data);};
this.AccountList.Build(accountdiv);
}
var workspacediv = document.getElementById('fltwcworkspacediv');
if (workspacediv) {
this.WorkspaceList = new jsListView();
this.WorkspaceList.Mode = jsListViewModeDetails;
this.WorkspaceList.MultipleSelect = false;
this.WorkspaceList.AllowDrag = false;
this.WorkspaceList.DetailsHeight = 20;
this.WorkspaceList.DetailsShowHeaders = false;
this.WorkspaceList.AddColumn('Nombre','210px','left');
this.WorkspaceList.AddColumn('Fecha','80px','left');
this.WorkspaceList.AddSmallIcons('../img/icon-workspace.gif');
this.WorkspaceList.OnItemSelected = function(item) {obj.WorkspaceListSelectionChanged(item.Data);};
this.WorkspaceList.Build(workspacediv);
}
this.ChangeWorkspaceChecker = new jsFormChecker('fltwcokimg','../img/icon-ok.gif','../img/icon-ok-dis.gif','fltwcerrordiv',
this.OnChangeWorkspaceOkClicked,this.OnChangeWorkspaceCancelClicked,this);
this.ChangeWorkspaceChecker.AdditionalCheck = function() {return obj.CheckWorkspaceIsSelected();};
}
ShowFloatingWall();
this.ChangeWorkspaceDiv.style.display = '';
this.ClearChangeWorkspaceDivValues();
}
function WorkspaceQueryHideChangeWorkspaceDiv() {
if (this.ChangeWorkspaceDiv) {this.ChangeWorkspaceDiv.style.display = 'none';}
}
function WorkspaceQueryClearChangeWorkspaceDivValues() {
if ((this.AccountList)&&(this.WorkspaceList)&&(this.ChangeWorkspaceChecker)) {
this.AccountList.Clear();
this.WorkspaceList.Clear();
this.ChangeWorkspaceChecker.Check();
this.LoadAccounts();
}
}
function WorkspaceQueryOnChangeWorkspaceOkClicked(obj) {
if (!obj) {obj = this;}
if (obj.ChangeWorkspaceChecker.IsOK) {
var idworkspace = null;
var items = obj.WorkspaceList.GetSelectedItems();
if ((items)&&(items.length)) {idworkspace = items[0].Data;}
if ((idworkspace)&&(idworkspace != CurrentWorkspace)) {
var loader = obj.Loader.GetLoader('../lib/ajax/workspacequery.php',obj.OnWorkspaceChanged,obj);
loader.AddVar('action','change');
loader.AddVar('idws',idworkspace);
obj.HideChangeWorkspaceDiv();
StartFloatingAJAXLoad('Cambiando espacio de trabajo...');
loader.Load();
} else {obj.OnChangeWorkspaceCancelClicked();}
}
}
function WorkspaceQueryOnChangeWorkspaceCancelClicked(obj) {
if (!obj) {obj = this;}
obj.HideChangeWorkspaceDiv();
HideFloatingWall();
}
function WorkspaceQueryLoadAccounts() {
if (this.AccountList) {
var pagesize = 0;
var cmb = document.getElementById('fltwcAccountSizeCombo');
if ((cmb)&&(cmb.selectedIndex)) {pagesize = cmb.options[cmb.selectedIndex].value;}
var loader = this.Loader.GetLoader('../lib/ajax/accountlist.php',this.OnAccountListLoaded,this);
loader.AddVar('allowedws','1');
loader.AddVar('pagenum',this.CurrentAccountPage);
loader.AddVar('pagesize',pagesize);
loader.AddVar('ofield','name');
this.AccountList.Clear();
this.AccountList.BeginUpdate();
loader.Load();
}
}
function WorkspaceQueryFillAccountList(data) {
if (this.AccountList) {
if (data) {
var nodes = data.getElementsByTagName('MaxPage'),mpage = null,cpage = null;
if ((nodes.length > 0)&&(nodes[0].childNodes.length > 0)&&(nodes[0].childNodes[0].nodeValue)) {mpage = parseInt(nodes[0].childNodes[0].nodeValue);}
nodes = data.getElementsByTagName('CurrentPage');
if ((nodes.length > 0)&&(nodes[0].childNodes.length > 0)&&(nodes[0].childNodes[0].nodeValue)) {cpage = parseInt(nodes[0].childNodes[0].nodeValue);}
this.SetAccountPageInfo(cpage,mpage);
this.AccountList.FromXML(data);
}
this.AccountList.EndUpdate();
this.AccountList.Rebuild();
this.AccountListSelectionChanged();
}
}
function WorkspaceQuerySetAccountPageInfo(current,max) {
this.CurrentAccountPage = current;
this.MaxAccountPage = max;
this.CheckAccountPageIcons();
}
function WorkspaceQueryCheckAccountPageIcons() {
var ficon = document.getElementById('fltwcAccountFirstPageIcon');
if (ficon) {
ficon.style.cursor = (this.CurrentAccountPage > 0) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
ficon.src = (this.CurrentAccountPage > 0) ? '../img/picon-first.gif' : '../img/picon-first-dis.gif';
ficon.disabled = (this.CurrentAccountPage == 0);
}
var picon = document.getElementById('fltwcAccountPrevPageIcon');
if (picon) {
picon.style.cursor = (this.CurrentAccountPage > 0) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
picon.src = (this.CurrentAccountPage > 0) ? '../img/picon-prev.gif' : '../img/picon-prev-dis.gif';
picon.disabled = (this.CurrentAccountPage == 0);
}
var nicon = document.getElementById('fltwcAccountNextPageIcon');
if (nicon) {
nicon.style.cursor = (this.CurrentAccountPage < this.MaxAccountPage) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
nicon.src = (this.CurrentAccountPage < this.MaxAccountPage) ? '../img/picon-next.gif' : '../img/picon-next-dis.gif';
nicon.disabled = (this.CurrentAccountPage >= this.MaxAccountPage);
}
var licon = document.getElementById('fltwcAccountLastPageIcon');
if (licon) {
licon.style.cursor = (this.CurrentAccountPage < this.MaxAccountPage) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
licon.src = (this.CurrentAccountPage < this.MaxAccountPage) ? '../img/picon-last.gif' : '../img/picon-last-dis.gif';
licon.disabled = (this.CurrentAccountPage >= this.MaxAccountPage);
}
var tdiv = document.getElementById('fltwcAccountTextDiv');
if (tdiv) {tdiv.innerHTML = 'Pág. ' + (this.CurrentAccountPage + 1) + ' / ' + (this.MaxAccountPage + 1);}
}
function WorkspaceQueryAccountListFirstPageIconClicked() {
if (this.CurrentAccountPage > 0) {this.CurrentAccountPage = 0;}
this.LoadAccounts();
}
function WorkspaceQueryAccountListPrevPageIconClicked() {
if (this.CurrentAccountPage > 0) {this.CurrentAccountPage--;}
this.LoadAccounts();
}
function WorkspaceQueryAccountListNextPageIconClicked() {
if (this.CurrentAccountPage < this.MaxAccountPage) {this.CurrentAccountPage++;}
this.LoadAccounts();
}
function WorkspaceQueryAccountListLastPageIconClicked() {
if (this.CurrentAccountPage < this.MaxAccountPage) {this.CurrentAccountPage = this.MaxAccountPage;}
this.LoadAccounts();
}
function WorkspaceQueryAccountListPageSizeChanged() {this.LoadAccounts();}
function WorkspaceQueryAccountListSelectionChanged() {
this.CurrentWorkspacePage = 0;
this.LoadWorkspaces();
}
function WorkspaceQueryLoadWorkspaces() {
if ((this.AccountList)&&(this.WorkspaceList)) {
var idaccount = null;
var items = this.AccountList.GetSelectedItems();
if ((items)&&(items.length > 0)) {idaccount = items[0].Data;}
if (!idaccount) {
this.WorkspaceList.Clear();
return;
}
var pagesize = 0;
var cmb = document.getElementById('fltwcWorkspaceSizeCombo');
if ((cmb)&&(cmb.selectedIndex)) {pagesize = cmb.options[cmb.selectedIndex].value;}
var loader = this.Loader.GetLoader('../lib/ajax/workspacelist.php',this.OnWorkspaceListLoaded,this);
loader.AddVar('idaccount',idaccount);
loader.AddVar('pagenum',this.CurrentWorkspacePage);
loader.AddVar('pagesize',pagesize);
loader.AddVar('ofield','name');
this.WorkspaceList.Clear();
this.WorkspaceList.BeginUpdate();
loader.Load();
}
}
function WorkspaceQueryFillWorkspaceList(data) {
if (this.WorkspaceList) {
if (data) {
var nodes = data.getElementsByTagName('MaxPage'),mpage = null,cpage = null;
if ((nodes.length > 0)&&(nodes[0].childNodes.length > 0)&&(nodes[0].childNodes[0].nodeValue)) {mpage = parseInt(nodes[0].childNodes[0].nodeValue);}
nodes = data.getElementsByTagName('CurrentPage');
if ((nodes.length > 0)&&(nodes[0].childNodes.length > 0)&&(nodes[0].childNodes[0].nodeValue)) {cpage = parseInt(nodes[0].childNodes[0].nodeValue);}
this.SetWorkspacePageInfo(cpage,mpage);
this.WorkspaceList.FromXML(data);
}
this.WorkspaceList.EndUpdate();
this.WorkspaceList.Rebuild();
this.WorkspaceListSelectionChanged();
}
}
function WorkspaceQuerySetWorkspacePageInfo(current,max) {
this.CurrentWorkspacePage = current;
this.MaxWorkspacePage = max;
this.CheckWorkspacePageIcons();
}
function WorkspaceQueryCheckWorkspacePageIcons() {
var ficon = document.getElementById('fltwcWorkspaceFirstPageIcon');
if (ficon) {
ficon.style.cursor = (this.CurrentWorkspacePage > 0) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
ficon.src = (this.CurrentWorkspacePage > 0) ? '../img/picon-first.gif' : '../img/picon-first-dis.gif';
ficon.disabled = (this.CurrentWorkspacePage == 0);
}
var picon = document.getElementById('fltwcWorkspacePrevPageIcon');
if (picon) {
picon.style.cursor = (this.CurrentWorkspacePage > 0) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
picon.src = (this.CurrentWorkspacePage > 0) ? '../img/picon-prev.gif' : '../img/picon-prev-dis.gif';
picon.disabled = (this.CurrentWorkspacePage == 0);
}
var nicon = document.getElementById('fltwcWorkspaceNextPageIcon');
if (nicon) {
nicon.style.cursor = (this.CurrentWorkspacePage < this.MaxWorkspacePage) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
nicon.src = (this.CurrentWorkspacePage < this.MaxWorkspacePage) ? '../img/picon-next.gif' : '../img/picon-next-dis.gif';
nicon.disabled = (this.CurrentWorkspacePage >= this.MaxWorkspacePage);
}
var licon = document.getElementById('fltwcWorkspaceLastPageIcon');
if (licon) {
licon.style.cursor = (this.CurrentWorkspacePage < this.MaxWorkspacePage) ? ((document.all) ? 'hand' : 'pointer') : 'not-allowed';
licon.src = (this.CurrentWorkspacePage < this.MaxWorkspacePage) ? '../img/picon-last.gif' : '../img/picon-last-dis.gif';
licon.disabled = (this.CurrentWorkspacePage >= this.MaxWorkspacePage);
}
var tdiv = document.getElementById('fltwcWorkspaceTextDiv');
if (tdiv) {tdiv.innerHTML = 'Pág. ' + (this.CurrentWorkspacePage + 1) + ' / ' + (this.MaxWorkspacePage + 1);}
}
function WorkspaceQueryWorkspaceListFirstPageIconClicked() {
if (this.CurrentWorkspacePage > 0) {this.CurrentWorkspacePage = 0;}
this.LoadWorkspaces();
}
function WorkspaceQueryWorkspaceListPrevPageIconClicked() {
if (this.CurrentWorkspacePage > 0) {this.CurrentWorkspacePage--;}
this.LoadWorkspaces();
}
function WorkspaceQueryWorkspaceListNextPageIconClicked() {
if (this.CurrentWorkspacePage < this.MaxWorkspacePage) {this.CurrentWorkspacePage++;}
this.LoadWorkspaces();
}
function WorkspaceQueryWorkspaceListLastPageIconClicked() {
if (this.CurrentWorkspacePage < this.MaxWorkspacePage) {this.CurrentWorkspacePage = this.MaxWorkspacePage;}
this.LoadWorkspaces();
}
function WorkspaceQueryWorkspaceListPageSizeChanged() {this.LoadWorkspaces();}
function WorkspaceQueryWorkspaceListSelectionChanged() {
if (this.ChangeWorkspaceChecker) {this.ChangeWorkspaceChecker.Check();}
}
function WorkspaceQueryCheckWorkspaceIsSelected() {
if ((this.WorkspaceList)&&(this.WorkspaceList.GetSelectedItems().length > 0)) {return null;}
return '(debe seleccionar un espacio de trabajo)';
}
function WorkspaceQueryOnWorkspaceChanged(xmlcode,obj) {
var data = ParseAJAXResponse(xmlcode);
if (data) {
var nodes = data.getElementsByTagName('UpdateResult');
if ((nodes)&&(nodes.length)&&(nodes[0].childNodes.length)) {
var idws = nodes[0].childNodes[0].nodeValue;
if (obj.OnAfterWorkspaceChanged) {obj.OnAfterWorkspaceChanged(idws);}
}
}
}
function WorkspaceQueryOnAccountListLoaded(xmlcode,obj) {
var data = ParseAJAXResponse(xmlcode,true);
if (obj.FillAccountList) {obj.FillAccountList(data);}
}
function WorkspaceQueryOnWorkspaceListLoaded(xmlcode,obj) {
var data = ParseAJAXResponse(xmlcode,true);
if (obj.FillWorkspaceList) {obj.FillWorkspaceList(data);}
}
var WorkspaceUpdater = new WorkspaceQuery();
function LanguageFlagClicked(lang) {
if (lang != 'es') {
var url = document.location.href,pos;
if ((pos = url.indexOf('?')) >= 0) {url = url.substring(0,pos);}
document.location.href = url + '?language=' + lang;
}
}
function WorkspaceClicked() {WorkspaceUpdater.ChangeWorkspace(WorkspaceChanged);}
function WorkspaceChanged(idws) {document.location.href = document.location.href;}
function LogoutClicked() {document.location.href = '../';}
document.write('');
document.write('

');
document.write('

');
document.write('

');
document.write('
');