359 lines
16 KiB
PHP
359 lines
16 KiB
PHP
<?php
|
|
session_start();
|
|
include_once 'clazz/Zincluder.php';
|
|
|
|
try{
|
|
|
|
$version = Version::showVersion($_SESSION['session_id'] ?? NULL,$_SESSION['session_mdp'] ?? NULL,$_GET['v'] ?? NULL);
|
|
|
|
|
|
}catch(SQLProcessingException $e){
|
|
echo $e->getHtmlMessage();
|
|
$_SESSION ['current_error'] = $e->getHtmlMessage();
|
|
header ( 'Location:' . ($e->getPreferredRedirection() ?? 'others.php') );
|
|
exit;
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<?php include 'includes/meta.php'; ?>
|
|
</head>
|
|
|
|
<body>
|
|
<?php include 'includes/header.php'; ?>
|
|
<?php
|
|
$su = $version['su'];
|
|
$ssu = $version['ssu'];
|
|
$langage = Langage::getFromId($version['langage']);
|
|
?>
|
|
<h1>Le projet <?php echo($version['projectName']) ?> en version <?php echo($version['name']) ?></h1>
|
|
<br/>
|
|
<?php if($langage->isJarAvalivable()){?>
|
|
<a class="project_option" href=<?php if($langage->isJarAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=jar&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isJarAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png"/>
|
|
</a>
|
|
<?php }if($langage->isJavaAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isJavaAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=java&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isJavaAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/view_code.png"/>
|
|
</a>
|
|
<?php }if($langage->isJavaAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isJavaAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=java&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isJavaAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png"/>
|
|
</a>
|
|
<?php }if($langage->isJavadocAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isJavadocAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=javadoc&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isJavadocAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png"/>
|
|
</a>
|
|
<?php }if($langage->isJavadocAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isJavadocAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=javadoc&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isJavadocAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png"/>
|
|
</a>
|
|
<?php }if($langage->isXlsmAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isXlsmAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=xlsm&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isXlsmAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png"/>
|
|
</a>
|
|
<?php }if($langage->isVbAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isVbAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=vb&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isVbAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png"/>
|
|
</a>
|
|
<?php }if($langage->isVbAvalivable()){ ?>
|
|
<a class="project_option" href=<?php if($langage->isVbAccessible($version['fileAccessibility']) OR $su){ echo( '"http://megabernard.alwaysdata.net/megaDownload.php?t=vb&v='.$version['ID'] . '"');}else{ echo( "\"#\"");} ?>>
|
|
<img class="project_option_img<?php if(!($langage->isVbAccessible($version['fileAccessibility']) OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png"/>
|
|
</a>
|
|
<?php } ?>
|
|
|
|
<script>
|
|
var projectID = <?php echo $version['projectID']; ?>;
|
|
var versionID = <?php echo $version['ID']; ?>;
|
|
</script>
|
|
|
|
<?php if($ssu){ ?>
|
|
|
|
<br/>
|
|
<br/><button id="editVersionButton">Editer la version</button>
|
|
<br/><button id="deleteVersionButton">Supprimer la version</button>
|
|
|
|
<div class="fullscreen absent big-background-semi-opaque" id="editVersionPanel">
|
|
<div class="screen-vertical-centered">
|
|
<div class="screen-horizontal-centered" id="editVersionPan">
|
|
<form id="eVersionForm">
|
|
<label for="nVersionName">Nom de la version</label>
|
|
<input type="text" id="nVersionName"><?php echo $version['name'] ?></input><br/>
|
|
<label for="languageSelect">Langage :</label>
|
|
<select id="languageSelect">
|
|
<option value="Java" <?php if($version['langage'] == Langage::$java->getID())echo 'selected=""'; ?>>Java</option>
|
|
<option value="VBA"<?php if($version['langage'] == Langage::$vba->getID())echo 'selected=""'; ?>>VBA</option>
|
|
</select><br/>
|
|
<label for="VAlphaCheck">Alpha : </label>
|
|
<input type="checkbox" id="VAlphaCheck" value="alpha" <?php if($version['alpha'])echo 'checked=""'; ?>/><br/>
|
|
<label for="VBetaCheck">Beta : </label>
|
|
<input type="checkbox" id="VBetaCheck" value="beta" <?php if($version['beta'])echo 'checked=""'; ?>/><br/>
|
|
<label for="VReleaseCheck">Release : </label>
|
|
<input type="checkbox" id="VReleaseCheck" value="release" <?php if($version['release'])echo 'checked=""'; ?>/><br/>
|
|
<label for="VBuggedCheck">Bogué : </label>
|
|
<input type="checkbox" id="VBuggedCheck" value="bugged" <?php if($version['bugged'])echo 'checked=""'; ?>/><br/>
|
|
</form><br/>
|
|
<ul class="gray-bordered fast-full-width gone-puce">
|
|
Mise a jour de la liste
|
|
</ul>
|
|
<button id="editVersionDone">Modifier la version</button><br/>
|
|
<button id="editVersionAbort">En fait ... non</button>
|
|
<script>
|
|
$('#nVersionName').on('input',updateVersionName);
|
|
$('#newVersionPan form').bind('submit',function() {return false;});
|
|
$('#editVersionDone').click(sendEditingRequest);
|
|
$('#editVersionAbort').click(function(){
|
|
$('#editVersionPanel').fadeOut(600);
|
|
});
|
|
var askVersionUpdate = function(){
|
|
$.post('executor.php?action=getVersionList&p='+projectID,{},answerVersionList);
|
|
};
|
|
|
|
|
|
var answerVersionList = function(newList){
|
|
var list = eval(newList);
|
|
$('#newVersionPan ul').empty();
|
|
$('#newVersionPan ul').append($('<li>‌</li>').attr('id',"versionAbsPotentialPos-1").addClass('potentialPos'));
|
|
list.forEach(function(item,index){
|
|
if(item['id'] != versionID){
|
|
var element = $('<li></li>');
|
|
element.text(item['name']);
|
|
element.data('versionAbs',item['versionAbs']);
|
|
element.addClass('hoverable');
|
|
$('#newVersionPan ul').append(element);
|
|
$('#newVersionPan ul').append($('<li>‌</li>').attr('id',"versionAbsPotentialPos" + index).addClass('potentialPos').css('display','none'));
|
|
}else{
|
|
window.currentIndex = $('#newVersionPan ul > li.hoverable').length - 1;
|
|
window.savedCurrentIndex = currentIndex;
|
|
}
|
|
});
|
|
$('#newVersionPan ul li.hoverable').mousemove(function(e){
|
|
var itemIndex = $('#newVersionPan ul > li.hoverable').index(this);
|
|
var index = (currentIndex < itemIndex)?itemIndex:itemIndex-1;
|
|
if(currentIndex != index){
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','none');
|
|
currentIndex = index;
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','block');
|
|
}
|
|
});
|
|
$('#newVersionPan ul').click(function(){
|
|
savedCurrentIndex = currentIndex;
|
|
});
|
|
$('#newVersionPan ul').hover(null,function(){
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','none');
|
|
currentIndex = savedCurrentIndex;
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','block');
|
|
});
|
|
};
|
|
function updateVersionName(){
|
|
var name = $('#nVersionName').val();
|
|
var pp = $('#newVersionPan ul li.potentialPos');
|
|
(name.match(/^\s*$/))?pp.html('‌'):pp.text(name);
|
|
}
|
|
|
|
function sendEditingRequest(){
|
|
var name = $('#nVersionName').val();
|
|
var langage = $('#languageSelect').val();
|
|
var tags = new Array();
|
|
$("#eVersionForm input:checked").each(function(){
|
|
tags.push($( this ).val());
|
|
});
|
|
var insertIndex = savedCurrentIndex;
|
|
|
|
$.post('executor.php?action=editVersion&v='+versionID,{name:name,langage:langage,tags:tags.join(' '),insertIndex:insertIndex},answerEditionRequest);
|
|
}
|
|
|
|
function answerEditionRequest(data){
|
|
if(data.startsWith('Error')){
|
|
console.log(data);//TODO la jolie boite de dialogue
|
|
}else
|
|
window.location.reload(true);
|
|
}
|
|
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$('#deleteVersionButton').click(function(){
|
|
$('#messagePan').addClass('redMessage').html('Voulez vous vraiment supprimer cette version ? Les fichiers seront supprimés automatiquement et seront irrécupérables et toutes les informations additionelles seront aussi supprimées et ce, définitivement !<br/><button>C\'est ainsi que version nous quitte ...</button><button>NONNNNNNN !!!!! NE MEURS PAS VERSIOOOOOOOON !!!!</button>');
|
|
$('#messagePan button:nth-of-type(1)').click(function(){
|
|
$.post('executor.php?action=delVersion&v='+versionID,{},function(data){
|
|
if(data == 'ok')window.location.replace('projet.php?p='+projectID);
|
|
});
|
|
});
|
|
$('#messagePan button:nth-of-type(2)').click(function(){
|
|
$('#messagePanel').fadeOut(600);
|
|
});
|
|
$('#messagePanel').fadeIn(600);
|
|
|
|
});
|
|
</script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
$('#editVersionButton').click(function(){
|
|
askVersionUpdate();
|
|
updateVersionName();
|
|
$('#editVersionPanel').fadeIn(600);
|
|
});
|
|
</script>
|
|
|
|
<?php } if($su) { ?>
|
|
|
|
<br/><button id="manageFilesButton">Gérer les fichiers</button>
|
|
|
|
|
|
<div class="fullscreen absent big-background-semi-opaque" id="newVersionPanel">
|
|
<div class="screen-vertical-centered">
|
|
<div class="screen-horizontal-centered" id="newVersionPan">
|
|
<form id="nVersionForm">
|
|
<label for="nVersionName">Nom de la version</label>
|
|
<input type="text" id="nVersionName" /><br/>
|
|
<label for="languageSelect">Langage :</label>
|
|
<select id="languageSelect">
|
|
<option value="Java">Java</option>
|
|
<option value="VBA">VBA</option>
|
|
</select><br/>
|
|
<label for="nVAlphaCheck">Alpha : </label>
|
|
<input type="checkbox" id="nVAlphaCheck" value="alpha"/><br/>
|
|
<label for="nVBetaCheck">Beta : </label>
|
|
<input type="checkbox" id="nVBetaCheck" value="beta"/><br/>
|
|
<label for="nVReleaseCheck">Release : </label>
|
|
<input type="checkbox" id="nVReleaseCheck" value="release"/><br/>
|
|
<label for="nVBuggedCheck">Bogué : </label>
|
|
<input type="checkbox" id="nVBuggedCheck" value="bugged"/><br/>
|
|
</form><br/>
|
|
<ul class="gray-bordered fast-full-width gone-puce">
|
|
Mise a jour de la liste
|
|
</ul>
|
|
<button id="createVersionDone">Créer la version</button><br/>
|
|
<button id="createVersionAbort">En fait ... non</button>
|
|
<script>
|
|
$('#nVersionName').on('input',updateVersionName);
|
|
$('#newVersionPan form').bind('submit',function() {return false;});
|
|
$('#createVersionDone').click(sendCreationRequest);
|
|
$('#createVersionAbort').click(function(){
|
|
$('#newVersionPanel').fadeOut(600);
|
|
});
|
|
var askVersionUpdate = function(){
|
|
$.post('executor.php?action=getVersionList&p='+projectID,{},answerVersionList);
|
|
};
|
|
|
|
|
|
var answerVersionList = function(newList){
|
|
var list = eval(newList);
|
|
$('#newVersionPan ul').empty();
|
|
$('#newVersionPan ul').append($('<li>‌</li>').attr('id',"versionAbsPotentialPos-1").addClass('potentialPos'));
|
|
list.forEach(function(item,index){
|
|
var element = $('<li></li>');
|
|
element.text(item['name']);
|
|
element.data('versionAbs',item['versionAbs']);
|
|
element.addClass('hoverable');
|
|
$('#newVersionPan ul').append(element);
|
|
$('#newVersionPan ul').append($('<li>‌</li>').attr('id',"versionAbsPotentialPos" + index).addClass('potentialPos').css('display','none'));
|
|
});
|
|
window.currentIndex = $('#newVersionPan ul > li.hoverable').length - 1;
|
|
window.savedCurrentIndex = currentIndex;
|
|
$('#newVersionPan ul li.hoverable').mousemove(function(e){
|
|
var itemIndex = $('#newVersionPan ul > li.hoverable').index(this);
|
|
var index = (currentIndex < itemIndex)?itemIndex:itemIndex-1;
|
|
if(currentIndex != index){
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','none');
|
|
currentIndex = index;
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','block');
|
|
}
|
|
});
|
|
$('#newVersionPan ul').click(function(){
|
|
savedCurrentIndex = currentIndex;
|
|
});
|
|
$('#newVersionPan ul').hover(null,function(){
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','none');
|
|
currentIndex = savedCurrentIndex;
|
|
$("#versionAbsPotentialPos"+currentIndex).css('display','block');
|
|
});
|
|
};
|
|
function updateVersionName(){
|
|
var name = $('#nVersionName').val();
|
|
var pp = $('#newVersionPan ul li.potentialPos');
|
|
(name.match(/^\s*$/))?pp.html('‌'):pp.text(name);
|
|
}
|
|
|
|
function sendCreationRequest(){
|
|
var name = $('#nVersionName').val();
|
|
var langage = $('#languageSelect').val();
|
|
var tags = new Array();
|
|
$("#nVersionForm input:checked").each(function(){
|
|
tags.push($( this ).val());
|
|
});
|
|
var insertIndex = savedCurrentIndex;
|
|
|
|
$.post('executor.php?action=createVersion&p='+projectID,{name:name,langage:langage,tags:tags.join(' '),insertIndex:insertIndex},answerCreationRequest);
|
|
}
|
|
|
|
function answerCreationRequest(data){
|
|
if(!data.startsWith('www.bernard.890m.com')){
|
|
console.log(data);//TODO la jolie boite de dialogue
|
|
}else
|
|
window.location.replace(data);
|
|
}
|
|
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="fullscreen absent big-background-semi-opaque" id="messagePanel">
|
|
<div class="screen-vertical-centered">
|
|
<div class="screen-horizontal-centered" id="messagePan">
|
|
<!-- Progamically filled -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$('#newVersionButton').click(function(){
|
|
askVersionUpdate();
|
|
$('#newVersionPanel').fadeIn(600);
|
|
});
|
|
</script>
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
<br/>
|
|
<br/>
|
|
<?php if(count($version['brothers']) > 0){ ?>
|
|
<?php $languages = array();
|
|
foreach($version['brothers'] AS $v)
|
|
array_push($languages,$v['language']);
|
|
$languages = array_unique($languages,SORT_REGULAR); ?>
|
|
<h3>Toutes les versions :</h3>
|
|
<br/>
|
|
<?php foreach($languages as $language){ ?>
|
|
<table class="versionTable">
|
|
<tr>
|
|
<th><?php echo Langage::getFromId($language)->getName(); ?></th>
|
|
</tr>
|
|
<?php foreach ($version['brothers'] as $writingVersion){if($writingVersion['language'] == $language){ ?>
|
|
<tr><td><a href = "version.php?v=<?php echo $writingVersion['ID'];?>"><?php echo $writingVersion['name']; ?></a></td></tr>
|
|
<?php }}?>
|
|
</table>
|
|
<?php } ?>
|
|
<?php }?>
|
|
<br/>
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
|
|
<?php include 'includes/footer.php'; ?>
|
|
</body>
|
|
</html>
|