Commit 3622a17d authored by Zéfling's avatar Zéfling 🎨
Browse files

propriétés avec [p] (v0.4.4)

Bon, quand tu fais [p] ça donne les informations d'un fichier ou dossier. C'est en XML et c'est fait à l'arrache.

J'ai viré des trucs pas implémentés en clair : scriptaculous

19/03/2008
parent 80504e61
......@@ -96,28 +96,12 @@ class Dossier {
$md5 = md5(substr($rep.$f, 0, -1));
return (($ret == 1) ? '<img alt="ouvert" id="i-'.$md5.'" src="icones/folder_open.png" title="'.addslashes(substr($rep, 0, -1)).'" onclick="arbreDossierFermer(this.title);" /><span id="l-'.$md5.'" title="'.addslashes(substr($rep, 0, -1)).'" onclick="xajax_afficherDossier(this.title);">'.$repCourant.'</span>' : '').'<ul id="u-'.$md5.'">'.$liste.'</ul>';
/*Droppables.add('panier',
{accept:'products',
onDrop:function(element)
{
//ajax.updater
new Ajax.Updater('panier','ajpan.php',
{
parameters:'id=' + encodeURIComponent(element.id)
//parameters:'id=' + encodeURIComponent(idprod)
})
}
})
*/
}
//Fonction qui va se charger de faire les requetes
public function listerDossier () {
$rep = $this->rep;
$nbFichiers = 0;
......@@ -132,9 +116,7 @@ class Dossier {
$liste = '<div class="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 != '..') {
$md5 = md5($rep.$f);
$drag .= "new Draggable('f-".$md5."',{revert:true});";
$md5 = md5($rep.$f);
$fileinfo = new FileInfo($rep, $f);
......@@ -154,13 +136,11 @@ class Dossier {
}
}
closedir($dir);
$this->taille = $taille;
$this->nbFichiers = $nbFichiers;
$this->nbDossiers = $nbDossiers;
$this->scriptDraggable = $drag;
$this->nbDossiers = $nbDossiers;;
return '<div id="tab">'.$liste.'</div>';
}
......
......@@ -7,7 +7,10 @@ class FileInfo {
private $fichier = '';
private $extension = '';
private $dateFichier = 0;
private $dateAccesFichier = 0;
private $tailleFichier = 0;
private $tailleBlock = 0;
private $nbBlock = 0;
public function __construct ($dossier, $nom) {
$this->fichier = $nom;
......@@ -26,18 +29,36 @@ class FileInfo {
//date
$this->dateFichier = filemtime($dossier.$nom);
$this->dateAccesFichier = filemtime($dossier.$nom);
//taille
$this->tailleFichier = filesize($dossier.$nom);
$info = stat($dossier.$nom);
$this->tailleBlock = $info[11];
$this->nbBlock = $info[12];
}
public function dateFormat() {
return date ('d/m/Y H:i', $this->dateFichier);
}
public function dateAccesFormat() {
return date ('d/m/Y H:i', $this->dateAccesFichier);
}
public function taille ($nombre = 5) {
return FileInfo::tailleFormat($this->tailleFichier, $nombre);
}
public function tailleReelle ($nombre = 5) {
return FileInfo::tailleFormat($this->tailleBloc * $this->nbBloc, $nombre);
}
public function getTailleBlock() {
return $this->tailleBlock;
}
public function getNbBlock() {
return $this->nbBlock;
}
public static function tailleFormat ($taille, $nombre = 5) {
if ($taille < 1024) {
......
......@@ -95,7 +95,6 @@ body {
background-position: 50% 50%;
}
#chemin {
white-space: nowrap;
border-left : 1px solid #dbdbdb;
......@@ -122,6 +121,7 @@ body {
background-image: url('icones/folder.png');
background-repeat: no-repeat;
background-position: 11px 0;
white-space: nowrap;
}
#arbre li li{
margin : 0px 0px 0px 13px;
......@@ -169,10 +169,6 @@ body {
#fichiers #tab .ligne_fichier div {
border-bottom : 1px solid #959595;
}
#fichiers #tab .ligne_fichier .nom span:hover {
text-decoration: underline;
color:#7a84d4;
}
#fichiers #tab .ligne_fichier:hover {
display : table-row;
......
......@@ -153,13 +153,17 @@ function touche(e) {
if (latouche == 46) {
supprimerFichier();
}
// [p]
if (latouche == 80) {
information();
}
// [ctrl] + [c]
if (latouche == 67 && ctrl) {
copierListeFichiers();
couper = false;
}
// [ctrl] + [x]
if (latouche == 67 && ctrl) {
if (latouche == 88 && ctrl) {
copierListeFichiers();
couper = true;
}
......@@ -405,4 +409,75 @@ function supprimerFichier () {
if (fichiers.length > 0 && confirm("Êtes-vous certains de vouloir supprimer :\n"+lister())) {
xajax_suppression(fichiers, listeAdresse(), nombreFichiers, nombreDossiers) ;
}
}
/* AJAX */
function AJAXRequest(page, retfonc, methode, data) {
var xhr_object = null;
if(window.XMLHttpRequest) // Firefox
xhr_object = new XMLHttpRequest();
else if(window.ActiveXObject) // Internet Explorer
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
else { // XMLHttpRequest non supporté par le navigateur
alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
return;
}
if (data=="")
data=null;
if(methode == "GET" && data != null) {
page += "?"+data;
data = null;
}
xhr_object.open(methode, page, true);
xhr_object.onreadystatechange = function() {
if(xhr_object.readyState == 4) {
var RetAjax = xhr_object.responseXML;
eval(retfonc+'(RetAjax);');
}
}
if(methode == "POST") {
xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
}
xhr_object.send(data);
}
function information () {
if(fichiers.length > 0) {
adresse = document.getElementById(fichiers[fichiers.length-1]).title;
AJAXRequest('information.php', 'informationAffiche', 'POST', 'adresse='+adresse);
}
}
function informationAffiche(xml) {
var nom = xml.getElementsByTagName("nom")[0].firstChild.data;
var chemin = xml.getElementsByTagName("chemin")[0].firstChild.data;
var system = xml.getElementsByTagName("system")[0].firstChild.data;
//taille
var reduite = xml.getElementsByTagName("reduite")[0].firstChild.data;
var octets = xml.getElementsByTagName("octets")[0].firstChild.data;
var réelle = xml.getElementsByTagName("réelle")[0].firstChild.data;
var tailleBlock = xml.getElementsByTagName("taille-block")[0].firstChild.data;
var nbBlock = xml.getElementsByTagName("nb-block")[0].firstChild.data;
// date
var edition = xml.getElementsByTagName("edition")[0].firstChild.data;
var accès = xml.getElementsByTagName("accès")[0].firstChild.data;
var chemin = xml.getElementsByTagName("chemin")[0].firstChild.data;
alert('nom : '+nom+
'\nchemin : '+chemin+
'\nch. réel : '+system+
'\n-- taille --'+
'\noctets : '+octets+
'\nRéduite : '+reduite+
'\nRéelle : '+réelle+
'\nTaille de blocks : '+tailleBlock+
'\nNombre de blocks : '+nbBlock+
'\n-- date --'+
'\nDernier accès : '+accès+
'\nDernier édition : '+edition);
}
\ No newline at end of file
......@@ -25,9 +25,6 @@ $dossier = new Dossier('', array('racine'));
<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>
<script src="scriptaculous/src/dragdrop.js" type="text/javascript"></script>
<script src="md5.js" type="text/javascript"></script>
<script src="index.js" type="text/javascript"></script>
</head>
......
<?php
include_once ('FileInfo.php');
if (isset($_POST['adresse'])) {
$dossiersAdresse = explode ('/', $_POST['adresse']);
$element = array_pop($dossiersAdresse);
$dossier = implode('/', $dossiersAdresse);
$info = new FileInfo($dossier.'/', $element);
Header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<info xmlns="http://exemple.org/" xml:lang=";fr">';
echo '<nom>'.$element.'</nom>';
echo '<chemin>'.$_POST['adresse'].'</chemin>';
echo '<system>'.realpath(dirname(__FILE__)).str_replace('/', '\\', substr($_POST['adresse'], 1)).'</system>';
echo '<taille>';
echo '<reduite>'.$info->taille().'</reduite>';
echo '<octets>'.$info->getTaille().'</octets>';
echo '<réelle>'.$info->tailleReelle().'</réelle>';
echo '<taille-block>'.$info->getTailleBlock().'</taille-block>';
echo '<nb-block>'.$info->getNbBlock().'</nb-block>';
echo '</taille>';
echo '<date>';
echo '<edition>'.$info->dateFormat().'</edition>';
echo '<accès>'.$info->dateAccesFormat().'</accès>';
echo '</date>';
echo '</info>';
} else {
Header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<info xmlns="http://exemple.org/" xml:lang=";fr">';
echo '<erreur>Invalide</erreur>';
echo '</info>';
}
?>
\ 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
This diff is collapsed.
// script.aculo.us sound.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)
//
// Based on code created by Jules Gravinese (http://www.webveteran.com/)
//
// 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/
Sound = {
tracks: {},
_enabled: true,
template:
new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
enable: function(){
Sound._enabled = true;
},
disable: function(){
Sound._enabled = false;