Nouvelle classe Membre, différente. D'autres modifs....
This commit is contained in:
+308
-50
@@ -5,6 +5,9 @@
|
||||
|
||||
<head>
|
||||
<?php include 'includes/meta.php'; ?>
|
||||
<script>
|
||||
var projectID = <?php echo $_GET['p']; ?>;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -12,63 +15,327 @@
|
||||
<?php
|
||||
//TODO re la fonction exiting
|
||||
$me = Membre::me();
|
||||
if(!isset($_GET['v'])){
|
||||
if(!isset($_GET['p'])){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Quand on demande des données, on donne des données !!!';
|
||||
exit;
|
||||
}
|
||||
$version = new Version($_GET['v']);
|
||||
if(!$version->exists()){
|
||||
$projet = new Projet($_GET['p']);
|
||||
if(!$projet->exists()){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées de la version néant ...';
|
||||
$_SESSION ['current_error'] = 'Je vais avoir du mal à afficher les donées du projet néant ...';
|
||||
exit;
|
||||
}
|
||||
if(count($version->getPublicFiles())<=0 && $me?$me->isAdminLevelLowerThan(12):FALSE && !$version->getProject()->haveRights()){
|
||||
if(!($projet->isPublic() or $me?$me->isAdminLevelGreaterThan(12):FALSE or $me?$projet->haveRights($me):FALSE)){
|
||||
header ( 'Location:projets.php');
|
||||
$_SESSION ['current_error'] = 'Vous n\'avez pas le droit d\'être ici ...<br/> DEGAGEZ !!!';
|
||||
exit;
|
||||
}
|
||||
$su = $me?$version->getProject()->haveRights($me):FALSE OR $me?$me->isAdminLevelHigherThan(12):FALSE;
|
||||
|
||||
$su = $me?$projet->haveRights($me):FALSE OR $me?$me->isAdminLevelGreaterThan(12):FALSE;
|
||||
$ssu = $me?$me->getID() == $projet->getOwner()->getID():FALSE OR $me?$me->isAdminLevelGreaterThan(13):FALSE;
|
||||
?>
|
||||
<h1>Le projet <?php echo($version->getProject()->getName()) ?> en version <?php echo($version->getName()) ?></h1>
|
||||
<script>
|
||||
var projectPublic = <?php echo $projet->isPublic()?'true':'false'; ?>;
|
||||
</script>
|
||||
<h1>Le projet <?php echo($projet->getName()); ?></h1>
|
||||
<br/>
|
||||
<?php if($version->getLanguage()->isJarAvalivable()){?>
|
||||
<a class="project_option" href=<?php if($version->isJarPublic() OR $su){ echo( '"megaProcess/downloadJar.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isJarPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger le jar" title="Télécharger le jar" src="pictures/download_jar.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isJavaAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isJavaPublic() OR $su){ echo( '"megaProcess/viewJavaSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isJavaPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/view_code.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isJavaAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isJavaPublic() OR $su){ echo( '"megaProcess/downloadJavaSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isJavaPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_code.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isJavadocAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isJavadocPublic() OR $su){ echo( '"megaProcess/viewJavadoc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isJavadocPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la doc" title="Voir la doc" src="pictures/view_javadoc.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isJavadocAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isJavadocPublic() OR $su){ echo( '"megaProcess/downloadJavadoc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isJavadocPublic() OR $su)){echo(" disabeled");} ?>" alt="Télecharger la doc" title="Télecharger la doc" src="pictures/download_javadoc.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isXlsmAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isXlsmPublic() OR $su){ echo( '"megaProcess/downloadXlsm.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isXlsmPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger le xlsm" title="Télécharger le xlsm" src="pictures/download_xlsm.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isVbAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isVbPublic() OR $su){ echo( '"megaProcess/viewVbSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isVbPublic() OR $su)){echo(" disabeled");} ?>" alt="Voir la source" title="Voir la source" src="pictures/voir_vb.png"/>
|
||||
</a>
|
||||
<?php }if($version->getLanguage()->isVbAvalivable()){ ?>
|
||||
<a class="project_option" href=<?php if($version->isVbPublic() OR $su){ echo( '"megaProcess/downloadVbSrc.php?v='.$version->getID() . '"');}else{ echo( "\"#\"");} ?>>
|
||||
<img class="project_option_img<?php if(!($version->isVbPublic() OR $su)){echo(" disabeled");} ?>" alt="Télécharger la source" title="Télécharger la source" src="pictures/download_vb.png"/>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
$couple = Utility::getHierarchicCouple();
|
||||
echo $couple[0] . ' : ' . $projet->getOwner()->getPseudo() . '<br/>';
|
||||
$str = $couple[1] . ' : ';
|
||||
foreach($projet->getSecondaryOwners() as $sowner)
|
||||
$str .= $sowner->getPseudo() . ', ';//TODO add link to membre.php
|
||||
if(count($projet->getSecondaryOwners()) > 0)
|
||||
echo '<span id="sOwnersText">'.substr($str,0,-2).'</span>';
|
||||
?>
|
||||
|
||||
<?php if($ssu){ ?>
|
||||
|
||||
<br/>
|
||||
<br/><button id="managePeopleButton">Gérer les <?php echo $couple[1];?></button>
|
||||
<br/><button id="editProjectButton">Editer le projet</button>
|
||||
<br/><button id="newVersionButton">Nouvelle version</button>
|
||||
|
||||
<div class="fullscreen absent big-background-semi-opaque" id="managePeoplePanel">
|
||||
<div class="screen-vertical-centered">
|
||||
<div class="screen-horizontal-centered opaque big-background-opaque" id="managePeoplePan">
|
||||
<ul class="gray-bordered fast-full-width gone-puce">
|
||||
Mise a jour de la liste
|
||||
</ul>
|
||||
<form>
|
||||
<input type="text"/>
|
||||
<button>Ajouter un <?php echo $couple[1];?></button>
|
||||
</form>
|
||||
<button>Supprimer les <?php echo $couple[1];?> sélectionnés</button><br/>
|
||||
<button>Terminé !</button>
|
||||
<script>
|
||||
$('#managePeoplePan form button').click(function(){
|
||||
var peopleIDs = new Array();
|
||||
$(this).prop('disabled',true);
|
||||
$.post('executor.php?action=addPeople&p='+projectID,{peopleName : $('#managePeoplePan form input').val()},function(){$('#managePeoplePan form button').prop('disabled',false);askPeopleUpdate();});
|
||||
});
|
||||
$('#managePeoplePan form').bind('submit',function() {return false;});
|
||||
$('#managePeoplePan > button:nth-of-type(1)').click(function(){
|
||||
var peopleIDs = new Array();
|
||||
$(this).prop('disabled',true);
|
||||
$('#managePeoplePan ul li.selected').each(function(){peopleIDs.push($(this).data('membreID'));});
|
||||
$.post('executor.php?action=removePeople&p='+projectID,{peopleIDs : peopleIDs.join(',')},function(){$('#managePeoplePan button:nth-of-type(1)').prop('disabled',false);askPeopleUpdate();});
|
||||
});
|
||||
$('#managePeoplePan > button:nth-of-type(2)').click(function(){
|
||||
$('#managePeoplePanel').fadeOut(600);
|
||||
});
|
||||
var askPeopleUpdate = function(){
|
||||
$.post('executor.php?action=getPeopleList&p='+projectID,{},answerPeopleList);
|
||||
};
|
||||
|
||||
|
||||
var answerPeopleList = function(newList){
|
||||
var list = eval(newList);
|
||||
$('#managePeoplePan ul').empty();
|
||||
if(list.length < 1)$('#managePeoplePan ul').text("Ce projet n'a pas de <?php echo $couple[1];?>");
|
||||
var pseudos = new Array();
|
||||
list.forEach(function(item){
|
||||
var element = $('<li></li>');
|
||||
pseudos.push(item['pseudo']);
|
||||
element.text(item['pseudo']);
|
||||
element.data('membreID',item['ID']);
|
||||
$('#managePeoplePan ul').append(element);
|
||||
});
|
||||
$('#managePeoplePan ul li').click(function(e){
|
||||
$(e.target).toggleClass('selected');
|
||||
});
|
||||
$('#sOwnersText').text(pseudos.join(','));
|
||||
};
|
||||
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fullscreen absent big-background-semi-opaque" id="editProjectPanel">
|
||||
<div class="screen-vertical-centered">
|
||||
<div class="screen-horizontal-centered" id="editProjectPan">
|
||||
<ul class="gray-bordered fast-full-width gone-puce">
|
||||
Mise a jour de la liste
|
||||
</ul>
|
||||
<button id="nOwnerButton">Nommer nouveau <?php echo $couple[0];?></button><br/>
|
||||
<button id="projectPublicButton"></button><br/>
|
||||
<button id="delProjectButton">Supprimer le projet </!\ Très dangereux></button><br/>
|
||||
<button id="editProjectDone">Terminé !</button>
|
||||
<script>
|
||||
var askPeopleNOwnUpdate = function(){
|
||||
$.post('executor.php?action=getPeopleList&p='+projectID,{},answerPeopleNOwnList);
|
||||
};
|
||||
$('#editProjectPan #projectPublicButton').click(function(){
|
||||
$('#editProjectPan #projectPublicButton').prop('disabled',true);
|
||||
|
||||
$.post('executor.php?action=setPublicy&p='+projectID,{publicy : !projectPublic},function(data){
|
||||
$('#editProjectPan #projectPublicButton').prop('disabled',false);
|
||||
if(data != 'ok')return;
|
||||
projectPublic = !projectPublic;
|
||||
nameProject();
|
||||
});
|
||||
});
|
||||
|
||||
$('#editProjectPan #nOwnerButton').click(function(){
|
||||
var idToName = $('#editProjectPan > ul > li.selected').data('membreID');
|
||||
if(!idToName)return;
|
||||
$('#messagePan').addClass('redMessage').html('Voulez vous vraiment promouvoir ce ministre en président ? Vous serez rétrogradé en simple ministre t lenouveau président pourra a tout moment vous virez ! Ne nommez pas un président si vous n\'avez pas confiance en lui<br/><button>Par les pouvoir qui me sont conférés, je nomme nouveau président ...</button><button>Je suis bien ici en fait !</button>');
|
||||
$('#messagePan button:nth-of-type(1)').click(function(){
|
||||
$('#messagePanel').fadeOut(600);
|
||||
$('#editProjectPan #nOwnerButton').prop('disabled',true);
|
||||
$.post('executor.php?action=nameOwner&p='+projectID,{nOwnerID : idToName},function(data){
|
||||
if(data == 'ok')window.location.reload();
|
||||
$('#editProjectPan #nOwnerButton').prop('disabled',false);
|
||||
});
|
||||
});
|
||||
$('#messagePan button:nth-of-type(2)').click(function(){
|
||||
$('#messagePanel').fadeOut(600);
|
||||
});
|
||||
$('#messagePanel').fadeIn(600);
|
||||
});
|
||||
|
||||
$('#editProjectPan #delProjectButton').click(function(){
|
||||
$('#messagePan').addClass('redMessage').html('Voulez vous vraiment supprimer ce projet ? Les fichiers seront supprimés automatiquement et seront irrécupérables, le nom de projet sera libés et toutes les informations additionelles seront aussi supprimées et ce, définitivement !<br/><button>C\'est ainsi que projet nous quitte ...</button><button>NONNNNNNN !!!!! NE MEURS PAS PROJEEEEEEET !!!!</button>');
|
||||
$('#messagePan button:nth-of-type(1)').click(function(){
|
||||
$('#messagePanel').fadeOut(600);
|
||||
$('#editProjectPan #delProjectButton').prop('disabled',true);
|
||||
$.post('executor.php?action=delProject&p='+projectID,{},function(data){
|
||||
if(data == 'ok')window.location.replace('projets.php');
|
||||
$('#editProjectPan #delProjectButton').prop('disabled',false);
|
||||
});
|
||||
});
|
||||
$('#messagePan button:nth-of-type(2)').click(function(){
|
||||
$('#messagePanel').fadeOut(600);
|
||||
});
|
||||
$('#messagePanel').fadeIn(600);
|
||||
});
|
||||
|
||||
|
||||
|
||||
var answerPeopleNOwnList = function(newList){
|
||||
var list = eval(newList);
|
||||
$('#editProjectPan ul').empty();
|
||||
if(list.length < 1)$('#editProjectPan ul').text("Ce projet n'a pas de <?php echo $couple[1];?>");
|
||||
list.forEach(function(item){
|
||||
var element = $('<li></li>');
|
||||
element.text(item['pseudo']);
|
||||
element.data('membreID',item['ID']);
|
||||
$('#editProjectPan ul').append(element);
|
||||
});
|
||||
$('#editProjectPan ul li').click(function(e){
|
||||
$('#editProjectPan ul li').removeClass('selected');
|
||||
$(e.target).addClass('selected');
|
||||
});
|
||||
};
|
||||
|
||||
var nameProject = function(){
|
||||
$('#editProjectPan #projectPublicButton').text(projectPublic?"Le projet est public":"Le projet n'est pas public");
|
||||
}
|
||||
|
||||
$('#editProjectPan > #editProjectDone').click(function(){
|
||||
$('#editProjectPanel').fadeOut(600);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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">
|
||||
$('#managePeopleButton').click(function(){
|
||||
askPeopleUpdate();
|
||||
$('#managePeoplePanel').fadeIn(600);
|
||||
});
|
||||
$('#editProjectButton').click(function(){
|
||||
askPeopleNOwnUpdate();
|
||||
nameProject();
|
||||
$('#editProjectPanel').fadeIn(600);
|
||||
});
|
||||
$('#newVersionButton').click(function(){
|
||||
askVersionUpdate();
|
||||
$('#newVersionPanel').fadeIn(600);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<?php $versions = Version::getFromProject($version->getProject()); ?>
|
||||
<?php $versions = Version::getFromProject($projet); ?>
|
||||
<?php if(is_array($versions)){/* = if count(versions>1) */ ?>
|
||||
<?php $languages = Langage::getLanguagesFromVersions($versions); ?>
|
||||
<h3>Toutes les versions :</h3>
|
||||
@@ -79,22 +346,13 @@
|
||||
<th><?php echo $language->getName(); ?></th>
|
||||
</tr>
|
||||
<?php foreach (Utility::arrayIfNot($versions) as $writingVersion){if($writingVersion->getLanguage() == $language){ ?>
|
||||
<tr><td><a href = "projet.php?v=<?php echo $writingVersion->getID();?>"><?php echo $writingVersion->getName(); ?></a></td></tr>
|
||||
<tr><td><a href = "version.php?v=<?php echo $writingVersion->getID();?>"><?php echo $writingVersion->getName(); ?></a></td></tr>
|
||||
<?php }}?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
<?php }?>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<?php if($me?$version->getProject()->haveRights($me):FALSE){ ?>
|
||||
<a href="newVersion.php?id=<?php echo $_GET['id'];?>">Nouvelle version</a><br/>
|
||||
<a href="editVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Modifier la version</a><br/>
|
||||
<a href="delVersion.php?id=<?php echo $_GET['id'];?>&v=<?php echo $_GET['v'];?>">Supprimer la version</a><br/>
|
||||
<a href="editProject.php?id=<?php echo $_GET['id'];?>">Modifier le projet</a><br/>
|
||||
<a href="delProject.php?id=<?php echo $_GET['id'];?>">Supprimer le projet</a><br/>
|
||||
<?php } ?>
|
||||
<br/>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user