Ajout dela structure MDT dans Infra-LAB
This commit is contained in:
@@ -0,0 +1,616 @@
|
||||
' // ***************************************************************************
|
||||
' //
|
||||
' // Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
' //
|
||||
' // Microsoft Deployment Toolkit Solution Accelerator
|
||||
' //
|
||||
' // File: DeployWiz_Initialization.vbs
|
||||
' //
|
||||
' // Version: 6.3.8456.1000
|
||||
' //
|
||||
' // Purpose: Main Client Deployment Wizard Initialization routines
|
||||
' //
|
||||
' // ***************************************************************************
|
||||
|
||||
|
||||
Option Explicit
|
||||
|
||||
Dim g_oTaskSequences
|
||||
Dim g_oSiteINI
|
||||
|
||||
|
||||
Function oTaskSequences
|
||||
|
||||
If isempty(g_oTaskSequences) then
|
||||
|
||||
oLogging.CreateEntry "Begin InitializeTSList...", LogTypeVerbose
|
||||
|
||||
set g_oTaskSequences = new ConfigFile
|
||||
g_oTaskSequences.sFileType = "TaskSequences"
|
||||
g_oTaskSequences.sSelectionProfile = oEnvironment.Item("WizardSelectionProfile")
|
||||
g_oTaskSequences.sCustomSelectionProfile = oEnvironment.Item("CustomWizardSelectionProfile")
|
||||
g_oTaskSequences.sHTMLPropertyHook = " onPropertyChange='TSItemChange'"
|
||||
set g_oTaskSequences.fnCustomFilter = GetRef("CustomTSFilter")
|
||||
|
||||
oLogging.CreateEntry "Finished InitializeTSList...", LogTypeVerbose
|
||||
|
||||
End if
|
||||
set oTaskSequences = g_oTaskSequences
|
||||
|
||||
End function
|
||||
|
||||
|
||||
function CustomTSFilter( sGuid, oItem )
|
||||
|
||||
' Hook for ZTIConfigFile.vbs. Return True only if the Item should be displayed, otherwise false.
|
||||
Dim oTaskList
|
||||
Dim oTaskOsGuid
|
||||
Dim oOS
|
||||
DIm sOSPlatform
|
||||
Dim sOSBuild
|
||||
|
||||
Set oTaskList = oUtility.LoadConfigFileSafe( "Control\" & oUtility.SelectSingleNodeString(oItem,"ID") & "\TS.xml")
|
||||
Set oTaskOsGuid = oTaskList.SelectSingleNode("//globalVarList/variable[@name='OSGUID']")
|
||||
|
||||
CustomTSFilter = True
|
||||
|
||||
If oTaskOsGuid is Nothing then
|
||||
|
||||
' This Task Sequence does not have any associated OS, allways include
|
||||
|
||||
ElseIf not AllOperatingSystems.Exists(oTaskOsGuid.text) then
|
||||
|
||||
' This Task Sequence does not have any associated OS, allways include
|
||||
oLogging.CreateEntry "ERROR: Invalid OS GUID " & oTaskOsGuid.text & " specified for task sequence " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeInfo
|
||||
|
||||
Else
|
||||
|
||||
set oOS = AllOperatingSystems.Item(oTaskOsGuid.text)
|
||||
|
||||
If not oOS.selectSingleNode("SMSImage") is nothing then
|
||||
If ucase(oUtility.SelectSingleNodeString(oOS,"SMSImage")) = "TRUE" then
|
||||
oLogging.CreateEntry "Skip SMS OS " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeVerbose
|
||||
CustomTSFilter = False
|
||||
exit function
|
||||
End if
|
||||
End if
|
||||
|
||||
if not oOS.selectSingleNode("Platform") is nothing then
|
||||
|
||||
sOSPlatform = oUtility.SelectSingleNodeString(oOS,"Platform")
|
||||
sOSBuild = oUtility.SelectSingleNodeString(oOS, "Build")
|
||||
oUtility.GetMajorMinorVersion(sOSBuild)
|
||||
|
||||
If UCase(sOSPlatform) = UCase(oEnvironment.Item("Architecture")) then
|
||||
|
||||
' Same Archtecture as current OS, No problems.
|
||||
|
||||
ElseIf Instr(1, Property("CapableArchitecture"), sOSPlatform, vbTextCompare) = 0 then
|
||||
|
||||
oLogging.CreateEntry "Not Capable of running Platform: " & sOSPlatform & " " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeInfo
|
||||
CustomTSFilter = False
|
||||
|
||||
ElseIf UCase(sOSPlatform) = "X86" and UCase(oEnvironment.Item("Architecture")) = "X64" then
|
||||
|
||||
oLogging.CreateEntry "Skip cross platform x86 install from x64 Windows. " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeInfo
|
||||
CustomTSFilter = False
|
||||
|
||||
ElseIf ucase(oEnvironment.Item("ForceApplyFallback")) = "NEVER" and ucase(oUtility.SelectSingleNodeString(oOS, "IncludesSetup")) = "TRUE" then
|
||||
|
||||
oLogging.CreateEntry "Skip cross platform unattended install disabled (ForceApplyFallback = NEVER). " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeInfo
|
||||
CustomTSFilter = False
|
||||
|
||||
ElseIf oUtility.VersionMajor = 6 and oUtility.VersionMinor < 1 and ucase(oUtility.SelectSingleNodeString(oOS, "IncludesSetup")) = "TRUE" then
|
||||
|
||||
oLogging.CreateEntry "Skip cross platform unattended install for OS'es earlier than Windows 7. " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeInfo
|
||||
CustomTSFilter = False
|
||||
|
||||
ElseIf oEnv("SystemDrive") <> "X:" then
|
||||
|
||||
' We are not in WinPE, so we can still apply any OS
|
||||
End if
|
||||
|
||||
End if
|
||||
|
||||
End if
|
||||
|
||||
If not oItem.selectSingleNode("SupportedPlatform") is nothing then
|
||||
If not oUtility.IsSupportedPlatform(oUtility.SelectSingleNodeString(oItem,"SupportedPlatform")) then
|
||||
oLogging.CreateEntry "Skip unsupported platform " & oUtility.SelectSingleNodeString(oItem,"SupportedPlatform") & " in " & oUtility.SelectSingleNodeString(oItem,"ID"), LogTypeVerbose
|
||||
CustomTSFilter = False
|
||||
Exit function
|
||||
End if
|
||||
End if
|
||||
|
||||
End function
|
||||
|
||||
|
||||
Dim sCachedTSID
|
||||
Dim oCachedTaskList
|
||||
|
||||
Function FindTaskSequenceStep(sStepType, sScriptCmd )
|
||||
Dim oAction
|
||||
Dim oItem
|
||||
Dim oOptionDiableVal
|
||||
|
||||
|
||||
' Is there a task sequence chosen yet? If not, the step can't possibly be present
|
||||
|
||||
If Property("TaskSequenceID") = "" then
|
||||
oLogging.CreateEntry "No task sequence has been selected yet.", LogTypeVerbose
|
||||
FindTaskSequenceStep = false
|
||||
Exit Function
|
||||
End if
|
||||
|
||||
|
||||
' For efficiency, only load the task sequence if it has changed from the last time we loaded it
|
||||
|
||||
If sCachedTSID <> Property("TaskSequenceID") then
|
||||
Set oCachedTaskList = oUtility.LoadConfigFileSafe( Property("TaskSequenceID") & "\TS.XML" )
|
||||
sCachedTSID = Property("TaskSequenceID")
|
||||
End if
|
||||
|
||||
|
||||
' Get the list of nodes of the specified type
|
||||
|
||||
set oItem = oCachedTaskList.SelectNodes(sStepType)
|
||||
|
||||
|
||||
If not oItem is nothing then
|
||||
oLogging.CreateEntry "Found Task Sequence Item: " & sStepType, LogTypeInfo
|
||||
|
||||
ElseIf len(sScriptCmd) > 0 then
|
||||
|
||||
oLogging.CreateEntry "Unable to find Task Sequence step of type " & sStepType & ", performing more exhaustive search...", LogTypeInfo
|
||||
For each oAction in oCachedTaskList.SelectNodes("//action")
|
||||
If instr(1,oAction.XML,sScriptCmd,vbTExtCompare) <> 0 then
|
||||
oLogging.CreateEntry "Found Task Sequence Item: " & sScriptCmd, LogTypeInfo
|
||||
set oItem = oAction
|
||||
exit for
|
||||
End if
|
||||
Next
|
||||
|
||||
End if
|
||||
|
||||
|
||||
' Verify this step is not "disabled"...
|
||||
|
||||
If oItem is nothing then
|
||||
oLogging.CreateEntry "Unable to find Task Sequence step of type " & sStepType , LogTypeInfo
|
||||
FindTaskSequenceStep = False
|
||||
Else
|
||||
'Loop through each step in the collection until first enabled step and exit the loop
|
||||
For each oOptionDiableVal in oItem
|
||||
set oAction = oOptionDiableVal.Attributes.getNamedItem("disable")
|
||||
If oAction is nothing then
|
||||
FindTaskSequenceStep = true
|
||||
|
||||
Else
|
||||
FindTaskSequenceStep = lcase(oAction.Value) <> "true"
|
||||
|
||||
If FindTaskSequenceStep = true then
|
||||
Exit For
|
||||
End If
|
||||
End if
|
||||
Next
|
||||
|
||||
oLogging.CreateEntry "Found Task Sequence step of type " & sStepType & " = " & FindTaskSequenceStep, LogTypeInfo
|
||||
|
||||
End if
|
||||
|
||||
End function
|
||||
|
||||
Function InitializeConfigurationPoste
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
oLogging.CreateEntry "InitializeConfigurationPoste: started, SiteCode = '" & Property("SiteCode") & "'", LogTypeInfo
|
||||
|
||||
Dim bLoadedSite
|
||||
Dim sSiteCode
|
||||
bLoadedSite = False
|
||||
|
||||
If Trim(Property("SiteCode")) <> "" Then
|
||||
sSiteCode = Trim(Property("SiteCode"))
|
||||
' MsgBox "DEBUG: SiteCode détecté = " & sSiteCode & vbCrLf & _
|
||||
' "Tentative de chargement du fichier : " & Property("DeployRoot") & "\Scripts\sites\" & LCase(sSiteCode) & ".ini", vbInformation, "Debug LoadSiteINI"
|
||||
oLogging.CreateEntry "InitializeConfigurationPoste: SiteCode détecté = " & sSiteCode, LogTypeInfo
|
||||
If EnsureSiteLoaded Then
|
||||
PopulateSalles
|
||||
bLoadedSite = True
|
||||
Else
|
||||
oLogging.CreateEntry "InitializeConfigurationPoste: LoadSiteINI failed for " & Property("SiteCode"), LogTypeError
|
||||
If Not SiteCodeError Is Nothing Then
|
||||
SiteCodeError.InnerText = "Fichier site introuvable pour " & Property("SiteCode") & ". Saisissez le code du site manuellement."
|
||||
SiteCodeError.style.display = "inline"
|
||||
End If
|
||||
MsgBox "DEBUG: LoadSiteINI échoue pour " & Property("SiteCode") & ". Vérifiez le fichier sXXXX.ini et le log.", vbExclamation, "Debug LoadSiteINI"
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not bLoadedSite Then
|
||||
If Not GatewayWarning Is Nothing Then
|
||||
GatewayWarning.InnerText = "Passerelle non définie : saisie manuelle du code site possible."
|
||||
GatewayWarning.style.display = "inline"
|
||||
End If
|
||||
If Not SiteCodeManual Is Nothing Then
|
||||
SiteCodeManual.style.display = "inline"
|
||||
SiteCodeManual.Value = ""
|
||||
End If
|
||||
Else
|
||||
If Not GatewayWarning Is Nothing Then GatewayWarning.style.display = "none"
|
||||
If Not SiteCodeError Is Nothing Then SiteCodeError.style.display = "none"
|
||||
If Not SiteCodeManual Is Nothing Then SiteCodeManual.style.display = "none"
|
||||
End If
|
||||
|
||||
Dim oSalleSelectInit
|
||||
Set oSalleSelectInit = document.getElementById("SalleSelect")
|
||||
If Not oSalleSelectInit Is Nothing Then
|
||||
If oSalleSelectInit.options.length > 0 Then
|
||||
oSalleSelectInit.selectedIndex = 0
|
||||
oEnvironment.Item("Salle") = oSalleSelectInit.options(0).value
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not RoleProf Is Nothing Then RoleProf.Checked = True
|
||||
If Not RoleEleve Is Nothing Then RoleEleve.Checked = False
|
||||
|
||||
If Not OSDComputerNumber Is Nothing Then
|
||||
If Trim(OSDComputerNumber.Value) = "" Then
|
||||
OSDComputerNumber.Value = "01"
|
||||
End If
|
||||
End If
|
||||
|
||||
UpdatePreview
|
||||
|
||||
InitializeConfigurationPoste = True
|
||||
|
||||
End Function
|
||||
|
||||
Function EnsureSiteLoaded()
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
' MsgBox "DEBUG: EnsureSiteLoaded called", vbInformation, "Debug EnsureSiteLoaded"
|
||||
|
||||
If Trim(Property("SiteCode")) = "" Then
|
||||
EnsureSiteLoaded = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not g_oSiteINI Is Nothing Then
|
||||
Dim sCurrentSalles
|
||||
sCurrentSalles = ReadIniValue("Default", "Salles")
|
||||
oLogging.CreateEntry "EnsureSiteLoaded: Current salles=" & sCurrentSalles, LogTypeVerbose
|
||||
If sCurrentSalles <> "" Then
|
||||
EnsureSiteLoaded = True
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
|
||||
EnsureSiteLoaded = LoadSiteINI()
|
||||
|
||||
End Function
|
||||
|
||||
Function LoadSiteINI()
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
oLogging.CreateEntry "LoadSiteINI: started", LogTypeInfo
|
||||
|
||||
Dim sIniFile
|
||||
Dim oFSO
|
||||
Dim oStream
|
||||
Dim sContent
|
||||
Dim aLines
|
||||
Dim sLine
|
||||
Dim sSection
|
||||
Dim oSection
|
||||
Dim iEq
|
||||
Dim sName
|
||||
Dim sValue
|
||||
Dim sSiteCode
|
||||
|
||||
Set g_oSiteINI = CreateObject("Scripting.Dictionary")
|
||||
|
||||
sSiteCode = Trim(Property("SiteCode"))
|
||||
If sSiteCode = "" Then
|
||||
oLogging.CreateEntry "LoadSiteINI: SiteCode vide.", LogTypeWarning
|
||||
LoadSiteINI = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
sSiteCode = LCase(sSiteCode)
|
||||
If Left(sSiteCode,1) <> "s" Then sSiteCode = "s" & sSiteCode
|
||||
|
||||
sIniFile = Property("DeployRoot") & "\Scripts\sites\" & sSiteCode & ".ini"
|
||||
oLogging.CreateEntry "LoadSiteINI: tentative chargement " & sIniFile, LogTypeInfo
|
||||
|
||||
Set oFSO = CreateObject("Scripting.FileSystemObject")
|
||||
If Not oFSO.FileExists(sIniFile) Then
|
||||
oLogging.CreateEntry "LoadSiteINI: fichier introuvable " & sIniFile, LogTypeError
|
||||
LoadSiteINI = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' Use ADODB.Stream to read UTF-8 file properly
|
||||
Set oStream = CreateObject("ADODB.Stream")
|
||||
oStream.Type = 2 ' adTypeText
|
||||
oStream.Charset = "utf-8"
|
||||
oStream.Open
|
||||
oStream.LoadFromFile sIniFile
|
||||
sContent = oStream.ReadText
|
||||
oStream.Close
|
||||
|
||||
' MsgBox "DEBUG: Content length = " & Len(sContent), vbInformation, "Debug Content"
|
||||
aLines = Split(sContent, vbCrLf)
|
||||
' MsgBox "DEBUG: Lines count = " & (UBound(aLines) + 1), vbInformation, "Debug Lines"
|
||||
For Each sLine In aLines
|
||||
sLine = Trim(sLine)
|
||||
If Len(sLine) > 0 Then
|
||||
If Left(sLine,1) = ";" Or Left(sLine,1) = "#" Then
|
||||
' ignore comments
|
||||
ElseIf Left(sLine,1) = "[" And Right(sLine,1) = "]" Then
|
||||
sSection = LCase(Mid(sLine,2,Len(sLine)-2))
|
||||
If Not g_oSiteINI.Exists(sSection) Then
|
||||
Set oSection = CreateObject("Scripting.Dictionary")
|
||||
oSection.CompareMode = vbTextCompare
|
||||
g_oSiteINI.Add sSection, oSection
|
||||
End If
|
||||
' MsgBox "DEBUG: Section found: " & sSection, vbInformation, "Debug Section"
|
||||
ElseIf InStr(1,sLine,"=",vbTextCompare) > 0 And sSection <> "" Then
|
||||
iEq = InStr(1,sLine,"=",vbTextCompare)
|
||||
sName = LCase(Trim(Left(sLine,iEq-1)))
|
||||
sValue = Trim(Mid(sLine,iEq+1))
|
||||
If g_oSiteINI.Exists(sSection) Then
|
||||
g_oSiteINI.Item(sSection).Item(sName) = sValue
|
||||
' If sSection = "default" And sName = "salles" Then
|
||||
' MsgBox "DEBUG: Salles found: " & sValue, vbInformation, "Debug Salles"
|
||||
' End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
On Error Resume Next
|
||||
Dim sSections
|
||||
sSections = Join(g_oSiteINI.Keys, ", ")
|
||||
oLogging.CreateEntry "LoadSiteINI: sections chargées = " & sSections, LogTypeInfo
|
||||
If Err.Number <> 0 Then
|
||||
oLogging.CreateEntry "LoadSiteINI: impossible de lister les sections du fichier INI", LogTypeWarning
|
||||
Err.Clear
|
||||
ElseIf g_oSiteINI.Exists("default") Then
|
||||
Dim sKeys
|
||||
sKeys = Join(g_oSiteINI.Item("default").Keys, ", ")
|
||||
oLogging.CreateEntry "LoadSiteINI: clés dans [Default] = " & sKeys, LogTypeInfo
|
||||
End If
|
||||
|
||||
LoadSiteINI = True
|
||||
' MsgBox "DEBUG: LoadSiteINI terminé avec succès", vbInformation, "Debug LoadSiteINI"
|
||||
|
||||
End Function
|
||||
|
||||
Function ReadIniValue(sSection, sKey)
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim sLowerKey
|
||||
Dim sLowerSection
|
||||
|
||||
If g_oSiteINI Is Nothing Then LoadSiteINI
|
||||
If g_oSiteINI Is Nothing Then
|
||||
ReadIniValue = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
sLowerSection = LCase(sSection)
|
||||
sLowerKey = LCase(sKey)
|
||||
If Not g_oSiteINI.Exists(sLowerSection) Then
|
||||
ReadIniValue = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not g_oSiteINI.Item(sLowerSection).Exists(sLowerKey) Then
|
||||
ReadIniValue = ""
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
ReadIniValue = g_oSiteINI.Item(sLowerSection).Item(sLowerKey)
|
||||
|
||||
End Function
|
||||
|
||||
Sub PopulateSalles
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
oLogging.CreateEntry "PopulateSalles: started", LogTypeInfo
|
||||
|
||||
Dim sSalles
|
||||
Dim aSalles
|
||||
Dim i
|
||||
Dim sSalle
|
||||
|
||||
Dim oSalleSelect
|
||||
|
||||
If g_oSiteINI Is Nothing Then LoadSiteINI
|
||||
|
||||
sSalles = ReadIniValue("Default","Salles")
|
||||
oLogging.CreateEntry "PopulateSalles: Salles récupérées = " & sSalles, LogTypeInfo
|
||||
If sSalles = "" Then
|
||||
oLogging.CreateEntry "PopulateSalles: aucune salle trouvée dans l'INI.", LogTypeWarning
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
aSalles = Split(sSalles,",")
|
||||
oLogging.CreateEntry "PopulateSalles: nombre d'éléments à ajouter = " & (UBound(aSalles) + 1), LogTypeInfo
|
||||
|
||||
Set oSalleSelect = document.getElementById("SalleSelect")
|
||||
If oSalleSelect Is Nothing Then
|
||||
oLogging.CreateEntry "PopulateSalles: getElementById(SalleSelect) introuvable.", LogTypeError
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Clear existing options
|
||||
Do While oSalleSelect.options.length > 0
|
||||
oSalleSelect.options.remove(0)
|
||||
Loop
|
||||
|
||||
' options.add() is the only reliable method in MSHTML/HTA — innerHTML on <select> is read-only in this engine
|
||||
Dim oOpt
|
||||
For i = 0 To UBound(aSalles)
|
||||
sSalle = Trim(aSalles(i))
|
||||
If sSalle <> "" Then
|
||||
Set oOpt = document.createElement("OPTION")
|
||||
oOpt.text = sSalle
|
||||
oOpt.value = sSalle
|
||||
oSalleSelect.options.add(oOpt)
|
||||
End If
|
||||
Next
|
||||
|
||||
oLogging.CreateEntry "PopulateSalles: options dans SalleSelect = " & oSalleSelect.options.length, LogTypeInfo
|
||||
|
||||
If oSalleSelect.options.length = 0 Then
|
||||
oLogging.CreateEntry "PopulateSalles: aucune option insérée malgré options.add.", LogTypeWarning
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub UpdatePreview
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim sSalle
|
||||
Dim sRole
|
||||
Dim sNumber
|
||||
Dim sSite
|
||||
Dim sPrefix
|
||||
Dim sName
|
||||
|
||||
sSalle = ""
|
||||
sRole = ""
|
||||
sNumber = ""
|
||||
sSite = Property("SiteCode")
|
||||
sPrefix = Property("Prefix")
|
||||
|
||||
Dim oSalleSelectUpd
|
||||
Set oSalleSelectUpd = document.getElementById("SalleSelect")
|
||||
|
||||
If Trim(Property("SiteCode")) <> "" Then
|
||||
If Not oSalleSelectUpd Is Nothing Then
|
||||
If oSalleSelectUpd.options.length = 0 Then
|
||||
If EnsureSiteLoaded Then PopulateSalles
|
||||
Set oSalleSelectUpd = document.getElementById("SalleSelect")
|
||||
End If
|
||||
Else
|
||||
EnsureSiteLoaded
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not oSalleSelectUpd Is Nothing Then
|
||||
sSalle = Trim(oSalleSelectUpd.value)
|
||||
End If
|
||||
|
||||
If Not RoleProf Is Nothing And RoleProf.Checked Then
|
||||
sRole = "P"
|
||||
ElseIf Not RoleEleve Is Nothing And RoleEleve.Checked Then
|
||||
sRole = ""
|
||||
End If
|
||||
|
||||
If Not OSDComputerNumber Is Nothing Then
|
||||
sNumber = Trim(OSDComputerNumber.Value)
|
||||
End If
|
||||
|
||||
If IsNumeric(sNumber) Then
|
||||
sNumber = CInt(sNumber)
|
||||
If sNumber < 1 Then sNumber = 1
|
||||
sNumber = Right("0" & CStr(sNumber), 2)
|
||||
InvalidNumber.style.display = "none"
|
||||
ElseIf sNumber = "" Then
|
||||
InvalidNumber.style.display = "none"
|
||||
Else
|
||||
InvalidNumber.style.display = "inline"
|
||||
End If
|
||||
|
||||
sName = sSite & "-" & sSalle & "-" & sPrefix & sRole & sNumber
|
||||
|
||||
If Not ComputerPreview Is Nothing Then
|
||||
ComputerPreview.InnerText = sName
|
||||
End If
|
||||
|
||||
oEnvironment.Item("Salle") = sSalle
|
||||
oEnvironment.Item("PosteType") = sRole
|
||||
oEnvironment.Item("OSDComputerNumber") = sNumber
|
||||
oEnvironment.Item("OSDComputerName") = sName
|
||||
|
||||
End Sub
|
||||
|
||||
Function SiteCodeManualChange
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim sSiteCode
|
||||
|
||||
If SiteCodeManual Is Nothing Then
|
||||
SiteCodeManualChange = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
sSiteCode = Trim(SiteCodeManual.Value)
|
||||
If sSiteCode = "" Then
|
||||
If Not InvalidSiteCode Is Nothing Then InvalidSiteCode.style.display = "inline"
|
||||
SiteCodeManualChange = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not InvalidSiteCode Is Nothing Then InvalidSiteCode.style.display = "none"
|
||||
|
||||
If Left(LCase(sSiteCode),1) <> "s" Then sSiteCode = "s" & sSiteCode
|
||||
oEnvironment.Item("SiteCode") = sSiteCode
|
||||
|
||||
If LoadSiteINI Then
|
||||
PopulateSalles
|
||||
If Not GatewayWarning Is Nothing Then GatewayWarning.style.display = "none"
|
||||
If Not SiteCodeError Is Nothing Then SiteCodeError.style.display = "none"
|
||||
If Not SiteCodeManual Is Nothing Then SiteCodeManual.style.display = "none"
|
||||
Else
|
||||
If Not SiteCodeError Is Nothing Then
|
||||
SiteCodeError.InnerText = "Fichier de site introuvable pour " & sSiteCode & "."
|
||||
SiteCodeError.style.display = "inline"
|
||||
End If
|
||||
SiteCodeManualChange = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
SiteCodeManualChange = True
|
||||
|
||||
End Function
|
||||
|
||||
Function ValidateConfigurationPoste
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
Dim sNumber
|
||||
|
||||
If Not OSDComputerNumber Is Nothing Then
|
||||
sNumber = Trim(OSDComputerNumber.Value)
|
||||
Else
|
||||
sNumber = ""
|
||||
End If
|
||||
|
||||
If sNumber = "" Then
|
||||
MsgBox "Veuillez saisir un numéro de poste."
|
||||
ValidateConfigurationPoste = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If Not IsNumeric(sNumber) Then
|
||||
MsgBox "Le numéro de poste doit être numérique."
|
||||
ValidateConfigurationPoste = False
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
UpdatePreview
|
||||
|
||||
ValidateConfigurationPoste = True
|
||||
|
||||
End Function
|
||||
Reference in New Issue
Block a user