?? webflow1.js
字號(hào):
function newFlow(){
if(document.all.FlowXML.value!='') {
if(!confirm('不保存舊流程,創(chuàng)建新流程嗎?')) return;
}
workFlowDialog(null,'Flow');
}
function newStep(){
if(document.all.FlowXML.value=='') {
alert('請(qǐng)先創(chuàng)建新流程!');
return;
}
workFlowDialog(null,'NormalStep');
}
function newAction(){
if(document.all.FlowXML.value=='') {
alert('請(qǐng)先創(chuàng)建新流程!');
return;
}
workFlowDialog(null,'Action');
}
function editFlow(){
if(document.all.FlowXML.value=='') {
alert('請(qǐng)先創(chuàng)建新流程!');
return;
}
var xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.async = false;
xmlDoc.loadXML(document.all.FlowXML.value);
var xmlRoot = xmlDoc.documentElement;
var Flow = xmlRoot.getElementsByTagName("FlowConfig").item(0);
workFlowDialog(Flow.getElementsByTagName("BaseProperties").item(0).getAttribute("flowId"),'Flow');
}
function editStep(stepId,stepType){
workFlowDialog(stepId,stepType);
}
function editAction(actionId){
workFlowDialog(actionId,'Action');
}
function delFlow(){
clearVML();
clearXML();
}
function delStep(stepId){
removeXMLNode(stepId);
FOCUSEDOBJID = '';
FOCUSEDOBJTYPE = '';
}
function delAction(actionId){
removeXMLNode(actionId);
FOCUSEDOBJID = '';
FOCUSEDOBJTYPE = '';
}
var CONST_LAY_LOWEST = '0';
var CONST_LAY_LOWER = '10';
var CONST_LAY_MIDDLE = '20';
var CONST_LAY_TOPPER = '30';
var CONST_LAY_TOPPEST = '40';
var AUTODRAW = true;
var FOCUSEDOBJID = '';
var FOCUSEDOBJTYPE = '';
function setFocusedObjLay(xmlRoot,oldObjId,newObjId,objType,newLay){
var Steps = xmlRoot.getElementsByTagName("Steps").item(0);
var Actions = xmlRoot.getElementsByTagName("Actions").item(0);
if(objType=='Action'){
for ( var i = 0;i < Actions.childNodes.length;i++ ) {
Action = Actions.childNodes.item(i);
aId = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
if(aId == newObjId){
document.getElementById(newObjId).style.zIndex = newLay;
Action.getElementsByTagName("VMLProperties").item(0).setAttribute("zIndex",newLay);
}
}
}else{
if(oldObjId!='' && newObjId!='' && newObjId!=oldObjId){
var fromStep = document.getElementById(oldObjId);
var toStep = document.getElementById(newObjId);
var fromStepWidth = parseInt(fromStep.style.width);
var fromStepHeight = parseInt(fromStep.style.height);
var fromStepX = parseInt(fromStep.style.left);
var fromStepY = parseInt(fromStep.style.top);
var toStepWidth = parseInt(toStep.style.width);
var toStepHeight = parseInt(toStep.style.height);
var toStepX = parseInt(toStep.style.left);
var toStepY = parseInt(toStep.style.top);
var flag = ifRepeatStep(fromStepX,fromStepY,fromStepWidth,fromStepHeight,toStepX,toStepY,toStepWidth,toStepHeight);
}else{
var flag = false;
}
for ( var i = 0;i < Steps.childNodes.length;i++ ) {
Step = Steps.childNodes.item(i);
sId = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
if(newObjId == sId){
document.getElementById(sId).style.zIndex = newLay;
Step.getElementsByTagName("VMLProperties").item(0).setAttribute("zIndex",newLay);
}
if(oldObjId == sId && flag){ //如果與原來(lái)的焦點(diǎn)步驟疊蓋則將原來(lái)的步驟放在下面
document.getElementById(oldObjId).style.zIndex = parseInt(newLay)-10;
Step.getElementsByTagName("VMLProperties").item(0).setAttribute("zIndex",parseInt(newLay)-1);
}
}
for ( var i = 0;i < Actions.childNodes.length;i++ ) {
Action = Actions.childNodes.item(i);
aId = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
fromStep = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("from");
toStep = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("to");
if(fromStep == newObjId || toStep == newObjId){
document.getElementById(aId).style.zIndex = newLay;
Action.getElementsByTagName("VMLProperties").item(0).setAttribute("zIndex",newLay);
}else{
document.getElementById(aId).style.zIndex = CONST_LAY_MIDDLE;
Action.getElementsByTagName("VMLProperties").item(0).setAttribute("zIndex",parseInt(newLay)-1);
}
}
}
return xmlRoot;
}
function objFocusedOn(objId,type){
var FlowXML = document.all.FlowXML;
if(FlowXML.value!=''){
var xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.async = false;
xmlDoc.loadXML(FlowXML.value);
var xmlRoot = xmlDoc.documentElement;
var Flow = xmlRoot.getElementsByTagName("FlowConfig").item(0);
if(type=='Action'){
focusedOnColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("actionFocusedStrokeColor");
}else{
focusedOnColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepFocusedStrokeColor");
}
xmlRoot = setFocusedObjLay(xmlRoot,FOCUSEDOBJID,objId,type,CONST_LAY_TOPPEST);AUTODRAW = false;FlowXML.value = xmlRoot.xml;AUTODRAW = true;
document.getElementById(objId).style.zIndex = CONST_LAY_TOPPEST;
document.getElementById(objId).StrokeColor = focusedOnColor;
if(FOCUSEDOBJID == objId && MOVEFLAG) return;
objFocusedOff();
FOCUSEDOBJID = objId;
FOCUSEDOBJTYPE = type;
}
}
function objFocusedOff(){
if(FOCUSEDOBJID=='') return;
var FlowXML = document.all.FlowXML;
if(FlowXML.value!=''){
var xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.async = false;
xmlDoc.loadXML(FlowXML.value);
var xmlRoot = xmlDoc.documentElement;
var Flow = xmlRoot.getElementsByTagName("FlowConfig").item(0);
if(FOCUSEDOBJTYPE == 'Action'){
focusedOffColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("actionStrokeColor");
}else{
if(FOCUSEDOBJTYPE == 'BeginStep' || FOCUSEDOBJTYPE == 'EndStep'){
focusedOffColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("sStepStrokeColor");
}else{
focusedOffColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepStrokeColor");
}
}
eval('document.all.'+FOCUSEDOBJID+'.StrokeColor="'+focusedOffColor+'"');
FOCUSEDOBJID = '';
FOCUSEDOBJTYPE = '';
}
}
function moveStep(moveId){
dragIt(moveId,"FlowVML");
}
function redrawVML(){
var FlowXML = document.all.FlowXML;
var FlowVML = document.all.FlowVML;
if(FlowXML.value!=''){
var xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.async = false;
xmlDoc.loadXML(FlowXML.value);
var xmlRoot = xmlDoc.documentElement;
var Flow = xmlRoot.getElementsByTagName("FlowConfig").item(0);
var Steps = xmlRoot.getElementsByTagName("Steps").item(0);
var Actions = xmlRoot.getElementsByTagName("Actions").item(0);
var StepColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepStrokeColor");
var StepTextColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepTextColor");
var ActionColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("actionStrokeColor");
var sStepColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("sStepStrokeColor");
var sStepTextColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("sStepTextColor");
var StepShadowColor = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepShadowColor");
var IsStepShadow = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("isStepShadow");
var StepColor1 = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepColor1");
var StepColor2 = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("stepColor2");
var IsStep3D = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("isStep3D");
var Step3DDepth = Flow.getElementsByTagName("VMLProperties").item(0).getAttribute("step3DDepth");
var vmlHTML = '';
//draw steps
var nIndex,nId,nText,nType,nIsFocused,nTextColor,nStrokeColor,nShadowColor,nIsShadow,nWidth,nHeight,nX,nY,nStrokeWeight,nTextWeight,nColor1,nColor2,nIs3D,n3DDepth;
for ( var i = 0;i < Steps.childNodes.length;i++ )
{
Step = Steps.childNodes.item(i);
nId = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
nText = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("text");
nType = Step.getElementsByTagName("BaseProperties").item(0).getAttribute("stepType");
nIndex = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("zIndex");if(nIndex=='') nIndex = CONST_LAY_LOWEST;
if(nType=='BeginStep' || nType=='EndStep'){
nTextColor = sStepTextColor;
nStrokeColor = sStepColor;
}else{
nTextColor = StepTextColor;
nStrokeColor = StepColor;
}
nShadowColor = StepShadowColor;
nIsShadow = IsStepShadow;
nWidth = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("width");
nHeight = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("height");
nX = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("x");
nY = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("y");
nStrokeWeight = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("strokeWeight");
nTextWeight = Step.getElementsByTagName("VMLProperties").item(0).getAttribute("textWeight");
nColor1 = StepColor1;
nColor2 = StepColor2;
nIs3D = IsStep3D;
n3DDepth = Step3DDepth;
vmlHTML+= getStepHTML(nType,nIndex,nId,nText,nTextColor,nStrokeColor,nShadowColor,nIsShadow,nWidth,nHeight,nX,nY,nStrokeWeight,nTextWeight,nColor1,nColor2,nIs3D,n3DDepth);
}
clearVML();
drawObject(vmlHTML);
vmlHTML = '';
//draw actions
var removeFlag = false;
var lIndex,lId,lText,lType,lIsFocused,lFromStep,lToStep,lStrokeColor,lStrokeWeight,lStartArrow,lEndArrow;
for ( var i = 0;i < Actions.childNodes.length;i++ )
{
Action = Actions.childNodes.item(i);
lId = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("id");
lText = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("text");
lType = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("actionType");
lIndex = Action.getElementsByTagName("VMLProperties").item(0).getAttribute("zIndex");if(lIndex=='') lIndex = CONST_LAY_LOWER;
lFromStep = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("from");
lToStep = Action.getElementsByTagName("BaseProperties").item(0).getAttribute("to");
lStartArrow = Action.getElementsByTagName("VMLProperties").item(0).getAttribute("startArrow");
lEndArrow = Action.getElementsByTagName("VMLProperties").item(0).getAttribute("endArrow");
lStrokeWeight = Action.getElementsByTagName("VMLProperties").item(0).getAttribute("strokeWeight");
lStrokeColor = ActionColor;
result = getActionHTML(lType,lIndex,lId,lText,document.getElementById(lFromStep),document.getElementById(lToStep),lStrokeColor,lStrokeWeight,lStartArrow,lEndArrow)
if(result!='') {
vmlHTML+= result;
}else{
Actions.removeChild(Action);
removeFlag = true;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -