Commit 5131e6f6 authored by Zéfling's avatar Zéfling 🎨
Browse files

Début de projet

J'ai commercé par xajax 0.2.5 (la 0.5 beta ne veut pas marcher chez moi).

13/03/2008
parents
html, body {
background-color : #c8c8c8;
margin:0px;
padding:0px;
width:100%;
min-width:100%;
max-width:100%;
height:100%;
min-height:100%;
max-height:100%;
font-family:Helvetica, Arial, sans-serif;
font-size:14px;
}
body {
display : table;
border-spacing: 3px;
}
#conteneur {
display : table-row-group;
min-width:100%;
max-width:100%;
}
#chemin, #arbre, #fichiers {
border-top : 1px solid #959595;
border-left : 1px solid #959595;
border-bottom : 1px solid white;
border-right : 1px solid white;
padding : 1px;
background-color : #dbdbdb;
}
#tete {
display : table-row;
width : 100%;
height: 20px;
}
#chemin {
white-space: nowrap;
border-left : 1px solid #dbdbdb;
}
#exploreur {
display : table;
width:100%;
height:100%;
min-height:100%;
max-height:100%;
}
#arbre {
display: table-cell;
width:300px;
max-width:300px;
vertical-align:top;
}
#arbre ul{
margin:0px;
padding:0px;
}
#arbre li{
list-style-type: none;
padding : 1px 0px 1px 17px;
background-image: url('icones/folder.png');
background-repeat: no-repeat;
background-position: 0 0;
}
#fichiers {
display: table-cell;
overflow: auto;
vertical-align:top;
}
#fichiers #tab {
border-spacing: 1px;
vertical-align:top;
width:100%;
display: table;
}
#fichiers #tab div {
display: table-cell;
}
#fichiers #tab #barre_type, #fichiers #tab #ligne_fichier {
display : table-row;
width:100%;
}
#fichiers #tab #barre_type div {
background-color:#b1c4df;
border-top : 1px solid #959595;
border-left : 1px solid #959595;
border-bottom : 1px solid white;
border-right : 1px solid white;
}
#fichiers #tab #ligne_fichier div {
border-bottom : 1px solid #959595;
}
#fichiers #tab #ligne_fichier:hover {
display : table-row;
background-color:#dbeaff;
}
\ No newline at end of file
<?php
require_once('xajax/xajax.inc.php');
function arbreDossier ($rep) {
$objResponse = new xajaxResponse();
$objResponse->addClear($rep, "innerHTML");
$objResponse->addAppend($rep, "innerHTML", lireDossier ($rep));
$r1 = afficherDossier ($rep);
$objResponse->loadXML($r1);
return $objResponse->getXML();
}
function afficherDossier ($rep) {
$objResponse = new xajaxResponse();
$objResponse->addClear("tab", "innerHTML");
$objResponse->addAppend("tab", "innerHTML", listerDossier ($rep));
$objResponse->addClear("chemin", "innerHTML");
$objResponse->addAppend("chemin", "innerHTML", 'Chemin : '.$rep);
return $objResponse->getXML();
}
$xajax = new xajax(); //On initialise l'objet xajax
$xajax->setCharEncoding("utf-8");
$xajax->registerFunction("arbreDossier");
$xajax->registerFunction("afficherDossier");
$xajax->processRequests();
//Fonction qui va se charger de faire les requetes
function lireDossier ($rep, $ret = 1) {
$aRep = explode ('/', $rep);
$repCourant = $aRep[count($aRep)-1];
$rep .= '/';
$dir = opendir($rep);
$liste = '';
while ($f = readdir($dir)) {
if(!is_file($rep.$f) && $f != '.' && $f != '..') {
// test si il y a des sous dossiers
$ssDir = opendir($rep.$f.'/');
$ssDossier = false;
while (($ssf = readdir($ssDir)) && !$ssDossier) {
if(!is_file($rep.$f.'/'.$ssf) && $ssf != '.' && $ssf != '..') {
$ssDossier = true;
}
}
// si il y a des sous-dossiers ou non
if ($ssDossier) {
$id = ' id="'.$rep.$f.'"';
$onclick = ' onclick="xajax_arbreDossier(\''.$rep.$f.'\');return false;"';
} else {
$id = '';
$onclick = ' onclick="xajax_afficherDossier(\''.$rep.$f.'\');return false;"';
}
$liste .= '<li'.$id.'><a href=""'.$onclick.'>'.$f.'</a></li>';
}
}
closedir($dir);
return (($ret == 1) ? '<a href="" onclick="xajax_afficherDossier(\''.$rep.$f.'\');return false;">'.$repCourant.'</a>' : '').'<ul id="'.$rep.'">'.$liste.'</ul>';
}
function listerDossier ($rep) {
$rep .= '/';
$dir = opendir($rep);
$liste = '<div id="barre_type"><div class="nom">Nom</div><div class="taille">Taille</div><div class="type">Type</div><div class="date">Date Modification</div></div>';
while ($f = readdir($dir)) {
if ($f != '.' && $f != '..') {
$liste .= '<div id="ligne_fichier">';
$liste .= '<div class="nom">'.$f.'</div>';
$liste .= '<div class="taille">'.filesize($rep.$f).'</div>';
$liste .= '<div class="type">'.filetype($rep.$f).'</div>';
$liste .= '<div class="date">'.filemtime($rep.$f).'</div>';
$liste .= '</div>';
}
}
closedir($dir);
return $liste;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Gestionnaire de fichiers</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="w3c.css" rel="stylesheet" type="text/css" />
<link href="index.css" rel="stylesheet" type="text/css" />
<?php $xajax->printJavascript('xajax/'); ?>
<script src="scriptaculous/lib/prototype.js" type="text/javascript"></script>
<script src="scriptaculous/src/scriptaculous.js" type="text/javascript"></script>
</head>
<body onload="xajax_arbreDossier('racine');">
<div id="conteneur">
<div id="tete">
<div id="chemin"></div>
</div>
<div id="exploreur">
<div id="arbre"><?php echo lireDossier ('racine', 0) ?></div>
<div id="fichiers">
<div id="tab">
<div id="barre_type">
<div class="nom">Nom</div>
<div class="taille">Taille</div>
<div class="type">Type</div>
<div class="date">Date Modification</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
== script.aculo.us web 2.0 javascript
The Web is changing. The 30-year-old terminal-like technology it was originally
is gradually giving way to new ways of doing things. The power of AJAX allows
for rich user interaction without the trouble that has bugged traditional
web applications.
Building upon the wonderful Prototype JavaScript library, script.aculo.us
provides you with some great additional ingredients to mix in.
For more information, see http://script.aculo.us/
== What's new in this release?
See the CHANGELOG file for information on what's new.
== Installation/Usage
script.aculo.us includes the Prototype JavaScript Framework
V1.6.0. You can use later versions, as they become available
(see http://prototypejs.org/).
Put prototype.js, and the six files scriptaculous.js,
builder.js, effects.js, dragdrop.js, controls.js and slider.js
in a directory of your website, e.g. /javascripts.
(The sound.js and unittest.js files are optional)
Now, you can include the scripts by adding the following
tags to the HEAD section of your HTML pages:
<script src="/javascripts/prototype.js" type="text/javascript"></script>
<script src="/javascripts/scriptaculous.js" type="text/javascript"></script>
scriptaculous.js will automatically load the other files of the
script.aculo.us distribution in, provided they are accessible
via the same path.
See http://wiki.script.aculo.us/scriptaculous/show/Usage for detailed
usage instructions.
== The distribution
Besides the script.aculo.us files in src, there's a complete
test tree included which holds functional and unit tests for
script.aculo.us.
If you need examples on how to implement things, the best place to
start is by opening test/run_functional_tests.html or
test/run_unit_tests.html in your browser, and looking at
the sources of the examples provided.
== License
script.aculo.us is licensed under the terms of the MIT License,
see the included MIT-LICENSE file.
\ No newline at end of file
This diff is collapsed.
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
var Builder = {
NODEMAP: {
AREA: 'map',
CAPTION: 'table',
COL: 'table',
COLGROUP: 'table',
LEGEND: 'fieldset',
OPTGROUP: 'select',
OPTION: 'select',
PARAM: 'object',
TBODY: 'table',
TD: 'table',
TFOOT: 'table',
TH: 'table',
THEAD: 'table',
TR: 'table'
},
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
// due to a Firefox bug
node: function(elementName) {
elementName = elementName.toUpperCase();
// try innerHTML approach
var parentTag = this.NODEMAP[elementName] || 'div';
var parentElement = document.createElement(parentTag);
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
} catch(e) {}
var element = parentElement.firstChild || null;
// see if browser added wrapping tags
if(element && (element.tagName.toUpperCase() != elementName))
element = element.getElementsByTagName(elementName)[0];
// fallback to createElement approach
if(!element) element = document.createElement(elementName);
// abort if nothing could be created
if(!element) return;
// attributes (or text)
if(arguments[1])
if(this._isStringOrNumber(arguments[1]) ||
(arguments[1] instanceof Array) ||
arguments[1].tagName) {
this._children(element, arguments[1]);
} else {
var attrs = this._attributes(arguments[1]);
if(attrs.length) {
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
parentElement.innerHTML = "<" +elementName + " " +
attrs + "></" + elementName + ">";
} catch(e) {}
element = parentElement.firstChild || null;
// workaround firefox 1.0.X bug
if(!element) {
element = document.createElement(elementName);
for(attr in arguments[1])
element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
}
if(element.tagName.toUpperCase() != elementName)
element = parentElement.getElementsByTagName(elementName)[0];
}
}
// text, or array of children
if(arguments[2])
this._children(element, arguments[2]);
return element;
},
_text: function(text) {
return document.createTextNode(text);
},
ATTR_MAP: {
'className': 'class',
'htmlFor': 'for'
},
_attributes: function(attributes) {
var attrs = [];
for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;') + '"');
return attrs.join(" ");
},
_children: function(element, children) {
if(children.tagName) {
element.appendChild(children);
return;
}
if(typeof children=='object') { // array can hold nodes and text
children.flatten().each( function(e) {
if(typeof e=='object')
element.appendChild(e)
else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));
});
} else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));
},
_isStringOrNumber: function(param) {
return(typeof param=='string' || typeof param=='number');
},
build: function(html) {
var element = this.node('div');
$(element).update(html.strip());
return element.down();
},
dump: function(scope) {
if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
tags.each( function(tag){
scope[tag] = function() {
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
}
});
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/
var Scriptaculous = {
Version: '1.8.1',
require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
},
REQUIRED_PROTOTYPE: '1.6.0',
load: function() {
function convertVersionString(versionString){
var r = versionString.split('.');
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
}
if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
(convertVersionString(Prototype.Version) <
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
Scriptaculous.REQUIRED_PROTOTYPE);
$A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
}).each( function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
function(include) { Scriptaculous.require(path+include+'.js') });
});
}
}
Scriptaculous.load();
\ No newline at end of file
// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
if (!Control) var Control = { };
// options:
// axis: 'vertical', or 'horizontal' (default)
//
// callbacks:
// onChange(value)
// onSlide(value)
Control.Slider = Class.create({
initialize: function(handle, track, options) {
var slider = this;
if (Object.isArray(handle)) {
this.handles = handle.collect( function(e) { return $(e) });
} else {
this.handles = [$(handle)];
}
this.track = $(track);
this.options = options || { };
this.axis = this.options.axis || 'horizontal';
this.increment = this.options.increment || 1;
this.step = parseInt(this.options.step || '1');
this.range = this.options.range || $R(0,1);
this.value = 0; // assure backwards compat
this.values = this.handles.map( function() { return 0 });
this.spans = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
this.options.startSpan = $(this.options.startSpan || null);
this.options.endSpan = $(this.options.endSpan || null);
this.restricted = this.options.restricted || false;
this.maximum = this.options.maximum || this.range.end;
this.minimum = this.options.minimum || this.range.start;
// Will be used to align the handle onto the track, if necessary
this.alignX = parseInt(this.options.alignX || '0');
this.alignY = parseInt(this.options.alignY || '0');
this.trackLength = this.maximumOffset() - this.minimumOffset();
this.handleLength = this.isVertical() ?
(this.handles[0].offsetHeight != 0 ?
this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,"")) :
(this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
this.handles[0].style.width.replace(/px$/,""));
this.active = false;
this.dragging = false;
this.disabled = false;
if (this.options.disabled) this.setDisabled();
// Allowed values array
this.allowedValues = this.options.values ? this.options.values.sortBy(Prototype.K) : false;
if (this.allowedValues) {
this.minimum = this.allowedValues.min();
this.maximum = this.allowedValues.max();
}
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
this.eventMouseUp = this.endDrag.bindAsEventListener(this);
this.eventMouseMove = this.update.bindAsEventListener(this);
// Initialize handles in reverse (make sure first handle is active)
this.handles.each( function(h,i) {
i = slider.handles.length-1-i;