You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

255 lines
8.4 KiB

<?xml version="1.0" encoding="ISO-8859-1"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:cti_control="CTI.technique.controls.*" xmlns="*"
creationComplete="creationComplete()" resize="resize()"
styleName="CTIView"
paddingTop="0" paddingBottom="0" paddingRight="0" paddingLeft="0"
creationPolicy="all">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.Menu;
import mx.collections.ArrayCollection;
import flash.net.URLVariables;
import mx.events.CloseEvent
import flash.events.*;
import mx.events.*;
import mx.collections.Sort;
import mx.collections.SortField;
import CTI.technique.CTI_Utilitaires;
import CTI.technique.CTI_ArrayCollection;
public var buildComplete:Boolean = false;
[Bindable]
public var title:String = "Synchronisation des données";
[Bindable]
public var hasHelp:Boolean = false;
[Bindable]
public var jobsHistory_list:CTI_ArrayCollection = new CTI_ArrayCollection();
[Bindable]
public var jobsHistory_length:Number;
public function creationComplete():void {
if (application.currentHelpFile != "") {
hasHelp = true;
}
if (application.name == "CTI") {
}
if (application.name == "CTI_1") {
GUI_titleBar.height = 0
}
tabNavigator_GUI.selectedIndex = 0
getData()
}
public function eventDispatcher(eventCode:String):Boolean {
return true
}
public function getData():void {
var urlVariables:URLVariables
synchronizeAll_description_GUI.htmlText = "La synchronisation de <B>l'intégralité des données</B> permet d'actualiser en cours de journée la base complète (<B>occupation</B>, <B>facturation</B>, <B>règlements</B>)."
synchronizeAll_description_GUI.htmlText = synchronizeAll_description_GUI.htmlText + "<BR><B>ATTENTION</B>"
synchronizeAll_description_GUI.htmlText = synchronizeAll_description_GUI.htmlText + "<BR>Ce traitement s'exécute normalement toutes les nuits"
synchronizeAll_description_GUI.htmlText = synchronizeAll_description_GUI.htmlText + "<BR>Si vous souhaitez néanmoins le lancer, il s'exécutera en <B>batch</B>."
synchronizeAll_description_GUI.htmlText = synchronizeAll_description_GUI.htmlText + "<BR>Durant le temps de synchronisation, les tableaux ne seront pas disponibles."
CTI_Utilitaires.startRequestHTTP("modules/activite/php/ACTI_getSynchronize.php",urlVariables,exec,true,this.parentApplication)
function exec(resultatService:XML):void {
var initDft:Boolean = false;
jobsHistory_length = resultatService.JOB.length()
jobsHistory_list.loadXMLList(resultatService.JOB)
var _sort:Sort = new Sort()
_sort.fields = [new SortField("start", true, true, false)];
jobsHistory_list.sort = _sort;
jobsHistory_list.refresh()
var lastjobs_node:XML = resultatService.LASTJOBS[0];
last_job_all_GUI.text = lastjobs_node.@last_all_active.toString()
if (last_job_all_GUI.text == "") {
last_job_all_GUI.text = lastjobs_node.@last_all_endded.toString()
}
setTimeout(setBuildComplete, 1000);
}
}
private function setBuildComplete():void {
buildComplete = true;
}
private function resize():void {
}
private function synchronizeAll():void {
CTI_Utilitaires.question_yesNo("Synchronisation des données", "Confirmez vous la synchronisation de toutes données ?", responseFunction)
function responseFunction(event:CloseEvent):void {
if (event.detail != Alert.YES) {
return;
}
var urlVariables:URLVariables = new URLVariables()
urlVariables.option = "all";
CTI_Utilitaires.startRequestHTTP("modules/activite/php/ACTI_execSynchronize.php",urlVariables,exec,true,this.parentApplication)
function exec(resultatService:XML):void {
if (resultatService.@returnCode.toString() == "KO") {
CTI_Utilitaires.alert_error("Synchronisation des données", resultatService.@returnTexte.toString());
}
else {
CTI_Utilitaires.alert_info("Synchronisation des données", "Synchronisation de toutes données démarrée en batch sur le serveur");
getData();
}
}
}
}
private function displayLog():void {
var job:Object;
if (historique_UI.selectedIndex < 0) {
return
}
job = historique_UI.selectedItem;
if (job.logFile.toString() == "") {
return;
}
var urlVariables:URLVariables = new URLVariables();
urlVariables.longfile = job.logFile.toString();
CTI_Utilitaires.openURL("modules/outils/php/getLogFile.php",urlVariables,"iCTI_logFile")
}
]]>
</mx:Script>
<mx:VBox width="100%" height="100%">
<cti_control:CTIViewTitle id="GUI_titleBar" label="{title}" width="100%" height="25" />
<mx:Canvas width="100%" height="28" >
<mx:Canvas width="100%" height="100%" visible="{tabNavigator_GUI.selectedIndex != 1}" >
<mx:HBox width="100%">
<mx:Button height="28" width="28" toolTip="Réafficher" icon="@Embed('../../base/swf/CTI/images/24/view-refresh.png')" labelPlacement="right" click="getData()" />
<mx:Spacer />
<mx:Button height="28" width="28" toolTip="Aide" icon="@Embed('../../base/swf/CTI/images/24/help.png')" labelPlacement="right" click="application.displayHelp()" visible="{hasHelp}" />
<mx:Button height="28" width="28" toolTip="A propos" icon="@Embed('../../base/swf/CTI/images/24/information.png')" labelPlacement="right" click="application.showApropos_view()" />
</mx:HBox>
</mx:Canvas>
<mx:Canvas width="100%" height="100%" visible="{tabNavigator_GUI.selectedIndex == 1}" >
<mx:HBox width="100%">
<mx:Button height="28" width="28" toolTip="Réafficher" icon="@Embed('../../base/swf/CTI/images/24/view-refresh.png')" labelPlacement="right" click="getData()" />
<mx:Button height="28" label="Afficher le fichier log" toolTip="Afficher le fichier log" icon="@Embed('../../base/swf/CTI/images/24/system-search.png')" labelPlacement="right" click="displayLog()" />
<mx:Spacer />
<mx:Button height="28" width="28" toolTip="Aide" icon="@Embed('../../base/swf/CTI/images/24/help.png')" labelPlacement="right" click="application.displayHelp()" visible="{hasHelp}" />
<mx:Button height="28" width="28" toolTip="A propos" icon="@Embed('../../base/swf/CTI/images/24/information.png')" labelPlacement="right" click="application.showApropos_view()" />
</mx:HBox>
</mx:Canvas>
</mx:Canvas>
<mx:TabNavigator id="tabNavigator_GUI" width="100%" height="100%" backgroundColor="0xf0f0f0" >
<mx:VBox width="100%" height="100%" label="Synchronisation des données">
<mx:Spacer height="5" />
<mx:Spacer height="5" />
<mx:Panel width="100%" height="100%" title="Synchronisation de l'intégralité des données" backgroundColor="0xf0f0f0">
<mx:Spacer height="3" />
<mx:Label width="100%" id="last_job_all_GUI" text="" />
<mx:Spacer height="3" />
<mx:Button height="28" width="100%" label="Synchroniser toutes les données " icon="@Embed('../../base/swf/CTI/images/24/system-run.png')" labelPlacement="right" click="synchronizeAll()" enabled="true"/>
<mx:Spacer height="3" />
<mx:TextArea id="synchronizeAll_description_GUI" width="100%" height="100%" htmlText="" editable="false" selectable="false" borderStyle="none" backgroundColor="0xf0f0f0"/>
</mx:Panel>
</mx:VBox>
<mx:VBox width="100%" height="100%" label="Historique des travaux">
<mx:DataGrid id="historique_UI"
rowCount="{jobsHistory_length + 1}" height="100%" width="100%" rowHeight="24"
wordWrap="false" dataProvider="{jobsHistory_list}"
>
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Nom" width="200"/>
<mx:DataGridColumn dataField="title" headerText="Titre" width="250" editable="false"/>
<mx:DataGridColumn dataField="start" headerText="Démarré" width="120" editable="false"/>
<mx:DataGridColumn dataField="end" headerText="Terminé" width="120" editable="false"/>
<mx:DataGridColumn dataField="endStatus" headerText="Statut" width="60" editable="false"/>
<mx:DataGridColumn dataField="duration" headerText="Durée" width="60" editable="false"/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
</mx:TabNavigator>
</mx:VBox>
</mx:Application>