Das ist die Datei SCMS-Kit.js mit JavaScript-Funktionen, die im SCMS-Kit eingebunden sind
// Content Management Systeme im Eigenbau für Profis und Quereinsteiger
//
// XML - XSL -Teil
var ScmsProjectPropertiesTemplate = "ScmsProjectProperties.xml"
var DocumentObjectXML = new ActiveXObject("Microsoft.xmldom");
var xml_file_var_js = new ActiveXObject("Microsoft.xmldom");
var style_file_var_js = new ActiveXObject("Microsoft.xmldom");
var PathXMLorXSLDirPrm, PathDir, ProjectName_js, targetFilesExtension, InputFilesExtension, PathXMLFile, PathXSLFile;
function ScmsProjectLoad(PathScmsProject)
{ // Load for XML-, XSL- and targetFormatFilesDirectory on the scms-Desktop
if (PathScmsProject == "")
{ alert('Bitte legen Sie den Pfad im Feld Scms-kit Projekt fest.');
}
else DocumentObjectXML.load (PathScmsProject);
var PathProperties;
PathProperties = DocumentObjectXML.documentElement.childNodes;
ProjectName_js = PathProperties.item(0).text;
document.ControlCenterForm.ProjectName.value = ProjectName_js;
PathDir = PathProperties.item(1).text + "\\";
document.InputFormXML.InputFieldXML.value = PathDir;
ChangeSrc(PathDir,'FrameWithXMLFiles');
PathDir = PathProperties.item(2).text+ "\\";
document.InputFormXSL.InputFieldXSL.value = PathDir;
ChangeSrc(PathDir,'FrameWithXSLFiles');
PathDir = PathProperties.item(3).text+ "\\";
document.InputFormTargetFormat.InputFieldTargetFormat.value = PathDir;
ChangeSrc(PathDir,'FrameWithTargetFormatFiles');
targetFilesExtension = PathProperties.item(4).text;
document.InputFormTargetFormat.targetFilesExtensionField.value = targetFilesExtension
}
function ProjectExport(PathXMLDirPrm, PathXSLDirPrm,PathExportDirPrm, TransformMode)
/* der Parameter TransformMode kann nur zwei Werte haben:
'StandAloneXMLwithnXSL' oder 'nXMLwithStandAloneXSL'' */
{
var TransformMode;
if(document.ControlCenterForm.TransformModeCB[0].checked == true)
TransformMode="nXMLwithStandAloneXSL"
else if(document.ControlCenterForm.TransformModeCB[1].checked == true)
TransformMode="StandAloneXMLwithnXSL"
targetFilesExtension = document.InputFormTargetFormat.targetFilesExtensionField.value;
switch(TransformMode)
{
case "StandAloneXMLwithnXSL":
ReadStandAloneFile(PathXMLDirPrm, 'xml');
ReadnFiles(PathXSLDirPrm, 'xsl', PathExportDirPrm);
break;
case "nXMLwithStandAloneXSL":
ReadStandAloneFile(PathXSLDirPrm, 'xsl');
ReadnFiles(PathXMLDirPrm, 'xml', PathExportDirPrm);
break;
}
}
function Path4XMLorXSL(PathVB, FileNameVB, FileExtensionVB)
{
if (FileExtensionVB == "xml")
{ PathXMLFile = PathVB + FileNameVB;
}
else if (FileExtensionVB == "xsl")
{ PathXSLFile = PathVB + "/" + FileNameVB;
};
}
function ScmsProjectSave(PathSaveProject)
{ // Save the ScmsProject
var ScmsProjectProperties;
ProjectName_js = document.ControlCenterForm.ProjectName.value;
ScmsProjectProperties = '<?xml version="1.0" encoding="ISO-8859-1"?>\n<ScmsProjectProperties>\n<name>' + ProjectName_js + '</name>\n<PathContent>' ;
PathDir = document.InputFormXML.InputFieldXML.value ;
ScmsProjectProperties = ScmsProjectProperties + PathDir + '</PathContent>\n<PathStylesheets>';
PathDir = document.InputFormXSL.InputFieldXSL.value;
ScmsProjectProperties = ScmsProjectProperties + PathDir + '</PathStylesheets>\n<PathTargetFormatFiles>';
PathDir = document.InputFormTargetFormat.InputFieldTargetFormat.value;
ScmsProjectProperties = ScmsProjectProperties + PathDir + '</PathTargetFormatFiles>\n<targetFilesExtension>'
targetFilesExtension = document.InputFormTargetFormat.targetFilesExtensionField.value
ScmsProjectProperties = ScmsProjectProperties + targetFilesExtension + '</targetFilesExtension>\n</ScmsProjectProperties>';
// save Scms-kit Project
if (PathSaveProject == "")
{ alert('Bitte legen Sie den Pfad im Feld Scms-kit Projekt fest.');
}
else FileSave(PathSaveProject,ScmsProjectProperties);
}
function CreateTargetFormat(PathXMLFile_js,PathXSLDirPrm_js,PathExportDirPrm_js) {
var html_file_var;
xml_file_var_js.load(PathXMLFile_js);
style_file_var_js.load(PathXSLDirPrm_js);
html_file_var = xml_file_var_js.transformNode(style_file_var_js.documentElement);
FileSave(PathExportDirPrm_js,html_file_var);
}
function ChangeSrc(PathWorkSpace, FrameID)
{
var BrowserOutput = "";
var BrowserOutput = "<iframe src='" + PathWorkSpace + "' class='cDir' ></iframe>";
document.getElementById(FrameID).innerHTML = BrowserOutput;
}
function FileNameFind(FileNameFull)
{
var FileNameShort_js, FileNameParts=FileNameFull.split(".");
FileNameShort_js = FileNameParts[0];
InputFilesExtension = FileNameParts[1].toLowerCase();
return FileNameShort_js;
}