

function DoFormWorkflowAction(strAction, strRole, intIdDocument, intIdMasterDoc, intIdType, intIdTypeNew) {

   switch (strAction) { 
   
      case 'ACTION_ENREGISTRE': 
         DoEnregistre(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;

      case 'ACTION_DEMANDE_LA_VALIDATION': 
      case 'ACTION_DEMANDE_LA_PUBLICATION': 
      case 'ACTION_PUBLIE': 
      case 'ACTION_REFUSE_LA_VALIDATION': 
      case 'ACTION_REFUSE_LA_PUBLICATION': 
         DoEnregistre(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;

      case 'ACTION_REFUSE_LA_VALIDATION_DE_SUPPRESSION': 
      case 'ACTION_REFUSE_LA_PUBLICATION_DE_SUPPRESSION': 
      case 'ACTION_DEMANDE_LA_VALIDATION_DE_SUPPRESSION': 
      case 'ACTION_DEMANDE_LA_PUBLICATION_DE_SUPPRESSION': 

         DoValidation(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;

      case 'ACTION_ACCEPTE_LA_PUBLICATION_DE_SUPPRESSION': 

         ConfirmDelete(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;

      case 'ACTION_SUPPRIME': 

      default: 
         alert('Action inconnue: '+ strAction); 
         break;
   } 
}

function DoWorkflowAction(strAction, strRole, intIdDocument, intIdMasterDoc, intIdType, intIdTypeNew) {

   switch (strAction) { 
   
      case 'ACTION_ENREGISTRE': 
      
         alert(strAction + ': action non traitée');
         break;

      case 'ACTION_DEMANDE_LA_VALIDATION': 
      case 'ACTION_DEMANDE_LA_PUBLICATION': 
      case 'ACTION_REFUSE_LA_VALIDATION_DE_SUPPRESSION': 
      case 'ACTION_REFUSE_LA_PUBLICATION_DE_SUPPRESSION': 
      case 'ACTION_REFUSE_LA_VALIDATION': 
      case 'ACTION_REFUSE_LA_PUBLICATION': 
      case 'ACTION_PUBLIE': 
      
         DoValidation(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;

      case 'ACTION_DEMANDE_LA_VALIDATION_DE_SUPPRESSION': 
      case 'ACTION_DEMANDE_LA_PUBLICATION_DE_SUPPRESSION': 
      case 'ACTION_SUPPRIME': 
      case 'ACTION_ACCEPTE_LA_PUBLICATION_DE_SUPPRESSION': 
     
         ConfirmDelete(strAction, intIdDocument, intIdMasterDoc, intIdType);
         break;


      default: 
         alert('Action inconnue: '+ strAction); 
         break;
   } 
}

function ConfirmDelete(strAction, indIdDocument, intIdMasterDoc, intIdType) {

	var strLocation;
	var blnConfirm;
	
	blnConfirm = confirm('Confirmer la suppression ?');
	if(blnConfirm){
      strLocation = '/d2w/Document/doDeleteDocument.asp?Action='+ strAction +'&IdDocument='+ indIdDocument +'&IdMaster='+ intIdMasterDoc +'&IdType='+ intIdType;
		document.location.href= strLocation;
		// alert(strLocation)
	} else {
		document.location.href='/content/Admin/Document/dispListDocument.asp';
   }
}

function ConfirmDeleteMembre(strAction, indIdDocument, intIdMasterDoc, intIdType) {

   alert('ConfirmDeleteMembre');
	var strLocation;
	var blnConfirm;
	
	blnConfirm = confirm('Attention, vous allez supprimer cette manifestation ainsi que toutes les inscriptions des membres.\n\nVous pouvez aussi archiver cette manifestation dans une autre catégorie.\n\nSouhaitez-vous quand même supprimer cette manifestations ?')
	if(blnConfirm){
      strLocation = '/d2w/Document/doDeleteDocument.asp?ConfirmMembreDeletion=yes&Action='+ strAction +'&IdDocument='+ indIdDocument +'&IdMaster='+ intIdMasterDoc +'&IdType='+ intIdType;
		document.location.href= strLocation;
	} else {
		document.location.href='/content/Admin/Document/dispListDocument.asp';
	}

}

function DoValidation(strAction, indIdDocument, intIdMasterDoc, intIdType) {

	var strLocation;
	var blnConfirm;
	
   strLocation = '/d2w/Document/doValidateDocument.asp?Action='+ strAction +'&IdDocument='+ indIdDocument +'&IdMaster='+ intIdMasterDoc +'&IdType='+ intIdType;
	document.location.href= strLocation;

}

function DoEnregistre(strAction, indIdDocument, intIdMasterDoc, intIdType) {

	var strLocation;
	var blnConfirm;
	
	document.d2wformdocument.WorkflowAction.value = strAction;
	
   SubmitForm();	

}


